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


PHP api::list_user_competencies_in_course方法代码示例

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


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

示例1: array_shift

    } else {
        if (!in_array($userid, array_keys($gradable))) {
            $userid = array_shift($gradable)->id;
        }
    }
}
$params = array('userid' => $userid, 'competencyid' => $competencyid, 'courseid' => $courseid);
$url = new moodle_url('/admin/tool/lp/user_competency_in_course.php', $params);
if ($userid > 0) {
    $usercontext = context_user::instance($userid);
    $user = $DB->get_record('user', array('id' => $userid));
}
$competency = new \core_competency\competency($competencyid);
// Does a permissions check for us.
if ($userid > 0) {
    $usercompetencycourses = \core_competency\api::list_user_competencies_in_course($courseid, $userid);
}
$subtitle = $competency->get_shortname() . ' <em>' . $competency->get_idnumber() . '</em>';
list($title, $subtitle) = \tool_lp\page_helper::setup_for_course($url, $course, $subtitle);
$output = $PAGE->get_renderer('tool_lp');
if ($userid > 0) {
    $userheading = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext);
}
echo $output->header();
if ($userid > 0) {
    echo $OUTPUT->context_header($userheading, 3);
}
$baseurl = new moodle_url('/admin/tool/lp/user_competency_in_course.php');
$nav = new \tool_lp\output\user_competency_course_navigation($userid, $competencyid, $courseid, $baseurl);
echo $output->render($nav);
if ($userid > 0) {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:user_competency_in_course.php

示例2: export_for_template

 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param renderer_base $output Renderer base.
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     global $USER;
     $data = new stdClass();
     $data->courseid = $this->courseid;
     $data->pagecontextid = $this->context->id;
     $data->competencies = array();
     $contextcache = array();
     $gradable = is_enrolled($this->context, $USER, 'moodle/competency:coursecompetencygradable');
     if ($gradable) {
         $usercompetencycourses = api::list_user_competencies_in_course($this->courseid, $USER->id);
         $data->gradableuserid = $USER->id;
     }
     $ruleoutcomelist = course_competency::get_ruleoutcome_list();
     $ruleoutcomeoptions = array();
     foreach ($ruleoutcomelist as $value => $text) {
         $ruleoutcomeoptions[$value] = array('value' => $value, 'text' => (string) $text, 'selected' => false);
     }
     foreach ($this->coursecompetencylist as $coursecompetencyelement) {
         $coursecompetency = $coursecompetencyelement['coursecompetency'];
         $competency = $coursecompetencyelement['competency'];
         if (!isset($contextcache[$competency->get_competencyframeworkid()])) {
             $contextcache[$competency->get_competencyframeworkid()] = $competency->get_context();
         }
         $context = $contextcache[$competency->get_competencyframeworkid()];
         $compexporter = new competency_exporter($competency, array('context' => $context));
         $ccexporter = new course_competency_exporter($coursecompetency, array('context' => $context));
         $ccoutcomeoptions = (array) (object) $ruleoutcomeoptions;
         $ccoutcomeoptions[$coursecompetency->get_ruleoutcome()]['selected'] = true;
         $coursemodules = api::list_course_modules_using_competency($competency->get_id(), $this->courseid);
         $fastmodinfo = get_fast_modinfo($this->courseid);
         $exportedmodules = array();
         foreach ($coursemodules as $cmid) {
             $cminfo = $fastmodinfo->cms[$cmid];
             $cmexporter = new course_module_summary_exporter(null, array('cm' => $cminfo));
             $exportedmodules[] = $cmexporter->export($output);
         }
         // Competency path.
         $pathexporter = new competency_path_exporter(['ancestors' => $competency->get_ancestors(), 'framework' => $competency->get_framework(), 'context' => $context]);
         $onerow = array('competency' => $compexporter->export($output), 'coursecompetency' => $ccexporter->export($output), 'ruleoutcomeoptions' => $ccoutcomeoptions, 'coursemodules' => $exportedmodules, 'comppath' => $pathexporter->export($output));
         if ($gradable) {
             $foundusercompetencycourse = false;
             foreach ($usercompetencycourses as $usercompetencycourse) {
                 if ($usercompetencycourse->get_competencyid() == $competency->get_id()) {
                     $foundusercompetencycourse = $usercompetencycourse;
                 }
             }
             if ($foundusercompetencycourse) {
                 $related = array('scale' => $competency->get_scale());
                 $exporter = new user_competency_course_exporter($foundusercompetencycourse, $related);
                 $onerow['usercompetencycourse'] = $exporter->export($output);
             }
         }
         array_push($data->competencies, $onerow);
     }
     $data->canmanagecompetencyframeworks = $this->canmanagecompetencyframeworks;
     $data->canmanagecoursecompetencies = $this->canmanagecoursecompetencies;
     $data->canconfigurecoursecompetencies = $this->canconfigurecoursecompetencies;
     $data->cangradecompetencies = $this->cangradecompetencies;
     $exporter = new course_competency_settings_exporter($this->coursecompetencysettings);
     $data->settings = $exporter->export($output);
     $related = array('context' => $this->context);
     $exporter = new course_competency_statistics_exporter($this->coursecompetencystatistics, $related);
     $data->statistics = $exporter->export($output);
     $data->manageurl = null;
     if ($this->canmanagecompetencyframeworks) {
         $data->manageurl = $this->manageurl->out(true);
     }
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:76,代码来源:course_competencies_page.php

示例3: export_for_template

 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     global $DB;
     $data = new stdClass();
     $data->courseid = $this->courseid;
     $course = $DB->get_record('course', array('id' => $this->courseid));
     $coursecontext = context_course::instance($course->id);
     $exporter = new course_summary_exporter($course, array('context' => $coursecontext));
     $coursecompetencysettings = api::read_course_competency_settings($course->id);
     $data->pushratingstouserplans = $coursecompetencysettings->get_pushratingstouserplans();
     $data->course = $exporter->export($output);
     $data->usercompetencies = array();
     $scalecache = array();
     $frameworkcache = array();
     $user = core_user::get_user($this->userid);
     $exporter = new user_summary_exporter($user);
     $data->user = $exporter->export($output);
     $data->usercompetencies = array();
     $coursecompetencies = api::list_course_competencies($this->courseid);
     $usercompetencycourses = api::list_user_competencies_in_course($this->courseid, $user->id);
     foreach ($usercompetencycourses as $usercompetencycourse) {
         $onerow = new stdClass();
         $competency = null;
         foreach ($coursecompetencies as $coursecompetency) {
             if ($coursecompetency['competency']->get_id() == $usercompetencycourse->get_competencyid()) {
                 $competency = $coursecompetency['competency'];
                 break;
             }
         }
         if (!$competency) {
             continue;
         }
         // Fetch the framework.
         if (!isset($frameworkcache[$competency->get_competencyframeworkid()])) {
             $frameworkcache[$competency->get_competencyframeworkid()] = $competency->get_framework();
         }
         $framework = $frameworkcache[$competency->get_competencyframeworkid()];
         // Fetch the scale.
         $scaleid = $competency->get_scaleid();
         if ($scaleid === null) {
             $scaleid = $framework->get_scaleid();
             if (!isset($scalecache[$scaleid])) {
                 $scalecache[$competency->get_scaleid()] = $framework->get_scale();
             }
         } else {
             if (!isset($scalecache[$scaleid])) {
                 $scalecache[$competency->get_scaleid()] = $competency->get_scale();
             }
         }
         $scale = $scalecache[$competency->get_scaleid()];
         $exporter = new user_competency_course_exporter($usercompetencycourse, array('scale' => $scale));
         $record = $exporter->export($output);
         $onerow->usercompetencycourse = $record;
         $exporter = new competency_summary_exporter(null, array('competency' => $competency, 'framework' => $framework, 'context' => $framework->get_context(), 'relatedcompetencies' => array(), 'linkedcourses' => array()));
         $onerow->competency = $exporter->export($output);
         array_push($data->usercompetencies, $onerow);
     }
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:65,代码来源:report.php


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