本文整理汇总了PHP中update_moduleinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP update_moduleinfo函数的具体用法?PHP update_moduleinfo怎么用?PHP update_moduleinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_moduleinfo函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_module
/**
* Update a module.
*
* It includes:
* - capability and other checks
* - update the module
*
* @param object $module
* @return object the updated module info
* @throws moodle_exception if current user is not allowed to update the module
*/
function update_module($moduleinfo)
{
global $DB, $CFG;
require_once $CFG->dirroot . '/course/modlib.php';
// Check the course module exists.
$cm = get_coursemodule_from_id('', $moduleinfo->coursemodule, 0, false, MUST_EXIST);
// Check the course exists.
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
// Some checks (capaibility / existing instances).
list($cm, $context, $module, $data, $cw) = can_update_moduleinfo($cm);
// Retrieve few information needed by update_moduleinfo.
$moduleinfo->modulename = $cm->modname;
if (!isset($moduleinfo->scale)) {
$moduleinfo->scale = 0;
}
$moduleinfo->type = 'mod';
// Update the module.
list($cm, $moduleinfo) = update_moduleinfo($cm, $moduleinfo, $course, null);
return $moduleinfo;
}
示例2: print_error
} else {
print_error('noformdesc');
}
$mformclassname = 'mod_' . $module->name . '_mod_form';
$mform = new $mformclassname($data, $cw->section, $cm, $course);
$mform->set_data($data);
if ($mform->is_cancelled()) {
if ($return && !empty($cm->id)) {
redirect("{$CFG->wwwroot}/mod/{$module->name}/view.php?id={$cm->id}");
} else {
redirect(course_get_url($course, $cw->section, array('sr' => $sectionreturn)));
}
} else {
if ($fromform = $mform->get_data()) {
if (!empty($fromform->update)) {
list($cm, $fromform) = update_moduleinfo($cm, $fromform, $course, $mform);
} else {
if (!empty($fromform->add)) {
$fromform = add_moduleinfo($fromform, $course, $mform);
} else {
print_error('invaliddata');
}
}
if (isset($fromform->submitbutton)) {
if (empty($fromform->showgradingmanagement)) {
redirect("{$CFG->wwwroot}/mod/{$module->name}/view.php?id={$fromform->coursemodule}");
} else {
$returnurl = new moodle_url("/mod/{$module->name}/view.php", array('id' => $fromform->coursemodule));
redirect($fromform->gradingman->get_management_url($returnurl));
}
} else {