本文整理匯總了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));
}