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


PHP api::template_viewed方法代码示例

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


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

示例1: test_template_viewed

 /**
  * Test the template viewed event.
  *
  */
 public function test_template_viewed()
 {
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
     $template = $lpg->create_template();
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     api::template_viewed($template);
     // Get our event event.
     $events = $sink->get_events();
     $event = reset($events);
     // Check that the event data is valid.
     $this->assertInstanceOf('\\core\\event\\competency_template_viewed', $event);
     $this->assertEquals($template->get_id(), $event->objectid);
     $this->assertEquals($template->get_contextid(), $event->contextid);
     $this->assertEventContextNotUsed($event);
     $this->assertDebuggingNotCalled();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:23,代码来源:event_test.php

示例2: template_viewed

 /**
  * Log the template viewed event.
  *
  * @param int $id the template id
  * @return array of warnings and status result
  * @throws moodle_exception
  */
 public static function template_viewed($id)
 {
     $params = self::validate_parameters(self::view_book_parameters(), array('id' => $id));
     $template = api::read_template($params['id']);
     self::validate_context($template->get_context());
     return api::template_viewed($params['id']);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:external.php

示例3: required_param

/**
 * This page lets users to manage template competencies.
 *
 * @package    tool_lp
 * @copyright  2015 Mark Nelson <markn@moodle.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once __DIR__ . '/../../../config.php';
require_once $CFG->libdir . '/adminlib.php';
$templateid = required_param('templateid', PARAM_INT);
$pagecontextid = required_param('pagecontextid', PARAM_INT);
// Reference to the context we came from.
require_login(0, false);
\core_competency\api::require_enabled();
$pagecontext = context::instance_by_id($pagecontextid);
$template = \core_competency\api::read_template($templateid);
$context = $template->get_context();
if (!$template->can_read()) {
    throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
}
// Trigger a template viewed event.
\core_competency\api::template_viewed($template);
// Set up the page.
$url = new moodle_url('/admin/tool/lp/templatecompetencies.php', array('templateid' => $template->get_id(), 'pagecontextid' => $pagecontextid));
list($title, $subtitle) = \tool_lp\page_helper::setup_for_template($pagecontextid, $url, $template);
// Display the page.
$output = $PAGE->get_renderer('tool_lp');
echo $output->header();
$page = new \tool_lp\output\template_competencies_page($template, $pagecontext);
echo $output->render($page);
echo $output->footer();
开发者ID:gabrielrosset,项目名称:moodle,代码行数:31,代码来源:templatecompetencies.php


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