本文整理汇总了PHP中grade_build_nav函数的典型用法代码示例。如果您正苦于以下问题:PHP grade_build_nav函数的具体用法?PHP grade_build_nav怎么用?PHP grade_build_nav使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grade_build_nav函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: require_login
}
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;
}
}
示例2: print_error
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'));
}
示例3: get_string
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 . '&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>
示例4: required_param
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);
示例5: grade_tree
$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 {
示例6: required_param
///////////////////////////////////////////////////////////////////////////
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) {
示例7: required_param
// //
// 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}&delete=1\"><img" . " src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a> ";
$line[3] = $buttons;
$data[] = $line;
示例8: print_error
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);
示例9: redirect
$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;
示例10: redirect
$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);
示例11: update_record
$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);
?>