Permalink
Browse files

MDL-32117 EQUELLA plugin: Added some TODO comments in callback.php an…

…d changed variable names to conform moodle coding style
  • Loading branch information...
1 parent 36f8060 commit da1f4aee95880b86676c5febe09af94c1c1f7181 @dcai dcai committed with danpoltawski May 25, 2012
Showing with 17 additions and 6 deletions.
  1. +11 −0 repository/equella/callback.php
  2. +6 −6 repository/equella/lib.php
@@ -32,6 +32,15 @@
$thumbnail = clean_param($info->thumbnail, PARAM_URL);
$filename = clean_param($info->name, PARAM_FILE);
+// TODO MDL-32117 EQUELLA callback should provide more information
+// $author = clean_param($info->author, PARAM_RAW);
+// $timecreated = clean_param($info->timecreated, PARAM_RAW);
+// $timemodified = clean_param($info->timemodified, PARAM_RAW);
+// NOTE: the license string must match the license names {@link license_manager::install_licenses()}
+// We could create a function to map the license names
+// $license = clean_param($info->license, PARAM_RAW);
+// $filesize = clean_param($info->filesize, PARAM_INT);
+
$js =<<<EOD
<html>
<head>
@@ -41,6 +50,8 @@
resource.title = "$filename";
resource.source = "$url";
resource.thumbnail = '$thumbnail';
+ // resource.author = "$author";
+ // resource.license = "$license";
parent.M.core_filepicker.select_file(resource);
}
</script>
@@ -259,22 +259,22 @@ function getssotoken($readwrite = 'read') {
global $USER, $COURSE;
if( $readwrite == 'write' ) {
- $context_sys = context_system::instance();
+ $systemcontext = context_system::instance();
if (!empty($COURSE->category)) {
- $context_cc = context_coursecat::instance($COURSE->category);
+ $categorycontext = context_coursecat::instance($COURSE->category);
}
- $context_c = context_course::instance($COURSE->id);
+ $coursecontext = context_course::instance($COURSE->id);
foreach( self::get_all_editing_roles() as $role) {
//does user have this role?
$hasroleassignment = false;
- if (user_has_role_assignment($USER->id, $role->id, $context_sys->id)) {
+ if (user_has_role_assignment($USER->id, $role->id, $systemcontext->id)) {
$hasroleassignment = true;
}
- if (!$hasroleassignment && !empty($context_cc) && user_has_role_assignment($USER->id, $role->id, $context_cc->id)) {
+ if (!$hasroleassignment && !empty($categorycontext) && user_has_role_assignment($USER->id, $role->id, $categorycontext->id)) {
$hasroleassignment = true;
}
- if (!$hasroleassignment && user_has_role_assignment($USER->id, $role->id, $context_c->id)) {
+ if (!$hasroleassignment && user_has_role_assignment($USER->id, $role->id, $coursecontext->id)) {
$hasroleassignment = true;
}
if ($hasroleassignment) {

0 comments on commit da1f4ae

Please sign in to comment.