public function show_notice() { $user_info = $this->check('all'); $gScriptName = SCRIPTNAME; $n = intval($this->input['n']); $count = 50; $pp = intval($this->input['pp']) / $count; $user_id = $this->user['id']; hg_add_head_element('js', RESOURCE_DIR . 'scripts/' . 'user.js'); switch ($n) { case 0: $this->page_title = '消息'; include_once ROOT_PATH . 'lib/messages/messages.class.php'; $mMessages = new messages(); $msg_members = array(); $from_who = $mMessages->get_members($user_id, '', $pp, $count); $total = @array_shift($from_who); //分页 $data['totalpages'] = $total; $data['perpage'] = $count; $data['curpage'] = $pp; $data['onclick'] = ' onclick="javascript:document.location.href=re_back+\'?a=show_notice&pp=\'+(parseInt(this.title,10) - 1)+\'&n=0\';$(this).addClass(\'pages_current\');" '; $showpages = hg_build_pagelinks($data, 1); $this->tpl->addVar('msg_members', $msg_members); $this->tpl->addVar('mMessages', $mMessages); $this->tpl->addVar('from_who', $from_who); $this->tpl->addVar('total', $total); break; case 1: $this->page_title = '通知'; include_once ROOT_PATH . 'lib/class/notify.class.php'; $mNotify = new notify(); $un_notice = $notice = array(); $un_notice = $mNotify->notify_get_unread($user_id, -1, $pp, $count); $notice = $mNotify->notify_get_read($user_id, -1, $pp, $count); /*if(is_array($un_notice)) { $nids = $space = ""; foreach($un_notice as $key => $value) { $mNotify->notify_send_read($value['id'] , $user_id, $value['type']); } }*/ $total_count = $mNotify->notify_count($user_id, -1); if (is_array($un_notice)) { $data['totalpages'] = $total_count[0]; $data['perpage'] = $count; $data['curpage'] = $this->input['pp']; $data['pagelink'] = '?a=show_notice&n=1'; $showpages = hg_build_pagelinks($data); } //$a = $mNotify->notify_send_read($key,$user_id,$n['type']);//将本页未读通知插入到已读表中 $this->tpl->addVar('un_notice', $un_notice); $this->tpl->addVar('notice', $notice); break; } $this->tpl->addVar('showpages', $showpages); $this->tpl->addVar('n', $n); $this->tpl->addVar('gScriptName', $gScriptName); $this->tpl->addHeaderCode(hg_add_head_element('echo')); $this->tpl->setTemplateTitle($this->lang['pageTitle']); $this->tpl->outTemplate('user_show_n'); }