示例#1
0
 /**
  * 用户邮件
  */
 private function _mailIndex()
 {
     #------初始化------#
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $this->_modelUserMail = $this->_getGlobalData('Model_UserMail', 'object');
     $this->_loadCore('Help_SqlSearch');
     $this->_loadCore('Help_Page');
     $mailType = $this->_getGlobalData('mail_type');
     #------初始化------#
     $userClass = $this->_utilRbac->getUserClass();
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($this->_modelUserMail->tName());
     $helpSqlSearch->set_conditions("user_id={$userClass['_id']}");
     if ($_GET['mail_type'] != '') {
         $helpSqlSearch->set_conditions("type={$_GET['mail_type']}");
         $this->_view->assign('selectedMailType', $_GET['mail_type']);
     }
     if ($_GET['read'] != '') {
         $helpSqlSearch->set_conditions("is_read='{$_GET['read']}'");
         $this->_view->assign('selectedRead', $_GET['read']);
     }
     if ($_GET['is_read'] != '') {
         $helpSqlSearch->set_orderBy('is_read asc,create_time desc');
     } else {
         $helpSqlSearch->set_orderBy('create_time desc');
     }
     $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE);
     $sql = $helpSqlSearch->createSql();
     $dataList = $this->_modelUserMail->select($sql);
     if ($dataList) {
         Tools::import('Util_FontColor');
         foreach ($dataList as &$list) {
             $list['word_is_read'] = Util_FontColor::getMailRead($list['is_read']);
             $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
             $list['word_type'] = Util_FontColor::getMailType($list['type'], $mailType[$list['type']]);
         }
         $conditions = $helpSqlSearch->get_conditions();
         $helpPage = new Help_Page(array('total' => $this->_modelUserMail->findCount($conditions), 'perpage' => PAGE_SIZE));
         $this->_view->assign('pageBox', $helpPage->show());
         $this->_view->assign('dataList', $dataList);
     }
     $mailType[''] = '所有';
     $this->_view->assign('selectMailType', $mailType);
     $this->_view->assign('selectRead', array('1' => '已读', '0' => '未读', '' => '所有'));
     $this->_view->set_tpl(array('body' => 'User/MailIndex.html'));
     $this->_utilMsg->createNavBar();
     $this->_view->display();
 }