本文整理汇总了PHP中core_competency\api::update_framework方法的典型用法代码示例。如果您正苦于以下问题:PHP api::update_framework方法的具体用法?PHP api::update_framework怎么用?PHP api::update_framework使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_competency\api
的用法示例。
在下文中一共展示了api::update_framework方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_competency_framework_updated
/**
* Test the competency framework updated event.
*
*/
public function test_competency_framework_updated()
{
$this->resetAfterTest(true);
$this->setAdminUser();
$lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
$framework = $lpg->create_framework();
// Trigger and capture the event.
$sink = $this->redirectEvents();
$framework->set_shortname('Shortname modified');
api::update_framework($framework->to_record());
// Get our event event.
$events = $sink->get_events();
$event = reset($events);
// Check that the event data is valid.
$this->assertInstanceOf('\\core\\event\\competency_framework_updated', $event);
$this->assertEquals($framework->get_id(), $event->objectid);
$this->assertEquals($framework->get_contextid(), $event->contextid);
$this->assertEventContextNotUsed($event);
$this->assertDebuggingNotCalled();
}
示例2: update_competency_framework
/**
* Update an existing competency framework
*
* @param array $competencyframework An array with all the fields for a competency framework.
* @return boolean
*/
public static function update_competency_framework($competencyframework)
{
$params = self::validate_parameters(self::update_competency_framework_parameters(), array('competencyframework' => $competencyframework));
$params = $params['competencyframework'];
$framework = api::read_framework($params['id']);
self::validate_context($framework->get_context());
$params = (object) $params;
return api::update_framework($params);
}
示例3: require_login
// We check that we have the permission to edit this framework, in its own context.
require_login();
\core_competency\api::require_enabled();
require_capability('moodle/competency:competencymanage', $context);
// Set up the framework page.
list($pagetitle, $pagesubtitle, $url, $frameworksurl) = tool_lp\page_helper::setup_for_framework($id, $pagecontextid, $framework, $returntype);
$output = $PAGE->get_renderer('tool_lp');
$form = new \tool_lp\form\competency_framework($url->out(false), array('context' => $context, 'persistent' => $framework));
if ($form->is_cancelled()) {
redirect($frameworksurl);
} else {
if ($data = $form->get_data()) {
if (empty($data->id)) {
// Create new framework.
$data->contextid = $context->id;
$framework = \core_competency\api::create_framework($data);
$frameworkmanageurl = new moodle_url('/admin/tool/lp/competencies.php', array('pagecontextid' => $pagecontextid, 'competencyframeworkid' => $framework->get_id()));
$messagesuccess = get_string('competencyframeworkcreated', 'tool_lp');
redirect($frameworkmanageurl, $messagesuccess, 0, \core\output\notification::NOTIFY_SUCCESS);
} else {
\core_competency\api::update_framework($data);
$messagesuccess = get_string('competencyframeworkupdated', 'tool_lp');
redirect($frameworksurl, $messagesuccess, 0, \core\output\notification::NOTIFY_SUCCESS);
}
}
}
echo $output->header();
echo $output->heading($pagetitle, 2);
echo $output->heading($pagesubtitle, 3);
$form->display();
echo $output->footer();