General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 20th, 2003, 02:44 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
laidbak + hours function

Hey laidbak,...I made some changes to your drop_down_hours function from your date select class,....lemme know what you think

PHP Code:
function add_dropdown_hours$name$hours 12$cssid ''$show_at '' )
{
    
$this->elements += 1;
    
array_push$this->id$name );
    
    
/* Display the @ symbol or not? */
    
if( $show_at == ( bool )true )
    {
        
array_push$this->html"\n @ \n" );
    }
    
    
/* Start the select html element */
    
array_push$this->html"\n<select id=\"$name\" name=\"$name\" class=\"$cssid\">\n" );
    
    
/* Initialize the local html array */
    
$html = array();
    
    
/* Make 12 hours the default */
    
if( $hours != ( int )12 AND $hours != ( int )24 )
    {
        
$hours = ( int )12;
    }
    
    for( 
$i 0$i 24$i++ )
    {
        switch ( 
$i )
        {
            case 
0;
                if( 
$hours == $i )
                    
array_push$this->html"\n<option value=$i selected=\"selected\">12 Midnight</option>\n" );
                else
                    
array_push$this->html"\n<option value=$i> 12 Midnight</option>\n" );
            break;
            case 
12:
                if( 
$hours == $i )
                    
array_push$this->html"\n<option value=$i selected=\"selected\">12 Noon</option>\n" );
                else
                    
array_push$this->html"\n<option value=$i>12 Noon</option>\n" );
            break;
            case( 
$i 13 ):
                if( 
$hours == $i )
                    
array_push$this->html"\n<option value=$i selected=\"selected\">$i AM</option>\n" );
                else
                    
array_push$this->html"\n<option value=$i>$i AM</option>\n" );
            break;
            case( 
$i 12 ):
                if( 
$hours == $i )
                    
array_push$this->html"\n<option value=$i selected=\"selected\"> " . ( $i 12 ) . " PM\n" );
                else
                    
array_push$this->html"\n<option value=$i> " . ( $i 12 ) . " PM\n" );
            break;
        }
    }
    
/* End the select control */
    
array_push$this->html"\n</select>\n" );

__________________
-- Jason

Last edited by Taelo : June 20th, 2003 at 05:37 PM.

Reply With Quote
  #2  
Old June 20th, 2003, 04:40 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
LOL... I haven't the slightest idea what you changed as I have never even had the need to use the time portions. I created the thing but never needed more than the date methods.

COOL... glad you decided to dip into it... I wasn't even sure if I had finished it. It has been over two years since I really took a look at it.

I had to open an old project folder just to see how to use my own methods.

I'm going to go try it out now.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old June 20th, 2003, 05:05 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Why, oh, why did you do this to me.
Now I feel compelled to enhance this thing.

I've actually been meaning to recode this for a while... so maybe I'll do that.

I like some of the changes you made. Good idea.
I was thinking about having the elements automatically create dynamic javascript for updating the days when you change the month.

The only problem I see with your changes is the "@" symbol.
Did you do that or did I. Either way, I'll probably remove it because it makes the class less useful as a reuseable module.
The @ symbol could easily just be typed in before the hours method is called.

Before I start refactoring this class I'm going to do a bit of research and see if there are any classes like this that are already more mature.

Reply With Quote
  #4  
Old June 20th, 2003, 05:06 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
BTW, if anyone wants to check it out, here is the live sample:
http://www.laidbak.net/dateselect2/

Reply With Quote
  #5  
Old June 20th, 2003, 05:21 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
no no,...I added the @,....so that I could have my own script setup like,..

Day, Month, Year @ Time

Just for Looks I may set it up as a function option,....so that you can use it or not,....that would be the best way

Reply With Quote
  #6  
Old June 20th, 2003, 05:22 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
Quote:
Originally posted by laidbak
BTW, if anyone wants to check it out, here is the live sample:
http://www.laidbak.net/dateselect2/


I see you like my edits

Reply With Quote
  #7  
Old June 20th, 2003, 05:37 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
EDIT: Updated code above for use of @ symbol or not.

Reply With Quote
  #8  
Old June 20th, 2003, 05:44 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Yes, your edit was a needed one.
I updated the code @ http://www.laidbak.net/dateselect2/ to have the optional "@" symbol.

Reply With Quote
  #9  
Old June 20th, 2003, 06:21 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
I am working on modifying it with another function option called $post_hour.....I am going to make it so that if you post the page and it has errors which brings you back to the form,...it will retain the time you put in...

I know how to do this.....well I have the idea in my head,....just gotta put it on paper

PHP Code:
function add_dropdown_hours$name$hours 12$cssid ''$show_at ''$post_hour 

Reply With Quote
  #10  
Old June 20th, 2003, 06:51 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Great... sounds good.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > laidbak + hours function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT