コード例 #1
0
ファイル: class.Calendar.php プロジェクト: oat-sa/tao-core
 /**
  * Rendering of the XHTML implementation of the Calendar Widget.
  *
  * @author Bertrand Chevrier, <*****@*****.**>
  * @return The XHTML stream of the Calendar Widget.
  */
 public function render()
 {
     $returnValue = $this->renderLabel();
     $uniqueId = uniqid('calendar_');
     $elementId = tao_helpers_Display::TextCleaner($this->getDescription()) . '_' . $uniqueId;
     if (!isset($this->attributes['size'])) {
         $this->attributes['size'] = 20;
     }
     $returnValue .= "<input class='datepicker-input' type='text' name='{$this->name}' id='{$elementId}' ";
     $returnValue .= $this->renderAttributes();
     if (!empty($this->value)) {
         $timeStamp = is_numeric($this->getRawValue()) ? $this->getRawValue() : $this->getEvaluatedValue();
         $returnValue .= ' value="' . _dh(tao_helpers_Date::displayeDate($timeStamp, tao_helpers_Date::FORMAT_DATEPICKER)) . '"';
     }
     $returnValue .= ' />';
     $returnValue .= "<script type=\"text/javascript\">\n\t\t\trequire(['jquery','jqueryui','jquery.timePicker'], function(\$){\n\t\t\t\t\$(\"#{$elementId}\").datetimepicker({\n                                        dateFormat: 'yy-mm-dd',\n                                        beforeShow: function (textbox, instance) {\n                                            \$(textbox).parent().append(instance.dpDiv);\n                                        }\n\t\t\t\t});\n                                \n\t\t\t});</script>";
     return (string) $returnValue;
 }