Skip to content

Commit

Permalink
Merge branch 'MDL-50710-master' of git://github.com/marinaglancy/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao authored and stronk7 committed Dec 3, 2015
2 parents 935b954 + f7ff14a commit 76bcec2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions blocks/glossary_random/block_glossary_random.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ function specialization() {
$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:
Expand All @@ -104,11 +103,10 @@ function specialization() {
$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 {
Expand All @@ -118,20 +116,19 @@ function specialization() {
$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);

Expand Down

0 comments on commit 76bcec2

Please sign in to comment.