]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15111 label mod converted
authorskodak <skodak>
Tue, 3 Jun 2008 23:44:16 +0000 (23:44 +0000)
committerskodak <skodak>
Tue, 3 Jun 2008 23:44:16 +0000 (23:44 +0000)
mod/label/backuplib.php
mod/label/db/upgrade.php
mod/label/lib.php
mod/label/view.php

index 5918b7ea40f4f1f46ce6830134479e83fc67fdf9..6b075572bd86283eca5c91a97126d153ab887c55 100644 (file)
 
     //This function executes all the backup procedure about this mod
     function label_backup_mods($bf,$preferences) {
-        global $CFG;
+        global $CFG, $DB;
 
         $status = true; 
 
         ////Iterate over label table
-        if ($labels = get_records ("label","course", $preferences->backup_course,"id")) {
+        if ($labels = $DB->get_records ("label","course", array($preferences->backup_course=>"id"))) {
             foreach ($labels as $label) {
                 if (backup_mod_selected($preferences,'label',$label->id)) {
                     $status = label_backup_one_mod($bf,$preferences,$label);
     }
    
     function label_backup_one_mod($bf,$preferences,$label) {
-
-        global $CFG;
+        global $CFG, $DB;
     
         if (is_numeric($label)) {
-            $label = get_record('label','id',$label);
+            $label = $DB->get_record('label', array('id'=>$label));
         }
     
         $status = true;
@@ -59,6 +58,8 @@
 
     ////Return an array of info (name,value)
     function label_check_backup_mods($course,$user_data=false,$backup_unique_code,$instances=null) {
+        global $DB;
+
         if (!empty($instances) && is_array($instances) && count($instances)) {
             $info = array();
             foreach ($instances as $id => $instance) {
@@ -69,7 +70,7 @@
         
          //First the course data
          $info[0][0] = get_string("modulenameplural","label");
-         $info[0][1] = count_records("label", "course", "$course");
+         $info[0][1] = $DB->count_records("label", array("course"=>$course));
          return $info;
     } 
 
index c1046254e77e25990978832d0233e7513dc90fc5..4b7e6b53009df5753d7feb6cee749cf585e52fbe 100644 (file)
@@ -18,7 +18,6 @@
 // using the functions defined in lib/ddllib.php
 
 function xmldb_label_upgrade($oldversion=0) {
-
     global $CFG, $THEME, $DB;
 
     $result = true;
index 9a7d6959c1cecee1a29c5e3d4480a8f6285b78a8..9d36666f6f4737a6e3a094ccacb4e3c5253d5d83 100644 (file)
@@ -74,7 +74,9 @@ function label_get_participants($labelid) {
  * See get_array_of_activities() in course/lib.php
  */
 function label_get_coursemodule_info($coursemodule) {
-    if ($label = get_record('label', 'id', $coursemodule->instance, '', '', '', '', 'id, content, name')) {
+    global $DB;
+
+    if ($label = $DB->get_record('label', array('id'=>$coursemodule->instance), 'id, content, name')) {
         $info = new object();
         $info->extra = urlencode($label->content);
         $info->name = urlencode($label->name);
index f450a55dd3f749932ba9a26f8700f4db4b250854..51261cfc431a1ec768bcf923a5f712736da2e88e 100644 (file)
             print_error("Course Module ID was incorrect");
         }
     
-        if (! $course = get_record("course", "id", $cm->course)) {
+        if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
             print_error("Course is misconfigured");
         }
     
-        if (! $label = get_record("label", "id", $cm->instance)) {
+        if (! $label = $DB->get_record("label", array("id"=>$cm->instance))) {
             print_error("Course module is incorrect");
         }
 
     } else {
-        if (! $label = get_record("label", "id", $l)) {
+        if (! $label = $DB->get_record("label", array("id"=>$l))) {
             print_error("Course module is incorrect");
         }
-        if (! $course = get_record("course", "id", $label->course)) {
+        if (! $course = $DB->get_record("course", array("id"=>$label->course)) ){
             print_error("Course is misconfigured");
         }
         if (! $cm = get_coursemodule_from_instance("label", $label->id, $course->id)) {