Ejemplo n.º 1
0
 function toHtml()
 {
     $str = "";
     if ($this->_flagFrozen) {
         $str .= $this->getFrozenHtml();
     } else {
         $value = $this->getAttribute('value');
         if (is_numeric($value)) {
             $value = date('Y-m-d', $value);
         }
         $id = $this->getAttribute('id');
         $name = $this->getAttribute('name');
         if ($value) {
             $this->setAttribute('value', Base_RegionalSettingsCommon::time2reg($value, false, true, false));
         }
         if (!isset($id)) {
             $id = 'datepicker_field_' . $name;
             $this->updateAttributes(array('id' => $id));
         }
         $ex_date = Base_RegionalSettingsCommon::time2reg(null, false, true, false);
         $date_format = Base_RegionalSettingsCommon::date_format();
         $this->setType('text');
         if (!$this->getAttribute('placeholder')) {
             $this->setAttribute('placeholder', __('Click to select date'));
         }
         $js = Utils_PopupCalendarCommon::create_href(md5($id), 'new Ajax.Request(\'modules/Utils/PopupCalendar/up.php\',' . '{method:\'post\', parameters:{date: __YEAR__+\'-\'+__MONTH__+\'-\'+__DAY__},' . 'onSuccess:function(t){e=$(\'' . Epesi::escapeJS($id, false) . '\');if(e) {e.value=t.responseText;jq(e).change();}}})', null, null, 'popup.clonePosition(\'' . $id . '\',{setWidth:false,setHeight:false,offsetTop:$(\'' . $id . '\').getHeight()})', $value, $id);
         $str .= $this->_getTabs() . '<input ' . $js . ' ' . $this->_getAttrString($this->_attributes) . ' ' . Utils_TooltipCommon::open_tag_attrs(__('Example date: %s', array($ex_date)), false) . ' />';
         eval_js('Event.observe(\'' . $id . '\',\'keypress\',Utils_PopupCalendarDatePicker.validate.bindAsEventListener(Utils_PopupCalendarDatePicker,\'' . Epesi::escapeJS($date_format, false) . '\'))');
         eval_js('Event.observe(\'' . $id . '\',\'blur\',Utils_PopupCalendarDatePicker.validate_blur.bindAsEventListener(Utils_PopupCalendarDatePicker,\'' . Epesi::escapeJS($date_format, false) . '\'))');
     }
     return $str;
 }
Ejemplo n.º 2
0
 public function init()
 {
     $d = getcwd();
     chdir('../../../../');
     require_once 'include/epesi.php';
     require_once 'include/cache.php';
     require_once 'include/variables.php';
     require_once 'include/misc.php';
     require_once 'include/module_primitive.php';
     require_once 'include/module_install.php';
     require_once 'include/module_common.php';
     require_once 'include/module.php';
     require_once 'include/module_manager.php';
     require_once 'include/autoloader.php';
     ModuleManager::load_modules();
     chdir($d);
     global $E_SESSION;
     $_SESSION['user'] = $E_SESSION['user'];
     if (Base_RegionalSettingsCommon::time_12h()) {
         $time = 'h:i a';
     } else {
         $time = 'H:i';
     }
     $date = Base_RegionalSettingsCommon::date_format();
     switch ($date) {
         case '%Y-%m-%d':
             $date = 'Y-m-d';
             break;
         case '%m/%d/%Y':
             $date = 'm/d/Y';
             break;
         case '%d %B %Y':
             $date = 'd F Y';
             break;
         case '%d %b %Y':
             $date = 'd M Y';
             break;
         case '%b %d, %Y':
             $date = 'M d, Y';
             break;
     }
     rcmail::get_instance()->config->set('date_short', 'D ' . $time);
     rcmail::get_instance()->config->set('date_long', $date . ' ' . $time);
     rcmail::get_instance()->config->set('date_today', $time);
     $this->add_hook('message_outgoing_body', array($this, 'add_signature'));
     $this->add_hook('user_create', array($this, 'lookup_user_name'));
 }