/** * * Construct a pop up calender used in the grid. The datepicker can be used in the * editing modules or/and in search module. * @uses jqCalender class. This requiere to include jqCalender.php in order * to work * @param string $colname (requiered) valid colname in colModel * @param array $options - array with options for the datepicker. Can be * all available options from jQuery UI datepicker in pair name=>value. * In case of events a "js:" tag should be added before the value. * @param boolean $editing determines if the datepicker should be used in editing * modules. Deafult is true * @param boolean $seraching determines if the datepicker should be present in * the search module. Deafult is true. */ public function setDatepicker($colname, $options = null, $editing = true, $searching = true) { try { if ($colname) { if ($this->runSetCommands) { $dp = new jqCalendar(); if (isset($options['buttonIcon'])) { $dp->buttonIcon = $options['buttonIcon']; unset($options['buttonIcon']); } if (isset($options['buttonOnly'])) { $dp->buttonOnly = $options['buttonOnly']; unset($options['buttonOnly']); } if (isset($options['fontsize'])) { $dp->fontsize = $options['fontsize']; unset($options['fontsize']); } if (is_array($options) && count($options) > 0) { $dp->setOption($options); } if (!isset($options['dateFormat'])) { $ud = $this->getUserDate(); $ud = jqGridUtils::phpTojsDate($ud); $dp->setOption('dateFormat', $ud); } $script = $dp->renderCalendar($colname, false, false); $script = str_replace("jQuery('" . $colname . "')", "jQuery(el)", $script); $script = "setTimeout(function(){" . $script . "},100);"; if ($editing) { $this->setColProperty($colname, array("editoptions" => array("dataInit" => "js:function(el){" . $script . "}"))); } if ($searching) { $this->setColProperty($colname, array("searchoptions" => array("dataInit" => "js:function(el){" . $script . "}"))); } } } } catch (Exception $e) { $e->getMessage(); } }