Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 89... Línea 89...
89
     * Ensure we can view the report
89
     * Ensure we can view the report
90
     *
90
     *
91
     * @return bool
91
     * @return bool
92
     */
92
     */
93
    protected function can_view(): bool {
93
    protected function can_view(): bool {
-
 
94
        $reportid = $this->get_parameter('reportid', 0, PARAM_INT);
-
 
95
        $report = report::get_record(['id' => $reportid], MUST_EXIST);
-
 
96
 
94
        return permission::can_view_reports_list();
97
        return permission::can_edit_report($report);
95
    }
98
    }
Línea 96... Línea 99...
96
 
99
 
97
    /**
100
    /**
98
     * Dim the table row for disabled schedules
101
     * Dim the table row for disabled schedules
Línea 133... Línea 136...
133
                return $renderer->render_from_template('core/toggle', [
136
                return $renderer->render_from_template('core/toggle', [
134
                    'id' => 'schedule-toggle-' . $row->id,
137
                    'id' => 'schedule-toggle-' . $row->id,
135
                    'checked' => $row->enabled,
138
                    'checked' => $row->enabled,
136
                    'dataattributes' => $attributes,
139
                    'dataattributes' => $attributes,
137
                    'label' => $label,
140
                    'label' => $label,
138
                    'labelclasses' => 'sr-only'
141
                    'labelclasses' => 'visually-hidden',
139
                ]);
142
                ]);
140
            })
143
            })
141
        );
144
        );
Línea 142... Línea 145...
142
 
145
 
Línea 156... Línea 159...
156
                $editable = new schedule_name_editable(0, new schedule(0, $schedule));
159
                $editable = new schedule_name_editable(0, new schedule(0, $schedule));
157
                return $editable->render($PAGE->get_renderer('core'));
160
                return $editable->render($PAGE->get_renderer('core'));
158
            })
161
            })
159
        );
162
        );
Línea 160... Línea -...
160
 
-
 
161
        // Time scheduled column.
-
 
162
        $this->add_column((new column(
-
 
163
            'timescheduled',
-
 
164
            new lang_string('startingfrom'),
-
 
165
            $this->get_schedule_entity_name()
-
 
166
        ))
-
 
167
            ->set_type(column::TYPE_TIMESTAMP)
-
 
168
            ->add_fields("{$tablealias}.timescheduled")
-
 
169
            ->set_is_sortable(true)
-
 
170
            ->add_callback([format::class, 'userdate'])
-
 
171
        );
-
 
172
 
163
 
173
        // Time last sent column.
164
        // Time last sent column.
174
        $this->add_column((new column(
165
        $this->add_column((new column(
175
            'timelastsent',
166
            'timelastsent',
176
            new lang_string('timelastsent', 'core_reportbuilder'),
167
            new lang_string('timelastsent', 'core_reportbuilder'),
Línea 186... Línea 177...
186
 
177
 
187
                return format::userdate($timelastsent, $row);
178
                return format::userdate($timelastsent, $row);
188
            })
179
            })
Línea -... Línea 180...
-
 
180
        );
-
 
181
 
-
 
182
        // Time next send column.
-
 
183
        $this->add_column((new column(
-
 
184
            'timenextsend',
-
 
185
            new lang_string('timenextsend', 'core_reportbuilder'),
-
 
186
            $this->get_schedule_entity_name()
-
 
187
        ))
-
 
188
            ->set_type(column::TYPE_TIMESTAMP)
-
 
189
            ->add_fields("{$tablealias}.timenextsend")
-
 
190
            ->set_is_sortable(true)
-
 
191
            ->add_callback(static function(int $timenextsend, stdClass $row): string {
-
 
192
                if ($timenextsend < time()) {
-
 
193
                    return get_string('never');
-
 
194
                }
-
 
195
 
-
 
196
                return format::userdate($timenextsend, $row);
-
 
197
            })
189
        );
198
        );
190
 
199
 
191
        // Format column.
200
        // Format column.
192
        $this->add_column((new column(
201
        $this->add_column((new column(
193
            'format',
202
            'format',
Línea 251... Línea 260...
251
            new lang_string('name'),
260
            new lang_string('name'),
252
            $this->get_schedule_entity_name(),
261
            $this->get_schedule_entity_name(),
253
            "{$tablealias}.name"
262
            "{$tablealias}.name"
254
        )));
263
        )));
Línea 255... Línea 264...
255
 
264
 
256
        // Time created filter.
265
        // Time last sent filter.
257
        $this->add_filter((new filter(
266
        $this->add_filter((new filter(
258
            date::class,
267
            date::class,
259
            'timelastsent',
268
            'timelastsent',
260
            new lang_string('timelastsent', 'core_reportbuilder'),
269
            new lang_string('timelastsent', 'core_reportbuilder'),
261
            $this->get_schedule_entity_name(),
270
            $this->get_schedule_entity_name(),
262
            "{$tablealias}.timelastsent"
271
            "{$tablealias}.timelastsent"
263
        ))
272
        ))
264
            ->set_limited_operators([
273
            ->set_limited_operators([
265
                date::DATE_ANY,
274
                date::DATE_ANY,
-
 
275
                date::DATE_EMPTY,
266
                date::DATE_EMPTY,
276
                date::DATE_NOT_EMPTY,
267
                date::DATE_RANGE,
277
                date::DATE_RANGE,
-
 
278
                date::DATE_BEFORE,
268
                date::DATE_PREVIOUS,
279
                date::DATE_LAST,
269
                date::DATE_CURRENT,
280
                date::DATE_CURRENT,
270
            ])
281
            ])
Línea -... Línea 282...
-
 
282
        );
-
 
283
 
-
 
284
        // Time next send filter.
-
 
285
        $this->add_filter((new filter(
-
 
286
            date::class,
-
 
287
            'timenextsend',
-
 
288
            new lang_string('timenextsend', 'core_reportbuilder'),
-
 
289
            $this->get_schedule_entity_name(),
-
 
290
            "{$tablealias}.timenextsend"
-
 
291
        ))
-
 
292
            ->set_limited_operators([
-
 
293
                date::DATE_ANY,
-
 
294
                date::DATE_RANGE,
-
 
295
                date::DATE_PAST,
-
 
296
                date::DATE_NEXT,
-
 
297
                date::DATE_AFTER,
-
 
298
                date::DATE_CURRENT,
271
        );
299
            ])
Línea 272... Línea 300...
272
 
300
        );
273
    }
301
    }
274
 
302