]> git.mjollnir.org Git - moodle.git/commitdiff
Changing some more incorrect uses of get_records and count_records with '1'. MDL...
authorstronk7 <stronk7>
Tue, 23 Jan 2007 16:21:21 +0000 (16:21 +0000)
committerstronk7 <stronk7>
Tue, 23 Jan 2007 16:21:21 +0000 (16:21 +0000)
user/profile/index.php
user/profile/lib.php

index 717755eb175caca11ae0e8ac024b247b5f5856fa..ec55cb867294425cb0fa688945cc9e3f3ae4bd2a 100644 (file)
@@ -47,7 +47,7 @@ switch ($action) {
         break;
     case 'deletecategory':
         if ($confirm and confirm_sesskey()) {
-            $categorycount = count_records_select('user_info_category', '1');
+            $categorycount = count_records('user_info_category');
             $fieldcount    = count_records('user_info_field', 'categoryid', $id);
 
             /// Can only delete the last category if there are no fields in it
@@ -118,7 +118,7 @@ if ( ($action == 'editcategory' )) {
         if ($data = $categoryform->get_data()) {
             if ($data->id == 0) {
                 unset($data->id);
-                $data->sortorder = count_records_select('user_info_category', '1') + 1;
+                $data->sortorder = count_records('user_info_category') + 1;
                 if (!insert_record('user_info_category', $data, false)) {
                     error('There was a problem adding the record to the database');
                     exit;
@@ -220,7 +220,7 @@ if ( ($action == 'editcategory' )) {
     print_heading(get_string('profilefields', 'admin'));
 
     /// Check that we have at least one category defined
-    if (count_records_select('user_info_category', '1') == 0) {
+    if (count_records('user_info_category') == 0) {
         unset($defaultcategory);
         $defaultcategory->name = $strdefaultcategory;
         $defaultcategory->sortorder = 1;
@@ -229,8 +229,8 @@ if ( ($action == 'editcategory' )) {
 
     /// We only displaying if there are fields defined or there is a category with a name different to the default name
     if ( ( (count_records_select('user_info_category', "name<>'$strdefaultcategory'") > 0) or
-           (count_records_select('user_info_field', '1') > 0) ) and
-         ( $categories = get_records_select('user_info_category', '1', 'sortorder ASC')) ) {
+           (count_records('user_info_field') > 0) ) and
+         ( $categories = get_records_select('user_info_category', '', 'sortorder ASC')) ) {
 
         
         foreach ($categories as $category) {
@@ -296,7 +296,7 @@ function profile_category_icons ($category) {
     $str->edit     = get_string("edit");
 
     $editstr = '';
-    $categorycount = count_records_select('user_info_category', '1');
+    $categorycount = count_records('user_info_category');
     $fieldcount    = count_records('user_info_field', 'categoryid', $category->id);
 
     /// Edit
index e3e7e420bbf00e1d249bc474c377c24d62322c6e..c8206ca2a8d927f7ead2b15d673da1ee1cd6a1ce 100644 (file)
@@ -524,7 +524,7 @@ function profile_move_category ($id, $move='down') {
     }
 
     /// Count the number of categories
-    $categorycount = count_records_select('user_info_category', '1');
+    $categorycount = count_records('user_info_category');
 
     /// Calculate the new sortorder
     if ( ($move == 'up') and ($category->sortorder > 1)) {
@@ -557,7 +557,7 @@ function profile_move_category ($id, $move='down') {
  * @return   array
  */
 function profile_list_categories() {
-    if ( !($categories = get_records_select_menu('user_info_category', '1', 'sortorder ASC', 'id, name')) ) {
+    if ( !($categories = get_records_select_menu('user_info_category', '', 'sortorder ASC', 'id, name')) ) {
         $categories = array();
     }
     return $categories;