]> git.mjollnir.org Git - moodle.git/commitdiff
quiz editing: MDL-18355 Try to improve the discoverability of Description again.
authortjhunt <tjhunt>
Thu, 26 Feb 2009 06:33:18 +0000 (06:33 +0000)
committertjhunt <tjhunt>
Thu, 26 Feb 2009 06:33:18 +0000 (06:33 +0000)
question/editlib.php
question/type/description/questiontype.php
question/type/questiontype.php
theme/standard/styles_layout.css

index aae052939470167921dd9ce77283b0e469f2218d..fdbbab6b28768ff38ffa99c2359b8e55bb14f568 100644 (file)
@@ -1837,13 +1837,25 @@ function print_choose_qtype_to_add_form($hiddenparams) {
         echo '<input type="hidden" name="' . s($name) . '" value="' . s($value) . '" />' . "\n";
     }
     echo "</div>\n";
-    $types = question_type_menu();
     echo '<div class="qtypes">' . "\n";
     echo '<div class="instruction">' . get_string('selectaqtypefordescription', 'question') . "</div>\n";
+    echo '<div class="realqtypes">' . "\n";
+    $types = question_type_menu();
+    $fakeqtypes = array();
     foreach ($types as $qtype => $localizedname) {
+        if ($QTYPES[$qtype]->is_real_question_type()) {
+            print_qtype_to_add_option($qtype, $localizedname);
+        } else {
+            $fakeqtypes[$qtype] = $localizedname;
+        }
+    }
+    echo "</div>\n";
+    echo '<div class="fakeqtypes">' . "\n";
+    foreach ($fakeqtypes as $qtype => $localizedname) {
         print_qtype_to_add_option($qtype, $localizedname);
     }
     echo "</div>\n";
+    echo "</div>\n";
     echo '<div class="submitbuttons">' . "\n";
     echo '<input type="submit" value="' . get_string('next') . '" id="chooseqtype_submit" />' . "\n";
     echo '<input type="submit" id="chooseqtypecancel" name="addcancel" value="' . get_string('cancel') . '" />' . "\n";
index dd948045c7fb7d1f62f0c0865273d4f6be252576..e1dfff390091e042ab1b12095ec376a6b89eedee 100644 (file)
@@ -1,16 +1,33 @@
 <?php  // $Id$
 
-///////////////////
-/// DESCRIPTION ///
-///////////////////
+///////////////////////////////////////////////////////////////////////////
+//                                                                       //
+// NOTICE OF COPYRIGHT                                                   //
+//                                                                       //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
+//          http://moodle.org                                            //
+//                                                                       //
+// Copyright (C) 1999 onwards Martin Dougiamas  http://dougiamas.com     //
+//                                                                       //
+// This program is free software; you can redistribute it and/or modify  //
+// it under the terms of the GNU General Public License as published by  //
+// the Free Software Foundation; either version 2 of the License, or     //
+// (at your option) any later version.                                   //
+//                                                                       //
+// This program is distributed in the hope that it will be useful,       //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
+// GNU General Public License for more details:                          //
+//                                                                       //
+//          http://www.gnu.org/copyleft/gpl.html                         //
+//                                                                       //
+///////////////////////////////////////////////////////////////////////////
 
-/// QUESTION TYPE CLASS //////////////////
-
-//
-// The question type 'description' is not really a question type
-// and it therefore often sticks to some kind of odd behaviour
-//
 /**
+ * The description question type is not acutally a question, it is just a way
+ * to add some static content in the middle of a quiz, or other place that
+ * questions are used.
+ *
  * @package questionbank
  * @subpackage questiontypes
  */
@@ -20,6 +37,10 @@ class description_qtype extends default_questiontype {
         return 'description';
     }
 
+    function is_real_question_type() {
+        return false;
+    }
+
     function is_usable_by_random() {
         return false;
     }
@@ -32,12 +53,10 @@ class description_qtype extends default_questiontype {
     }
 
     function get_question_options(&$question) {
-        // No options to be restored for this question type
         return true;
     }
 
     function save_question_options($question) {
-        /// No options to be saved for this question type:
         return true;
     }
 
@@ -61,11 +80,6 @@ class description_qtype extends default_questiontype {
     }
 
     function actual_number_of_questions($question) {
-        /// Used for the feature number-of-questions-per-page
-        /// to determine the actual number of questions wrapped
-        /// by this question.
-        /// The question type description is not even a question
-        /// in itself so it will return ZERO!
         return 0;
     }
 
@@ -74,12 +88,7 @@ class description_qtype extends default_questiontype {
         $state->penalty = 0;
         return true;
     }
-
 }
-//// END OF CLASS ////
-
-//////////////////////////////////////////////////////////////////////////
-//// INITIATION - Without this line the question type is not in use... ///
-//////////////////////////////////////////////////////////////////////////
+// Register this question type with questionlib.php.
 question_register_questiontype(new description_qtype());
 ?>
index ccf4ad0ee4e60d69b91f812c442aa90e1491f8df..23e33de9e129d70e1c585c14115b1e4f92647931 100644 (file)
@@ -84,6 +84,15 @@ class default_questiontype {
         return $this->local_name();
     }
 
+    /**
+     * @return boolean override this to return false if this is not really a
+     *      question type, for example the description question type is not
+     *      really a question type.
+     */
+    function is_real_question_type() {
+        return true;
+    }
+
     /**
      * @return boolean true if this question type may require manual grading.
      */
index 34d4d3851957d9681c56f822a684beacb620d6b8..4b522f6cbf6d9f106812bf699f54aaec8f60f832 100644 (file)
@@ -2916,6 +2916,9 @@ body.notes .notesgroup {
 #chooseqtype .instruction {
   display: none;
 }
+#chooseqtype .fakeqtypes {
+  border-top: 1px solid silver;
+}
 #chooseqtype .qtypeoption {
   margin-bottom: 0.5em;
 }