$this->instance_config_commit();
}
+ $limitfrom = 0;
+ $limitnum = 1;
+
switch ($this->config->type) {
case BGR_RANDOMLY:
$i = rand(1,$numberofentries);
- $LIMIT = sql_paging_limit($i-1, 1);
+ $limitfrom = $i-1;
$SORT = 'ASC';
break;
if ($i > $numberofentries) { // Loop back to beginning
$i = 1;
}
- $LIMIT = sql_paging_limit($i-1, 1);
+ $limitfrom = $i-1;
$SORT = 'ASC';
break;
default: // BGR_LASTMODIFIED
$i = $numberofentries;
- $LIMIT = 'LIMIT 1'; // The last one
+ $limitfrom = 0;
$SORT = 'DESC';
break;
}
' FROM '.$CFG->prefix.'glossary_entries'.
' WHERE glossaryid = '.$this->config->glossary.
' AND approved = 1 '.
- 'ORDER BY timemodified '.$SORT.' '.$LIMIT)) {
+ 'ORDER BY timemodified '.$SORT, $limitfrom, $limitnum)) {
$entry = reset($entry);
}
+ $limitfrom = 0;
+ $limitnum = 0;
+
if ($fetchstart !== '' && $limit) {
- $limit = sql_paging_limit($fetchstart, $fetchlimit);
- } else {
- $limit = '';
+ $limitfrom = $fetchstart;
+ $limitnum = $fetchlimit;
}
$orderby = ' ORDER BY '. $sort .' ';
//echo 'Debug: BlogFilter fetch_entries() sql="'. $SQL . $orderby . $limit .'"<br />'. $this->categoryid; //debug
- $records = get_records_sql($SQL . $orderby . $limit);
+ $records = get_records_sql($SQL . $orderby, $limitfrom, $limitnum);
// print_object($records); //debug
$table->initialbars($totalcount > $perpage);
$table->pagesize($perpage, $matchcount);
- if($table->get_page_start() !== '' && $table->get_page_size() !== '') {
- $sql .= ' '.sql_paging_limit($table->get_page_start(), $table->get_page_size());
- }
-
- if (!$users = get_records_sql($sql)) {
+ if (!$users = get_records_sql($sql, $table->get_page_start(), $table->get_page_size())) {
$users = array(); // tablelib will handle saying 'Nothing to display' for us.
}
$totalcount = count_records_sql('SELECT COUNT(*) ' . $from . $where);
$table->initialbars($totalcount > $perpage);
$table->pagesize($perpage, $totalcount);
- if ($table->get_page_start() !== '' && $table->get_page_size() !== '') {
- $limit = ' ' . sql_paging_limit($table->get_page_start(), $table->get_page_size());
- }
- else {
- $limit = '';
- }
- if ($records = get_records_sql($select . $from . $where . $sort . $limit)) {
+ if ($records = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
foreach ($records as $record) {
$actionstatus = authorize_get_status_action($record);
$color = authorize_get_status_color($actionstatus->status);
global $CFG;
- if ($recordsperpage) {
- $limit = sql_paging_limit($page, $recordsperpage);
- } else {
- $limit = '';
- }
$LIKE = sql_ilike();
$fullname = sql_fullname();
/// warning: will return UNCONFIRMED USERS
return get_records_sql("SELECT id, username, email, firstname, lastname, city, country, lastaccess, confirmed
FROM {$CFG->prefix}user
- WHERE $select $sort $limit ");
+ WHERE $select $sort", $page, $recordsperpage);
}
global $CFG;
- $limit = sql_paging_limit($page, $recordsperpage);
-
//to allow case-insensitive search for postgesql
if ($CFG->dbtype == 'postgres7') {
$LIKE = 'ILIKE';
$totalcount = count_records_sql('SELECT COUNT(*) FROM '. $selectsql);
- $courses = get_records_sql('SELECT * FROM '. $selectsql .' ORDER BY '. $sort .' '. $limit);
+ $courses = get_records_sql('SELECT * FROM '. $selectsql .' ORDER BY '. $sort, $page, $recordsperpage);
if ($courses) { /// Remove unavailable courses from the list
foreach ($courses as $key => $course) {
$sort = 'ORDER BY '.$sort.' ';
}
- $limit = sql_paging_limit($offset+1, 1);
-
$nextid = 0;
- if (($auser = get_record_sql($select.$sql.$sort.$limit, false, true)) !== false) {
+ if (($auser = get_records_sql($select.$sql.$sort, $offset+1, 1)) !== false) {
$nextid = $auser->id;
}
$table->pagesize($perpage, count($users));
- if($table->get_page_start() !== '' && $table->get_page_size() !== '') {
- $limit = ' '.sql_paging_limit($table->get_page_start(), $table->get_page_size());
- }
- else {
- $limit = '';
- }
-
///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
$offset = $page * $perpage;
$strgrade = get_string('grade');
$grademenu = make_grades_menu($this->assignment->grade);
- if (($ausers = get_records_sql($select.$sql.$sort.$limit)) !== false) {
+ if (($ausers = get_records_sql($select.$sql.$sort, $table->get_page_start(), $table->get_page_size())) !== false) {
foreach ($ausers as $auser) {
$picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true);