本文整理汇总了PHP中core_competency\api::list_courses_using_competency方法的典型用法代码示例。如果您正苦于以下问题:PHP api::list_courses_using_competency方法的具体用法?PHP api::list_courses_using_competency怎么用?PHP api::list_courses_using_competency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_competency\api
的用法示例。
在下文中一共展示了api::list_courses_using_competency方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct this renderable.
*
* @param \core_competency\competency $competency Competency persistent.
* @param \core_competency\competency_framework $framework framework persistent.
* @param boolean $includerelated Include or not related competencies.
* @param boolean $includecourses Include or not competency courses.
*/
public function __construct($competency, $framework, $includerelated, $includecourses)
{
$this->competency = $competency;
$this->framework = $framework;
if ($includerelated) {
$this->relatedcompetencies = api::list_related_competencies($competency->get_id());
}
if ($includecourses) {
$this->courses = api::list_courses_using_competency($competency->get_id());
}
}
示例2: list_courses_using_competency
/**
* Count the courses (visible to this user) that use this competency.
*
* @param int $competencyid Competency id.
* @return array
*/
public static function list_courses_using_competency($competencyid)
{
global $PAGE;
$params = self::validate_parameters(self::list_courses_using_competency_parameters(), array('id' => $competencyid));
$competency = api::read_competency($params['id']);
self::validate_context($competency->get_context());
$output = $PAGE->get_renderer('tool_lp');
$results = array();
$courses = api::list_courses_using_competency($params['id']);
foreach ($courses as $course) {
$context = context_course::instance($course->id);
$exporter = new course_summary_exporter($course, array('context' => $context));
$result = $exporter->export($output);
array_push($results, $result);
}
return $results;
}
示例3: export_for_template
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return stdClass
*/
public function export_for_template(renderer_base $output)
{
$data = new stdClass();
$data->template = (new template_exporter($this->template))->export($output);
$data->pagecontextid = $this->pagecontext->id;
$data->competencies = array();
$contextcache = array();
$frameworkcache = array();
foreach ($this->competencies as $competency) {
if (!isset($contextcache[$competency->get_competencyframeworkid()])) {
$contextcache[$competency->get_competencyframeworkid()] = $competency->get_context();
}
$context = $contextcache[$competency->get_competencyframeworkid()];
if (!isset($frameworkcache[$competency->get_competencyframeworkid()])) {
$frameworkcache[$competency->get_competencyframeworkid()] = $competency->get_framework();
}
$framework = $frameworkcache[$competency->get_competencyframeworkid()];
$courses = api::list_courses_using_competency($competency->get_id());
$relatedcompetencies = api::list_related_competencies($competency->get_id());
$related = array('competency' => $competency, 'linkedcourses' => $courses, 'context' => $context, 'relatedcompetencies' => $relatedcompetencies, 'framework' => $framework);
$exporter = new competency_summary_exporter(null, $related);
$record = $exporter->export($output);
array_push($data->competencies, $record);
}
$data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(false);
$data->canmanagecompetencyframeworks = $this->canmanagecompetencyframeworks;
$data->canmanagetemplatecompetencies = $this->canmanagetemplatecompetencies;
$data->manageurl = $this->manageurl->out(true);
$exporter = new template_statistics_exporter($this->templatestatistics);
$data->statistics = $exporter->export($output);
$data->showcompetencylinks = true;
return $data;
}