MDL-11382 Put back 'Activity Reports' and 'Edit Profil' links in the administration...
authorjerome <jerome>
Thu, 24 Apr 2008 08:58:48 +0000 (08:58 +0000)
committerjerome <jerome>
Thu, 24 Apr 2008 08:58:48 +0000 (08:58 +0000)
blocks/admin/block_admin.php

index 76deb18eab6a0842488d4aac1556a02d60c7f8bd..ae157e12dad9471381987778bc595c6c565ff762 100644 (file)
@@ -214,28 +214,23 @@ class block_admin extends block_list {
         }
 
 
-    /// Should the following two be in this block?
-
-
-    /// View own activity report
-//        if ($course->showreports) {
-//            $this->content->items[]='<a href="user.php?id='.$this->instance->pageid.'&amp;user='.$USER->id.'">'.get_string('activityreport').'</a>';
-//            $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" alt="" />';
-//        }
-
+     /// View own activity report
+        $coursecontext   = get_context_instance(CONTEXT_COURSE, $course->id);
+        $personalcontext = get_context_instance(CONTEXT_USER, $USER->id);
+        if ($course->id !== SITEID 
+            && ($course->showreports 
+                || has_capability('moodle/user:viewuseractivitiesreport', $context) 
+                || has_capability('moodle/user:viewuseractivitiesreport', $coursecontext) 
+                || has_capability('moodle/user:viewuseractivitiesreport', $personalcontext))){ 
+         $this->content->items[]='<a href="'.$CFG->wwwroot.'/course/user.php?id='.$course->id.'&amp;user='.$USER->id.'&amp;mode=todaylogs'.'">'.get_string('activityreports').'</a>';
+         $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" alt="" />';
+        }
 
     /// Edit your own profile
-
-//        $fullname = fullname($USER, has_capability('moodle/site:viewfullnames', $context));
-//        $editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
-//        if (empty($USER->description)) {
-//                //Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
-//            $text = get_string('profile').' '.get_string('missingdescription');
-//            $this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
-//        } else {
-//            $this->content->items[]= $editmyprofile;
-//        }
-//        $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
+        if ($course->id !== SITEID && has_capability('moodle/user:editownprofile', $context)){ 
+         $this->content->items[]='<a href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.$course->id.'">'.get_string('editmyprofile').'</a>';
+         $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
+        }