]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11379 and MDL-11380 fixed
authornicolasconnault <nicolasconnault>
Fri, 21 Sep 2007 07:52:52 +0000 (07:52 +0000)
committernicolasconnault <nicolasconnault>
Fri, 21 Sep 2007 07:52:52 +0000 (07:52 +0000)
admin/roles/assign.php
course/user.php
notes/index.php
user/tabs.php

index 8088733a069597644c6a1bcc68a9e5843459afc6..f428bdbed278ddd04a095f8e86c733a3dee0607a 100755 (executable)
         /// course header
         $navlinks = array();
         if ($courseid != SITEID) {
-            $navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'course');
             $navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'misc');
             $navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid", 'type' => 'misc');
             $navlinks[] = array('name' => $straction, 'link' => null, 'type' => 'misc');
 
             $selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR email $LIKE '%$searchtext%') ";
             $select  .= $selectsql;
-        } else { 
-            $selectsql = ""; 
+        } else {
+            $selectsql = "";
         }
 
         if ($context->contextlevel > CONTEXT_COURSE) { // mod or block (or group?)
              * 3) get_recordset_sql() is more efficient                             *
              *                                                                      *
              ************************************************************************/
-        
+
             if ($possibleroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context)) {
-  
+
                 $doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM));
 
                 $validroleids = array();
 
                 if ($validroleids) {
                     $roleids =  '('.implode(',', $validroleids).')';
-            
+
                     $select = " SELECT u.id, u.firstname, u.lastname, u.email";
                     $countselect = "SELECT COUNT(u.id)";
                     $from   = " FROM {$CFG->prefix}user u
                                     FROM {$CFG->prefix}role_assignments r,
                                     {$CFG->prefix}user u
                                     WHERE r.contextid = $contextid
-                                    AND u.id = r.userid 
+                                    AND u.id = r.userid
                                     AND r.roleid = $roleid
                                     $selectsql)";
-            
-                    $availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);         
+
+                    $availableusers = get_recordset_sql($select . $from . $where . $selectsql . $excsql);
                 }
-                
+
                 $usercount =  count_records_sql($countselect . $from . $where) - count($contextusers);
             }
 
-        } else { 
-         
+        } else {
+
             /************************************************************************
              *                                                                      *
              * context level is above or equal course context level                 *
              * in this case we pull out all users matching search criteria (if any) *
              *                                                                      *
              ************************************************************************/
-            
+
             /// MDL-11111 do not include user already assigned this role in this context as available users
             /// so that the number of available users is right and we save time looping later
             $availableusers = get_recordset_sql('SELECT id, firstname, lastname, email
                                                     FROM '.$CFG->prefix.'role_assignments r,
                                                     '.$CFG->prefix.'user u
                                                     WHERE r.contextid = '.$contextid.'
-                                                    AND u.id = r.userid 
+                                                    AND u.id = r.userid
                                                     AND r.roleid = '.$roleid.'
                                                     '.$selectsql.')
                                                 ORDER BY lastname ASC, firstname ASC');
             $usercount = count_records_select('user', $select) - count($contextusers);
-   
+
         }
 
         echo '<div style="text-align:center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
index 4c270b1dc82d3527b28069d8a714daa48b07e2f6..63d9432f7a966ae18c5ed1baef334280cd951b25 100644 (file)
@@ -43,6 +43,8 @@
     $fullname          = fullname($user, true);
 
     $navlinks = array();
+    $navlinks[] = array('name' => $course->shortname, 'link' => "course/view.php?id=$course->id", 'type' => 'misc');
+
     if ($course->id != SITEID) {
         $navlinks[] = array('name' => $strparticipants, 'link' => "../user/index.php?id=$course->id", 'type' => 'misc');
     }
index d20f4a72e847ab54bebb9de0111b28b44232f221..e563e94c998c8a1d838b87f7c00fa98a40c26d14 100644 (file)
@@ -2,7 +2,7 @@
 
     /**
      * file index.php
-     * index page to view notes. 
+     * index page to view notes.
      * if a course id is specified then the entries from that course are shown
      * if a user id is specified only notes related to that user are shown
      */
@@ -59,6 +59,7 @@
 
     print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav));
 
+    $showroles = 1;
     $currenttab = 'notes';
     require_once($CFG->dirroot .'/user/tabs.php');
 
@@ -96,7 +97,7 @@
                 note_print_notes($header, $addid, $view, $c->id, $userid, NOTES_STATE_PUBLIC, 0);
             }
         }
-    }    
+    }
 
     print_box_end();
 
index 814a6fff55f7cb7e03147d37bb47309b86c573fe..4990e582975f10d23feecf855741aef8159cac33 100644 (file)
@@ -32,7 +32,7 @@
 
         $site = get_site();
         print_heading(format_string($site->fullname));
-        
+
         if ($CFG->bloglevel >= 4) {
             if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
                 $toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.SITEID,
@@ -54,7 +54,7 @@
 
         $toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.$filterselect,
             get_string('participants'));
-        
+
         if ($CFG->bloglevel >= 3) {
             $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=course&amp;filterselect='.$filterselect, get_string('blogs','blog'));
         }
@@ -76,7 +76,7 @@
             $toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect,
                 get_string('participants'));
 
-        
+
             $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=group&amp;filterselect='.$filterselect, get_string('blogs','blog'));
         }
 
         }
 
     /// Everyone can see posts for this user
-    
+
     /// add logic to see course read posts permission
         if (has_capability('moodle/user:readuserposts', $personalcontext) || has_capability('mod/forum:viewdiscussion', get_context_instance(CONTEXT_COURSE, $course->id))) {
             $toprow[] = new tabobject('forumposts', $CFG->wwwroot.'/mod/forum/user.php?id='.$user->id.'&amp;course='.$course->id,
         }
 
     /// Current user must be teacher of the course or the course allows user to view their reports
-    
+
     //print_object($course);
     //print_object($user);
-    
+
         // add in logic to check course read report
         if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext) || ($course->showreports and $USER->id == $user->id) || has_capability('moodle/user:viewuseractivitiesreport', $coursecontext)) {
 
                     $secondrow[] = new tabobject('stats',$CFG->wwwroot.'/course/user.php?id='.$course->id.
                                                  '&amp;user='.$user->id.'&amp;mode=stats',get_string('stats'));
                 }
-                
+
                 if ($course->showgrades) {
                     $secondrow[] = new tabobject('grade', $CFG->wwwroot.'/course/user.php?id='.$course->id.
                                           '&amp;user='.$user->id.'&amp;mode=grade', get_string('grade'));
                 }
-                                
+
             }
 
         }
 
     /// this needs permission checkings
 
-    
+
     if (!empty($showroles) and !empty($user)) { // this variable controls whether this roles is showed, or not, so only user/view page should set this flag
         $usercontext = get_context_instance(CONTEXT_USER, $user->id);
         if (has_capability('moodle/role:assign',$usercontext)) {
             $toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$usercontext->id.'&amp;userid='.$user->id.'&amp;courseid='.$course->id
                                   ,get_string('roles'));
-                                  
+
             if (in_array($currenttab, array('assign', 'override'))) {
                 $inactive = array('roles');
                 $activetwo = array('roles');
-    
+
                 $secondrow = array();
                 $secondrow[] = new tabobject('assign', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$usercontext->id.'&amp;userid='.$user->id.'&amp;courseid='.$course->id
                                   ,get_string('assignroles', 'role'));
                 $secondrow[] = new tabobject('override', $CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$usercontext->id.'&amp;userid='.$user->id.'&amp;courseid='.$course->id
                                   ,get_string('overrideroles', 'role'));
-                                    
+
             }
-        }                                                                                                       
+        }
     }
 /// Add second row to display if there is one