本文整理汇总了PHP中grade_plugin_return::get_return_url方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_plugin_return::get_return_url方法的具体用法?PHP grade_plugin_return::get_return_url怎么用?PHP grade_plugin_return::get_return_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_plugin_return
的用法示例。
在下文中一共展示了grade_plugin_return::get_return_url方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$aggregationtype = optional_param('aggregationtype', null, PARAM_INT);
$url = new moodle_url('/grade/edit/tree/index.php', array('id' => $courseid));
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
/// Make sure they can even access this course
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('nocourseid');
}
require_login($course);
$context = context_course::instance($course->id);
require_capability('moodle/grade:manage', $context);
// todo $PAGE->requires->js_module() should be used here instead
$PAGE->requires->js('/grade/edit/tree/functions.js');
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'tree', 'courseid' => $courseid));
$returnurl = $gpr->get_return_url(null);
// Change category aggregation if requested
if (!is_null($category) && !is_null($aggregationtype) && confirm_sesskey()) {
if (!($grade_category = grade_category::fetch(array('id' => $category, 'courseid' => $courseid)))) {
print_error('invalidcategoryid');
}
$data = new stdClass();
$data->aggregation = $aggregationtype;
grade_category::set_properties($grade_category, $data);
$grade_category->update();
grade_regrade_final_grades($courseid);
}
//first make sure we have proper final grades - we need it for locking changes
$normalisationmessage = null;
$originalweights = grade_helper::fetch_all_natural_weights_for_course($courseid);
grade_regrade_final_grades($courseid);
示例2: array
$url = new moodle_url('/grade/edit/tree/category.php', array('courseid' => $courseid));
if ($id !== 0) {
$url->param('id', $id);
}
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url(new moodle_url('/grade/edit/tree/index.php', array('id' => $courseid)));
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('nocourseid');
}
require_login($course);
$context = context_course::instance($course->id);
require_capability('moodle/grade:manage', $context);
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url('index.php?id=' . $course->id);
$heading = get_string('categoryedit', 'grades');
if ($id) {
if (!($grade_category = grade_category::fetch(array('id' => $id, 'courseid' => $course->id)))) {
print_error('invalidcategory');
}
$grade_category->apply_forced_settings();
$category = $grade_category->get_record_data();
// set parent
$category->parentcategory = $grade_category->parent;
$grade_item = $grade_category->load_grade_item();
// nomalize coef values if needed
$parent_category = $grade_category->get_parent_category();
foreach ($grade_item->get_record_data() as $key => $value) {
$category->{"grade_item_{$key}"} = $value;
}
示例3: error
require_once $CFG->dirroot . '/grade/lib.php';
require_once $CFG->libdir . '/mathslib.php';
require_once 'calculation_form.php';
$courseid = required_param('courseid', PARAM_INT);
$id = required_param('id', PARAM_INT);
$section = optional_param('section', 'calculation', PARAM_ALPHA);
$idnumbers = optional_param('idnumbers', null, PARAM_RAW);
if (!($course = get_record('course', 'id', $courseid))) {
print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/grade:manage', $context);
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url($CFG->wwwroot . '/grade/report.php?id=' . $course->id);
if (!($grade_item = grade_item::fetch(array('id' => $id, 'courseid' => $course->id)))) {
error('Incorect item id');
}
// activity items and items without grade can not have calculation
if ($grade_item->is_external_item() or $grade_item->gradetype != GRADE_TYPE_VALUE and $grade_item->gradetype != GRADE_TYPE_SCALE) {
redirect($returnurl, get_string('errornocalculationallowed', 'grades'));
}
$mform = new edit_calculation_form(null, array('gpr' => $gpr, 'itemid' => $grade_item->id));
if ($mform->is_cancelled()) {
redirect($returnurl);
}
$calculation = calc_formula::localize($grade_item->calculation);
$calculation = grade_item::denormalize_formula($calculation, $grade_item->courseid);
$mform->set_data(array('courseid' => $grade_item->courseid, 'calculation' => $calculation, 'id' => $grade_item->id, 'itemname' => $grade_item->itemname));
$errors = array();
示例4: array
// no separate group access, can view only self
$userid = $USER->id;
$user_selector = false;
} else {
$user_selector = true;
}
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
$showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context);
if (empty($userid)) {
$gui = new graded_users_iterator($course, null, $currentgroup);
$gui->require_active_enrolment($showonlyactiveenrol);
$gui->init();
// Add tabs
print_grade_page_head($courseid, 'report', 'user');
groups_print_course_menu($course, $gpr->get_return_url('index.php?id=' . $courseid, array('userid' => 0)));
if ($user_selector) {
$renderer = $PAGE->get_renderer('gradereport_user');
echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, true);
}
while ($userdata = $gui->next_user()) {
$user = $userdata->user;
$report = new grade_report_user($courseid, $gpr, $context, $user->id);
$studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink);
if ($report->fill_table()) {
echo '<br />' . $report->print_table(true);
}
echo "<p style = 'page-break-after: always;'></p>";
}
$gui->close();
示例5: array
*/
require_once '../../../config.php';
require_once $CFG->dirroot . '/grade/lib.php';
$courseid = required_param('id', PARAM_INT);
$action = required_param('action', PARAM_ALPHA);
$eid = required_param('eid', PARAM_ALPHANUM);
$PAGE->set_url('/grade/edit/tree/action.php', array('id' => $courseid, 'action' => $action, 'eid' => $eid));
/// Make sure they can even access this course
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('nocourseid');
}
require_login($course);
$context = context_course::instance($course->id);
// default return url
$gpr = new grade_plugin_return();
$returnurl = $gpr->get_return_url($CFG->wwwroot . '/grade/edit/tree/index.php?id=' . $course->id);
// get the grading tree object
$gtree = new grade_tree($courseid, false, false);
// what are we working with?
if (!($element = $gtree->locate_element($eid))) {
print_error('invalidelementid', '', $returnurl);
}
$object = $element['object'];
$type = $element['type'];
switch ($action) {
case 'hide':
if ($eid and confirm_sesskey()) {
if (!has_capability('moodle/grade:manage', $context) and !has_capability('moodle/grade:hide', $context)) {
print_error('nopermissiontohide', '', $returnurl);
}
if ($type == 'grade' and empty($object->id)) {