8bde1611 |
1 | <?php |
2 | |
3 | require_once(dirname(dirname(__FILE__)) . '/config.php'); |
4 | |
5 | if (empty($CFG->enableportfolios)) { |
6 | print_error('disabled', 'portfolio'); |
7 | } |
8 | |
9 | require_once($CFG->libdir . '/portfoliolib.php'); |
10 | |
11 | $course = optional_param('course', SITEID, PARAM_INT); |
12 | if (! $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 | |
20 | require_login($course, false); |
21 | |
22 | $page = optional_param('page', 0, PARAM_INT); |
23 | $perpage = optional_param('perpage', 10, PARAM_INT); |
24 | |
25 | $navlinks[] = array('name' => $fullname, 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id, 'type' => 'misc'); |
26 | $navlinks[] = array('name' => $strportfolios, 'link' => null, 'type' => 'misc'); |
27 | |
28 | $navigation = build_navigation($navlinks); |
29 | |
30 | print_header("$course->fullname: $fullname: $strportfolios", $course->fullname, |
31 | $navigation, "", "", true, " ", navmenu($course)); |
32 | |
33 | $currenttab = 'portfolios'; |
34 | $showroles = 1; |
35 | include('tabs.php'); |
36 | |
37 | $queued = $DB->get_records('portfolio_tempdata', array('userid' => $USER->id), '', 'id, expirytime'); |
38 | if (count($queued) > 0) { |
39 | $table = new stdClass; |
40 | $table->head = array( |
41 | get_string('displayarea', 'portfolio'), |
42 | get_string('plugin', 'portfolio'), |
43 | get_string('displayinfo', 'portfolio'), |
44 | get_string('displayexpiry', 'portfolio'), |
45 | ); |
46 | $table->data = array(); |
47 | foreach ($queued as $q){ |
48 | $e = portfolio_exporter::rewaken_object($q->id); |
49 | $e->verify_rewaken(true); |
50 | $table->data[] = array( |
51 | $e->get('caller')->display_name(), |
52 | $e->get('instance')->get('name'), |
53 | $e->get('caller')->heading_summary(), |
54 | userdate($q->expirytime), |
55 | ); |
56 | unset($e); // this could potentially be quite big, so free it. |
57 | } |
58 | print_heading(get_string('queuesummary', 'portfolio')); |
59 | print_table($table); |
60 | } |
61 | $logcount = $DB->count_records('portfolio_log', array('userid' => $USER->id)); |
62 | if ($logcount > 0) { |
63 | $table = new StdClass; |
64 | $table->head = array( |
65 | get_string('plugin', 'portfolio'), |
66 | get_string('displayarea', 'portfolio'), |
67 | get_string('transfertime', 'portfolio'), |
68 | ); |
69 | $logs = $DB->get_records('portfolio_log', array('userid' => $USER->id), 'time DESC', '*', ($page * $perpage), $perpage); |
70 | foreach ($logs as $log) { |
71 | require_once($CFG->dirroot . $log->caller_file); |
72 | $class = $log->caller_class; |
73 | $pluginname = ''; |
74 | try { |
75 | $plugin = portfolio_instance($log->portfolio); |
76 | $pluginname = $plugin->get('name'); |
77 | } catch (portfolio_exception $e) { // may have been deleted |
78 | $pluginname = get_string('unknownplugin', 'portfolio'); |
79 | } |
80 | |
81 | $table->data[] = array( |
82 | $pluginname, |
83 | call_user_func(array($class, 'display_name')), |
84 | userdate($log->time), |
85 | ); |
86 | } |
87 | print_heading(get_string('logsummary', 'portfolio')); |
88 | print_paging_bar($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?'); |
89 | print_table($table); |
90 | print_paging_bar($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?'); |
91 | |
92 | } |
93 | |
94 | print_footer(); |
95 | |
96 | ?> |