8bde1611 |
1 | <?php |
2 | |
ce221eb5 |
3 | // This file is part of Moodle - http://moodle.org/ |
4 | // |
5 | // Moodle is free software: you can redistribute it and/or modify |
6 | // it under the terms of the GNU General Public License as published by |
7 | // the Free Software Foundation, either version 3 of the License, or |
8 | // (at your option) any later version. |
9 | // |
10 | // Moodle is distributed in the hope that it will be useful, |
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | // GNU General Public License for more details. |
14 | // |
15 | // You should have received a copy of the GNU General Public License |
16 | // along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
17 | |
18 | /** |
19 | * This file is part of the User section Moodle |
20 | * |
21 | * @copyright 1999 Martin Dougiamas http://dougiamas.com |
22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
23 | * @package user |
24 | */ |
25 | |
8bde1611 |
26 | require_once(dirname(dirname(__FILE__)) . '/config.php'); |
27 | |
28 | if (empty($CFG->enableportfolios)) { |
29 | print_error('disabled', 'portfolio'); |
30 | } |
31 | |
32 | require_once($CFG->libdir . '/portfoliolib.php'); |
33 | |
34 | $course = optional_param('course', SITEID, PARAM_INT); |
ce221eb5 |
35 | |
36 | $url = new moodle_url($CFG->wwwroot.'/user/portfoliologs.php', array('course'=>$course)); |
37 | |
8bde1611 |
38 | if (! $course = $DB->get_record("course", array("id"=>$course))) { |
39 | print_error('invalidcourseid'); |
40 | } |
41 | |
42 | $user = $USER; |
43 | $fullname = fullname($user); |
44 | $strportfolios = get_string('portfolios', 'portfolio'); |
45 | |
46 | require_login($course, false); |
47 | |
48 | $page = optional_param('page', 0, PARAM_INT); |
49 | $perpage = optional_param('perpage', 10, PARAM_INT); |
50 | |
ce221eb5 |
51 | if ($page !== 0) { |
52 | $url->param('page', $page); |
53 | } |
54 | if ($perpage !== 0) { |
55 | $url->param('perpage', $perpage); |
56 | } |
57 | $PAGE->set_url($url); |
58 | |
caa8363f |
59 | $PAGE->set_title("$course->fullname: $fullname: $strportfolios"); |
60 | $PAGE->set_heading($course->fullname); |
8bde1611 |
61 | |
caa8363f |
62 | echo $OUTPUT->header(); |
8bde1611 |
63 | |
55de6e07 |
64 | $currenttab = 'portfoliologs'; |
8bde1611 |
65 | $showroles = 1; |
66 | include('tabs.php'); |
67 | |
68 | $queued = $DB->get_records('portfolio_tempdata', array('userid' => $USER->id), '', 'id, expirytime'); |
69 | if (count($queued) > 0) { |
f2f085ee |
70 | $table = new html_table(); |
8bde1611 |
71 | $table->head = array( |
72 | get_string('displayarea', 'portfolio'), |
73 | get_string('plugin', 'portfolio'), |
74 | get_string('displayinfo', 'portfolio'), |
75 | get_string('displayexpiry', 'portfolio'), |
76 | ); |
77 | $table->data = array(); |
78 | foreach ($queued as $q){ |
79 | $e = portfolio_exporter::rewaken_object($q->id); |
80 | $e->verify_rewaken(true); |
81 | $table->data[] = array( |
82 | $e->get('caller')->display_name(), |
83 | $e->get('instance')->get('name'), |
84 | $e->get('caller')->heading_summary(), |
85 | userdate($q->expirytime), |
86 | ); |
87 | unset($e); // this could potentially be quite big, so free it. |
88 | } |
f24ca3ce |
89 | echo $OUTPUT->heading(get_string('queuesummary', 'portfolio')); |
f2f085ee |
90 | echo $OUTPUT->table($table); |
8bde1611 |
91 | } |
92 | $logcount = $DB->count_records('portfolio_log', array('userid' => $USER->id)); |
93 | if ($logcount > 0) { |
f2f085ee |
94 | $table = new html_table(); |
8bde1611 |
95 | $table->head = array( |
96 | get_string('plugin', 'portfolio'), |
97 | get_string('displayarea', 'portfolio'), |
98 | get_string('transfertime', 'portfolio'), |
99 | ); |
100 | $logs = $DB->get_records('portfolio_log', array('userid' => $USER->id), 'time DESC', '*', ($page * $perpage), $perpage); |
101 | foreach ($logs as $log) { |
102 | require_once($CFG->dirroot . $log->caller_file); |
103 | $class = $log->caller_class; |
104 | $pluginname = ''; |
105 | try { |
106 | $plugin = portfolio_instance($log->portfolio); |
107 | $pluginname = $plugin->get('name'); |
108 | } catch (portfolio_exception $e) { // may have been deleted |
109 | $pluginname = get_string('unknownplugin', 'portfolio'); |
110 | } |
111 | |
112 | $table->data[] = array( |
113 | $pluginname, |
114 | call_user_func(array($class, 'display_name')), |
115 | userdate($log->time), |
116 | ); |
117 | } |
f24ca3ce |
118 | echo $OUTPUT->heading(get_string('logsummary', 'portfolio')); |
da9ac19f |
119 | $pagingbar = moodle_paging_bar::make($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?'); |
ecd035a4 |
120 | echo $OUTPUT->paging_bar($pagingbar); |
f2f085ee |
121 | echo $OUTPUT->table($table); |
ecd035a4 |
122 | echo $OUTPUT->paging_bar($pagingbar); |
8bde1611 |
123 | |
124 | } |
125 | |
f24ca3ce |
126 | echo $OUTPUT->footer(); |
8bde1611 |
127 | |
aa6c1ced |
128 | |