Added the option to random order the dynamic get result set. gh-348

This commit is contained in:
2018-09-29 02:57:11 +02:00
parent 1447e06dd7
commit fdd1cf7390
9 changed files with 22 additions and 11 deletions

View File

@ -2075,9 +2075,17 @@ class Interpretation extends Fields
foreach ($order as $or)
{
list($as, $field) = array_map('trim', explode('.', $or['table_key']));
// set the string
$string = "\$query->order('" . $or['table_key'] . " " . $or['direction'] . "');";
// check if random
if ('RAND' === $or['direction'])
{
// set the string
$string = "\$query->order('RAND()');";
}
else
{
// set the string
$string = "\$query->order('" . $or['table_key'] . " " . $or['direction'] . "');";
}
// sort where
if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
{