MDL-10110 Adding validation for multichoice option single and multianswer
[moodle.git] / user / portfoliologs.php
CommitLineData
8bde1611 1<?php
2
3require_once(dirname(dirname(__FILE__)) . '/config.php');
4
5if (empty($CFG->enableportfolios)) {
6 print_error('disabled', 'portfolio');
7}
8
9require_once($CFG->libdir . '/portfoliolib.php');
10
11$course = optional_param('course', SITEID, PARAM_INT);
12if (! $course = $DB->get_record("course", array("id"=>$course))) {
13 print_error('invalidcourseid');
14}
15
16$user = $USER;
17$fullname = fullname($user);
18$strportfolios = get_string('portfolios', 'portfolio');
19
20require_login($course, false);
21
22$page = optional_param('page', 0, PARAM_INT);
23$perpage = optional_param('perpage', 10, PARAM_INT);
24
caa8363f 25$PAGE->set_title("$course->fullname: $fullname: $strportfolios");
26$PAGE->set_heading($course->fullname);
8bde1611 27
caa8363f 28echo $OUTPUT->header();
8bde1611 29
55de6e07 30$currenttab = 'portfoliologs';
8bde1611 31$showroles = 1;
32include('tabs.php');
33
34$queued = $DB->get_records('portfolio_tempdata', array('userid' => $USER->id), '', 'id, expirytime');
35if (count($queued) > 0) {
f2f085ee 36 $table = new html_table();
8bde1611 37 $table->head = array(
38 get_string('displayarea', 'portfolio'),
39 get_string('plugin', 'portfolio'),
40 get_string('displayinfo', 'portfolio'),
41 get_string('displayexpiry', 'portfolio'),
42 );
43 $table->data = array();
44 foreach ($queued as $q){
45 $e = portfolio_exporter::rewaken_object($q->id);
46 $e->verify_rewaken(true);
47 $table->data[] = array(
48 $e->get('caller')->display_name(),
49 $e->get('instance')->get('name'),
50 $e->get('caller')->heading_summary(),
51 userdate($q->expirytime),
52 );
53 unset($e); // this could potentially be quite big, so free it.
54 }
f24ca3ce 55 echo $OUTPUT->heading(get_string('queuesummary', 'portfolio'));
f2f085ee 56 echo $OUTPUT->table($table);
8bde1611 57}
58$logcount = $DB->count_records('portfolio_log', array('userid' => $USER->id));
59if ($logcount > 0) {
f2f085ee 60 $table = new html_table();
8bde1611 61 $table->head = array(
62 get_string('plugin', 'portfolio'),
63 get_string('displayarea', 'portfolio'),
64 get_string('transfertime', 'portfolio'),
65 );
66 $logs = $DB->get_records('portfolio_log', array('userid' => $USER->id), 'time DESC', '*', ($page * $perpage), $perpage);
67 foreach ($logs as $log) {
68 require_once($CFG->dirroot . $log->caller_file);
69 $class = $log->caller_class;
70 $pluginname = '';
71 try {
72 $plugin = portfolio_instance($log->portfolio);
73 $pluginname = $plugin->get('name');
74 } catch (portfolio_exception $e) { // may have been deleted
75 $pluginname = get_string('unknownplugin', 'portfolio');
76 }
77
78 $table->data[] = array(
79 $pluginname,
80 call_user_func(array($class, 'display_name')),
81 userdate($log->time),
82 );
83 }
f24ca3ce 84 echo $OUTPUT->heading(get_string('logsummary', 'portfolio'));
da9ac19f 85 $pagingbar = moodle_paging_bar::make($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?');
ecd035a4 86 echo $OUTPUT->paging_bar($pagingbar);
f2f085ee 87 echo $OUTPUT->table($table);
ecd035a4 88 echo $OUTPUT->paging_bar($pagingbar);
8bde1611 89
90}
91
f24ca3ce 92echo $OUTPUT->footer();
8bde1611 93
94?>