当前位置: 首页>>代码示例>>PHP>>正文


PHP api::get_user_competency_in_course方法代码示例

本文整理汇总了PHP中core_competency\api::get_user_competency_in_course方法的典型用法代码示例。如果您正苦于以下问题:PHP api::get_user_competency_in_course方法的具体用法?PHP api::get_user_competency_in_course怎么用?PHP api::get_user_competency_in_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_competency\api的用法示例。


在下文中一共展示了api::get_user_competency_in_course方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export_for_template

 /**
  * Export the data.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     global $DB;
     $usercompetencycourse = api::get_user_competency_in_course($this->courseid, $this->userid, $this->competencyid);
     $competency = $usercompetencycourse->get_competency();
     if (empty($usercompetencycourse) || empty($competency)) {
         throw new \invalid_parameter_exception('Invalid params. The competency does not belong to the course.');
     }
     $relatedcompetencies = api::list_related_competencies($competency->get_id());
     $user = $DB->get_record('user', array('id' => $this->userid));
     $evidence = api::list_evidence_in_course($this->userid, $this->courseid, $this->competencyid);
     $course = $DB->get_record('course', array('id' => $this->courseid));
     $params = array('competency' => $competency, 'usercompetencycourse' => $usercompetencycourse, 'evidence' => $evidence, 'user' => $user, 'course' => $course, 'scale' => $competency->get_scale(), 'relatedcompetencies' => $relatedcompetencies);
     $exporter = new user_competency_summary_in_course_exporter(null, $params);
     $data = $exporter->export($output);
     return $data;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:23,代码来源:user_competency_summary_in_course.php

示例2: test_get_user_competency_in_course

 /**
  * Get a user competency in a course.
  */
 public function test_get_user_competency_in_course()
 {
     $this->resetAfterTest(true);
     $dg = $this->getDataGenerator();
     $lpg = $dg->get_plugin_generator('core_competency');
     $this->setAdminUser();
     $user = $dg->create_user();
     $c1 = $dg->create_course();
     // Enrol the user so they can be rated in the course.
     $studentarch = get_archetype_roles('student');
     $studentrole = array_shift($studentarch);
     $coursecontext = context_course::instance($c1->id);
     $dg->role_assign($studentrole->id, $user->id, $coursecontext->id);
     $dg->enrol_user($user->id, $c1->id, $studentrole->id);
     $framework = $lpg->create_framework();
     $comp1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
     $comp2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
     $lpg->create_course_competency(array('competencyid' => $comp1->get_id(), 'courseid' => $c1->id));
     $lpg->create_course_competency(array('competencyid' => $comp2->get_id(), 'courseid' => $c1->id));
     // Create a user competency for comp1.
     api::grade_competency_in_course($c1, $user->id, $comp1->get_id(), 3, 'Unit test');
     // Test for competency already exist in user_competency.
     $uc = api::get_user_competency_in_course($c1->id, $user->id, $comp1->get_id());
     $this->assertEquals($comp1->get_id(), $uc->get_competencyid());
     $this->assertEquals($user->id, $uc->get_userid());
     $this->assertEquals(3, $uc->get_grade());
     $this->assertEquals(true, $uc->get_proficiency());
     // Test for competency does not exist in user_competency.
     $uc2 = api::get_user_competency_in_course($c1->id, $user->id, $comp2->get_id());
     $this->assertEquals($comp2->get_id(), $uc2->get_competencyid());
     $this->assertEquals($user->id, $uc2->get_userid());
     $this->assertEquals(null, $uc2->get_grade());
     $this->assertEquals(null, $uc2->get_proficiency());
 }
开发者ID:dg711,项目名称:moodle,代码行数:37,代码来源:api_test.php

示例3: user_competency_viewed_in_course

 /**
  * Log user competency viewed in course event.
  *
  * @param int $competencyid The competency ID.
  * @param int $userid The user ID.
  * @param int $courseid The course ID.
  * @return boolean
  */
 public static function user_competency_viewed_in_course($competencyid, $userid, $courseid)
 {
     $params = self::validate_parameters(self::user_competency_viewed_in_course_parameters(), array('competencyid' => $competencyid, 'userid' => $userid, 'courseid' => $courseid));
     $ucc = api::get_user_competency_in_course($params['courseid'], $params['userid'], $params['competencyid']);
     $result = api::user_competency_viewed_in_course($ucc);
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:external.php

示例4: array

    $user = $DB->get_record('user', array('id' => $userid));
}
$competency = new \core_competency\competency($competencyid);
// Does a permissions check for us.
if ($userid > 0) {
    $usercompetencycourses = \core_competency\api::list_user_competencies_in_course($courseid, $userid);
}
$subtitle = $competency->get_shortname() . ' <em>' . $competency->get_idnumber() . '</em>';
list($title, $subtitle) = \tool_lp\page_helper::setup_for_course($url, $course, $subtitle);
$output = $PAGE->get_renderer('tool_lp');
if ($userid > 0) {
    $userheading = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext);
}
echo $output->header();
if ($userid > 0) {
    echo $OUTPUT->context_header($userheading, 3);
}
$baseurl = new moodle_url('/admin/tool/lp/user_competency_in_course.php');
$nav = new \tool_lp\output\user_competency_course_navigation($userid, $competencyid, $courseid, $baseurl);
echo $output->render($nav);
if ($userid > 0) {
    $page = new \tool_lp\output\user_competency_summary_in_course($userid, $competencyid, $courseid);
    echo $output->render($page);
    // Trigger the viewed event.
    $uc = \core_competency\api::get_user_competency_in_course($courseid, $userid, $competencyid);
    \core_competency\api::user_competency_viewed_in_course($uc, $courseid);
} else {
    echo $output->container('', 'clearfix');
    echo $output->notify_problem(get_string('noparticipants', 'tool_lp'));
}
echo $output->footer();
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:user_competency_in_course.php


注:本文中的core_competency\api::get_user_competency_in_course方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。