Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 103... Línea 103...
103
            'outerwhere' => $outerwhere,
103
            'outerwhere' => $outerwhere,
104
            'innerwhere' => $innerwhere,
104
            'innerwhere' => $innerwhere,
105
            'params' => $params,
105
            'params' => $params,
106
        ] = $this->get_participants_sql($additionalwhere, $additionalparams);
106
        ] = $this->get_participants_sql($additionalwhere, $additionalparams);
Línea 107... Línea 107...
107
 
107
 
108
        $sql = "{$outerselect}
108
        $select = "{$outerselect}
109
                          FROM ({$innerselect}
109
                        FROM ({$innerselect}
110
                                          FROM {$innerjoins}
110
                                FROM {$innerjoins}
111
                                 {$innerwhere}
111
                              {$innerwhere}
112
                               ) {$subqueryalias}
112
                        ) {$subqueryalias}
113
                 {$outerjoins}
113
                   {$outerjoins}
-
 
114
                   {$outerwhere}";
-
 
115
        return $DB->get_counted_recordset_sql(
-
 
116
            sql: $select,
114
                 {$outerwhere}
117
            fullcountcolumn: 'fullcount',
115
                       {$sort}";
-
 
-
 
118
            sort: $sort,
116
 
119
            params: $params,
-
 
120
            limitfrom: $limitfrom,
-
 
121
            limitnum: $limitnum,
117
        return $DB->get_recordset_sql($sql, $params, $limitfrom, $limitnum);
122
        );
Línea 118... Línea 123...
118
    }
123
    }
119
 
124
 
120
    /**
125
    /**
-
 
126
     * Returns the total number of participants for a given course.
-
 
127
     *
-
 
128
     * @deprecated Moodle 4.5 MDL-78030 - No longer used since the total count can be obtained from {@see ::get_participants()}.
121
     * Returns the total number of participants for a given course.
129
     * @todo Final deprecation on Moodle 6.0 MDL-82441.
122
     *
130
     *
123
     * @param string $additionalwhere Any additional SQL to add to where.
131
     * @param string $additionalwhere Any additional SQL to add to where.
124
     * @param array $additionalparams The additional params used by $additionalwhere.
132
     * @param array $additionalparams The additional params used by $additionalwhere.
-
 
133
     * @return int
-
 
134
     */
-
 
135
    #[\core\attribute\deprecated(
-
 
136
        'participants_search::get_participants()',
-
 
137
        since: '4.5',
-
 
138
        mdl: 'MDL-78030',
125
     * @return int
139
        reason: 'No longer used since the total count can be obtained from {@see ::get_participants()}',
-
 
140
    )]
-
 
141
    public function get_total_participants_count(string $additionalwhere = '', array $additionalparams = []): int {
-
 
142
 
126
     */
143
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
Línea 127... Línea 144...
127
    public function get_total_participants_count(string $additionalwhere = '', array $additionalparams = []): int {
144
 
128
        global $DB;
145
        global $DB;
129
 
146
 
Línea 311... Línea 328...
311
                case $this->filterset::JOINTYPE_NONE:
328
                case $this->filterset::JOINTYPE_NONE:
312
                    $wherenot = ' NOT ';
329
                    $wherenot = ' NOT ';
313
                    $wheresjoin = ' AND NOT ';
330
                    $wheresjoin = ' AND NOT ';
Línea 314... Línea 331...
314
 
331
 
315
                    // Some of the $where conditions may begin with `NOT` which results in `AND NOT NOT ...`.
332
                    // Some of the $where conditions may begin with `NOT` which results in `AND NOT NOT ...`.
316
                    // To prevent this from breaking on Oracle the inner WHERE clause is wrapped in brackets, making it
333
                    // To ensure consistent SQL syntax across databases, the inner WHERE clause is wrapped in brackets,
317
                    // `AND NOT (NOT ...)` which is valid in all DBs.
334
                    // making it `AND NOT (NOT ...)`, which is valid and improves readability.
318
                    $wheres = array_map(function($where) {
335
                    $wheres = array_map(function($where) {
319
                        return "({$where})";
336
                        return "({$where})";
Línea 320... Línea 337...
320
                    }, $wheres);
337
                    }, $wheres);