Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 175... Línea 175...
175
     * Check if the user has permission to submit a particular h5pactivity for a specific user.
175
     * Check if the user has permission to submit a particular h5pactivity for a specific user.
176
     *
176
     *
177
     * @param stdClass|null $user user record (default $USER)
177
     * @param stdClass|null $user user record (default $USER)
178
     * @return bool if the user has permission to submit in this activity
178
     * @return bool if the user has permission to submit in this activity
179
     */
179
     */
180
    public function can_submit(stdClass $user = null): bool {
180
    public function can_submit(?stdClass $user = null): bool {
181
        global $USER;
181
        global $USER;
Línea 182... Línea 182...
182
 
182
 
183
        if (empty($user)) {
183
        if (empty($user)) {
184
            $user = $USER;
184
            $user = $USER;
Línea 190... Línea 190...
190
     * Check if a user can see the activity attempts list.
190
     * Check if a user can see the activity attempts list.
191
     *
191
     *
192
     * @param stdClass|null $user user record (default $USER)
192
     * @param stdClass|null $user user record (default $USER)
193
     * @return bool if the user can see the attempts link
193
     * @return bool if the user can see the attempts link
194
     */
194
     */
195
    public function can_view_all_attempts(stdClass $user = null): bool {
195
    public function can_view_all_attempts(?stdClass $user = null): bool {
196
        global $USER;
196
        global $USER;
197
        if (!$this->instance->enabletracking) {
197
        if (!$this->instance->enabletracking) {
198
            return false;
198
            return false;
199
        }
199
        }
200
        if (empty($user)) {
200
        if (empty($user)) {
Línea 207... Línea 207...
207
     * Check if a user can see own attempts.
207
     * Check if a user can see own attempts.
208
     *
208
     *
209
     * @param stdClass|null $user user record (default $USER)
209
     * @param stdClass|null $user user record (default $USER)
210
     * @return bool if the user can see the own attempts link
210
     * @return bool if the user can see the own attempts link
211
     */
211
     */
212
    public function can_view_own_attempts(stdClass $user = null): bool {
212
    public function can_view_own_attempts(?stdClass $user = null): bool {
213
        global $USER;
213
        global $USER;
214
        if (!$this->instance->enabletracking) {
214
        if (!$this->instance->enabletracking) {
215
            return false;
215
            return false;
216
        }
216
        }
217
        if (empty($user)) {
217
        if (empty($user)) {
Línea 300... Línea 300...
300
     * Check get_active_users_join PHPdoc to a more detailed description of "active users".
300
     * Check get_active_users_join PHPdoc to a more detailed description of "active users".
301
     *
301
     *
302
     * @param int|null $userid optional user id (default null)
302
     * @param int|null $userid optional user id (default null)
303
     * @return int the total amount of attempts
303
     * @return int the total amount of attempts
304
     */
304
     */
305
    public function count_attempts(int $userid = null): int {
305
    public function count_attempts(?int $userid = null): int {
306
        global $DB;
306
        global $DB;
Línea 307... Línea 307...
307
 
307
 
308
        // Counting records is enough for one user.
308
        // Counting records is enough for one user.
309
        if ($userid) {
309
        if ($userid) {
Línea 458... Línea 458...
458
     * @param int $userid an opional userid to show
458
     * @param int $userid an opional userid to show
459
     * @param int $attemptid an optional $attemptid to show
459
     * @param int $attemptid an optional $attemptid to show
460
     * @param int|bool $currentgroup False if groups not used, 0 for all groups, group id (int) to filter by specific group
460
     * @param int|bool $currentgroup False if groups not used, 0 for all groups, group id (int) to filter by specific group
461
     * @return report|null available report (or null if no report available)
461
     * @return report|null available report (or null if no report available)
462
     */
462
     */
463
    public function get_report(int $userid = null, int $attemptid = null, $currentgroup = false): ?report {
463
    public function get_report(?int $userid = null, ?int $attemptid = null, $currentgroup = false): ?report {
464
        global $USER, $CFG;
464
        global $USER, $CFG;
Línea 465... Línea 465...
465
 
465
 
Línea 466... Línea 466...
466
        require_once("{$CFG->dirroot}/user/lib.php");
466
        require_once("{$CFG->dirroot}/user/lib.php");