Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 94... Línea 94...
94
                            ),
94
                            ),
95
                            get_string('runclassname', 'tool_task')
95
                            get_string('runclassname', 'tool_task')
96
                        ),
96
                        ),
97
                        'task-runnow'
97
                        'task-runnow'
98
                    );
98
                    );
-
 
99
                    $duecontent .= html_writer::div(
-
 
100
                        html_writer::link(
-
 
101
                            new moodle_url(
-
 
102
                                $adhocrunurl,
-
 
103
                                ['classname' => $classname, 'dueonly' => 1]
-
 
104
                            ),
-
 
105
                            get_string('runclassnamedueonly', 'tool_task')
-
 
106
                        ),
-
 
107
                        'task-runnow'
-
 
108
                    );
99
                }
109
                }
Línea 100... Línea 110...
100
 
110
 
101
                // Mark cell if has failed tasks.
111
                // Mark cell if has failed tasks.
102
                $failed = $stats['failed'];
112
                $failed = $stats['failed'];
Línea 231... Línea 241...
231
     * @param bool $wantruntasks add 'Run now' link
241
     * @param bool $wantruntasks add 'Run now' link
232
     * @return html_table
242
     * @return html_table
233
     */
243
     */
234
    private function generate_adhoc_tasks_simple_table(array $tasks, bool $wantruntasks = false): html_table {
244
    private function generate_adhoc_tasks_simple_table(array $tasks, bool $wantruntasks = false): html_table {
235
        $adhocrunurl = '/admin/tool/task/run_adhoctasks.php';
245
        $adhocrunurl = '/admin/tool/task/run_adhoctasks.php';
-
 
246
        $adhocdeleteurl = '/admin/tool/task/delete_adhoctasks.php';
236
        $now = time();
247
        $now = time();
237
        $failedstr = get_string('failed', 'tool_task');
248
        $failedstr = get_string('failed', 'tool_task');
Línea 238... Línea 249...
238
 
249
 
239
        // Main tasks table.
250
        // Main tasks table.
240
        $table = new html_table();
251
        $table = new html_table();
241
        $table->caption = get_string('adhoctasks', 'tool_task');
252
        $table->caption = get_string('adhoctasks', 'tool_task');
242
        $table->head = [
253
        $table->head = [
243
            get_string('taskid', 'tool_task'),
254
            get_string('taskid', 'tool_task'),
244
            get_string('nextruntime', 'tool_task'),
255
            get_string('nextruntime', 'tool_task'),
245
            get_string('payload', 'tool_task'),
256
            get_string('payload', 'tool_task'),
-
 
257
            $failedstr,
-
 
258
            get_string('faildelay', 'tool_task'),
246
            $failedstr
259
            get_string('actions','tool_task'),
Línea 247... Línea 260...
247
        ];
260
        ];
248
 
261
 
Línea 261... Línea 274...
261
            $taskidcell->header = true;
274
            $taskidcell->header = true;
262
            $taskidcell->id = "task-$taskid";
275
            $taskidcell->id = "task-$taskid";
Línea 263... Línea 276...
263
 
276
 
264
            // Mark cell if task has failed.
277
            // Mark cell if task has failed.
265
            $faildelay = $task->get_fail_delay();
278
            $faildelay = $task->get_fail_delay();
266
            $faildelaycell = new html_table_cell($faildelay ? $failedstr : '');
279
            $failedcell = new html_table_cell($faildelay ? $failedstr : '');
267
            if ($faildelay) {
280
            if ($faildelay) {
268
                $faildelaycell->attributes['class'] = 'table-danger';
281
                $failedcell->attributes['class'] = 'table-danger';
Línea 269... Línea 282...
269
            }
282
            }
270
 
283
 
271
            // Prepares the next run time cell contents.
284
            // Prepares the next run time cell contents.
272
            $nextrun = get_string('started', 'tool_task');
285
            $nextrun = get_string('started', 'tool_task');
273
            if (!$started) {
286
            if (!$started) {
274
                $nextruntime = $task->get_next_run_time();
287
                $nextruntime = $task->get_next_run_time();
275
                $due = $nextruntime < $now;
288
                $due = $nextruntime < $now;
276
                if ($task->get_attempts_available() > 0) {
289
                if ($task->get_attempts_available() > 0) {
277
                    $nextrun = $due ? userdate($nextruntime) : get_string('asap', 'tool_task');
290
                    $nextrun = $due ? get_string('asap', 'tool_task') : userdate($nextruntime);
278
                } else {
291
                } else {
Línea 279... Línea 292...
279
                    $nextrun = get_string('never', 'admin');
292
                    $nextrun = get_string('never', 'admin');
Línea 291... Línea 304...
291
                        'task-runnow'
304
                        'task-runnow'
292
                    );
305
                    );
293
                }
306
                }
294
            }
307
            }
Línea -... Línea 308...
-
 
308
 
-
 
309
            // Create fail delay cell.
-
 
310
            $faildelaycellcontent = $faildelay;
-
 
311
            $faildelaycell = new html_table_cell($faildelaycellcontent);
-
 
312
 
-
 
313
            if ($faildelay) {
-
 
314
                $faildelaycell->attributes['class'] = 'table-danger';
-
 
315
            }
-
 
316
 
-
 
317
            // Add delete link with modal trigger.
-
 
318
            $deletelink = html_writer::link(
-
 
319
                new moodle_url($adhocdeleteurl, ['taskid' => $taskid, 'sesskey' => sesskey()]),
-
 
320
                get_string('delete'),
-
 
321
                [
-
 
322
                    'class' => 'btn btn-danger',
-
 
323
                    'role' => 'button',
-
 
324
                    'aria-label' => get_string('deleteadhoctask', 'tool_task', $taskid),
-
 
325
                    'data-confirmation' => 'modal',
-
 
326
                    'data-confirmation-type' => 'delete',
-
 
327
                    'data-confirmation-title-str' => '["deleteadhoctask", "tool_task", ' . $taskid . ']',
-
 
328
                    'data-confirmation-content-str' => '["confirmdeletetaskwithid", "tool_task", {"id":'.$taskid.'}]',
-
 
329
                    'data-confirmation-yes-button-str' => '["delete", "core"]',
-
 
330
                ]
-
 
331
            );
-
 
332
            $deletecell = new html_table_cell($deletelink);
295
 
333
 
296
            $data[] = new html_table_row([
334
            $data[] = new html_table_row([
297
                $taskidcell,
335
                $taskidcell,
298
                new html_table_cell($nextrun),
336
                new html_table_cell($nextrun),
-
 
337
                new html_table_cell($task->get_custom_data_as_string()),
299
                new html_table_cell($task->get_custom_data_as_string()),
338
                $failedcell,
-
 
339
                $faildelaycell,
300
                $faildelaycell,
340
                $deletecell,
301
            ]);
341
            ]);
302
        }
342
        }
Línea 303... Línea 343...
303
        $table->data = $data;
343
        $table->data = $data;
Línea 396... Línea 436...
396
                        new moodle_url('/admin/tool/task/schedule_task.php',
436
                        new moodle_url('/admin/tool/task/schedule_task.php',
397
                            ['task' => $classname]),
437
                            ['task' => $classname]),
398
                        get_string('runnow', 'tool_task')), 'task-runnow');
438
                        get_string('runnow', 'tool_task')), 'task-runnow');
399
            }
439
            }
Línea 400... Línea 440...
400
 
440
 
401
            $faildelaycell = new html_table_cell($task->get_fail_delay());
441
            if ($faildelay = $task->get_fail_delay()) {
402
            if ($task->get_fail_delay()) {
442
                $faildelaycell = new html_table_cell(format_time($faildelay));
403
                $faildelaycell->text .= html_writer::div(
443
                $faildelaycell->text .= html_writer::div(
404
                    $this->output->single_button(
444
                    $this->output->single_button(
405
                        new moodle_url('/admin/tool/task/clear_fail_delay.php',
445
                        new moodle_url('/admin/tool/task/clear_fail_delay.php',
406
                                ['task' => $classname]),
446
                                ['task' => $classname]),
407
                        get_string('clear')
447
                        get_string('clear')
408
                    ),
448
                    ),
409
                    'task-runnow'
449
                    'task-runnow'
410
                );
450
                );
-
 
451
                $faildelaycell->attributes['class'] = 'table-danger';
-
 
452
            } else {
411
                $faildelaycell->attributes['class'] = 'table-danger';
453
                $faildelaycell = new html_table_cell(0);
Línea 412... Línea 454...
412
            }
454
            }
413
 
455
 
414
            $row = new html_table_row([
456
            $row = new html_table_row([