Exemple #1
0
}
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 navigation
$strgrades = get_string('grades');
$reportname = get_string('modulename', 'gradereport_grader');
$navigation = grade_build_nav(__FILE__, $reportname, $courseid);
/// 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;
    } else {
        if ($edit == 0 and confirm_sesskey()) {
            $USER->gradeediting[$course->id] = 0;
        }
    }
Exemple #2
0
if ($courseid) {
    if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
        print_error('nocourseid');
    }
    require_login($course);
    $context = context_course::instance($course->id);
    if (empty($CFG->enableoutcomes)) {
        redirect('../../index.php?id=' . $courseid);
    }
} else {
    require_once $CFG->libdir . '/adminlib.php';
    admin_externalpage_setup('outcomes');
    $context = context_system::instance();
}
require_capability('moodle/grade:manageoutcomes', $context);
$navigation = grade_build_nav(__FILE__, get_string('outcomes', 'grades'), $courseid);
$upload_form = new import_outcomes_form();
// display import form
if (!$upload_form->get_data()) {
    print_grade_page_head($courseid, 'outcome', 'import', get_string('importoutcomes', 'grades'));
    $upload_form->display();
    echo $OUTPUT->footer();
    die;
}
print_grade_page_head($courseid, 'outcome', 'import', get_string('importoutcomes', 'grades'));
$imported_file = $CFG->tempdir . '/outcomeimport/importedfile_' . time() . '.csv';
make_temp_directory('outcomeimport');
// copying imported file
if (!$upload_form->save_file('userfile', $imported_file, true)) {
    redirect('import.php' . ($courseid ? "?courseid={$courseid}" : ''), get_string('importfilemissing', 'grades'));
}
                continue;
            }
            if (empty($gi->idnumber) and !$gi->add_idnumber(stripslashes($idnumbers[$gi->id]))) {
                $errors[$giid] = get_string('error');
                continue;
            }
        } else {
            $errors[$giid] = 'Could not fetch the grade_item with id=' . $giid;
        }
    }
}
$gtree = new grade_tree($course->id, false, false);
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$strcalculationedit = get_string('editcalculation', 'grades');
$navigation = grade_build_nav(__FILE__, $strcalculationedit, array('courseid' => $courseid));
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcalculationedit, $navigation, '', '', true, '', navmenu($course));
$mform->display();
// Now show the gradetree with the idnumbers add/edit form
echo '
<form class="mform" id="mform2" method="post" action="' . $CFG->wwwroot . '/grade/edit/tree/calculation.php?courseid=' . $courseid . '&amp;id=' . $id . '">
    <div style="display: none;">
        <input type="hidden" value="' . $id . '" name="id"/>
        <input type="hidden" value="' . $courseid . '" name="courseid"/>
        <input type="hidden" value="' . $gpr->type . '" name="gpr_type"/>
        <input type="hidden" value="' . $gpr->plugin . '" name="gpr_plugin"/>
        <input type="hidden" value="' . $gpr->courseid . '" name="gpr_courseid"/>
        <input type="hidden" value="' . sesskey() . '" name="sesskey"/>
        <input type="hidden" value="idnumbers" name="section"/>
    </div>
require '../../../config.php';
require_once '../../lib.php';
require_once $CFG->libdir . '/gradelib.php';
$contextid = required_param('contextid', PARAM_INT);
$courseid_1 = optional_param('courseid', PARAM_INT);
if (!($context = get_context_instance_by_id($contextid))) {
    error('Incorrect context id');
}
if (!($course = $DB->get_record('course', array('id' => $courseid_1)))) {
    echo "No course found for id=" . $courseid_1 . ".";
    print_error('nocourseid');
}
require_login($courseid_1);
$pagename = get_string('letters', 'grades');
//
$navigation = grade_build_nav(__FILE__, $pagename, $courseid_1);
$navlinks[] = array('name' => "Graph", 'link' => null, 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
//print_header('Grader Report', 'Grader Report', $navigation, '', '', true, '', user_login_string($SITE).$langmenu);
//print_grade_plugin_selector($courseid_1, 'edit', 'graph');
print_header('Grade: Graph', 'Grade: Graph', $navigation, '', '', true, '', user_login_string($SITE) . $langmenu);
//print_grade_plugin_selector($courseid_1, 'edit', 'graph');
/*if ($context->contextlevel == CONTEXT_SYSTEM or $context->contextlevel == CONTEXT_COURSECAT) {
    require_once $CFG->libdir.'/adminlib.php';
    require_login();
    admin_externalpage_setup('letters');
    $admin = true;


} else if ($context->contextlevel == CONTEXT_COURSE) {
    require_login($context->instanceid);
$gtree = new grade_tree($courseid, false, false);
if (empty($eid)) {
    $element = null;
    $object = null;
} else {
    if (!($element = $gtree->locate_element($eid))) {
        print_error('invalidelementid', '', $returnurl);
    }
    $object = $element['object'];
}
$switch = grade_get_setting($course->id, 'aggregationposition', $CFG->grade_aggregationposition);
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$strcategoriesedit = get_string('categoriesedit', 'grades');
$strcategoriesanditems = get_string('categoriesanditems', 'grades');
$navigation = grade_build_nav(__FILE__, $strcategoriesanditems, array('courseid' => $courseid));
$moving = false;
$grade_edit_tree = new grade_edit_tree($gtree, $moving, $gpr);
switch ($action) {
    case 'delete':
        if ($eid && confirm_sesskey()) {
            if (!$grade_edit_tree->element_deletable($element)) {
                // no deleting of external activities - they would be recreated anyway!
                // exception is activity without grading or misconfigured activities
                break;
            }
            $confirm = optional_param('confirm', 0, PARAM_BOOL);
            if ($confirm and confirm_sesskey()) {
                $object->delete('grade/report/grader/category');
                redirect($returnurl);
            } else {
Exemple #6
0
///////////////////////////////////////////////////////////////////////////
require_once '../../../config.php';
require_once $CFG->dirroot . '/grade/export/lib.php';
require_once 'grade_export_txt.php';
$id = required_param('id', PARAM_INT);
// course id
if (!($course = get_record('course', 'id', $id))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:view', $context);
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_txt');
$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
print_header($course->shortname . ': ' . get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'txt');
if (!empty($CFG->gradepublishing)) {
    $CFG->gradepublishing = has_capability('gradeexport/txt:publish', $context);
}
$mform = new grade_export_form(null, array('includeseparator' => true, 'publishing' => true));
// process post information
if ($data = $mform->get_data()) {
    $export = new grade_export_txt($course, groups_get_course_group($course), '', false, false, $data->display, $data->decimals);
    // print the grades on screen for feedback
    $export->process_form($data);
    $export->print_continue();
    $export->display_preview();
    print_footer($course);
    exit;
Exemple #7
0
            continue;
        }
        if ($value == GRADE_REPORT_PREFERENCE_DEFAULT || strlen($value) == 0) {
            unset_user_preference($preference);
        } else {
            set_user_preference($preference, $value);
        }
    }
    redirect($CFG->wwwroot . '/grade/report/grader/index.php?id=' . $courseid);
    // message here breaks accessability and is sloooowww
    exit;
}
$strgrades = get_string('grades');
$strgraderreport = get_string('modulename', 'gradereport_grader');
$strgradepreferences = get_string('gradepreferences', 'grades');
$navigation = grade_build_nav(__FILE__, $strgradepreferences, $courseid);
print_header_simple($strgrades . ': ' . $strgraderreport . ': ' . $strgradepreferences, ': ' . $strgradepreferences, $navigation, '', '', true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($course->id, 'report', 'grader');
// Add tabs
$currenttab = 'preferences';
include 'tabs.php';
// If USER has admin capability, print a link to the site config page for this report
if (has_capability('moodle/site:config', $systemcontext)) {
    echo '<div id="siteconfiglink"><a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=gradereportgrader">';
    echo get_string('changereportdefaults', 'grades');
    echo "</a></div>\n";
}
print_simple_box_start("center");
$mform->display();
print_simple_box_end();
Exemple #8
0
///////////////////////////////////////////////////////////////////////////
include_once '../../../config.php';
require_once $CFG->libdir . '/gradelib.php';
require_once $CFG->dirroot . '/grade/lib.php';
$courseid = required_param('id', PARAM_INT);
// course id
if (!($course = get_record('course', 'id', $courseid))) {
    print_error('nocourseid');
}
require_login($course->id);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('gradereport/outcomes:view', $context);
// Build navigation
$strgrades = get_string('grades');
$stroutcomes = get_string('outcomes', 'grades');
$navigation = grade_build_nav(__FILE__, $stroutcomes, $course->id);
/// Print header
print_header_simple($strgrades . ':' . $stroutcomes, ':' . $strgrades, $navigation, '', '', true);
print_grade_plugin_selector($courseid, 'report', 'outcomes');
//first make sure we have proper final grades
grade_regrade_final_grades($courseid);
// Grab all outcomes used in course
$report_info = array();
$outcomes = grade_outcome::fetch_all_available($courseid);
// Get grade_items that use each outcome
foreach ($outcomes as $outcomeid => $outcome) {
    $report_info[$outcomeid]['items'] = get_records_select('grade_items', "outcomeid = {$outcomeid} AND courseid = {$courseid}");
    $report_info[$outcomeid]['outcome'] = $outcome;
    // Get average grades for each item
    if (is_array($report_info[$outcomeid]['items'])) {
        foreach ($report_info[$outcomeid]['items'] as $itemid => $item) {
Exemple #9
0
            }
            $outcome->insert();
        } else {
            if (isset($data->standard)) {
                $outcome->courseid = !empty($data->standard) ? null : $courseid;
            } else {
                unset($outcome->couseid);
                // keep previous
            }
            $outcome->update();
        }
        redirect($returnurl);
    }
}
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$stroutcomeedit = get_string('outcome', 'grades');
if ($courseid) {
    $navigation = grade_build_nav(__FILE__, $stroutcomeedit, array('courseid' => $courseid));
    print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $stroutcomeedit, $navigation, '', '', true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($course));
} else {
    require_once $CFG->libdir . '/adminlib.php';
    admin_externalpage_setup('outcomes');
    admin_externalpage_print_header();
}
$mform->display();
if ($courseid) {
    print_footer($course);
} else {
    admin_externalpage_print_footer();
}
//                                                                       //
//          http://www.gnu.org/copyleft/gpl.html                         //
//                                                                       //
///////////////////////////////////////////////////////////////////////////
require_once '../../config.php';
require_once $CFG->dirroot . '/grade/lib.php';
$id = required_param('id', PARAM_INT);
// course id
if (!($course = get_record('course', 'id', $id))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
require_capability('moodle/grade:import', $context);
$strgrades = get_string('grades', 'grades');
$navigation = grade_build_nav(__FILE__, null, array('courseid' => $course->id));
print_header($course->shortname . ': ' . get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, '', '');
$stredit = get_string('edit');
$strdelete = get_string('delete');
$data = array();
if ($keys = get_records_select('user_private_key', "script='grade/import' AND instance={$course->id} AND userid={$USER->id}")) {
    foreach ($keys as $key) {
        $line = array();
        $line[0] = format_string($key->value);
        $line[1] = $key->iprestriction;
        $line[2] = empty($key->validuntil) ? get_string('always') : userdate($key->validuntil);
        $buttons = "<a title=\"{$stredit}\" href=\"key.php?id={$key->id}\"><img" . " src=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"{$stredit}\" /></a> ";
        $buttons .= "<a title=\"{$strdelete}\" href=\"key.php?id={$key->id}&amp;delete=1\"><img" . " src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a> ";
        $line[3] = $buttons;
        $data[] = $line;
Exemple #11
0
if ($courseid) {
    if (!($course = get_record('course', 'id', $courseid))) {
        print_error('nocourseid');
    }
    require_login($course);
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    require_capability('moodle/course:managescales', $context);
} else {
    require_once $CFG->libdir . '/adminlib.php';
    admin_externalpage_setup('scales');
}
/// return tracking object
$gpr = new grade_plugin_return(array('type' => 'edit', 'plugin' => 'scale', 'courseid' => $courseid));
$strgrades = get_string('grades');
$pagename = get_string('scales');
$navigation = grade_build_nav(__FILE__, $pagename, array('courseid' => $courseid));
$strscale = get_string('scale');
$strstandardscale = get_string('scalesstandard');
$strcustomscales = get_string('scalescustom');
$strname = get_string('name');
$strdelete = get_string('delete');
$stredit = get_string('edit');
$srtcreatenewscale = get_string('scalescustomcreate');
$strused = get_string('used');
$stredit = get_string('edit');
switch ($action) {
    case 'delete':
        if (!confirm_sesskey()) {
            break;
        }
        $scaleid = required_param('scaleid', PARAM_INT);
Exemple #12
0
            $parent = $grade_item->get_parent_category();
            $parent->force_regrading();
        } else {
            if ($old_grade_grade->overridden != $grade_grade->overridden and empty($grade_grade->overridden)) {
                // only when unoverridding
                $grade_item->force_regrading();
            } else {
                if ($old_grade_grade->locktime != $grade_grade->locktime) {
                    $grade_item->force_regrading();
                }
            }
        }
        redirect($returnurl);
    }
}
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$strgradeedit = get_string('editgrade', 'grades');
$struser = get_string('user');
grade_build_nav(__FILE__, $strgradeedit, array('courseid' => $courseid));
/*********** BEGIN OUTPUT *************/
$PAGE->set_title($strgrades . ': ' . $strgraderreport . ': ' . $strgradeedit);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($strgradeedit);
echo $OUTPUT->box_start();
// Form if in edit or add modes
$mform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
die;
Exemple #13
0
    $grade_item->outcomeid = null;
    // Handle null decimals value
    if (!array_key_exists('decimals', $data) or $data->decimals < 0) {
        $grade_item->decimals = null;
    }
    if (empty($grade_item->id)) {
        $grade_item->itemtype = 'manual';
        // all new items to be manual only
        $grade_item->insert();
    } else {
        $grade_item->update();
    }
    // update hiding flag
    if ($hiddenuntil) {
        $grade_item->set_hidden($hiddenuntil, false);
    } else {
        $grade_item->set_hidden($hidden, false);
    }
    $grade_item->set_locktime($locktime);
    // locktime first - it might be removed when unlocking
    $grade_item->set_locked($locked, false, true);
    redirect($returnurl);
}
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$stritemsedit = get_string('itemsedit', 'grades');
$stritem = get_string('item', 'grades');
$navigation = grade_build_nav(__FILE__, $stritem, array('courseid' => $courseid));
print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $stritemsedit, $navigation, '', '', true, '', navmenu($course));
$mform->display();
print_footer($course);
Exemple #14
0
            $scale->courseid = !empty($data->standard) ? 0 : $courseid;
            $scale->insert();
        } else {
            if (isset($data->standard)) {
                $scale->courseid = !empty($data->standard) ? 0 : $courseid;
            } else {
                unset($scale->couseid);
                // keep previous
            }
            $scale->update();
        }
        redirect($returnurl);
    }
}
$strgrades = get_string('grades');
$strgraderreport = get_string('graderreport', 'grades');
$strscaleedit = get_string('scale');
if ($courseid) {
    $navigation = grade_build_nav(__FILE__, $strscaleedit, $courseid);
    print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strscaleedit, $navigation, '', '', true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($course));
} else {
    require_once $CFG->libdir . '/adminlib.php';
    admin_externalpage_setup('outcomes');
    admin_externalpage_print_header();
}
$mform->display();
if ($courseid) {
    print_footer($course);
} else {
    admin_externalpage_print_footer();
}
Exemple #15
0
            $record->letter = $letter;
            $record->lowerboundary = $boundary;
            $record->contextid = $context->id;
            if ($old_id = array_pop($old_ids)) {
                $record->id = $old_id;
                update_record('grade_letters', $record);
            } else {
                insert_record('grade_letters', $record);
            }
        }
        foreach ($old_ids as $old_id) {
            delete_records('grade_letters', 'id', $old_id);
        }
        redirect($returnurl);
    }
}
//page header
if ($admin) {
    admin_externalpage_print_header();
} else {
    $navigation = grade_build_nav(__FILE__, $pagename, $COURSE->id);
    /// Print header
    print_header_simple($strgrades . ': ' . $pagename, ': ' . $strgrades, $navigation, '', '', true, '', navmenu($COURSE));
    $currenttab = 'lettersedit';
    require 'tabs.php';
}
$mform->display();
print_footer($COURSE);
?>