Beispiel #1
0
 /**
  * @return array
  * @throws Exception
  */
 function get_nav()
 {
     if ($this->_nav === null) {
         $mo = new Model_Option();
         $nav = $mo->get_one_by_keyword(Module_Page_Manager::SAVE_KEY_NAV);
         if ($nav[Const_DataAccess::MREK_ERRNO] != Const_Err_Base::ERR_OK) {
             throw new Exception(Lib_Helper::format_err_struct($nav), $nav[Const_DataAccess::MREK_ERRNO]);
         }
         $this->_nav = $nav[Const_DataAccess::MREK_DATA]['value'];
     }
     return $this->_nav;
 }
Beispiel #2
0
 /**
  * @param string $key
  */
 static function render_help_page($key)
 {
     if (!isset(self::$_action_list[$key])) {
         self::_error_and_redirect('不存在此页', '/');
     }
     $actions = self::$_action_list[$key];
     $keyword = $actions[self::KEYWORD];
     $model_option = new Model_Option();
     $data = $model_option->get_one_by_keyword($keyword);
     $content = [];
     if ($data['errno'] == Const_Err_Base::ERR_OK) {
         $content = $data['data'];
     } elseif ($data['errno'] != Const_Err_Db::ERR_MONGO_FINDONE_EMPTY) {
         self::_error_and_redirect(Lib_Helper::format_err_struct($data), '/');
     }
     $content = isset($content['value']) ? $content['value'] : '';
     if (trim($content) != '') {
         $content = str_replace("\r", '', $content);
         $content = str_replace("\n", '\\n', $content);
         $content = htmlentities($content);
     }
     $render_data = ['help_title' => $actions[self::TITLE], 'submit_action' => Module_HttpRequest_Router::site_url($actions[self::SUBMIT_URL]), 'md_content' => $content];
     Module_Page_Main::render('help/markdown', $render_data);
 }