MDL-29189 course Minor fixups after code review
authorSam Hemelryk <sam@moodle.com>
Mon, 12 Sep 2011 23:17:18 +0000 (11:17 +1200)
committerSam Hemelryk <sam@moodle.com>
Mon, 12 Sep 2011 23:17:18 +0000 (11:17 +1200)
enrol/authorize/locallib.php
lib/db/upgrade.php
mod/assignment/lib.php
mod/chat/gui_header_js/index.php
mod/chat/gui_sockets/index.php
mod/feedback/analysis_course.php
mod/feedback/mapcourse.php

index 6dc069e..058b1b0 100644 (file)
@@ -54,7 +54,7 @@ function authorize_print_orders($courseid, $userid) {
     $searchtype = optional_param('searchtype', 'orderid', PARAM_ALPHA);
     $status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
 
-    $coursecontext = get_context_instance(CONTEXT_USER, $USER->id);
+    $coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
 
     $searchmenu = array('orderid' => $authstrs->orderid, 'transid' => $authstrs->transid, 'cclastfour' => $authstrs->cclastfour);
     $buttons = "<form method='post' action='index.php' autocomplete='off'><div>";
@@ -63,7 +63,7 @@ function authorize_print_orders($courseid, $userid) {
     $buttons .= "<input type='submit' value='$strs->search' />";
     $buttons .= "</div></form>";
 
-    if (has_capability('enrol/authorize:uploadcsv', $coursecontext)) {
+    if (has_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id))) {
         $buttons .= "<form method='get' action='uploadcsv.php'><div><input type='submit' value='".get_string('uploadcsv', 'enrol_authorize')."' /></div></form>";
     }
 
index eaa12d3..85b4afb 100644 (file)
@@ -6698,7 +6698,7 @@ FROM
 
     if ($oldversion < 2011090800) {
         // Increase the length of the of the course shortname field as it is now going
-        // to be consistently filtered and 100 characters if practically useless for
+        // to be consistently filtered and 100 characters is practically useless for
         // things like the multilang filter.
 
         $table = new xmldb_table('course');
index 6f17416..8811370 100644 (file)
@@ -122,7 +122,7 @@ class assignment_base {
             print_error('invalidid', 'assignment');
         }
         $this->coursecontext = get_context_instance(CONTEXT_COURSE, $this->course->id);
-        $courseshortname = format_text($this->course->shortname, true, array('context' => $coursecontext));
+        $courseshortname = format_text($this->course->shortname, true, array('context' => $this->coursecontext));
 
         if ($assignment) {
             $this->assignment = $assignment;
index 5c298ba..43d0f0b 100644 (file)
@@ -67,7 +67,7 @@ $courseshortname = format_string($course->shortname, true, array('context' => ge
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>
-   <?php echo "$strchat: " . $courseshortname . ": ".format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
+   <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
   </title>
  </head>
  <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
index 40cc52e..4a5de8b 100644 (file)
@@ -60,7 +60,7 @@ $courseshortname = format_string($course->shortname, true, array('context' => ge
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>
-   <?php echo "$strchat: " . $courseshortname . ": ".format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
+   <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
   </title>
  </head>
  <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
index 1b500df..548d4c8 100644 (file)
@@ -128,7 +128,7 @@ if ($courseitemfilter > 0) {
         $sep_thous = get_string('separator_thousand', 'feedback');
 
         foreach ($courses as $c) {
-            $shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $c->course_id)));
+            $shortname = format_string($c->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $c->course_id)));
             echo '<tr><td>'.$shortname.'</td><td align="right">'.number_format(($c->avgvalue), 2, $sep_dec, $sep_thous).'</td></tr>';
         }
          echo '</table></td></tr>';
index 8495cf7..a0a24b0 100644 (file)
@@ -116,7 +116,7 @@ if($coursemap = feedback_get_courses_from_sitecourse_map($feedback->id)) {
     $unmapurl = new moodle_url('/mod/feedback/unmapcourse.php');
     foreach ($coursemap as $cmap) {
         $cmapcontext = get_context_instance(CONTEXT_COURSE, $cmap->id);
-        $cmapshortname = format_string($cmap->shortname, true, array('context' => $coursecontext));
+        $cmapshortname = format_string($cmap->shortname, true, array('context' => $cmapcontext));
         $unmapurl->params(array('id'=>$id, 'cmapid'=>$cmap->id));
         $table->add_data(array('<a href="'.$unmapurl->out().'"><img src="'.$OUTPUT->pix_url('t/delete') . '" alt="Delete" /></a> ('.$cmapshortname.') '.$cmap->fullname));
     }