本文整理匯總了PHP中moodleform::get_coursemodule方法的典型用法代碼示例。如果您正苦於以下問題:PHP moodleform::get_coursemodule方法的具體用法?PHP moodleform::get_coursemodule怎麽用?PHP moodleform::get_coursemodule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類moodleform
的用法示例。
在下文中一共展示了moodleform::get_coursemodule方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tool_lp_coursemodule_standard_elements
/**
* Inject the competencies elements into all moodle module settings forms.
*
* @param moodleform $formwrapper The moodle quickforms wrapper object.
* @param MoodleQuickForm $mform The actual form object (required to modify the form).
*/
function tool_lp_coursemodule_standard_elements($formwrapper, $mform)
{
global $CFG, $COURSE;
if (!get_config('core_competency', 'enabled')) {
return;
} else {
if (!has_capability('moodle/competency:coursecompetencymanage', $formwrapper->get_context())) {
return;
}
}
$mform->addElement('header', 'competenciessection', get_string('competencies', 'core_competency'));
MoodleQuickForm::registerElementType('course_competencies', "{$CFG->dirroot}/admin/tool/lp/classes/course_competencies_form_element.php", 'tool_lp_course_competencies_form_element');
$cmid = null;
if ($cm = $formwrapper->get_coursemodule()) {
$cmid = $cm->id;
}
$options = array('courseid' => $COURSE->id, 'cmid' => $cmid);
$mform->addElement('course_competencies', 'competencies', get_string('modcompetencies', 'tool_lp'), $options);
$mform->addHelpButton('competencies', 'modcompetencies', 'tool_lp');
MoodleQuickForm::registerElementType('course_competency_rule', "{$CFG->dirroot}/admin/tool/lp/classes/course_competency_rule_form_element.php", 'tool_lp_course_competency_rule_form_element');
// Reuse the same options.
$mform->addElement('course_competency_rule', 'competency_rule', get_string('uponcoursemodulecompletion', 'tool_lp'), $options);
}