/**
  * возвращает HTML-код для поля ввода даты
  *
  * @param string $name идентефикатор(и имя) элемента ввода даты
  * @var array $options Дополнительные опции (changeMonth и changeYear)
  * @return string HTML-код элемента ввода даты
  */
 function date_html($name, $options = array())
 {
     $CI =& get_instance();
     $html = $CI->load->view('common/date_field.html', '', TRUE);
     $date_params = array();
     datepicker_vars($date_params);
     $html = str_replace('<%NAME%>', $name, $html);
     $html = str_replace('<%DPDATEFORMAT%>', $date_params['DPDATEFORMAT'], $html);
     $html = str_replace('<%DPWEEKSTART%>', $date_params['DPWEEKSTART'], $html);
     $changeMonth = 'false';
     if (isset($options['changeMonth']) && $options['changeMonth'] == true) {
         $changeMonth = 'true';
     }
     $html = str_replace('<%CHANGEMONTH%>', $changeMonth, $html);
     $changeYear = 'false';
     if (isset($options['changeYear']) && $options['changeYear'] == true) {
         $changeYear = 'true';
     }
     $html = str_replace('<%CHANGEYEAR%>', $changeYear, $html);
     $yearRange = '-10:+10';
     if (isset($options['yearRange'])) {
         $yearRange = $options['yearRange'];
     }
     $html = str_replace('<%YEARRANGE%>', $yearRange, $html);
     $minDate = 'null';
     if (isset($options['minDate'])) {
         $minDate = $options['minDate'];
     }
     $html = str_replace('<%MINDATE%>', $minDate, $html);
     $maxDate = 'null';
     if (isset($options['maxDate'])) {
         $maxDate = $options['maxDate'];
     }
     $html = str_replace('<%MAXDATE%>', $maxDate, $html);
     $defaultDate = 'null';
     if (isset($options['defaultDate'])) {
         $defaultDate = $options['defaultDate'];
     }
     $html = str_replace('<%DEFAULT_DATE%>', $defaultDate, $html);
     $tabIndex = '';
     if (isset($options['tabIndex'])) {
         $tabIndex = $options['tabIndex'];
     }
     $html = str_replace('<%TAB_INDEX%>', $tabIndex, $html);
     return $html;
 }
 /**
  * формирует, переводит и выводит на экран web-страницу контроллера
  *
  * @return ничего не возвращает
  */
 public function _display($data = array())
 {
     // Execute all display plugins for search controller
     Plugin_Manager::getInstance()->execute('parent_controller', 'display', $this, $data);
     if (!$this->noframe) {
         $this->content["MENU"] = $this->menu->generate($this->role, $this->menu_item);
     }
     // set inline JS code:
     if (count($this->_javascriptInline) > 0) {
         $jsInlineCode = implode(PHP_EOL, $this->_javascriptInline);
         $this->content['JAVASCRIPT'] .= '<script type="text/javascript">' . PHP_EOL . $jsInlineCode . PHP_EOL . '</script>';
     }
     if ($this->date_picker) {
         $this->load->model('locale_settings', '', TRUE);
         $this->content['JAVASCRIPT'] .= $this->locale_settings->date_picker();
         datepicker_vars($this->content);
     }
     $this->_save_session();
     $this->_save_temporary();
     $this->benchmark->mark('display_start');
     if ($this->role == 'admin') {
         $this->_get_community();
     }
     if ($this->role == 'admin') {
         $this->_get_bytecity_links();
     }
     if ($this->user_id && $this->role != 'guest') {
         $this->content["UPANEL"] = $this->_get_upanel();
         $this->content["USERPANEL"] = array(array());
         $this->content["USERPANEL2"] = array(array());
     } else {
         $this->content["USERPANEL"] = array();
         $this->content["USERPANEL2"] = array();
     }
     $this->benchmark->mark('display_end');
     $this->content["SITEURL"] = $this->site_url;
     $this->content["INDEXPAGE"] = $this->index_page;
     // is_admin
     $this->content["IS_ADMIN"] = 'admin' == $this->role ? array(array()) : array();
     /*Add tag <%CONTROLLER%>*/
     global $RTR;
     $this->content["CONTROLLER"] = $RTR->fetch_class();
     $this->content["ROLE"] = $this->role;
     $this->content["LOCALE"] = $this->locale;
     $this->content["FOOTER"] = $this->load->view('common/parent/footer.html', '', true);
     $this->content["HEADER"] = $this->load->view('common/parent/header.html', '', true);
     $this->content['BODY'] = $this->_translate($this->content['BODY']);
     $page = $this->parser->parse($this->template, $this->content, TRUE);
     $page = $this->_translate($page);
     $this->load->helper("button");
     $page = make_buttons($page);
     header('Content-Type: text/html; charset=utf-8');
     header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
     // always modified
     header("Cache-Control: no-cache, must-revalidate, no-store, max-age=0");
     // HTTP/1.1
     $this->output->set_output($page);
 }