/**
  * 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
0
파일: external.php 프로젝트: evltuma/moodle
 /**
  * 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
0
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();