本文整理汇总了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;
}
}
}
示例2: __construct
/**
* Constructor
* @param context the current context.
*/
public function __construct(context $thiscontext)
{
$this->allcontexts = array_values($thiscontext->get_parent_contexts(true));
}