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


PHP core_competency\api类代码示例

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


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

示例1: __construct

 /**
  * Return the custom definition of the properties of this model.
  *
  * @param int $courseid The course we want to generate statistics for.
  */
 public function __construct($courseid)
 {
     global $USER;
     $this->competencycount = api::count_competencies_in_course($courseid);
     $this->proficientcompetencycount = api::count_proficient_competencies_in_course_for_user($courseid, $USER->id);
     $this->leastproficientcompetencies = api::get_least_proficient_competencies_for_course($courseid, 0, 3);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:12,代码来源:course_competency_statistics.php

示例2: export_for_template

 /**
  * Export the data.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     $frameworks = array();
     $scales = array();
     $planexporter = new plan_exporter($this->plan, array('template' => $this->plan->get_template()));
     $data = new stdClass();
     $data->plan = $planexporter->export($output);
     $data->competencies = array();
     $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(false);
     $data->contextid = $this->plan->get_context()->id;
     if ($data->plan->iscompleted) {
         $ucproperty = 'usercompetencyplan';
         $ucexporter = 'core_competency\\external\\user_competency_plan_exporter';
     } else {
         $ucproperty = 'usercompetency';
         $ucexporter = 'core_competency\\external\\user_competency_exporter';
     }
     $pclist = api::list_plan_competencies($this->plan);
     $proficientcount = 0;
     foreach ($pclist as $pc) {
         $comp = $pc->competency;
         $usercomp = $pc->{$ucproperty};
         // Get the framework.
         if (!isset($frameworks[$comp->get_competencyframeworkid()])) {
             $frameworks[$comp->get_competencyframeworkid()] = $comp->get_framework();
         }
         $framework = $frameworks[$comp->get_competencyframeworkid()];
         // Get the scale.
         $scaleid = $comp->get_scaleid();
         if ($scaleid === null) {
             $scaleid = $framework->get_scaleid();
         }
         if (!isset($scales[$framework->get_scaleid()])) {
             $scales[$framework->get_scaleid()] = $framework->get_scale();
         }
         $scale = $scales[$framework->get_scaleid()];
         // Prepare the data.
         $record = new stdClass();
         $exporter = new competency_exporter($comp, array('context' => $framework->get_context()));
         $record->competency = $exporter->export($output);
         // Competency path.
         $exporter = new competency_path_exporter(['ancestors' => $comp->get_ancestors(), 'framework' => $framework, 'context' => $framework->get_context()]);
         $record->comppath = $exporter->export($output);
         $exporter = new $ucexporter($usercomp, array('scale' => $scale));
         $record->{$ucproperty} = $exporter->export($output);
         $data->competencies[] = $record;
         if ($usercomp->get_proficiency()) {
             $proficientcount++;
         }
     }
     $data->competencycount = count($data->competencies);
     $data->proficientcompetencycount = $proficientcount;
     if ($data->competencycount) {
         $data->proficientcompetencypercentage = (double) $proficientcount / (double) $data->competencycount * 100.0;
     } else {
         $data->proficientcompetencypercentage = 0.0;
     }
     $data->proficientcompetencypercentageformatted = format_float($data->proficientcompetencypercentage);
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:66,代码来源:plan_page.php

示例3: get_other_values

 protected function get_other_values(renderer_base $output)
 {
     // Arrays are copy on assign.
     $related = $this->related;
     $result = new stdClass();
     // Remove course from related as it is not wanted by the user_competency_summary_exporter.
     unset($related['course']);
     $related['usercompetencyplan'] = null;
     $related['usercompetency'] = null;
     $exporter = new user_competency_summary_exporter(null, $related);
     $result->usercompetencysummary = $exporter->export($output);
     $result->usercompetencysummary->cangrade = user_competency::can_grade_user_in_course($this->related['user']->id, $this->related['course']->id);
     $context = context_course::instance($this->related['course']->id);
     $exporter = new course_summary_exporter($this->related['course'], array('context' => $context));
     $result->course = $exporter->export($output);
     $coursemodules = api::list_course_modules_using_competency($this->related['competency']->get_id(), $this->related['course']->id);
     $fastmodinfo = get_fast_modinfo($this->related['course']->id);
     $exportedmodules = array();
     foreach ($coursemodules as $cm) {
         $cminfo = $fastmodinfo->cms[$cm];
         $cmexporter = new course_module_summary_exporter(null, array('cm' => $cminfo));
         $exportedmodules[] = $cmexporter->export($output);
     }
     $result->coursemodules = $exportedmodules;
     return (array) $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:26,代码来源:user_competency_summary_in_course_exporter.php

示例4: export_for_template

 /**
  * Export the data.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     $data = new stdClass();
     $data->userid = $this->userid;
     $data->competencyid = $this->competencyid;
     $data->planid = $this->planid;
     $data->baseurl = $this->baseurl;
     $plancompetencies = \core_competency\api::list_plan_competencies($data->planid);
     $data->competencies = array();
     $contextcache = array();
     foreach ($plancompetencies as $plancompetency) {
         $frameworkid = $plancompetency->competency->get_competencyframeworkid();
         if (!isset($contextcache[$frameworkid])) {
             $contextcache[$frameworkid] = $plancompetency->competency->get_context();
         }
         $context = $contextcache[$frameworkid];
         $exporter = new competency_exporter($plancompetency->competency, array('context' => $context));
         $competency = $exporter->export($output);
         if ($competency->id == $this->competencyid) {
             $competency->selected = true;
         }
         $data->competencies[] = $competency;
     }
     $data->hascompetencies = count($data->competencies);
     return $data;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:32,代码来源:competency_plan_navigation.php

示例5: __construct

 /**
  * Constructor
  *
  * @param string $elementName Element name
  * @param mixed $elementLabel Label(s) for an element
  * @param array $options Options to control the element's display
  * @param mixed $attributes Either a typical HTML attribute string or an associative array.
  */
 public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
 {
     global $OUTPUT;
     if ($elementName == null) {
         // This is broken quickforms messing with the constructors.
         return;
     }
     if (!isset($options['courseid'])) {
         throw new coding_exception('Course id is required for the course_competencies form element');
     }
     $courseid = $options['courseid'];
     if (!empty($options['cmid'])) {
         $current = \core_competency\api::list_course_module_competencies_in_course_module($options['cmid']);
         $ids = array();
         foreach ($current as $coursemodulecompetency) {
             array_push($ids, $coursemodulecompetency->get_competencyid());
         }
         $this->setValue($ids);
     }
     $competencies = api::list_course_competencies($courseid);
     $validoptions = array();
     $context = context_course::instance($courseid);
     foreach ($competencies as $competency) {
         // We don't need to show the description as part of the options, so just set this to null.
         $competency['competency']->set_description(null);
         $exporter = new competency_exporter($competency['competency'], array('context' => $context));
         $templatecontext = array('competency' => $exporter->export($OUTPUT));
         $id = $competency['competency']->get_id();
         $validoptions[$id] = $OUTPUT->render_from_template('tool_lp/competency_summary', $templatecontext);
     }
     $attributes['tags'] = false;
     $attributes['multiple'] = 'multiple';
     parent::__construct($elementName, $elementLabel, $validoptions, $attributes);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:42,代码来源:course_competencies_form_element.php

示例6: __construct

 /**
  * Construct this renderable.
  *
  * @param context $pagecontext The page context
  */
 public function __construct(context $pagecontext)
 {
     $this->pagecontext = $pagecontext;
     if (competency_framework::can_manage_context($this->pagecontext)) {
         $addpage = new single_button(new moodle_url('/admin/tool/lp/editcompetencyframework.php', array('pagecontextid' => $this->pagecontext->id)), get_string('addnewcompetencyframework', 'tool_lp'), 'get');
         $this->navigation[] = $addpage;
     }
     $this->competencyframeworks = api::list_frameworks('shortname', 'ASC', 0, 0, $this->pagecontext);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:14,代码来源:manage_competency_frameworks_page.php

示例7: __construct

 /**
  * Construct this renderable.
  * @param context $pagecontext
  */
 public function __construct(context $pagecontext)
 {
     $this->pagecontext = $pagecontext;
     if (template::can_manage_context($this->pagecontext)) {
         $addpage = new single_button(new moodle_url('/admin/tool/lp/edittemplate.php', array('pagecontextid' => $this->pagecontext->id)), get_string('addnewtemplate', 'tool_lp'), 'get');
         $this->navigation[] = $addpage;
     }
     $this->templates = api::list_templates('shortname', 'ASC', 0, 0, $this->pagecontext);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:13,代码来源:manage_templates_page.php

示例8: __construct

 /**
  * Construct this renderable.
  *
  * @param int $userid
  */
 public function __construct($userid)
 {
     $this->userid = $userid;
     $this->plans = api::list_user_plans($userid);
     $this->context = context_user::instance($userid);
     if (plan::can_manage_user($userid) || plan::can_manage_user_draft($userid)) {
         $addplan = new single_button(new moodle_url('/admin/tool/lp/editplan.php', array('userid' => $userid)), get_string('addnewplan', 'tool_lp'), 'get');
         $this->navigation[] = $addplan;
     }
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:15,代码来源:plans_page.php

示例9: __construct

 /**
  * Construct this renderable.
  *
  * @param int $userid
  */
 public function __construct($userid)
 {
     $this->userid = $userid;
     $this->context = context_user::instance($userid);
     $this->evidence = api::list_user_evidence($userid);
     $this->canmanage = user_evidence::can_manage_user($this->userid);
     if ($this->canmanage) {
         $addevidence = new single_button(new moodle_url('/admin/tool/lp/user_evidence_edit.php', array('userid' => $userid)), get_string('addnewuserevidence', 'tool_lp'), 'get');
         $this->navigation[] = $addevidence;
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:user_evidence_list_page.php

示例10: __construct

 /**
  * Construct this renderable.
  *
  * @param \core_competency\competency $competency Competency persistent.
  * @param \core_competency\competency_framework $framework framework persistent.
  * @param boolean $includerelated Include or not related competencies.
  * @param boolean $includecourses Include or not competency courses.
  */
 public function __construct($competency, $framework, $includerelated, $includecourses)
 {
     $this->competency = $competency;
     $this->framework = $framework;
     if ($includerelated) {
         $this->relatedcompetencies = api::list_related_competencies($competency->get_id());
     }
     if ($includecourses) {
         $this->courses = api::list_courses_using_competency($competency->get_id());
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:19,代码来源:competency_summary.php

示例11: __construct

 /**
  * Return the custom definition of the properties of this model.
  *
  * @param int $templateid The template we want to generate statistics for.
  */
 public function __construct($templateid)
 {
     $template = new template($templateid);
     $this->competencycount = api::count_competencies_in_template($template);
     $this->unlinkedcompetencycount = api::count_competencies_in_template_with_no_courses($template);
     $this->plancount = api::count_plans_for_template($template, 0);
     $this->completedplancount = api::count_plans_for_template($template, plan::STATUS_COMPLETE);
     $this->usercompetencyplancount = api::count_user_competency_plans_for_template($template);
     $this->proficientusercompetencyplancount = api::count_user_competency_plans_for_template($template, true);
     $this->leastproficientcompetencies = api::get_least_proficient_competencies_for_template($template, 0, 3);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:template_statistics.php

示例12: execute

 /**
  * Do the job.
  */
 public function execute()
 {
     if (!api::is_enabled()) {
         return;
     }
     $records = plan::get_recordset_for_due_and_incomplete();
     foreach ($records as $record) {
         $plan = new plan(0, $record);
         api::complete_plan($plan);
     }
     $records->close();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:complete_plans_task.php

示例13: export_for_template

 /**
  * Export the data.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     if (!isset($related['user'])) {
         $related['user'] = core_user::get_user($this->usercompetency->get_userid());
     }
     if (!isset($related['competency'])) {
         $related['competency'] = $this->usercompetency->get_competency();
     }
     $related += array('usercompetency' => $this->usercompetency, 'usercompetencyplan' => null, 'usercompetencycourse' => null, 'evidence' => api::list_evidence($this->usercompetency->get_userid(), $this->usercompetency->get_competencyid()), 'relatedcompetencies' => api::list_related_competencies($this->usercompetency->get_competencyid()));
     $exporter = new user_competency_summary_exporter(null, $related);
     $data = $exporter->export($output);
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:19,代码来源:user_competency_summary.php

示例14: __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

示例15: test_import_framework

 public function test_import_framework()
 {
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $importer = new framework_importer(file_get_contents(__DIR__ . '/fixtures/example.csv'));
     $this->assertEquals('', $importer->get_error());
     $framework = $importer->import();
     $this->assertEmpty('', $importer->get_error());
     $this->assertGreaterThan(0, $framework->get_id());
     $filters = ['competencyframeworkid' => $framework->get_id()];
     $count = api::count_competencies($filters);
     $this->assertEquals(64, $count);
     // We can't test the exporter because it sends force-download headers.
 }
开发者ID:janeklb,项目名称:moodle,代码行数:14,代码来源:import_test.php


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