Differences Between: [Versions 310 and 311] [Versions 39 and 311]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * Allows a creator to edit custom scales, and also display help about scales 20 * 21 * @copyright 1999 Martin Dougiamas http://dougiamas.com 22 * @deprecated - TODO remove this file or replace it with an alternative solution for scales overview 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 * @package course 25 */ 26 27 require_once("../config.php"); 28 require_once ("lib.php"); 29 30 $id = required_param('id', PARAM_INT); // course id 31 $scaleid = optional_param('scaleid', 0, PARAM_INT); // scale id (show only this one) 32 33 $url = new moodle_url('/course/scales.php', array('id'=>$id)); 34 if ($scaleid !== 0) { 35 $url->param('scaleid', $scaleid); 36 } 37 $PAGE->set_url($url); 38 $PAGE->set_pagelayout('popup'); 39 40 $context = null; 41 if ($course = $DB->get_record('course', array('id'=>$id))) { 42 require_login($course); 43 $context = context_course::instance($course->id); 44 } else { 45 //$id will be 0 for site level scales 46 require_login(); 47 $context = context_system::instance(); 48 } 49 50 $PAGE->set_context($context); 51 require_capability('moodle/course:viewscales', $context); 52 53 $strscales = get_string("scales"); 54 $strcustomscales = get_string("scalescustom"); 55 $strstandardscales = get_string("scalesstandard"); 56 57 $PAGE->set_title($strscales); 58 if (!empty($course)) { 59 $PAGE->set_heading($course->fullname); 60 } else { 61 $PAGE->set_heading($SITE->fullname); 62 } 63 echo $OUTPUT->header(); 64 65 if ($scaleid) { 66 if ($scale = $DB->get_record("scale", array('id'=>$scaleid))) { 67 if ($scale->courseid == 0 || $scale->courseid == $course->id) { 68 69 $scalemenu = make_menu_from_list($scale->scale); 70 71 echo $OUTPUT->box_start(); 72 echo $OUTPUT->heading($scale->name); 73 echo "<center>"; 74 echo html_writer::label(get_string('scales'), 'scaleunused'. $scaleid, false, array('class' => 'accesshide')); 75 echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'scaleunused'.$scaleid)); 76 echo "</center>"; 77 echo text_to_html($scale->description); 78 echo $OUTPUT->box_end(); 79 echo $OUTPUT->close_window_button(); 80 echo $OUTPUT->footer(); 81 exit; 82 } 83 } 84 } 85 86 $systemcontext = context_system::instance(); 87 88 if ($scales = $DB->get_records("scale", array("courseid"=>$course->id), "name ASC")) { 89 echo $OUTPUT->heading($strcustomscales); 90 91 if (has_capability('moodle/course:managescales', $context)) { 92 echo "<p align=\"center\">("; 93 print_string('scalestip2'); 94 echo ")</p>"; 95 } 96 97 foreach ($scales as $scale) { 98 99 $scale->description = file_rewrite_pluginfile_urls($scale->description, 'pluginfile.php', $systemcontext->id, 'grade', 'scale', $scale->id); 100 101 $scalemenu = make_menu_from_list($scale->scale); 102 103 echo $OUTPUT->box_start(); 104 echo $OUTPUT->heading($scale->name); 105 echo "<center>"; 106 echo html_writer::label(get_string('scales'), 'courseunused' . $scale->id, false, array('class' => 'accesshide')); 107 echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'courseunused' . $scale->id)); 108 echo "</center>"; 109 echo text_to_html($scale->description); 110 echo $OUTPUT->box_end(); 111 echo "<hr />"; 112 } 113 114 } else { 115 if (has_capability('moodle/course:managescales', $context)) { 116 echo "<p align=\"center\">("; 117 print_string("scalestip2"); 118 echo ")</p>"; 119 } 120 } 121 122 if ($scales = $DB->get_records("scale", array("courseid"=>0), "name ASC")) { 123 echo $OUTPUT->heading($strstandardscales); 124 foreach ($scales as $scale) { 125 126 $scale->description = file_rewrite_pluginfile_urls($scale->description, 'pluginfile.php', $systemcontext->id, 'grade', 'scale', $scale->id); 127 128 $scalemenu = make_menu_from_list($scale->scale); 129 130 echo $OUTPUT->box_start(); 131 echo $OUTPUT->heading($scale->name); 132 echo "<center>"; 133 echo html_writer::label(get_string('scales'), 'sitescale' . $scale->id, false, array('class' => 'accesshide')); 134 echo html_writer::select($scalemenu, 'unused', '', array('' => 'choosedots'), array('id' => 'sitescale' . $scale->id)); 135 echo "</center>"; 136 echo text_to_html($scale->description); 137 echo $OUTPUT->box_end(); 138 echo "<hr />"; 139 } 140 } 141 142 echo $OUTPUT->close_window_button(); 143 echo $OUTPUT->footer(); 144
title
Description
Body
title
Description
Body
title
Description
Body
title
Body