From 0bde63002a414d4e1029dfbae1f8741f2b48365e Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Tue, 29 Aug 2006 03:22:05 +0000 Subject: [PATCH] adding in capabilities --- mod/assignment/lib.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index da88634442..3cdf636ebc 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -83,7 +83,9 @@ class assignment_base { $this->pagetitle = strip_tags($this->course->shortname.': '.$this->strassignment.': '.format_string($this->assignment->name,true)); - if (!$this->cm->visible and !isteacher($this->course->id)) { + // visibility + $context = get_context_instance(CONTEXT_MODULE, $cmid); + if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) { $pagetitle = strip_tags($this->course->shortname.': '.$this->strassignment); print_header($pagetitle, $this->course->fullname, "$this->navigation $this->strassignment", "", "", true, '', navmenu($this->course, $this->cm)); @@ -1737,8 +1739,8 @@ function assignment_cron () { echo "Could not find course $submission->course\n"; continue; } - - if (! isstudent($course->id, $user->id) and !isteacher($course->id, $user->id)) { + + if (!has_capability('moodle/course:view', get_context_instance(CONTEXT_COURSE, $$submission->course))) { echo fullname($user)." not an active participant in $course->shortname\n"; continue; } @@ -2082,7 +2084,7 @@ function assignment_print_recent_mod_activity($activity, $course, $detail=false) } - if (isteacher($course)) { + if (has_capability('moodle/course:viewrecent', get_context_instance(CONTEXT_COURSE, $course))) { $grades = "(" . $activity->content->grade . " / " . $activity->content->maxgrade . ") "; $assignment->id = $activity->instance; @@ -2363,7 +2365,6 @@ function assignment_print_overview($courses, &$htmlarray) { $str .= '
'.$strduedateno.'
'; } - // if (isteacher($assignment->course)) { $context = get_context_instance(CONTEXT_MODULE,$this->cm->id); if (has_capability('mod/assignment:grade', $context)) { $submissions = count_records_sql("SELECT COUNT(*) -- 2.39.5