Пример #1
0
 private function _search()
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $this->_modelBulletin = $this->_getGlobalData('Model_Bulletin', 'object');
     $bulletinKind = $this->_modelBulletin->createBulletinKind();
     $this->_loadCore('Help_SqlSearch');
     $this->_loadCore('Help_Page');
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($this->_modelBulletin->tName());
     if ($_GET['kind']) {
         $helpSqlSearch->set_conditions("kind={$_GET['kind']}");
         $this->_view->assign('selectedKind', $_GET['kind']);
     }
     $helpSqlSearch->set_conditions("(title like '%{$_GET['content']}%' or content like '%{$_GET['content']}%' )");
     $this->_view->assign('selectedContent', $_GET['content']);
     $helpSqlSearch->set_orderBy("create_time desc");
     $helpSqlSearch->setPageLimit($_GET['page']);
     $sql = $helpSqlSearch->createSql();
     $dataList = $this->_modelBulletin->select($sql);
     $users = $this->_getGlobalData('user_index_id');
     if ($dataList) {
         foreach ($dataList as &$childList) {
             $childList['word_kind'] = $bulletinKind[$childList['kind']];
             $childList['create_time'] = date('Y-m-d H:i:s', $childList['create_time']);
             $childList['word_user_id'] = $users[$childList['user_id']];
             if (strpos($childList['content'], '\\')) {
                 $childList['content'] = str_replace('\\', '', $childList['content']);
             }
             $childList['not_read'] = unserialize($childList['not_read']);
             $childList['url_edit'] = Tools::url(CONTROL, 'Notice', array('Id' => $childList['Id'], 'doaction' => 'edit'));
             $childList['url_del'] = Tools::url(CONTROL, 'Notice', array('Id' => $childList['Id'], 'doaction' => 'del'));
             if (count($childList['not_read'])) {
                 //如果还有未读用户
                 if (array_search($userClass['_id'], $childList['not_read']) !== false) {
                     //如果当前登录用户没有读取这个邮件的话
                     $childList['user_no_read'] = true;
                     //设为用户未读这个邮件
                 }
                 $childList['word_not_read'] = array();
                 foreach ($childList['not_read'] as $userId) {
                     $childList['word_not_read'][$userId] = $users[$userId];
                 }
                 $childList['word_not_read'] = implode(',', $childList['word_not_read']);
             }
         }
     }
     $bulletinKind[''] = '所有';
     $this->_view->assign('kind', $bulletinKind);
     $this->_view->assign('dataList', $dataList);
     $this->_view->set_tpl(array('body' => 'ServiceTools/NoticeSearch.html'));
     $this->_view->display();
 }