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


PHP api::list_user_competencies_to_review方法代碼示例

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


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

示例1: __construct

 /**
  * Constructor.
  * @param stdClass $user The user.
  */
 public function __construct($user = null)
 {
     global $USER;
     if (!$user) {
         $user = $USER;
     }
     $this->user = $user;
     // Get the plans.
     $this->plans = api::list_user_plans($this->user->id);
     // Get the competencies to review.
     $this->compstoreview = api::list_user_competencies_to_review(0, 3);
     // Get the plans to review.
     $this->planstoreview = api::list_plans_to_review(0, 3);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:18,代碼來源:summary.php

示例2: test_list_user_competencies_to_review

 public function test_list_user_competencies_to_review()
 {
     $dg = $this->getDataGenerator();
     $this->resetAfterTest();
     $ccg = $dg->get_plugin_generator('core_competency');
     $sysctx = context_system::instance();
     $this->setAdminUser();
     $reviewer = $dg->create_user();
     $roleallow = $dg->create_role();
     $roleprohibit = $dg->create_role();
     assign_capability('moodle/competency:usercompetencyreview', CAP_ALLOW, $roleallow, $sysctx->id);
     assign_capability('moodle/competency:usercompetencyreview', CAP_PROHIBIT, $roleprohibit, $sysctx->id);
     role_assign($roleallow, $reviewer->id, $sysctx->id);
     accesslib_clear_all_caches_for_unit_testing();
     $u1 = $dg->create_user();
     $u2 = $dg->create_user();
     $f1 = $ccg->create_framework();
     $c1 = $ccg->create_competency(['competencyframeworkid' => $f1->get_id()]);
     $c2 = $ccg->create_competency(['competencyframeworkid' => $f1->get_id()]);
     $c3 = $ccg->create_competency(['competencyframeworkid' => $f1->get_id()]);
     $uc1a = $ccg->create_user_competency(['userid' => $u1->id, 'competencyid' => $c1->get_id(), 'status' => user_competency::STATUS_IDLE]);
     $uc1b = $ccg->create_user_competency(['userid' => $u1->id, 'competencyid' => $c2->get_id(), 'status' => user_competency::STATUS_WAITING_FOR_REVIEW]);
     $uc1c = $ccg->create_user_competency(['userid' => $u1->id, 'competencyid' => $c3->get_id(), 'status' => user_competency::STATUS_IN_REVIEW, 'reviewerid' => $reviewer->id]);
     $uc2a = $ccg->create_user_competency(['userid' => $u2->id, 'competencyid' => $c1->get_id(), 'status' => user_competency::STATUS_WAITING_FOR_REVIEW]);
     $uc2b = $ccg->create_user_competency(['userid' => $u2->id, 'competencyid' => $c2->get_id(), 'status' => user_competency::STATUS_IDLE]);
     $uc2c = $ccg->create_user_competency(['userid' => $u2->id, 'competencyid' => $c3->get_id(), 'status' => user_competency::STATUS_IN_REVIEW]);
     // The reviewer can review all plans waiting for review, or in review where they are the reviewer.
     $this->setUser($reviewer);
     $result = api::list_user_competencies_to_review();
     $this->assertEquals(3, $result['count']);
     $this->assertEquals($uc2a->get_id(), $result['competencies'][0]->usercompetency->get_id());
     $this->assertEquals($uc1b->get_id(), $result['competencies'][1]->usercompetency->get_id());
     $this->assertEquals($uc1c->get_id(), $result['competencies'][2]->usercompetency->get_id());
     // The reviewer cannot view the plans when they do not have the permission in the user's context.
     role_assign($roleprohibit, $reviewer->id, context_user::instance($u2->id)->id);
     accesslib_clear_all_caches_for_unit_testing();
     $result = api::list_user_competencies_to_review();
     $this->assertEquals(2, $result['count']);
     $this->assertEquals($uc1b->get_id(), $result['competencies'][0]->usercompetency->get_id());
     $this->assertEquals($uc1c->get_id(), $result['competencies'][1]->usercompetency->get_id());
 }
開發者ID:dg711,項目名稱:moodle,代碼行數:41,代碼來源:api_test.php

示例3: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->compstoreview = api::list_user_competencies_to_review(0, 1000);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:7,代碼來源:competencies_to_review_page.php


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