]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 removed all instances of get_records_select_menu()
authorskodak <skodak>
Sun, 1 Jun 2008 15:52:12 +0000 (15:52 +0000)
committerskodak <skodak>
Sun, 1 Jun 2008 15:52:12 +0000 (15:52 +0000)
blocks/glossary_random/block_glossary_random.php
lib/dmllib.php
lib/dmllib_todo.php
lib/questionlib.php
mod/feedback/lib.php
mod/scorm/locallib.php
question/category_class.php
question/contextmove.php

index 855ae7df57108fdaae405d0b5d39d7a2f97bf134..6fa57e51a25a14a3ca044984ff7c00c1e74caec0 100644 (file)
@@ -109,7 +109,7 @@ class block_glossary_random extends block_base {
     }
 
     function instance_config_print() {
-        global $CFG;
+        global $CFG, $DB;
 
         if (!isset($this->config)) {
             // ... teacher has not yet configured the block, let's put some default values here to explain things
@@ -123,7 +123,7 @@ class block_glossary_random extends block_base {
         }
 
         // select glossaries to put in dropdown box ...
-        $glossaries = get_records_select_menu('glossary', 'course='.$this->course->id,'name','id,name');
+        $glossaries = $DB->get_records_menu('glossary', array('course'=>$this->course->id),'name','id,name');
 
         //format menu texts to avoid html and to filter multilang values
         if(!empty($glossaries)) {
index 85f684315adfb39954725ff686422e066ee55c33..50d56bf73f7c8b54d036209d27f98b77db5269fc 100644 (file)
@@ -431,3 +431,7 @@ function get_recordset_list($table, $field='', $values='', $sort='', $fields='*'
 function get_records_menu($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
     error('get_records_menu() removed');
 }
+
+function get_records_select_menu($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
+    error('get_records_select_menu() removed');
+}
index 65866c2be0907f1e55c7cba61e13eb55877cb9e1..888df948a328d755faba820845da1afd6c776a5a 100644 (file)
@@ -664,25 +664,6 @@ function records_to_menu($records, $field1, $field2) {
     }
 }
 
-/**
- * Get the first two columns from a number of records as an associative array.
- *
- * Arguments as for @see function get_recordset_select.
- * Return value as for @see function get_records_menu.
- *
- * @param string $table The database table to be checked against.
- * @param string $select A fragment of SQL to be used in a where clause in the SQL call.
- * @param string $sort Sort order (optional) - a valid SQL order parameter
- * @param string $fields A comma separated list of fields to be returned from the chosen table.
- * @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
- * @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
- * @return mixed an associative array, or false if no records were found or an error occured.
- */
-function get_records_select_menu($table, $select='', $sort='', $fields='*', $limitfrom='', $limitnum='') {
-    $rs = get_recordset_select($table, $select, $sort, $fields, $limitfrom, $limitnum);
-    return recordset_to_menu($rs);
-}
-
 /**
  * Get the first two columns from a number of records as an associative array.
  *
index 008d28e9f3c5ef2ad83f3701f45f49911eda2f39..6b6d03dbde7d9ccf0dae6d56d4e02eb52dc99ddc 100644 (file)
@@ -556,6 +556,8 @@ function question_delete_course($course, $feedback=true) {
  * @return boolean
  */
 function question_delete_course_category($category, $newcategory, $feedback=true) {
+    global $DB;
+
     $context = get_context_instance(CONTEXT_COURSECAT, $category->id);
     if (empty($newcategory)) {
         $feedbackdata   = array(); // To store feedback to be showed at the end of the process
@@ -578,7 +580,7 @@ function question_delete_course_category($category, $newcategory, $feedback=true
                     // still in use somehow, even though quizzes in courses in this category will
                     // already have been deteted. This could happen, for example, if questions are
                     // added to a course, and then that course is moved to another category (MDL-14802).
-                    $questionids = get_records_select_menu('question', 'category = ' . $category->id, '', 'id,1');
+                    $questionids = $DB->get_records_menu('question', array('category'=>$category->id), '', 'id,1');
                     if (!empty($questionids)) {
                         if (!$rescueqcategory = question_save_from_deletion(implode(',', array_keys($questionids)),
                                 get_parent_contextid($context), print_context_name($context), $rescueqcategory)) {
index 72f4d87254c2a7470ef0fb3d61ea0631416f9988..80f5b8a4c9f740bfe59476e869ca3115bc2e4263 100644 (file)
@@ -1029,7 +1029,9 @@ function feedback_create_pagebreak($feedbackid) {
  *  @return array all ordered pagebreak positions
  */
 function feedback_get_all_break_positions($feedbackid) {
-    if(!$allbreaks = get_records_select_menu('feedback_item', "typ = 'pagebreak' AND feedback = ".$feedbackid, 'position', 'id, position')) return false;
+    global $DB;
+
+    if(!$allbreaks = $DB->get_records_menu('feedback_item', array('typ'=>'pagebreak', 'feedback'=>$feedbackid), 'position', 'id, position')) return false;
     return array_values($allbreaks);
 }
 
@@ -1359,16 +1361,15 @@ function feedback_get_group_values($item, $groupid = false, $courseid = false){
  *  @return boolean true if the feedback already is submitted otherwise false
  */
 function feedback_is_already_submitted($feedbackid, $courseid = false) {
-    global $USER;
+    global $USER, $DB;
     
-    $select = 'userid = '.$USER->id.' AND feedback = '.$feedbackid;
-    if(!$trackings = get_records_select_menu('feedback_tracking', $select, '', 'id, completed')) {
+    if (!$trackings = $DB->get_records_menu('feedback_tracking', array('userid'=>$USER->id, 'feedback'=>$feedbackid), '', 'id, completed')) {
         return false;
     }
 
     if($courseid) {
-        $select = 'completed IN ('.implode(',',$trackings).') AND course_id = '.$courseid;
-        if(!$values = get_records_select('feedback_value', $select)) {
+        $select = 'completed IN ('.implode(',',$trackings).') AND course_id = ?';
+        if(!$values = $DB->get_records_select('feedback_value', $select, array($courseid))) {
             return false;
         }
     }
index bb368b3e1cde14d5ad5a9b4b9d752f0d829ffe6f..f9ae7fd56e72678de75f567a4197af197efcc51b 100755 (executable)
@@ -485,7 +485,7 @@ function scorm_course_format_display($user,$course) {
 }
 
 function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
-    global $CFG;
+    global $CFG, $DB;
 
     if ($scorm->updatefreq == UPDATE_EVERYTIME){
         require_once($CFG->dirroot.'/mod/scorm/lib.php');
@@ -503,7 +503,7 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
     if (empty($organization)) {
         $organization = $scorm->launch;
     }
-    if ($orgs = get_records_select_menu('scorm_scoes',"scorm='$scorm->id' AND organization='' AND launch=''",'id','id,title')) {
+    if ($orgs = $DB->get_records_select_menu('scorm_scoes', array('scorm'=>$scorm->id, 'organization'=>'', 'launch'=>''), 'id', 'id,title')) {
         if (count($orgs) > 1) {
  ?>
             <div class='center'>
index ca3c513faaaa4ef42b44468ab305b03ea919f670..9a914028577d424bec38a0ec35a471a0acc75a6a 100644 (file)
@@ -352,7 +352,8 @@ class question_category_object {
     }
 
     function move_questions($oldcat, $newcat){
-        $questionids = get_records_select_menu('question', "category = $oldcat AND (parent = 0 OR parent = id)", '', 'id,1');
+        global $DB;
+        $questionids = $DB->get_records_select_menu('question', "category = ? AND (parent = 0 OR parent = id)", array($oldcat), '', 'id,1');
         if (!question_move_questions_to_category(implode(',', array_keys($questionids)), $newcat)) {
             print_error('errormovingquestions', 'question', $returnurl, $ids);
         }
index d4fede6b3f703d8928bc4350c4db613ca9d8432f..4b6f165afb0bc509cf8937e214173b4450a58359 100644 (file)
         }
 
         //adjust sortorder before we make the cat a peer of it's new peers
-        $peers = get_records_select_menu('question_categories', "contextid = {$toparent->contextid} AND ".
-                                                                 "parent = {$toparent->id}", "sortorder ASC",
-                                                                 "id, id");
+        $peers = $DB->get_records_select_menu('question_categories', "contextid = ? AND parent = ?", array($toparent->contextid, $toparent->id), 
+                                                                     "sortorder ASC", "id, id");
         $peers = array_keys($peers);
         if ($totop){
            array_unshift($peers, $cattomove->id);