public function historyAction() { $id = $this->params()->fromQuery('id'); $created = $this->params()->fromQuery('created'); if (!$id || $created) { return $this->page404(); } /** @var \Admin\Model\ReportMapper $reportMapper */ $reportMapper = $this->getServiceLocator()->get('Admin\\Model\\ReportMapper'); /** @var \User\Model\UserMapper $userMapper */ $userMapper = $this->getServiceLocator()->get('User\\Model\\UserMapper'); $user = new User(); if (!$user->getId() || !$userMapper->get($user->getId())) { return $this->page404(); } if (!$this->params()->fromQuery('created') || !DateBase::validateDate($this->params()->fromQuery('created'), DateBase::DISPLAY_DATE_FORMAT)) { return $this->page404(); } $user = $userMapper->get($id); /** @var \Admin\Model\MessagesMG $mess */ $mess = new MessagesMG(); $mess->setSender($user->getUsername()); $mess->setCreated($this->params()->fromQuery('created')); $data = $reportMapper->reportdetail($mess); $this->getViewModel()->setVariable('data', $data); $this->getViewModel()->setVariable('user', $user); return $this->getViewModel(); }
<?php session_start(); require_once "libs/Smarty.class.php"; require_once "dbclass.php"; date_default_timezone_set("PRC"); $smarty = new Smarty(); $dbclass = new DateBase(); $_select_mess = $_GET; $username = empty($_GET['username']) ? '' : trim($_GET['username']); $sex = isset($_GET['sex']) ? $_GET['sex'] : ""; $school = empty($_GET['school']) ? '' : trim($_GET['school']); $phone = empty($_GET['phone']) ? '' : trim($_GET['phone']); $smarty->assign('username', $username); $smarty->assign('sex', $sex); $smarty->assign('school', $school); $smarty->assign('phone', $phone); $smarty->display("selete_resume.tpl"); $countsql = $dbclass->counttotal($username, $_select_mess); $countsql = intval($countsql[tcount]); $pagenum = 5; $total_age = ceil($countsql / 5); $current_age = empty($_GET['page']) ? 1 : intval($_GET['page']); $smarty->assign('current_age', $current_age); $smarty->assign('total_age', $total_age); $pagstar = intval($current_age * 5); $pagend = $pagstar + 5; $orderz = $_GET[orderz]; $orderf = $_GET[orderf]; $pagstar = ($current_age - 1) * 5; $_show_mess = $dbclass->showMess($username, $_select_mess, $pagstar, $pagenum, $orderz, $orderf);
/** * Get recommended items by user's id * * @param int $userId * @param int $limit * @return array */ public function getRecommendedItemsByUser($userId, $limit = 20) { $sql = 'select s.item_id2 from oso_slope_one s,oso_user_ratings u where u.user_id = ' . $userId . ' and s.item_id1 = u.item_id and s.item_id2 != u.item_id group by s.item_id2 order by sum(u.rating * s.times - s.rating)/sum(s.times) desc limit ' . $limit; $Database = new DateBase($this->_config['host'], $this->_config['username'], $this->_config['password'], $this->_config['dbname']); $Database->Connect(); $Database->Query = $sql; $Database->Query(); while ($row = mysql_fetch_array($Database->queryResult)) { $user[] = $row[0]; } $Database->Close(); return $user; }