1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 09:23:09 +02:00

MDL-16046 - log page for portfolio transfers

This commit is contained in:
mjollnir_ 2008-09-12 15:34:20 +00:00
parent fae696850a
commit 8bde161135
3 changed files with 111 additions and 2 deletions

@ -17,6 +17,9 @@ $string['continuetoportfolio'] = 'Continue to your portfolio';
$string['commonsettingsdesc'] = '<p>Whether a transfer is considered to take a \'Moderate\' or \'High\' amount of time changes whether the user is able to wait for the transfer to complete or not.</p><p>Sizes up to the \'Moderate\' threshold just happen immediately without the user being asked, and \'Moderate\' and \'High\' transfers mean they are offered the option but warned it might take some time.</p><p>Additionally, some portfolio plugins might ignore this option completely and force all transfers to be queued.</p>';
$string['deleteportfolio'] = 'Delete portfolio instance';
$string['disabled'] = 'Sorry, but portfolio exports are not enabled in this site';
$string['displayarea'] = 'Export area';
$string['displayinfo'] = 'Export info';
$string['displayexpiry'] = 'Transfer expiry time';
$string['dontwait'] = 'Don\'t wait';
$string['err_uniquename'] = 'Portfolio name must be unique (per plugin)';
$string['enabled'] = 'Enable portfolios';
@ -58,6 +61,8 @@ $string['invalidexportproperty'] = 'Could not find that export config property (
$string['invaliduserproperty'] = 'Could not find that user config property ($a->property of $a->class)';
$string['invalidconfigproperty'] = 'Could not find that config property ($a->property of $a->class)';
$string['invalidbuttonproperty'] = 'Could not find that property ($a) of portfolio_button';
$string['logs'] = 'Transfer logs';
$string['logsummary'] = 'Previous successful transfers';
$string['manageportfolios'] = 'Manage portfolios';
$string['manageyourportfolios'] = 'Manage your portfolios';
$string['missingcallbackarg'] = 'Missing callback argument $a->arg for class $a->class';
@ -81,6 +86,7 @@ $string['portfolio'] = 'Portfolio';
$string['portfolios'] = 'Portfolios';
$string['plugin'] = 'Portfolio Plugin';
$string['plugincouldnotpackage'] = 'Failed to package up your data for export: original error was $a';
$string['queuesummary'] = 'Currently queued transfers';
$string['returntowhereyouwere'] = 'Return to where you were';
$string['save'] = 'Save';
$string['selectedformat'] = 'Selected export format';
@ -90,6 +96,8 @@ $string['someinstancesdisabled'] = 'Some configured plugin instances have been d
$string['somepluginsdisabled'] = 'Some entire plugins have been disabled because they are either misconfigured or rely on something else that is:';
$string['sure'] = 'Are you sure you want to delete \'$a\'? This cannot be undone.';
$string['thirdpartyexception'] = 'A third party exception was thrown during portfolio export ($a). Caught and rethrown but this should really be fixed';
$string['transfertime'] = 'Transfer time';
$string['unknownplugin'] = 'Unknown (may have since been removed by an administrator)';
$string['wanttowait_moderate'] = 'Do you want to wait for this transfer? It might take a few minutes';
$string['wanttowait_high'] = 'It is not recommended that you wait for this transfer to complete, but you can if you\'re sure and know what you\'re doing';
$string['wait'] = 'Wait';

96
user/portfoliologs.php Normal file

@ -0,0 +1,96 @@
<?php
require_once(dirname(dirname(__FILE__)) . '/config.php');
if (empty($CFG->enableportfolios)) {
print_error('disabled', 'portfolio');
}
require_once($CFG->libdir . '/portfoliolib.php');
$course = optional_param('course', SITEID, PARAM_INT);
if (! $course = $DB->get_record("course", array("id"=>$course))) {
print_error('invalidcourseid');
}
$user = $USER;
$fullname = fullname($user);
$strportfolios = get_string('portfolios', 'portfolio');
require_login($course, false);
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 10, PARAM_INT);
$navlinks[] = array('name' => $fullname, 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id, 'type' => 'misc');
$navlinks[] = array('name' => $strportfolios, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->fullname: $fullname: $strportfolios", $course->fullname,
$navigation, "", "", true, "&nbsp;", navmenu($course));
$currenttab = 'portfolios';
$showroles = 1;
include('tabs.php');
$queued = $DB->get_records('portfolio_tempdata', array('userid' => $USER->id), '', 'id, expirytime');
if (count($queued) > 0) {
$table = new stdClass;
$table->head = array(
get_string('displayarea', 'portfolio'),
get_string('plugin', 'portfolio'),
get_string('displayinfo', 'portfolio'),
get_string('displayexpiry', 'portfolio'),
);
$table->data = array();
foreach ($queued as $q){
$e = portfolio_exporter::rewaken_object($q->id);
$e->verify_rewaken(true);
$table->data[] = array(
$e->get('caller')->display_name(),
$e->get('instance')->get('name'),
$e->get('caller')->heading_summary(),
userdate($q->expirytime),
);
unset($e); // this could potentially be quite big, so free it.
}
print_heading(get_string('queuesummary', 'portfolio'));
print_table($table);
}
$logcount = $DB->count_records('portfolio_log', array('userid' => $USER->id));
if ($logcount > 0) {
$table = new StdClass;
$table->head = array(
get_string('plugin', 'portfolio'),
get_string('displayarea', 'portfolio'),
get_string('transfertime', 'portfolio'),
);
$logs = $DB->get_records('portfolio_log', array('userid' => $USER->id), 'time DESC', '*', ($page * $perpage), $perpage);
foreach ($logs as $log) {
require_once($CFG->dirroot . $log->caller_file);
$class = $log->caller_class;
$pluginname = '';
try {
$plugin = portfolio_instance($log->portfolio);
$pluginname = $plugin->get('name');
} catch (portfolio_exception $e) { // may have been deleted
$pluginname = get_string('unknownplugin', 'portfolio');
}
$table->data[] = array(
$pluginname,
call_user_func(array($class, 'display_name')),
userdate($log->time),
);
}
print_heading(get_string('logsummary', 'portfolio'));
print_paging_bar($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?');
print_table($table);
print_paging_bar($logcount, $page, $perpage, $CFG->wwwroot . '/user/portfoliologs.php?');
}
print_footer();
?>

@ -245,14 +245,19 @@
require_once($CFG->libdir . '/portfoliolib.php');
if (portfolio_instances(true, false)) {
$toprow[] = new tabobject('portfolios', $CFG->wwwroot .'/user/portfolio.php', get_string('portfolios', 'portfolio'));
$inactive = array('portfolios');
$activetwo = array('portfolios');
$secondrow[] = new tabobject('configure', $CFG->wwwroot . '/user/portfolio.php', get_string('configure', 'portfolio'));
$secondrow[] = new tabobject('logs', $CFG->wwwroot . '/user/portfoliologs.php', get_string('logs', 'portfolio'));
}
}
// Repository Tab
if (!empty($user) and $user->id == $USER->id) {
if (!empty($user) and $user->id == $USER->id) {
require_once($CFG->dirroot . '/repository/lib.php');
$usercontext = get_context_instance(CONTEXT_USER,$user->id);
if (!empty($usercontext) && $usercontext->contextlevel == CONTEXT_USER) {
$editabletypes = repository_get_editable_types();
if (!empty($usercontext) && $usercontext->contextlevel == CONTEXT_USER && !empty($editabletypes)) {
$toprow[] = new tabobject('repositories', $CFG->wwwroot .'/repository/manage_instances.php?contextid='.$usercontext->id, get_string('repositories', 'repository'));
}