本文整理汇总了PHP中core_competency\api::read_competency方法的典型用法代码示例。如果您正苦于以下问题:PHP api::read_competency方法的具体用法?PHP api::read_competency怎么用?PHP api::read_competency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_competency\api
的用法示例。
在下文中一共展示了api::read_competency方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct this renderable.
*
* @param int $competencyid
*/
public function __construct($competencyid)
{
$this->competency = api::read_competency($competencyid);
$this->context = $this->competency->get_context();
$this->relatedcompetencies = api::list_related_competencies($competencyid);
}
示例2: grade_competency_in_course
/**
* Grade a competency in a course.
*
* @param int $courseid The course id
* @param int $userid The user id
* @param int $competencyid The competency id
* @param int $grade The new grade value
* @param string $note A note to add to the evidence
* @return bool
*/
public static function grade_competency_in_course($courseid, $userid, $competencyid, $grade, $note = null)
{
global $USER, $PAGE, $DB;
$params = self::validate_parameters(self::grade_competency_in_course_parameters(), array('courseid' => $courseid, 'userid' => $userid, 'competencyid' => $competencyid, 'grade' => $grade, 'note' => $note));
$course = $DB->get_record('course', array('id' => $params['courseid']));
$context = context_course::instance($course->id);
self::validate_context($context);
$output = $PAGE->get_renderer('core');
$evidence = api::grade_competency_in_course($params['courseid'], $params['userid'], $params['competencyid'], $params['grade'], $params['note']);
$competency = api::read_competency($params['competencyid']);
$scale = $competency->get_scale();
$exporter = new evidence_exporter($evidence, array('actionuser' => $USER, 'scale' => $scale, 'usercompetency' => null, 'usercompetencyplan' => null));
return $exporter->export($output);
}
示例3: redirect
}
// Get competency.
$competency = null;
if (!empty($id)) {
$competency = \core_competency\api::read_competency($id);
if (empty($competencyframework)) {
$competencyframework = $competency->get_framework();
}
}
// Get parent competency, if any.
$parent = null;
if ($competency) {
$parent = $competency->get_parent();
} else {
if ($parentid) {
$parent = \core_competency\api::read_competency($parentid);
}
}
// 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.
示例4: data_for_related_competencies_section
/**
* Data to render in the related competencies section.
*
* @param int $competencyid
* @return array Related competencies and whether to show delete action button or not.
*/
public static function data_for_related_competencies_section($competencyid)
{
global $PAGE;
$params = self::validate_parameters(self::data_for_related_competencies_section_parameters(), array('competencyid' => $competencyid));
$competency = api::read_competency($params['competencyid']);
self::validate_context($competency->get_context());
$renderable = new \tool_lp\output\related_competencies($params['competencyid']);
$renderer = $PAGE->get_renderer('tool_lp');
return $renderable->export_for_template($renderer);
}