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


PHP grade_plugin_return类代码示例

本文整理汇总了PHP中grade_plugin_return的典型用法代码示例。如果您正苦于以下问题:PHP grade_plugin_return类的具体用法?PHP grade_plugin_return怎么用?PHP grade_plugin_return使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: optional_param

$move = optional_param('move', 0, PARAM_INT);
$type = optional_param('type', 0, PARAM_ALPHA);
$target = optional_param('target', 0, PARAM_ALPHANUM);
$toggle = optional_param('toggle', NULL, PARAM_INT);
$toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM);
$PAGE->set_url(new moodle_url('/grade/report/grader/index.php', array('id' => $courseid)));
/// basic access checks
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/grader:view', $context);
require_capability('moodle/grade:viewall', $context);
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'grader', 'courseid' => $courseid, 'page' => $page));
/// last selected report session tracking
if (!isset($USER->grade_last_report)) {
    $USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'grader';
/// Build editing on/off buttons
if (!isset($USER->gradeediting)) {
    $USER->gradeediting = array();
}
if (has_capability('moodle/grade:edit', $context)) {
    if (!isset($USER->gradeediting[$course->id])) {
        $USER->gradeediting[$course->id] = 0;
    }
    if ($edit == 1 and confirm_sesskey()) {
        $USER->gradeediting[$course->id] = 1;
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:index.php

示例2: optional_param

$category = optional_param('category', null, PARAM_INT);
$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);
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:index.php

示例3: print_error

    if ($userid == $USER->id and has_capability('moodle/grade:view', $context) and $course->showgrades) {
        //ok - can view own grades
        $access = true;
    } else {
        if (has_capability('moodle/grade:viewall', context_user::instance($userid)) and $course->showgrades) {
            // ok - can view grades of this user- parent most probably
            $access = true;
        }
    }
}
if (!$access) {
    // no access to grades!
    print_error('nopermissiontoviewgrades', 'error', $CFG->wwwroot . '/course/view.php?id=' . $courseid);
}
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'user', 'courseid' => $courseid, 'userid' => $userid));
/// last selected report session tracking
if (!isset($USER->grade_last_report)) {
    $USER->grade_last_report = array();
}
$USER->grade_last_report[$course->id] = 'user';
//first make sure we have proper final grades - this must be done before constructing of the grade tree
grade_regrade_final_grades($courseid);
if (has_capability('moodle/grade:viewall', $context)) {
    //Teachers will see all student reports
    $groupmode = groups_get_course_groupmode($course);
    // Groups are being used
    $currentgroup = groups_get_course_group($course, true);
    if (!$currentgroup) {
        // To make some other functions work better later
        $currentgroup = NULL;
开发者ID:harshasunny,项目名称:grade,代码行数:31,代码来源:index.php

示例4: moodle_url

// grade_category->id
$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;
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:category.php

示例5: optional_param

$id = optional_param('id', 0, PARAM_INT);
$url = new moodle_url('/grade/edit/tree/item.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('itemsedit', 'grades');
if ($grade_item = grade_item::fetch(array('id' => $id, 'courseid' => $courseid))) {
    // redirect if outcomeid present
    if (!empty($grade_item->outcomeid) && !empty($CFG->enableoutcomes)) {
        $url = $CFG->wwwroot . '/grade/edit/tree/outcomeitem.php?id=' . $id . '&courseid=' . $courseid;
        redirect($gpr->add_url_params($url));
    }
    if ($grade_item->is_course_item() or $grade_item->is_category_item()) {
        $grade_category = $grade_item->get_item_category();
        $url = $CFG->wwwroot . '/grade/edit/tree/category.php?id=' . $grade_category->id . '&courseid=' . $courseid;
        redirect($gpr->add_url_params($url));
    }
    $item = $grade_item->get_record_data();
    $parent_category = $grade_item->get_parent_category();
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:item.php

示例6: required_param

require_once '../../../config.php';
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));
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:31,代码来源:calculation.php

示例7: required_param

$courseid = required_param('id', PARAM_INT);
$action = optional_param('action', 0, PARAM_ALPHA);
$eid = optional_param('eid', 0, PARAM_ALPHANUM);
$category = optional_param('category', null, PARAM_INT);
$aggregationtype = optional_param('aggregationtype', null, PARAM_INT);
$showadvanced = optional_param('showadvanced', -1, PARAM_BOOL);
// sticky editting mode
/// Make sure they can even access this course
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);
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'tree', 'courseid' => $courseid));
$returnurl = $gpr->get_return_url(null);
/// Build editing on/off buttons
if (!isset($USER->gradeediting)) {
    $USER->gradeediting = array();
}
$current_view = '';
if (has_capability('moodle/grade:manage', $context)) {
    if (!isset($USER->gradeediting[$course->id])) {
        $USER->gradeediting[$course->id] = 0;
    }
    if ($showadvanced == 1 and confirm_sesskey()) {
        $USER->gradeediting[$course->id] = 1;
    } else {
        if ($showadvanced == 0 and confirm_sesskey()) {
            $USER->gradeediting[$course->id] = 0;
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:31,代码来源:index.php

示例8: grade_print_scale_link

/**
 * Local shortcut function for creating a link to a scale.
 * @param int $courseid The Course ID
 * @param grade_scale $scale The Scale to link to
 * @param grade_plugin_return $gpr An object used to identify the page we just came from
 * @return string html
 */
function grade_print_scale_link($courseid, $scale, $gpr)
{
    global $CFG, $OUTPUT;
    $url = new moodle_url('/grade/edit/scale/edit.php', array('courseid' => $courseid, 'id' => $scale->id));
    $url = $gpr->add_url_params($url);
    return html_writer::link($url, $scale->get_name());
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:14,代码来源:index.php

示例9: required_param

require_once '../../../config.php';
require_once $CFG->dirroot . '/grade/lib.php';
require_once $CFG->dirroot . '/grade/report/lib.php';
// for preferences
$courseid = required_param('id', PARAM_INT);
$action = optional_param('action', 0, PARAM_ALPHA);
$eid = optional_param('eid', 0, PARAM_ALPHANUM);
/// Make sure they can even access this course
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);
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'tree', 'courseid' => $courseid));
$returnurl = $gpr->get_return_url(null);
//first make sure we have proper final grades - we need it for locking changes
grade_regrade_final_grades($courseid);
// get the grading tree object
// note: total must be first for moving to work correctly, if you want it last moving code must be rewritten!
$gtree = new grade_tree($courseid, false, false);
if (empty($eid)) {
    $element = null;
    $object = null;
} else {
    if (!($element = $gtree->locate_element($eid))) {
        error('Incorrect element id!', $returnurl);
    }
    $object = $element['object'];
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:index.php

示例10: required_param

 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
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);
            }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:action.php


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