Exemple #1
0
 /**
  * 模块栏目列表
  */
 protected function _category($id = 0, $dir = NULL, $page = 1)
 {
     $mod = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
     if ($id) {
         $cat = $mod['category'][$id];
         if (!$cat) {
             $this->goto_404_page(dr_lang('cat-23', $id));
         }
     } elseif ($dir) {
         $id = $mod['category_dir'][$dir];
         $cat = $mod['category'][$id];
         if (!$cat) {
             // 无法通过目录找到栏目时,尝试多及目录
             foreach ($mod['category'] as $t) {
                 if ($t['setting']['urlrule']) {
                     $rule = $this->get_cache('urlrule', $t['setting']['urlrule']);
                     if ($rule['value']['catjoin'] && strpos($dir, $rule['value']['catjoin'])) {
                         $dir = trim(strchr($dir, $rule['value']['catjoin']), $rule['value']['catjoin']);
                         if (isset($mod['category_dir'][$dir])) {
                             $id = $mod['category_dir'][$dir];
                             $cat = $mod['category'][$id];
                             break;
                         }
                     }
                 }
             }
             // 返回无法找到栏目
             if (!$cat) {
                 $this->goto_404_page(dr_lang('cat-23', $dir));
             }
         }
     } else {
         $this->goto_404_page(lang('cat-23'));
     }
     list($parent, $related) = $this->_related_cat($mod, $id);
     $this->template->assign(dr_category_seo($mod, $cat, max(1, (int) $this->input->get('page'))));
     $this->template->assign(array('cat' => $cat, 'page' => $page, 'catid' => $id, 'params' => array('catid' => $id), 'parent' => $parent, 'related' => $related, 'urlrule' => $this->mobile ? dr_mobile_category_url($this->dir, $catid, '{page}') : dr_category_url($catid, '{page}')));
     $this->template->display($cat['child'] ? $cat['setting']['template']['category'] : $cat['setting']['template']['list']);
 }
 /**
  * 模块栏目列表
  */
 protected function _category($id = 0, $dir = NULL, $page = 1)
 {
     $member = $_SESSION['userstatus'];
     $this->template->assign('me', $member);
     /*zjp 0814 网上信访前台页面已回复未回复数量显示start*/
     $yi_num = $this->content_model->count_wsxf_yi();
     $this->template->assign('yi', $yi_num[0]['yi']);
     $wei_num = $this->content_model->count_wsxf_wei();
     $this->template->assign('wei', $wei_num[0]['wei']);
     $bs = $this->input->get('backstatus');
     $this->template->assign('bs', $bs);
     /*zjp 0814 网上信访前台页面已回复未回复数量显示  end*/
     //zjp添加,动态显示日期天气温度
     //$city="宜春";
     //$content = file_get_contents("http://api.map.baidu.com/telematics/v3/weather?location=宜春&output=json&ak=i8GFDZTM22uqICZbtioaVbnk");
     //$de_json = json_decode($content,TRUE);
     $id = intval($id);
     $mod = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
     if ($id) {
         $cat = $mod['category'][$id];
         //zjp 0814
         /*if (!$cat) {
               $this->goto_404_page(dr_lang('cat-23', $id));
           }*/
     }
     /*elseif ($dir) {
           $id = $mod['category_dir'][$dir];
           $cat = $mod['category'][$id];
           if (!$cat) {
               // 无法通过目录找到栏目时,尝试多及目录
               foreach ($mod['category'] as $t) {
                   if ($t['setting']['urlrule']) {
                       $rule = $this->get_cache('urlrule', $t['setting']['urlrule']);
                       if ($rule['value']['catjoin']
                           && strpos($dir, $rule['value']['catjoin'])) {
                           $dir = trim(strchr($dir, $rule['value']['catjoin']), $rule['value']['catjoin']);
                           if (isset($mod['category_dir'][$dir])) {
                               $id = $mod['category_dir'][$dir];
                               $cat = $mod['category'][$id];
                               break;
                           }
                       }
                   }
               }
               // 返回无法找到栏目
               if (!$cat) {
                   $this->goto_404_page(dr_lang('cat-23', $dir));
               }
           }
       } else {
           $this->goto_404_page(lang('cat-23'));
       }*/
     list($parent, $related) = $this->_related_cat($mod, $id);
     $this->template->assign(dr_category_seo($mod, $cat, max(1, (int) $this->input->get('page'))));
     $this->template->assign(array('cat' => $cat, 'page' => $page, 'catid' => $id, 'params' => array('catid' => $id), 'parent' => $parent, 'related' => $related, 'urlrule' => $this->mobile ? dr_mobile_category_url($this->dir, $catid, '{page}') : dr_category_url($catid, '{page}'), 'de_json' => $_SESSION["de_json"]));
     /*zjp 0818 添加获取在线监测文章内容start*/
     if ($id == 94 || $id == 95 || $id == 96 || $id == 97) {
         $this->load->model("content_model");
         $content_zxjc = $this->content_model->get_zxjc($id);
         $content_zxjctime = $this->content_model->get_zxjctime($id);
         $this->template->assign("content_zxjc", $content_zxjc);
     }
     $this->template->assign("content_zxjctime", $content_zxjctime['inputtime']);
     $this->template->assign("title_zxjc", $content_zxjctime['title']);
     /*zjp 0818 添加获取在线监测文章内容end  */
     if ($this->input->get('backstatus')) {
         $backstatus = $this->input->get('backstatus');
     } else {
         $backstatus = 1;
     }
     if (APP_DIR == "wsxf") {
         //zjp 0814 添加网上信访判断
         if ($backstatus == 0) {
             $param['hf'] = 0;
         } else {
             $param['hf'] = 1;
         }
         list($list, $param) = $this->content_model->limit_page_wsxf($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
         $total = $param['total'];
         $pages = $this->get_pagination("index.php?c=category&backstatus=" . $param['backstatus'], $param['total']);
         //var_dump($pages);
         $this->template->assign(array('list' => $list, 'pages' => $pages, 'pagenow' => $page, 'rowtotal' => $total, 'backstatus' => $backstatus));
         $this->template->display("list.html");
     } else {
         if (APP_DIR == "wsfk") {
             list($list, $param) = $this->content_model->limit_page_wsfk($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
             $total = $param['total'];
             $pages = $this->get_pagination("index.php?c=category", $param['total']);
             $this->template->assign(array('list' => $list, 'pages' => $pages, 'page' => $page, 'total' => $total));
             $this->template->display("list.html");
         } else {
             if (APP_DIR == "question") {
                 //zjp 0820添加问卷调查统计
                 list($list, $param) = $this->content_model->limit_page_question($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
                 $total = $param['total'];
                 $pages = $this->get_pagination("index.php?c=category", $param['total']);
                 $this->template->assign(array('list' => $list, 'pages' => $pages, 'page' => $page, 'total' => $total));
                 $this->template->display("list.html");
             } else {
                 list($list, $param) = $this->content_model->limit_page($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
                 $total = $param['total'];
                 $this->template->assign(array('list' => $list, 'totals' => $total));
                 $this->template->display($cat['child'] ? $cat['setting']['template']['category'] : $cat['setting']['template']['list']);
             }
         }
     }
 }