當前位置: 首頁>>代碼示例>>PHP>>正文


PHP api::update_competency方法代碼示例

本文整理匯總了PHP中core_competency\api::update_competency方法的典型用法代碼示例。如果您正苦於以下問題:PHP api::update_competency方法的具體用法?PHP api::update_competency怎麽用?PHP api::update_competency使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core_competency\api的用法示例。


在下文中一共展示了api::update_competency方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update_competency

 /**
  * Update an existing competency
  *
  * @param array $competency The array of competency fields (id is required).
  * @return boolean
  */
 public static function update_competency($competency)
 {
     $params = self::validate_parameters(self::update_competency_parameters(), array('competency' => $competency));
     $params = $params['competency'];
     $competency = api::read_competency($params['id']);
     self::validate_context($competency->get_context());
     $params = (object) $params;
     return api::update_competency($params);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:15,代碼來源:external.php

示例2: moodle_url

// Get page URL.
$urloptions = ['id' => $id, 'competencyframeworkid' => $competencyframework->get_id(), 'parentid' => $parentid, 'pagecontextid' => $pagecontextid];
$url = new moodle_url("/admin/tool/lp/editcompetency.php", $urloptions);
// Set up the page.
list($title, $subtitle, $returnurl) = \tool_lp\page_helper::setup_for_competency($pagecontextid, $url, $competencyframework, $competency, $parent);
// Set up the form.
$formoptions = ['competencyframework' => $competencyframework, 'parent' => $parent, 'persistent' => $competency, 'pagecontextid' => $pagecontextid];
$form = new \tool_lp\form\competency($url->out(false), $formoptions);
// Form cancelled.
if ($form->is_cancelled()) {
    redirect($returnurl);
}
// Get form data.
$data = $form->get_data();
if ($data) {
    if (empty($competency)) {
        \core_competency\api::create_competency($data);
        $returnmsg = get_string('competencycreated', 'tool_lp');
    } else {
        \core_competency\api::update_competency($data);
        $returnmsg = get_string('competencyupdated', 'tool_lp');
    }
    redirect($returnurl, $returnmsg, null, \core\output\notification::NOTIFY_SUCCESS);
}
// Render the page.
$output = $PAGE->get_renderer('tool_lp');
echo $output->header();
echo $output->heading($title);
echo $output->heading($subtitle, 3);
$form->display();
echo $output->footer();
開發者ID:evltuma,項目名稱:moodle,代碼行數:31,代碼來源:editcompetency.php

示例3: test_competency_updated

 /**
  * Test the competency updated event.
  *
  */
 public function test_competency_updated()
 {
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
     $f1 = $lpg->create_framework();
     $competency = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
     $c1 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
     $c2 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
     $c12 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id(), 'parentid' => $c1->get_id()));
     $c13 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id(), 'parentid' => $c1->get_id()));
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     $competency->set_shortname('Shortname modified');
     api::update_competency($competency->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_updated', $event);
     $this->assertEquals($competency->get_id(), $event->objectid);
     $this->assertEquals($competency->get_context()->id, $event->contextid);
     $this->assertEventContextNotUsed($event);
     $this->assertDebuggingNotCalled();
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:29,代碼來源:event_test.php


注:本文中的core_competency\api::update_competency方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。