From 3b112723732c42cd16530282a83608f686ef5433 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 1 Jun 2008 15:44:59 +0000 Subject: [PATCH] MDL-14679 removed all instances of get_records_menu() --- course/edit_form.php | 2 +- lib/dmllib.php | 18 ++++++++--- lib/dmllib_todo.php | 72 -------------------------------------------- 3 files changed, 14 insertions(+), 78 deletions(-) diff --git a/course/edit_form.php b/course/edit_form.php index 934f16bd91..706e20ac2b 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -359,7 +359,7 @@ class course_edit_form extends moodleform { $options['1'] = get_string('yes'); $mform->addElement('select', 'restrictmodules', get_string('restrictmodules'), $options); $mods = array(0=>get_string('allownone')); - $mods += get_records_menu('modules', array() ,'name','id, name'); + $mods += $DB->get_records_menu('modules', array(), 'name', 'id, name'); $mform->addElement('select', 'allowedmods', get_string('to'), $mods, diff --git a/lib/dmllib.php b/lib/dmllib.php index c7af985d26..85f684315a 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -382,11 +382,7 @@ function get_field($table, $return, $field1, $value1, $field2='', $value2='', $f - - - - -///// DELETED - must not be used anymore +///// DELETED - must not be used anymore! function configure_dbconnection() { error('configure_dbconnection() removed'); @@ -423,3 +419,15 @@ function where_clause($field1='', $value1='', $field2='', $value2='', $field3='' function execute_sql_arr($sqlarr, $continue=true, $feedback=true) { error('execute_sql_arr() removed'); } + +function get_records_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') { + error('get_records_list() removed'); +} + +function get_recordset_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') { + error('get_recordset_list() removed'); +} + +function get_records_menu($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') { + error('get_records_menu() removed'); +} diff --git a/lib/dmllib_todo.php b/lib/dmllib_todo.php index 3b0476997d..65866c2be0 100644 --- a/lib/dmllib_todo.php +++ b/lib/dmllib_todo.php @@ -341,35 +341,6 @@ function get_recordset_select($table, $select='', $sort='', $fields='*', $limitf return get_recordset_sql('SELECT '. $fields .' FROM '. $CFG->prefix . $table . $select . $sort, $limitfrom, $limitnum); } -/** - * Get a number of records as an ADODB RecordSet. - * - * Only records where $field takes one of the values $values are returned. - * $values should be a comma-separated list of values, for example "4,5,6,10" - * or "'foo','bar','baz'". - * - * Other arguments and the return type as for @see function get_recordset. - * - * @param string $table the table to query. - * @param string $field a field to check (optional). - * @param string $values comma separated list of values the field must have (requred if field is given, else optional). - * @param string $sort an order to sort the results in (optional, a valid SQL ORDER BY parameter). - * @param string $fields a comma separated list of fields to return (optional, by default all fields are returned). - * @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 ADODB RecordSet object, or false if an error occured. - */ -function get_recordset_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - - if ($field) { - $select = "$field IN ($values)"; - } else { - $select = ''; - } - - return get_recordset_select($table, $select, $sort, $fields, $limitfrom, $limitnum); -} - /** * Get a number of records as an ADODB RecordSet. $sql must be a complete SQL query. * Since this method is a little less readable, use of it should be restricted to @@ -623,25 +594,6 @@ function get_records_select($table, $select='', $sort='', $fields='*', $limitfro return recordset_to_array($rs); } -/** - * Get a number of records as an array of objects. - * - * Return value as for @see function get_records. - * - * @param string $table The database table to be checked against. - * @param string $field The field to search - * @param string $values Comma separated list of possible value - * @param string $sort Sort order (as valid SQL sort parameter) - * @param string $fields A comma separated list of fields to be returned from the chosen table. If specified, - * the first field should be a unique one such as 'id' since it will be used as a key in the associative - * array. - * @return mixed an array of objects, or false if no records were found or an error occured. - */ -function get_records_list($table, $field='', $values='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - $rs = get_recordset_list($table, $field, $values, $sort, $fields, $limitfrom, $limitnum); - return recordset_to_array($rs); -} - /** * Get a number of records as an array of objects. * @@ -712,30 +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. - * - * If no errors occur, and at least one records is found, the return value - * is an associative whose keys come from the first field of each record, - * and whose values are the corresponding second fields. If no records are found, - * or an error occurs, false is returned. - * - * @param string $table the table to query. - * @param string $field a field to check (optional). - * @param string $value the value the field must have (requred if field1 is given, else optional). - * @param string $sort an order to sort the results in (optional, a valid SQL ORDER BY parameter). - * @param string $fields a comma separated list of fields to return (optional, by default all fields are returned). - * @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_menu($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') { - $rs = get_recordset($table, $field, $value, $sort, $fields, $limitfrom, $limitnum); - return recordset_to_menu($rs); -} - /** * Get the first two columns from a number of records as an associative array. * -- 2.39.5