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


PHP api::user_competency_viewed方法代码示例

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


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

示例1: array

}
\core_competency\api::require_enabled();
$uc = \core_competency\api::get_user_competency_by_id($id);
$params = array('id' => $id);
$url = new moodle_url('/admin/tool/lp/user_competency.php', $params);
$user = core_user::get_user($uc->get_userid());
if (!$user || !core_user::is_real_user($user->id)) {
    throw new moodle_exception('invaliduser', 'error');
}
$iscurrentuser = $USER->id == $user->id;
$competency = $uc->get_competency();
$compexporter = new \core_competency\external\competency_exporter($competency, array('context' => $competency->get_context()));
$PAGE->set_pagelayout('standard');
$PAGE->set_url($url);
$PAGE->navigation->override_active_url(new moodle_url('/admin/tool/lp/plans.php', array('userid' => $uc->get_userid())));
$PAGE->set_context($uc->get_context());
if (!$iscurrentuser) {
    $PAGE->navigation->extend_for_user($user);
    $PAGE->navigation->set_userid_for_parent_checks($user->id);
}
$output = $PAGE->get_renderer('tool_lp');
$compdata = $compexporter->export($output);
$PAGE->navbar->add($compdata->shortname, $url);
$PAGE->set_title($compdata->shortname);
$PAGE->set_heading($compdata->shortname);
echo $output->header();
$page = new \tool_lp\output\user_competency_summary($uc);
echo $output->render($page);
// Trigger viewed event.
\core_competency\api::user_competency_viewed($uc);
echo $output->footer();
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:user_competency.php

示例2: user_competency_viewed

 /**
  * Log user competency viewed event.
  *
  * @param int $usercompetencyid The user competency ID.
  * @return boolean
  */
 public static function user_competency_viewed($usercompetencyid)
 {
     $params = self::validate_parameters(self::user_competency_viewed_parameters(), array('usercompetencyid' => $usercompetencyid));
     $uc = api::get_user_competency_by_id($params['usercompetencyid']);
     $result = api::user_competency_viewed($uc);
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:external.php

示例3: test_user_competency_viewed

 /**
  * Test the user competency viewed event.
  *
  */
 public function test_user_competency_viewed()
 {
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $dg = $this->getDataGenerator();
     $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
     $user = $dg->create_user();
     $fr = $lpg->create_framework();
     $c = $lpg->create_competency(array('competencyframeworkid' => $fr->get_id()));
     $uc = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c->get_id()));
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     api::user_competency_viewed($uc);
     // Get our event event.
     $events = $sink->get_events();
     $event = reset($events);
     // Check that the event data is valid.
     $this->assertInstanceOf('\\core\\event\\competency_user_competency_viewed', $event);
     $this->assertEquals($uc->get_id(), $event->objectid);
     $this->assertEquals($uc->get_context()->id, $event->contextid);
     $this->assertEquals($uc->get_userid(), $event->relateduserid);
     $this->assertEquals($c->get_id(), $event->other['competencyid']);
     $this->assertEventContextNotUsed($event);
     $this->assertDebuggingNotCalled();
     // Test validation.
     $params = array('objectid' => $uc->get_id(), 'contextid' => $uc->get_context()->id);
     // Missing competencyid.
     try {
         \core\event\competency_user_competency_viewed::create($params)->trigger();
         $this->fail('The \'competencyid\' value must be set.');
     } catch (coding_exception $e) {
         $this->assertRegExp("/The 'competencyid' value must be set./", $e->getMessage());
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:38,代码来源:event_test.php


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