本文整理汇总了PHP中build_logs_array函数的典型用法代码示例。如果您正苦于以下问题:PHP build_logs_array函数的具体用法?PHP build_logs_array怎么用?PHP build_logs_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_logs_array函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_log_ods
function print_log_ods($course, $user, $date, $order = 'l.time DESC', $modname, $modid, $modaction, $groupid)
{
global $CFG, $DB;
require_once "{$CFG->libdir}/odslib.class.php";
if (!($logs = build_logs_array($course, $user, $date, $order, '', '', $modname, $modid, $modaction, $groupid))) {
return false;
}
$courses = array();
if ($course->id == SITEID) {
$courses[0] = '';
if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname')) {
foreach ($ccc as $cc) {
$courses[$cc->id] = $cc->shortname;
}
}
} else {
$courses[$course->id] = $course->shortname;
}
$count = 0;
$ldcache = array();
$tt = getdate(time());
$today = mktime(0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
$strftimedatetime = get_string("strftimedatetime");
$nroPages = ceil(count($logs) / (EXCELROWS - FIRSTUSEDEXCELROW + 1));
$filename = 'logs_' . userdate(time(), get_string('backupnameformat', 'langconfig'), 99, false);
$filename .= '.ods';
$workbook = new MoodleODSWorkbook('-');
$workbook->send($filename);
$worksheet = array();
$headers = array(get_string('course'), get_string('time'), get_string('ip_address'), get_string('fullnameuser'), get_string('action'), get_string('info'));
// Creating worksheets
for ($wsnumber = 1; $wsnumber <= $nroPages; $wsnumber++) {
$sheettitle = get_string('logs') . ' ' . $wsnumber . '-' . $nroPages;
$worksheet[$wsnumber] =& $workbook->add_worksheet($sheettitle);
$worksheet[$wsnumber]->set_column(1, 1, 30);
$worksheet[$wsnumber]->write_string(0, 0, get_string('savedat') . userdate(time(), $strftimedatetime));
$col = 0;
foreach ($headers as $item) {
$worksheet[$wsnumber]->write(FIRSTUSEDEXCELROW - 1, $col, $item, '');
$col++;
}
}
if (empty($logs['logs'])) {
$workbook->close();
return true;
}
$formatDate =& $workbook->add_format();
$formatDate->set_num_format(get_string('log_excel_date_format'));
$row = FIRSTUSEDEXCELROW;
$wsnumber = 1;
$myxls =& $worksheet[$wsnumber];
foreach ($logs['logs'] as $log) {
if (isset($ldcache[$log->module][$log->action])) {
$ld = $ldcache[$log->module][$log->action];
} else {
$ld = $DB->get_record('log_display', array('module' => $log->module, 'action' => $log->action));
$ldcache[$log->module][$log->action] = $ld;
}
if ($ld && !empty($log->info)) {
// ugly hack to make sure fullname is shown correctly
if ($ld->mtable == 'user' and $ld->field == $DB->sql_concat('firstname', "' '", 'lastname')) {
$log->info = fullname($DB->get_record($ld->mtable, array('id' => $log->info)), true);
} else {
$log->info = $DB->get_field($ld->mtable, $ld->field, array('id' => $log->info));
}
}
// Filter log->info
$log->info = format_string($log->info);
$log->info = strip_tags(urldecode($log->info));
// Some XSS protection
if ($nroPages > 1) {
if ($row > EXCELROWS) {
$wsnumber++;
$myxls =& $worksheet[$wsnumber];
$row = FIRSTUSEDEXCELROW;
}
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$myxls->write_string($row, 0, format_string($courses[$log->course], true, array('context' => $coursecontext)));
$myxls->write_date($row, 1, $log->time);
$myxls->write_string($row, 2, $log->ip);
$fullname = fullname($log, has_capability('moodle/site:viewfullnames', $coursecontext));
$myxls->write_string($row, 3, $fullname);
$myxls->write_string($row, 4, $log->module . ' ' . $log->action);
$myxls->write_string($row, 5, $log->info);
$row++;
}
$workbook->close();
return true;
}
示例2: get_activity_start_date
function get_activity_start_date($course, $user, $modname, $modaction, $modid)
{
$date = 0;
$group = 0;
$groupid = 0;
$limitfrom = '';
$limitnum = '';
$start_date = null;
$logs = build_logs_array($course, $user, $date, $order = "l.time ASC", $limitfrom, $limitnum, $modname, $modid, $modaction, $groupid);
$log = $logs['logs'];
if (count($log) > 0) {
// var_dump($log);
$log = array_shift($log);
$date_string = $log->time;
$start_date = new DateTime("@" . $date_string);
// print_r($start_date);
}
return $start_date;
}
示例3: error
// Group to display
if ($hostid == $CFG->mnet_localhost_id) {
if (!($course = get_record('course', 'id', $id))) {
echo ERROR;
error('That\'s an invalid course id' . $id);
}
$context = get_context_instance(CONTEXT_COURSE, $course->id);
} else {
$course_stub = array_pop(get_records_select('mnet_log', " hostid='{$hostid}' AND course='{$id}' ", '', '*', '', '1'));
$course->id = $id;
$course->shortname = $course_stub->coursename;
$course->fullname = $course_stub->coursename;
$context = get_context_instance(CONTEXT_COURSE, $course->id);
}
require_capability('moodle/site:viewreports', $context);
if (!($logs = build_logs_array($course, $user, $date, 'l.time DESC', 0, '', $modname, $modid, $modaction, $group))) {
exit;
}
$courses = array();
if ($course->id == SITEID) {
$courses[0] = '';
if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname')) {
foreach ($ccc as $cc) {
$courses[$cc->id] = $cc->shortname;
}
}
} else {
$courses[$courseid] = $course->shortname;
}
$totalcount = $logs['totalcount'];
$count = 0;
示例4: get_activity_start_date
public function get_activity_start_date($course, $user, $grade_item)
{
$date = 0;
$group = 0;
$groupid = 0;
$limitfrom = '';
$limitnum = '';
$start_date = null;
$modaction = "";
$modname = '';
$modid = $grade_item->iteminstance;
$user = $user->id;
if ($grade_item->itemtype == 'mod') {
$instances = get_fast_modinfo($this->course->id)->get_instances_of($grade_item->itemmodule);
$cm = $instances[$grade_item->iteminstance];
$modid = $cm->id;
}
$logs = build_logs_array($course, $user, $date, $order = "l.time ASC", $limitfrom, $limitnum, $modname, $modid, $modaction, $groupid);
$log = $logs['logs'];
// var_dump($logs);
if (count($log) > 0) {
$log = array_shift($log);
$date_string = $log->time;
$start_date = new DateTime("@" . $date_string);
// print_r($start_date);
}
return $start_date;
}
示例5: array
$navlinks = array();
$navlinks[] = array('name' => $strreports, 'link' => "{$CFG->wwwroot}/course/report.php?id={$course->id}", 'type' => 'misc');
$navlinks[] = array('name' => $strlogs, 'link' => "index.php?id={$course->id}", 'type' => 'misc');
$navigation = build_navigation($navlinks);
$printheader = print_header($course->shortname . ': ' . $strlogs, $course->fullname, $navigation, '', '', '', '', '', '', '', true);
// For moodle 1.8
/*print_header($course->shortname .': '. $strlogs, $course->fullname,
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"$CFG->wwwroot/course/report.php?id=$course->id\">$strreports</a> ->
<a href=\"index.php?id=$course->id\">$strlogs</a>",'','','','','','','', true);*/
$printheader = explode('</head>', $printheader);
$printheader[0] .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}/course/report/log_timeline/api_timeline/timeline-api.js\"></script>\n";
echo implode('</head>', $printheader);
print_heading_modified(format_string($course->fullname) . " : {$userinfo} : {$dateinfo} (" . usertimezone() . ")", "title_timeline");
print_mnet_log_selector_form($hostid, $course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
$logs = build_logs_array($course, $user, $date, '', 0, '', $modname, $modid, $modaction, $group);
if (!$logs) {
notify("No logs found!");
} else {
//Print the timeline
$getaxml = "getxml.php?id=" . $id . "&hostid=" . $hostid . "&user=" . $user . "&date=" . $date . "&modname=" . $modname . "&modid=" . $modid . "&modaction=" . $modaction . "&group=" . $group;
if ($height_timeline < 0) {
$height_timeline = 500;
}
echo '<div id="my-timeline" style="height: ' . $height_timeline . 'px; border: 1px solid #aaa"></div>';
?>
<script type="text/javascript">
<!--
var file_xml="";
file_xml="<?php