moodle/course/scales.php

101 lines
3.3 KiB
PHP
Raw Normal View History

2004-09-12 12:21:27 +00:00
<?php // $Id$
2003-08-15 14:03:25 +00:00
// Allows a creator to edit custom scales, and also display help about scales
require_once("../config.php");
require_once("lib.php");
2003-08-15 14:03:25 +00:00
$id = required_param('id', PARAM_INT); // course id
2008-08-04 07:01:52 +00:00
$scaleid = optional_param('scaleid', 0, PARAM_INT); // scale id (show only this one)
2003-08-15 14:03:25 +00:00
2008-06-01 18:12:24 +00:00
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error("invalidcourseid");
2003-08-15 14:03:25 +00:00
}
require_login($course);
2006-09-20 20:31:09 +00:00
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:viewscales', $context);
2003-08-15 14:03:25 +00:00
$strscale = get_string("scale");
$strscales = get_string("scales");
$strcustomscale = get_string("scalescustom");
$strstandardscale = get_string("scalesstandard");
2003-08-15 14:03:25 +00:00
$strcustomscales = get_string("scalescustom");
$strstandardscales = get_string("scalesstandard");
$strname = get_string("name");
$strdescription = get_string("description");
$strhelptext = get_string("helptext");
$stractivities = get_string("activities");
print_header($strscales);
2008-08-04 07:01:52 +00:00
if ($scaleid) {
2008-09-02 22:20:35 +00:00
if ($scale = $DB->get_record("scale", array('id'=>$scaleid))) {
2008-08-04 07:01:52 +00:00
if ($scale->courseid == 0 || $scale->courseid == $course->id) {
$scalemenu = make_menu_from_list($scale->scale);
print_simple_box_start("center");
print_heading($scale->name);
echo "<center>";
choose_from_menu($scalemenu, "", "", "");
echo "</center>";
echo text_to_html($scale->description);
print_simple_box_end();
close_window_button();
print_footer('empty');
2008-08-04 07:01:52 +00:00
exit;
}
}
}
2008-06-02 08:13:24 +00:00
if ($scales = $DB->get_records("scale", array("courseid"=>$course->id), "name ASC")) {
print_heading($strcustomscales);
2006-02-12 19:46:30 +00:00
if (has_capability('moodle/course:managescales', $context)) {
echo "<p align=\"center\">(";
print_string('scalestip2');
echo ")</p>";
}
foreach ($scales as $scale) {
$scalemenu = make_menu_from_list($scale->scale);
print_simple_box_start("center");
print_heading($scale->name);
echo "<center>";
choose_from_menu($scalemenu, "", "", "");
echo "</center>";
echo text_to_html($scale->description);
print_simple_box_end();
echo "<hr />";
}
} else {
if (has_capability('moodle/course:managescales', $context)) {
echo "<p align=\"center\">(";
print_string("scalestip");
echo ")</p>";
}
}
2008-06-02 08:13:24 +00:00
if ($scales = $DB->get_records("scale", array("courseid"=>0), "name ASC")) {
print_heading($strstandardscales);
foreach ($scales as $scale) {
$scalemenu = make_menu_from_list($scale->scale);
print_simple_box_start("center");
print_heading($scale->name);
echo "<center>";
choose_from_menu($scalemenu, "", "", "");
echo "</center>";
echo text_to_html($scale->description);
print_simple_box_end();
echo "<hr />";
}
}
close_window_button();
print_footer('empty');
2003-08-15 14:03:25 +00:00
?>