本文整理匯總了PHP中UserUtil::getUserLastLogoutTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserUtil::getUserLastLogoutTime方法的具體用法?PHP UserUtil::getUserLastLogoutTime怎麽用?PHP UserUtil::getUserLastLogoutTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserUtil
的用法示例。
在下文中一共展示了UserUtil::getUserLastLogoutTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: haveNewReply
/**
* 判斷有無新回複
* @param: &$db,
* @param: $id
* @return: boolan
* @access: public
* @static
*/
public static function haveNewReply(&$db, $id, $user_id)
{
/*{{{*/
//求用戶最後訪問的時間
//$user_name = UserUtil::getUserNameById($db, $user_id);
$last_time = UserUtil::getUserLastLogoutTime($db, $user_id);
$sql = 'select last_access_date from bbs_subject where id=?';
$sth = $db->Prepare($sql);
$res = $db->Execute($sth, array($id));
$rows = $res->FetchRow();
$temp_time = $rows['last_access_date'];
if ($temp_time >= $last_time) {
return TRUE;
} else {
return FALSE;
}
}
示例2: run
/**
* 顯示版麵的情況
* @param: NULL
* @return: NULL
* @access: public
*/
public function run()
{
//取得用戶的id
$user_id = UserUtil::getUserId($this->db, $_SESSION['user']['name']);
$smarty = $this->getSmarty();
//取得站點的公告,並顯示在頁麵上
$is_have_post = false;
$post_str = '';
if (PostUtil::haveNotExpirePost($this->getDB())) {
$is_have_post = true;
$post_array = PostUtil::getPost($this->getDB(), 3);
foreach ($post_array as $post_rows) {
$post_str .= '<a href=\'index.php?module=post&action=view&id=' . $post_rows['id'] . '\' title=\'' . $post_rows['title'] . '\'>' . utf8_substr($post_rows['title'], 0, 35) . '</a>' . ' ';
}
}
$smarty->assign('have_system_post', $is_have_post);
$smarty->assign('post_str', $post_str);
//公告顯示結束
$q = $this->getParameterFromGET('q');
$encode_q = $q;
//取得查詢字符串
if (!$q) {
//取得用戶最後一次的動作時間
$last_time = UserUtil::getUserLastLogoutTime($this->db, $user_id);
//生成一個where語句
$q = " where last_access_date >='" . $last_time . "'";
$encode_q = base64_encode($q);
} else {
$q = base64_decode($q);
}
$smarty->assign('encode_q', $encode_q);
//生成所有的記錄數
$sql = 'select count(*) as num from bbs_subject ' . $q;
$res = $this->db->Execute($sql);
$rows = $res->FetchRow();
$total_number = $rows['num'];
//求總公的頁麵
$total_page = ceil($total_number / $this->page_number);
//取得當前的頁麵
$page = $this->getParameter('page');
if (!$page || $page < 0) {
$page = 1;
}
if ($page > $total_page && $total_page > 0) {
$page = $total_page;
}
$begin_page = 1;
$end_page = $total_page;
if ($page <= 10 && $total_page >= 10) {
$end_page = 10;
} else {
if ($page > 10) {
if ($page % 10 == 0) {
//向前翻
$end_page = $page;
$begin_page = $end_page - 9;
} else {
if ($page % 10 == 1) {
//向後翻
//確定開始的頁數
$begin_page = $page;
if ($begin_page > $total_page) {
$begin_page = $page - 9;
}
if ($begin_page + 9 > $total_page) {
$end_page = $total_page;
} else {
$end_page = $begin_page + 9;
}
} else {
$num = $page % 10;
$pre_num = floor($page / 10);
$begin_page = $pre_num * 10 + 1;
$end_page = $begin_page + 9;
}
}
}
}
if ($end_page > $total_page) {
$end_page = $total_page;
}
$nav_page_array = array();
for ($i = $begin_page; $i <= $end_page; $i++) {
array_push($nav_page_array, $i);
}
//帖子導航欄
$smarty->assign('nav_page', $nav_page_array);
//當前的頁麵
$smarty->assign('now_page', $page);
//共有的頁麵
$smarty->assign('total_page', $total_page);
//顯示搜索結果
//求出偏移
$offset_number = ($page - 1) * $this->page_number;
//.........這裏部分代碼省略.........
示例3: haveNewTopic
/**
* 判斷論壇是否有新帖
* @param: &$db database references
* @param: $user_name
* @param: $sub_bbs_id 板塊及子板塊的ID數組
* @return: boolean
* @access: public
* @static
*/
public static function haveNewTopic(&$db, $user_name, &$sub_bbs_id)
{
/*{{{*/
/**
* 求出最後時間後,需要我們找出當前子論壇下各個子論壇的id
*/
$user_id = UserUtil::getUserId($db, $user_name);
$last_time = UserUtil::getUserLastLogoutTime($db, $user_id);
$sql = 'select count(*) as num from bbs_subject where layout_id in (' . implode(',', $sub_bbs_id) . ') and last_access_date >= ? ';
$sth = $db->Prepare($sql);
$res = $db->Execute($sth, array($last_time));
$rows = $res->FetchRow();
if ($rows['num']) {
return TRUE;
} else {
return FALSE;
}
}