예제 #1
0
 /**
  * Construct this renderable.
  * @param int $courseid The course record for this page.
  */
 public function __construct($courseid)
 {
     $this->context = context_course::instance($courseid);
     $this->courseid = $courseid;
     $this->coursecompetencylist = api::list_course_competencies($courseid);
     $this->canmanagecoursecompetencies = has_capability('moodle/competency:coursecompetencymanage', $this->context);
     $this->canconfigurecoursecompetencies = has_capability('moodle/competency:coursecompetencyconfigure', $this->context);
     $this->cangradecompetencies = has_capability('moodle/competency:competencygrade', $this->context);
     $this->coursecompetencysettings = api::read_course_competency_settings($courseid);
     $this->coursecompetencystatistics = new course_competency_statistics($courseid);
     // Check the lowest level in which the user can manage the competencies.
     $this->manageurl = null;
     $this->canmanagecompetencyframeworks = false;
     $contexts = array_reverse($this->context->get_parent_contexts(true));
     foreach ($contexts as $context) {
         $canmanage = has_capability('moodle/competency:competencymanage', $context);
         if ($canmanage) {
             $this->manageurl = new moodle_url('/admin/tool/lp/competencyframeworks.php', array('pagecontextid' => $context->id));
             $this->canmanagecompetencyframeworks = true;
             break;
         }
     }
 }
예제 #2
0
 /**
  * Constructor
  * @param context the current context.
  */
 public function __construct(context $thiscontext)
 {
     $this->allcontexts = array_values($thiscontext->get_parent_contexts(true));
 }