Public Member Functions | |
__construct ($attributes=array()) | |
getName () | |
getElementHtml () |
Definition at line 34 of file Time.php.
__construct | ( | $ | attributes = array() |
) |
Enter description here...
array | $attributes |
Reimplemented from Varien_Data_Form_Element_Abstract.
Definition at line 36 of file Time.php.
00037 { 00038 parent::__construct($attributes); 00039 $this->setType('time'); 00040 }
getElementHtml | ( | ) |
Reimplemented from Varien_Data_Form_Element_Abstract.
Definition at line 51 of file Time.php.
00052 { 00053 $this->addClass('select'); 00054 00055 $value_hrs = 0; 00056 $value_min = 0; 00057 $value_sec = 0; 00058 00059 if( $value = $this->getValue() ) { 00060 $values = explode(',', $value); 00061 if( is_array($values) && count($values) == 3 ) { 00062 $value_hrs = $values[0]; 00063 $value_min = $values[1]; 00064 $value_sec = $values[2]; 00065 } 00066 } 00067 00068 $html = '<select name="'. $this->getName() . '" '.$this->serialize($this->getHtmlAttributes()).' style="width:40px">'."\n"; 00069 for( $i=0;$i<24;$i++ ) { 00070 $hour = str_pad($i, 2, '0', STR_PAD_LEFT); 00071 $html.= '<option value="'.$hour.'" '. ( ($value_hrs == $i) ? 'selected="selected"' : '' ) .'>' . $hour . '</option>'; 00072 } 00073 $html.= '</select>'."\n"; 00074 00075 $html.= ' : <select name="'. $this->getName() . '" '.$this->serialize($this->getHtmlAttributes()).' style="width:40px">'."\n"; 00076 for( $i=0;$i<60;$i++ ) { 00077 $hour = str_pad($i, 2, '0', STR_PAD_LEFT); 00078 $html.= '<option value="'.$hour.'" '. ( ($value_min == $i) ? 'selected="selected"' : '' ) .'>' . $hour . '</option>'; 00079 } 00080 $html.= '</select>'."\n"; 00081 00082 $html.= ' : <select name="'. $this->getName() . '" '.$this->serialize($this->getHtmlAttributes()).' style="width:40px">'."\n"; 00083 for( $i=0;$i<60;$i++ ) { 00084 $hour = str_pad($i, 2, '0', STR_PAD_LEFT); 00085 $html.= '<option value="'.$hour.'" '. ( ($value_sec == $i) ? 'selected="selected"' : '' ) .'>' . $hour . '</option>'; 00086 } 00087 $html.= '</select>'."\n"; 00088 $html.= $this->getAfterElementHtml(); 00089 return $html; 00090 }
getName | ( | ) |
Reimplemented from Varien_Data_Form_Element_Abstract.
Definition at line 42 of file Time.php.
00043 { 00044 $name = parent::getName(); 00045 if (strpos($name, '[]') === false) { 00046 $name.= '[]'; 00047 } 00048 return $name; 00049 }