mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
Merge branch 'MDL-50710-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
commit
76bcec2cb1
@ -84,14 +84,13 @@ class block_glossary_random extends block_base {
|
||||
$limitfrom = 0;
|
||||
$limitnum = 1;
|
||||
|
||||
$BROWSE = 'timemodified';
|
||||
$orderby = 'timemodified ASC';
|
||||
|
||||
switch ($this->config->type) {
|
||||
|
||||
case BGR_RANDOMLY:
|
||||
$i = rand(1,$numberofentries);
|
||||
$limitfrom = $i-1;
|
||||
$SORT = 'ASC';
|
||||
break;
|
||||
|
||||
case BGR_NEXTONE:
|
||||
@ -104,11 +103,10 @@ class block_glossary_random extends block_base {
|
||||
$i = 1;
|
||||
}
|
||||
$limitfrom = $i-1;
|
||||
$SORT = 'ASC';
|
||||
break;
|
||||
|
||||
case BGR_NEXTALPHA:
|
||||
$BROWSE = 'concept';
|
||||
$orderby = 'concept ASC';
|
||||
if (isset($this->config->previous)) {
|
||||
$i = $this->config->previous + 1;
|
||||
} else {
|
||||
@ -118,20 +116,19 @@ class block_glossary_random extends block_base {
|
||||
$i = 1;
|
||||
}
|
||||
$limitfrom = $i-1;
|
||||
$SORT = 'ASC';
|
||||
break;
|
||||
|
||||
default: // BGR_LASTMODIFIED
|
||||
$i = $numberofentries;
|
||||
$limitfrom = 0;
|
||||
$SORT = 'DESC';
|
||||
$orderby = 'timemodified DESC, id DESC';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($entry = $DB->get_records_sql("SELECT id, concept, definition, definitionformat, definitiontrust
|
||||
FROM {glossary_entries}
|
||||
WHERE glossaryid = ? AND approved = 1
|
||||
ORDER BY $BROWSE $SORT", array($this->config->glossary), $limitfrom, $limitnum)) {
|
||||
ORDER BY $orderby", array($this->config->glossary), $limitfrom, $limitnum)) {
|
||||
|
||||
$entry = reset($entry);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user