本文整理汇总了PHP中ApplicationLogs::getObjectLogs方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationLogs::getObjectLogs方法的具体用法?PHP ApplicationLogs::getObjectLogs怎么用?PHP ApplicationLogs::getObjectLogs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationLogs
的用法示例。
在下文中一共展示了ApplicationLogs::getObjectLogs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_history
function view_history()
{
$id = array_var($_GET, 'id');
$obj = Objects::findObject($id);
$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;
}
$logs = ApplicationLogs::getObjectLogs($obj);
$logs_read = ApplicationReadLogs::getObjectLogs($obj);
tpl_assign('object', $obj);
tpl_assign('logs', $logs);
tpl_assign('logs_read', $logs_read);
}
示例2: view_history
function view_history()
{
$id = array_var($_GET, 'id');
$manager = array_var($_GET, 'manager');
$obj = get_object_by_manager_and_id($id, $manager);
if (!$obj instanceof ApplicationDataObject) {
flash_error(lang('object dnx'));
ajx_current("empty");
return;
}
// if
if (!$obj->canView(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
if ($obj instanceof User && (logged_user()->getId() != $id && !logged_user()->isAdministrator())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
$logs = ApplicationLogs::getObjectLogs($obj);
$logs_read = ApplicationReadLogs::getObjectLogs($obj);
tpl_assign('object', $obj);
tpl_assign('logs', $logs);
tpl_assign('logs_read', $logs_read);
}
示例3: render_object_latest_activity
/**
* Render Latest Activity
*
* @param ContentDataObject $object
* @return null
*/
function render_object_latest_activity($object) {
$latest_logs = ApplicationLogs::getObjectLogs($object, false, false, 3, 0);
tpl_assign('logs', $latest_logs);
return tpl_fetch(get_template_path('activity_log', 'latest_activity'));
} // render_object_latest_activity
示例4: 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', ''));
}