Skip to content

Commit

Permalink
MDL-41286 report_outline: updated report to use logging api
Browse files Browse the repository at this point in the history
AMOS START
 MOV [neverseen, mod_folder],[neverseen, report_outline]
 MOV [neverseen, mod_page],[neverseen, report_outline]
 MOV [neverseen, mod_resource],[neverseen, report_outline]
 MOV [neverseen, mod_url],[neverseen, report_outline]
AMOS END
  • Loading branch information
mdjnelson committed Apr 16, 2014
1 parent 63eb19c commit 7027974
Show file tree
Hide file tree
Showing 19 changed files with 530 additions and 383 deletions.
41 changes: 0 additions & 41 deletions mod/book/lib.php
Expand Up @@ -112,47 +112,6 @@ function book_delete_instance($id) {
return true;
}

/**
* Return use outline
*
* @param stdClass $course
* @param stdClass $user
* @param stdClass $mod
* @param object $book
* @return object|null
*/
function book_user_outline($course, $user, $mod, $book) {
global $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'book',
'action'=>'view', 'info'=>$book->id), 'time ASC')) {

$numviews = count($logs);
$lastlog = array_pop($logs);

$result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;

return $result;
}
return null;
}

/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
*
* @param stdClass $course
* @param stdClass $user
* @param stdClass $mod
* @param stdClass $book
* @return bool
*/
function book_user_complete($course, $user, $mod, $book) {
return true;
}

/**
* Given a course and a time, this module should find recent activity
* that has occurred in book activities and print it out.
Expand Down
33 changes: 0 additions & 33 deletions mod/chat/lib.php
Expand Up @@ -203,39 +203,6 @@ function chat_delete_instance($id) {
return $result;
}

/**
* Return a small object with summary information about what a
* user has done with a given particular instance of this module
* Used for user activity reports.
* <code>
* $return->time = the time they did it
* $return->info = a short text description
* </code>
*
* @param object $course
* @param object $user
* @param object $mod
* @param object $chat
* @return void
*/
function chat_user_outline($course, $user, $mod, $chat) {
return NULL;
}

/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
*
* @param object $course
* @param object $user
* @param object $mod
* @param object $chat
* @return bool
*/
function chat_user_complete($course, $user, $mod, $chat) {
return true;
}

/**
* Given a course and a date, prints a summary of all chat rooms past and present
* This function is called from block_recent_activity
Expand Down
1 change: 0 additions & 1 deletion mod/folder/lang/en/folder.php
Expand Up @@ -39,7 +39,6 @@
* To provide a shared uploading space for teachers on the course page (keeping the folder hidden so that only teachers can see it)';
$string['modulename_link'] = 'mod/folder/view';
$string['modulenameplural'] = 'Folders';
$string['neverseen'] = 'Never seen';
$string['page-mod-folder-x'] = 'Any folder module page';
$string['page-mod-folder-view'] = 'Folder module main page';
$string['pluginadministration'] = 'Folder administration';
Expand Down
51 changes: 0 additions & 51 deletions mod/folder/lib.php
Expand Up @@ -168,57 +168,6 @@ function folder_delete_instance($id) {
return true;
}

/**
* Return use outline
* @param object $course
* @param object $user
* @param object $mod
* @param object $folder
* @return object|null
*/
function folder_user_outline($course, $user, $mod, $folder) {
global $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'folder',
'action'=>'view', 'info'=>$folder->id), 'time ASC')) {

$numviews = count($logs);
$lastlog = array_pop($logs);

$result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;

return $result;
}
return NULL;
}

/**
* Return use complete
* @param object $course
* @param object $user
* @param object $mod
* @param object $folder
*/
function folder_user_complete($course, $user, $mod, $folder) {
global $CFG, $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'folder',
'action'=>'view', 'info'=>$folder->id), 'time ASC')) {
$numviews = count($logs);
$lastlog = array_pop($logs);

$strmostrecently = get_string('mostrecently');
$strnumviews = get_string('numviews', '', $numviews);

echo "$strnumviews - $strmostrecently ".userdate($lastlog->time);

} else {
print_string('neverseen', 'folder');
}
}

/**
* Lists all browsable file areas
*
Expand Down
51 changes: 0 additions & 51 deletions mod/imscp/lib.php
Expand Up @@ -219,57 +219,6 @@ function imscp_delete_instance($id) {
return true;
}

/**
* Return use outline
* @param object $course
* @param object $user
* @param object $mod
* @param object $imscp
* @return object|null
*/
function imscp_user_outline($course, $user, $mod, $imscp) {
global $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'imscp',
'action'=>'view', 'info'=>$imscp->id), 'time ASC')) {

$numviews = count($logs);
$lastlog = array_pop($logs);

$result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;

return $result;
}
return NULL;
}

/**
* Return use complete
* @param object $course
* @param object $user
* @param object $mod
* @param object $imscp
*/
function imscp_user_complete($course, $user, $mod, $imscp) {
global $CFG, $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'imscp',
'action'=>'view', 'info'=>$imscp->id), 'time ASC')) {
$numviews = count($logs);
$lastlog = array_pop($logs);

$strmostrecently = get_string('mostrecently');
$strnumviews = get_string('numviews', '', $numviews);

echo "$strnumviews - $strmostrecently ".userdate($lastlog->time);

} else {
print_string('neverseen', 'imscp');
}
}

/**
* Lists all browsable file areas
*
Expand Down
1 change: 0 additions & 1 deletion mod/page/lang/en/page.php
Expand Up @@ -46,7 +46,6 @@
* To embed several videos or sound files together with some explanatory text';
$string['modulename_link'] = 'mod/page/view';
$string['modulenameplural'] = 'Pages';
$string['neverseen'] = 'Never seen';
$string['optionsheader'] = 'Display options';
$string['page-mod-page-x'] = 'Any page module page';
$string['page:addinstance'] = 'Add a new page resource';
Expand Down
51 changes: 0 additions & 51 deletions mod/page/lib.php
Expand Up @@ -191,57 +191,6 @@ function page_delete_instance($id) {
return true;
}

/**
* Return use outline
* @param object $course
* @param object $user
* @param object $mod
* @param object $page
* @return object|null
*/
function page_user_outline($course, $user, $mod, $page) {
global $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'page',
'action'=>'view', 'info'=>$page->id), 'time ASC')) {

$numviews = count($logs);
$lastlog = array_pop($logs);

$result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;

return $result;
}
return NULL;
}

/**
* Return use complete
* @param object $course
* @param object $user
* @param object $mod
* @param object $page
*/
function page_user_complete($course, $user, $mod, $page) {
global $CFG, $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'page',
'action'=>'view', 'info'=>$page->id), 'time ASC')) {
$numviews = count($logs);
$lastlog = array_pop($logs);

$strmostrecently = get_string('mostrecently');
$strnumviews = get_string('numviews', '', $numviews);

echo "$strnumviews - $strmostrecently ".userdate($lastlog->time);

} else {
print_string('neverseen', 'page');
}
}

/**
* Given a course_module object, this function returns any
* "extra" information that may be needed when printing
Expand Down
1 change: 0 additions & 1 deletion mod/resource/lang/en/resource.php
Expand Up @@ -75,7 +75,6 @@
* To provide draft files of certain software programs (eg Photoshop .psd) so students can edit and submit them for assessment';
$string['modulename_link'] = 'mod/resource/view';
$string['modulenameplural'] = 'Files';
$string['neverseen'] = 'Never seen';
$string['notmigrated'] = 'This legacy resource type ({$a}) was not yet migrated, sorry.';
$string['optionsheader'] = 'Display options';
$string['page-mod-resource-x'] = 'Any file module page';
Expand Down
51 changes: 0 additions & 51 deletions mod/resource/lib.php
Expand Up @@ -177,57 +177,6 @@ function resource_delete_instance($id) {
return true;
}

/**
* Return use outline
* @param object $course
* @param object $user
* @param object $mod
* @param object $resource
* @return object|null
*/
function resource_user_outline($course, $user, $mod, $resource) {
global $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'resource',
'action'=>'view', 'info'=>$resource->id), 'time ASC')) {

$numviews = count($logs);
$lastlog = array_pop($logs);

$result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;

return $result;
}
return NULL;
}

/**
* Return use complete
* @param object $course
* @param object $user
* @param object $mod
* @param object $resource
*/
function resource_user_complete($course, $user, $mod, $resource) {
global $CFG, $DB;

if ($logs = $DB->get_records('log', array('userid'=>$user->id, 'module'=>'resource',
'action'=>'view', 'info'=>$resource->id), 'time ASC')) {
$numviews = count($logs);
$lastlog = array_pop($logs);

$strmostrecently = get_string('mostrecently');
$strnumviews = get_string('numviews', '', $numviews);

echo "$strnumviews - $strmostrecently ".userdate($lastlog->time);

} else {
print_string('neverseen', 'resource');
}
}

/**
* Given a course_module object, this function returns any
* "extra" information that may be needed when printing
Expand Down
4 changes: 4 additions & 0 deletions mod/upgrade.txt
Expand Up @@ -8,6 +8,10 @@ information provided here is intended especially for developers.
$plugin instead. The support for the legacy notation will be dropped in Moodle 2.10.
* xxx_get_view_actions() and xxx_get_post_actions() will be ignored by new logging system for
participation report. view_action and post_action will be detected by event's crud and edulevel.
* The functions xxx_user_outline() and xxx_user_complete() have been removed from the majority of core modules (see MDL-41286),
except for those that require unique functionality. These functions are used by the outline report, but now if they no longer
exist, the default behaviour is chosen, which supports the legacy and standard log storages introduced in 2.7 (see MDL-41266).
It is highly recommended you remove these functions from your module if they are simply performing the default behaviour.

=== 2.6 ===

Expand Down
1 change: 0 additions & 1 deletion mod/url/lang/en/url.php
Expand Up @@ -54,7 +54,6 @@
Note that URLs can also be added to any other resource or activity type through the text editor.';
$string['modulename_link'] = 'mod/url/view';
$string['modulenameplural'] = 'URLs';
$string['neverseen'] = 'Never seen';
$string['page-mod-url-x'] = 'Any URL module page';
$string['parameterinfo'] = '&amp;parameter=variable';
$string['parametersheader'] = 'URL variables';
Expand Down

0 comments on commit 7027974

Please sign in to comment.