Select Git revision
-
Chris Sangwin authoredChris Sangwin authored
To learn more about this project, read the wiki.
delayed_courses_table.php 9.74 KiB
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Table listing all delayed courses
*
* @package tool_lifecycle
* @copyright 2019 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lifecycle\local\table;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/tablelib.php');
/**
* Table listing all delayed courses
*
* @package tool_lifecycle
* @copyright 2019 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class delayed_courses_table extends \table_sql {
/** @var null|int|string $workflow workflow to filter for. Might be workflowid or "global" to filter for global delays. */
private $workflow;
/**
* Constructor for delayed_courses_table.
*
* @param object|null $filterdata filterdata from moodle form.
* @throws \coding_exception
*/
public function __construct($filterdata) {
parent::__construct('tool_lifecycle-delayed-courses');
$fields = 'c.id as courseid, c.fullname as coursefullname, cat.name as category, ';
$selectseperatedelays = true;
$selectglobaldelays = true;
$workflowfilterid = null;
if ($filterdata && $filterdata->workflow) {
if ($filterdata->workflow == 'global') {
$selectseperatedelays = false;
$this->workflow = 'global';
} else if (is_number($filterdata->workflow)) {
$selectglobaldelays = false;
$workflowfilterid = $filterdata->workflow;
$this->workflow = $filterdata->workflow;
} else {
throw new \coding_exception('workflow has to be "global" or a int value');
}
}
if ($selectseperatedelays) {
$fields .= 'wfdelay.workflowid, wfdelay.workflow, wfdelay.workflowdelay, wfdelay.workflowcount, ';