本文整理汇总了PHP中ApplicationLogs::countObjectLogs方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationLogs::countObjectLogs方法的具体用法?PHP ApplicationLogs::countObjectLogs怎么用?PHP ApplicationLogs::countObjectLogs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationLogs
的用法示例。
在下文中一共展示了ApplicationLogs::countObjectLogs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_history
function view_history()
{
$id = array_var($_GET, 'id');
$obj = Objects::findObject($id);
$page_size = 20;
$limit = $page_size;
// get submitted modification logs page
$mod_page_submitted = array_var($_REQUEST, 'mod_page');
$mod_page = $mod_page_submitted ? $mod_page_submitted : 1;
$mod_offset = $page_size * ($mod_page - 1);
// get submitted read logs page
$view_page_submitted = array_var($_REQUEST, 'view_page');
$view_page = $view_page_submitted ? $view_page_submitted : 1;
$view_offset = $page_size * ($view_page - 1);
$isUser = $obj instanceof Contact && $obj->isUser() ? true : false;
if (!$obj instanceof ApplicationDataObject) {
flash_error(lang('object dnx'));
ajx_current("empty");
return;
}
// if
if ($isUser && (logged_user()->getId() != $id && !logged_user()->isAdministrator())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
if (!$isUser && !$obj->canView(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if logged user is guest don't show other users logs
$extra_conditions = "";
if (logged_user()->isGuest()) {
$extra_conditions = " AND `created_by_id` = " . logged_user()->getId();
}
$logs = ApplicationLogs::getObjectLogs($obj, false, true, $limit, $mod_offset, $extra_conditions);
$logs_read = ApplicationReadLogs::getObjectLogs($obj, $limit, $view_offset, $extra_conditions);
// build modification logs pagination object
$total_logs = ApplicationLogs::countObjectLogs($obj, false, true, $extra_conditions);
$mod_logs_pagination = array('total_pages' => ceil($total_logs / $page_size), 'current_page' => $mod_page);
// build read logs pagination object
$total_read_logs = ApplicationReadLogs::countObjectLogs($obj, $extra_conditions);
$view_logs_pagination = array('total_pages' => ceil($total_read_logs / $page_size), 'current_page' => $view_page);
if ($mod_page_submitted || $view_page_submitted) {
ajx_replace(true);
}
tpl_assign('object', $obj);
tpl_assign('logs', $logs);
tpl_assign('logs_read', $logs_read);
tpl_assign('mod_logs_pagination', $mod_logs_pagination);
tpl_assign('view_logs_pagination', $view_logs_pagination);
tpl_assign('curtab', array_var($_REQUEST, 'curtab', ''));
}