public function show_notice() { $gScriptName = SCRIPTNAME; $n = intval($this->input['n']); $pp = intval($this->input['pp']) ? intval($this->input['pp']) : 0; $count = 50; 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($this->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); ob_start(); include hg_load_template("user_msgs"); $html = ob_get_contents(); ob_end_clean(); break; case 1: $this->page_title = '通知'; include_once ROOT_PATH . 'lib/class/notify.class.php'; $mNotify = new notify(); $notice_arr = $un_notice = $notice = array(); $notice_arr = $mNotify->notify_get($this->user['id'], -1, $pp, $count); //分页,这个通知要区分一下,已读的通知和未知的通知要分开 $notice_count = $mNotify->notify_count($this->user['id'], -1); $total_count = $notice_count[0]; $total1 = array_sum($total_count); $data['totalpages'] = $total1; $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=1\';$(this).addClass(\'pages_current\');" '; $showpages = hg_build_pagelinks($data); if ($notice_arr) { $sp = ''; foreach ($notice_arr as $key => $n) { if ($n['is_read'] == 0) { if (in_array($n['type'], array(0, 1, 2, 3))) { $un_notice[$n['type']]['idstr'] .= $sp . $n['id']; $un_notice[$n['type']]['content'] = unserialize($n['content']); } else { $un_notice[$n['type']][$n['id']]['content'] = unserialize($n['content']); $un_notice[$n['type']][$n['id']]['content']['notify_time'] = hg_get_date($n['notify_time']); } $a = $mNotify->notify_send_read($key, $this->user['id'], $n['type']); //将本页未读通知插入到已读表中 $sp = ','; } else { if ($n['type'] > 3) { $notice[$n['type']][$n['id']]['content'] = unserialize($n['content']); $notice[$n['type']][$n['id']]['content']['notify_time'] = hg_get_date($n['notify_time']); } } } } ob_start(); include hg_load_template("user_notices"); $html = ob_get_contents(); ob_end_clean(); break; } hg_add_head_element('js', RESOURCE_DIR . 'scripts/' . 'user.js'); include hg_load_template("user_show_n"); }