[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/course/ -> scales.php (source)

   1  <?php // $Id: scales.php,v 1.32.2.1 2008/08/04 07:00:08 moodler Exp $
   2        // Allows a creator to edit custom scales, and also display help about scales
   3  
   4      require_once("../config.php");
   5      require_once ("lib.php");
   6  
   7      $id   = required_param('id', PARAM_INT);               // course id
   8      $scaleid  = optional_param('scaleid', 0, PARAM_INT);   // scale id (show only this one)
   9  
  10      if (! $course = get_record("course", "id", $id)) {
  11          error("Course ID was incorrect");
  12      }
  13  
  14      require_login($course);
  15      $context = get_context_instance(CONTEXT_COURSE, $course->id);
  16      require_capability('moodle/course:viewscales', $context);
  17  
  18      $strscale = get_string("scale");
  19      $strscales = get_string("scales");
  20      $strcustomscale = get_string("scalescustom");
  21      $strstandardscale = get_string("scalesstandard");
  22      $strcustomscales = get_string("scalescustom");
  23      $strstandardscales = get_string("scalesstandard");
  24      $strname = get_string("name");
  25      $strdescription = get_string("description");
  26      $strhelptext = get_string("helptext");
  27      $stractivities = get_string("activities");
  28  
  29      print_header($strscales);
  30  
  31      if ($scaleid) {
  32          if ($scale = get_record("scale", 'id', $scaleid)) {
  33              if ($scale->courseid == 0 || $scale->courseid == $course->id) {
  34  
  35                  $scalemenu = make_menu_from_list($scale->scale);
  36  
  37                  print_simple_box_start("center");
  38                  print_heading($scale->name);
  39                  echo "<center>";
  40                  choose_from_menu($scalemenu, "", "", "");
  41                  echo "</center>";
  42                  echo text_to_html($scale->description);
  43                  print_simple_box_end();
  44                  close_window_button();
  45                  exit;
  46              }
  47          }
  48      }
  49  
  50      if ($scales = get_records("scale", "courseid", "$course->id", "name ASC")) {
  51          print_heading($strcustomscales);
  52  
  53          if (has_capability('moodle/course:managescales', $context)) {
  54              echo "<p align=\"center\">(";
  55              print_string("scalestip");
  56              echo ")</p>";
  57          }
  58  
  59          foreach ($scales as $scale) {
  60              $scalemenu = make_menu_from_list($scale->scale);
  61  
  62              print_simple_box_start("center");
  63              print_heading($scale->name);
  64              echo "<center>";
  65              choose_from_menu($scalemenu, "", "", "");
  66              echo "</center>";
  67              echo text_to_html($scale->description);
  68              print_simple_box_end();
  69              echo "<hr />";
  70          }
  71  
  72      } else {
  73          if (has_capability('moodle/course:managescales', $context)) {
  74              echo "<p align=\"center\">(";
  75              print_string("scalestip");
  76              echo ")</p>";
  77          }
  78      }
  79  
  80      if ($scales = get_records("scale", "courseid", "0", "name ASC")) {
  81          print_heading($strstandardscales);
  82          foreach ($scales as $scale) {
  83              $scalemenu = make_menu_from_list($scale->scale);
  84  
  85              print_simple_box_start("center");
  86              print_heading($scale->name);
  87              echo "<center>";
  88              choose_from_menu($scalemenu, "", "", "");
  89              echo "</center>";
  90              echo text_to_html($scale->description);
  91              print_simple_box_end();
  92              echo "<hr />";
  93          }
  94      }
  95  
  96      close_window_button();
  97      exit;
  98  
  99  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7