当前位置: 首页>>代码示例>>PHP>>正文


PHP context::get_parent_contexts方法代码示例

本文整理汇总了PHP中context::get_parent_contexts方法的典型用法代码示例。如果您正苦于以下问题:PHP context::get_parent_contexts方法的具体用法?PHP context::get_parent_contexts怎么用?PHP context::get_parent_contexts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在context的用法示例。


在下文中一共展示了context::get_parent_contexts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * 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;
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:27,代码来源:course_competencies_page.php

示例2: __construct

 /**
  * Constructor
  * @param context the current context.
  */
 public function __construct(context $thiscontext)
 {
     $this->allcontexts = array_values($thiscontext->get_parent_contexts(true));
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:8,代码来源:questionlib.php


注:本文中的context::get_parent_contexts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。