コード例 #1
0
 /**
  * To get Zend form element text with date time picker
  * @param string $id
  * @param bool $elementequired = true
  * @return Zend_Form_Element_Text with date picker
  */
 public function getDateTimePicker($id, $value = "", $elementequired = true)
 {
     $element = new Zend_Form_Element_Text($id);
     $element->removeDecorator('HtmlTag');
     $element->removeDecorator('DtDdWrapper');
     $element->removeDecorator('Label');
     if (empty($value)) {
         $value = date('Y-m-d H:i');
     }
     $element->setValue(date_format(date_create($value), 'Y-m-d H:i'));
     if ($elementequired) {
         $element->setAttribs(array('class' => 'validate[required] text-input'));
     }
     Application_Model_GlobalClass::addDateTimeField($id);
     return $element;
 }