本文整理汇总了PHP中core_competency\api::get_plan_competency方法的典型用法代码示例。如果您正苦于以下问题:PHP api::get_plan_competency方法的具体用法?PHP api::get_plan_competency怎么用?PHP api::get_plan_competency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_competency\api
的用法示例。
在下文中一共展示了api::get_plan_competency方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export_for_template
/**
* Export the data.
*
* @param renderer_base $output
* @return stdClass
*/
public function export_for_template(\renderer_base $output)
{
global $DB;
$plan = api::read_plan($this->planid);
$pc = api::get_plan_competency($plan, $this->competencyid);
$competency = $pc->competency;
$usercompetency = $pc->usercompetency;
$usercompetencyplan = $pc->usercompetencyplan;
if (empty($competency)) {
throw new \invalid_parameter_exception('Invalid params. The competency does not belong to the plan.');
}
$relatedcompetencies = api::list_related_competencies($competency->get_id());
$userid = $plan->get_userid();
$user = $DB->get_record('user', array('id' => $userid));
$evidence = api::list_evidence($userid, $this->competencyid, $plan->get_id());
$params = array('competency' => $competency, 'usercompetency' => $usercompetency, 'usercompetencyplan' => $usercompetencyplan, 'evidence' => $evidence, 'user' => $user, 'plan' => $plan, 'relatedcompetencies' => $relatedcompetencies);
$exporter = new user_competency_summary_in_plan_exporter(null, $params);
$data = $exporter->export($output);
return $data;
}
示例2: user_competency_plan_viewed
/**
* Log user competency plan viewed event.
*
* @param int $competencyid The competency ID.
* @param int $userid The user ID.
* @param int $planid The plan ID.
* @return boolean
*/
public static function user_competency_plan_viewed($competencyid, $userid, $planid)
{
$params = self::validate_parameters(self::user_competency_viewed_in_plan_parameters(), array('competencyid' => $competencyid, 'userid' => $userid, 'planid' => $planid));
$pl = api::get_plan_competency($params['planid'], $params['competencyid']);
$result = api::user_competency_plan_viewed($pl->usercompetencyplan);
return $result;
}
示例3: require_login
require_login(null, false);
if (isguestuser()) {
throw new require_login_exception('Guests are not allowed here.');
}
\core_competency\api::require_enabled();
$params = array('userid' => $userid, 'competencyid' => $competencyid);
$params['planid'] = $planid;
$plan = \core_competency\api::read_plan($planid);
$url = new moodle_url('/admin/tool/lp/user_competency_in_plan.php', $params);
$competency = new \core_competency\competency($competencyid);
$framework = $competency->get_framework();
list($title, $subtitle) = \tool_lp\page_helper::setup_for_plan($userid, $url, $plan);
$output = $PAGE->get_renderer('tool_lp');
echo $output->header();
echo $output->heading($title);
// User competency plan navigation.
$baseurl = new moodle_url('/admin/tool/lp/user_competency_in_plan.php');
$nav = new \tool_lp\output\competency_plan_navigation($userid, $competencyid, $planid, $baseurl);
echo $output->render($nav);
$page = new \tool_lp\output\user_competency_summary_in_plan($competencyid, $planid);
echo $output->render($page);
// Trigger the viewed event.
$pc = \core_competency\api::get_plan_competency($plan, $competency->get_id());
if ($plan->get_status() == \core_competency\plan::STATUS_COMPLETE) {
$usercompetencyplan = $pc->usercompetencyplan;
\core_competency\api::user_competency_plan_viewed($usercompetencyplan);
} else {
$usercompetency = $pc->usercompetency;
\core_competency\api::user_competency_viewed_in_plan($usercompetency, $plan->get_id());
}
echo $output->footer();