• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP core_competency\api类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: execute

 /**
  * Do the job.
  */
 public function execute()
 {
     if (!api::is_enabled()) {
         return;
     }
     $missingplans = template_cohort::get_all_missing_plans(self::get_last_run_time());
     foreach ($missingplans as $missingplan) {
         foreach ($missingplan['userids'] as $userid) {
             try {
                 api::create_plan_from_template($missingplan['template'], $userid);
             } catch (\Exception $e) {
                 debugging(sprintf('Exception caught while creating plan for user %d from template %d. Message: %s', $userid, $missingplan['template']->get_id(), $e->getMessage()), DEBUG_DEVELOPER);
             }
         }
     }
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:19,代码来源:sync_plans_from_template_cohorts_task.php


示例17: export

 /**
  * Export all the competencies from this framework to a csv file.
  */
 public function export()
 {
     global $CFG;
     require_once $CFG->libdir . '/csvlib.class.php';
     $writer = new csv_export_writer();
     $filename = clean_param($this->framework->get_shortname() . '-' . $this->framework->get_idnumber(), PARAM_FILE);
     $writer->set_filename($filename);
     $headers = framework_importer::list_required_headers();
     $writer->add_data($headers);
     // Order and number of columns must match framework_importer::list_required_headers().
     $row = array('', $this->framework->get_idnumber(), $this->framework->get_shortname(), $this->framework->get_description(), $this->framework->get_descriptionformat(), $this->framework->get_scale()->compact_items(), $this->framework->get_scaleconfiguration(), '', '', '', '', '', true, implode(',', $this->framework->get_taxonomies()));
     $writer->add_data($row);
     $filters = array('competencyframeworkid' => $this->framework->get_id());
     $competencies = api::list_competencies($filters);
     // Index by id so we can lookup parents.
     $indexed = array();
     foreach ($competencies as $competency) {
         $indexed[$competency->get_id()] = $competency;
     }
     foreach ($competencies as $competency) {
         $parentidnumber = '';
         if ($competency->get_parentid() > 0) {
             $parent = $indexed[$competency->get_parentid()];
             $parentidnumber = $parent->get_idnumber();
         }
         $scalevalues = '';
         $scaleconfig = '';
         if ($competency->get_scaleid() !== null) {
             $scalevalues = $competency->get_scale()->compact_items();
             $scaleconfig = $competency->get_scaleconfiguration();
         }
         $ruleconfig = $competency->get_ruleconfig();
         if ($ruleconfig === null) {
             $ruleconfig = "null";
         }
         $allrelated = $competency->get_related_competencies();
         $relatedidnumbers = array();
         foreach ($allrelated as $onerelated) {
             $relatedidnumbers[] = str_replace(',', '%2C', $onerelated->get_idnumber());
         }
         $relatedidnumbers = implode(',', $relatedidnumbers);
         // Order and number of columns must match framework_importer::list_required_headers().
         $row = array($parentidnumber, $competency->get_idnumber(), $competency->get_shortname(), $competency->get_description(), $competency->get_descriptionformat(), $scalevalues, $scaleconfig, $competency->get_ruletype(), $competency->get_ruleoutcome(), $ruleconfig, $relatedidnumbers, $competency->get_id(), false, '');
         $writer->add_data($row);
     }
     $writer->download_file();
 }
开发者ID:janeklb,项目名称:moodle,代码行数:50,代码来源:framework_exporter.php


示例18: export_for_template

 /**
  * Export the data.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     global $DB;
     $usercompetencycourse = api::get_user_competency_in_course($this->courseid, $this->userid, $this->competencyid);
     $competency = $usercompetencycourse->get_competency();
     if (empty($usercompetencycourse) || empty($competency)) {
         throw new \invalid_parameter_exception('Invalid params. The competency does not belong to the course.');
     }
     $relatedcompetencies = api::list_related_competencies($competency->get_id());
     $user = $DB->get_record('user', array('id' => $this->userid));
     $evidence = api::list_evidence_in_course($this->userid, $this->courseid, $this->competencyid);
     $course = $DB->get_record('course', array('id' => $this->courseid));
     $params = array('competency' => $competency, 'usercompetencycourse' => $usercompetencycourse, 'evidence' => $evidence, 'user' => $user, 'course' => $course, 'scale' => $competency->get_scale(), 'relatedcompetencies' => $relatedcompetencies);
     $exporter = new user_competency_summary_in_course_exporter(null, $params);
     $data = $exporter->export($output);
     return $data;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:23,代码来源:user_competency_summary_in_course.php


示例19: definition

 /**
  * Define the form - called by parent constructor
  */
 public function definition()
 {
     $mform = $this->_form;
     $context = context_system::instance();
     $frameworks = api::list_frameworks('shortname', 'ASC', null, null, $context);
     $options = array();
     foreach ($frameworks as $framework) {
         $options[$framework->get_id()] = $framework->get_shortname();
     }
     if (empty($options)) {
         $mform->addElement('static', 'frameworkid', '', get_string('noframeworks', 'tool_lpimportcsv'));
     } else {
         $mform->addElement('select', 'frameworkid', get_string('competencyframework', 'tool_lp'), $options);
         $mform->setType('frameworkid', PARAM_INT);
         $mform->addRule('frameworkid', null, 'required', null, 'client');
         $this->add_action_buttons(true, get_string('export', 'tool_lpimportcsv'));
     }
     $mform->setDisableShortforms();
 }
开发者ID:janeklb,项目名称:moodle,代码行数:22,代码来源:export.php


示例20: __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)
 {
     if ($elementName == null) {
         // This is broken quickforms messing with the constructors.
         return;
     }
     if (!empty($options['cmid'])) {
         $cmid = $options['cmid'];
         $current = \core_competency\api::list_course_module_competencies_in_course_module($cmid);
         // Note: We just pick the outcome set on the first course_module_competency - because in our UI are are
         // forcing them to be all the same for each activity.
         if (!empty($current)) {
             $one = array_pop($current);
             $this->setValue($one->get_ruleoutcome());
         }
     }
     $validoptions = course_module_competency::get_ruleoutcome_list();
     parent::__construct($elementName, $elementLabel, $validoptions, $attributes);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:27,代码来源:course_competency_rule_form_element.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Craft\Craft类代码示例发布时间:2022-05-23
下一篇:
PHP core_calendar\type_factory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap