Ejemplo n.º 1
0
 public function view_categoryList()
 {
     /* -----  获取全部的分类列表  -----*/
     $msgcat_obj = new messagecategoryModel();
     $lp_ojb = new LocalPowerModel();
     $powerlist = $lp_ojb->getEbayPowerlist($_SESSION['userId']);
     if (empty($powerlist['field'])) {
         $filsql = '0';
     } else {
         $filsql = implode(', ', $powerlist['field']);
     }
     $arrlist = $msgcat_obj->getAllCategoryInfoList(' and id in (' . $filsql . ') order by category_name');
     $msg_obj = new messageModel();
     if (in_array('-1', $powerlist['field'])) {
         $arrlist[] = array('id' => -1, 'category_name' => '迷途文件夹', 'ebay_account' => '');
     }
     foreach ($arrlist as &$listval) {
         /* ---- 计算某个分类下已经回复的数量  ---- */
         $replyed_num = $msg_obj->getNumber($listval['id'], array(2, 3));
         $listval['replyed'] = $replyed_num;
         /* ---- 计算某个分类下未回复的数量  ---- */
         $noreply_num = $msg_obj->getNumber($listval['id'], array(0));
         $listval['noreply'] = $noreply_num;
     }
     $this->smarty->assign('sec_menue', 1);
     $this->smarty->assign('toplevel', 1);
     $this->smarty->assign('categorylist', $arrlist);
     $this->smarty->assign('toptitle', 'message类别列表');
     $this->smarty->display('msgcategorylist.htm');
 }
Ejemplo n.º 2
0
 public function view_getMessageListByConditions()
 {
     $keywords = isset($_GET['keywords']) ? trim($_GET['keywords']) : '';
     //关键字
     $keywords = mysql_real_escape_string($keywords);
     $status = isset($_GET['status']) ? $_GET['status'] : FALSE;
     //回复状态
     $category = isset($_GET['catid']) ? intval($_GET['catid']) : FALSE;
     //分类
     $from = isset($_GET['from']) ? intval($_GET['from']) : FALSE;
     //发送者
     $name = isset($_GET['name']) ? trim($_GET['name']) : FALSE;
     isset($_GET['pagesize']) ? $_SESSION['pagesize'] = intval($_GET['pagesize']) : 200;
     $pagesize = isset($_SESSION['pagesize']) ? intval($_SESSION['pagesize']) : 200;
     //每页数量
     $cat_obj = new messagecategoryModel();
     /*----- 获得用户所属文件夹 -----*/
     $Lp_obj = new LocalPowerModel();
     $fieldid = $Lp_obj->getEbayPowerlist($_SESSION['userId']);
     //获得当前用户所属的id
     $fieldid = isset($fieldid['field']) ? empty($fieldid['field']) ? array(-10) : $fieldid['field'] : array(-10);
     $category = in_array($category, $fieldid) ? $category : FALSE;
     if (empty($category)) {
         $catList = $fieldid;
     } else {
         $catList = array($category);
     }
     /*----- 获得用户所属文件夹 -----*/
     if (!empty($fieldid)) {
         $powerlist = $cat_obj->getFieldInfoByIds($fieldid, ' and platform=1 order by category_name');
     } else {
         $powerlist = array();
     }
     if (in_array('-1', $fieldid)) {
         $powerlist[] = array('id' => -1, 'category_name' => '迷途文件夹', 'ebay_account' => '');
     }
     $wheresql = '';
     if (!empty($keywords)) {
         //是否指定keywords
         $wheresql .= " and sendid='{$keywords}' ";
     }
     if ($status !== FALSE) {
         //指定状态
         switch ($status) {
             case 1:
                 //回复完成
                 $wheresql .= " and status in (2,3)";
                 break;
             case 2:
                 //未回复
                 $wheresql .= " and status=0 ";
                 break;
             case 3:
                 //回复中
                 $wheresql .= " and status=1 ";
                 break;
             case 4:
                 //回复失败
                 $wheresql .= " and status=4 ";
                 break;
             default:
                 $wheresql .= "";
                 break;
         }
     }
     if ($from !== FALSE) {
         $wheresql .= " and forms={$from} ";
     }
     $class_sql = implode(', ', $catList);
     $wheresql .= " and classid in ({$class_sql})";
     $msg_obj = new messageModel();
     $mount = $msg_obj->getCountNumberByConditions($wheresql);
     $page_obj = new Page($mount, $pagesize);
     $usercache = new UserCacheModel();
     if ($name !== FALSE) {
         if ($name == 'asc') {
             $orderby = ' order by sendid asc ';
         } else {
             $orderby = ' order by sendid desc ';
         }
     } else {
         $orderby = ' order by createtimestamp ';
     }
     //echo $_SERVER['QUERY_STRING'];
     $msglist = $msg_obj->getMessageListByConditions($wheresql . $orderby . $page_obj->limit);
     /* --- 格式化数据 ---*/
     foreach ($msglist as &$msgitem) {
         $msgitem['revtime'] = empty($msgitem['createtimestamp']) ? '' : date("Y-m-d ", $msgitem['createtimestamp']) . date("H:i:s", $msgitem['createtimestamp']);
         $catinfo = $cat_obj->getCategoryInfoById($msgitem['classid']);
         $msgitem['classname'] = $catinfo['category_name'];
         $msgitem['subjectfm'] = mb_substr($msgitem['subject'], 0, 60) . '...';
         $userinfo = empty($msgitem['replyuser_id']) ? array('userName' => '') : $usercache->getUserInfoBySysId($msgitem['replyuser_id'], 0);
         $msgitem['username'] = $userinfo['userName'];
         $msgitem['retime'] = $msgitem['replytime'] ? date("Y-m-d \n H:i:s", $msgitem['replytime']) : '';
     }
     if ($mount > $pagesize) {
         //分页
         $pagestr = $page_obj->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $pagestr = $page_obj->fpage(array(0, 2, 3));
     }
     /*----- 获得分类文件夹列表 -----*/
     $categorylist = $cat_obj->getAllCategoryInfoList(' order by category_name', 1);
     //         print_r($categorylist);
     $this->smarty->assign('catlist', $categorylist);
     /*----- 获得分类列表 -----*/
     if ($from === FALSE) {
         $this->smarty->assign('third_menue', 1);
     } elseif ($from == 0) {
         $this->smarty->assign('third_menue', 2);
     } elseif ($from == 2) {
         $this->smarty->assign('third_menue', 3);
     } elseif ($from == 3) {
         $this->smarty->assign('third_menue', 4);
     }
     $urlquery = convertUrlQuery($_SERVER['QUERY_STRING']);
     unset($urlquery['name']);
     if ($name == 'asc') {
         $urlquery['name'] = 'desc';
     } else {
         $urlquery['name'] = 'asc';
     }
     $url = getUrlQuery($urlquery);
     //         echo $url, "\n";
     //         var_dump($urlquery);
     $this->smarty->assign('url', $url);
     $this->smarty->assign('powerlist', $powerlist);
     $this->smarty->assign('from', $from);
     $this->smarty->assign('sec_menue', 3);
     $this->smarty->assign('toplevel', 0);
     $this->smarty->assign('keywords', $keywords);
     $this->smarty->assign('category', $category);
     $this->smarty->assign('status', $status);
     $this->smarty->assign('pagestr', $pagestr);
     $this->smarty->assign('msglist', $msglist);
     $this->smarty->assign('categorylist', $arrlist);
     $this->smarty->assign('toptitle', 'message列表');
     $this->smarty->display('msglist.htm');
 }