| Línea 152... |
Línea 152... |
| 152 |
*
|
152 |
*
|
| 153 |
* @param string $field The original field or SQL expression
|
153 |
* @param string $field The original field or SQL expression
|
| 154 |
* @param string|null $sort A valid SQL ORDER BY to sort the concatenated fields, if omitted then $field will be used
|
154 |
* @param string|null $sort A valid SQL ORDER BY to sort the concatenated fields, if omitted then $field will be used
|
| 155 |
* @return string
|
155 |
* @return string
|
| 156 |
*/
|
156 |
*/
|
| 157 |
public static function sql_group_concat_sort(string $field, string $sort = null): string {
|
157 |
public static function sql_group_concat_sort(string $field, ?string $sort = null): string {
|
| 158 |
global $DB;
|
158 |
global $DB;
|
| Línea 159... |
Línea 159... |
| 159 |
|
159 |
|
| 160 |
// Fallback to sorting by the specified field, unless it contains parameters which would be duplicated.
|
160 |
// Fallback to sorting by the specified field, unless it contains parameters which would be duplicated.
|
| 161 |
if ($sort === null && !preg_match('/[:?$]/', $field)) {
|
161 |
if ($sort === null && !preg_match('/[:?$]/', $field)) {
|