Skip to content
Snippets Groups Projects
Commit 34f7729c authored by yorickreum's avatar yorickreum
Browse files

added list view / table for deactivated workflows

parent b4c9bb09
No related branches found
No related tags found
No related merge requests found
......@@ -157,6 +157,10 @@ class admin_settings {
$table->out(10, false);
echo $OUTPUT->box_end();
$deactivatedworkflowsurl = new \moodle_url('/admin/tool/lifecycle/deactivatedworkflows.php',
array('sesskey' => sesskey()));
echo \html_writer::link($deactivatedworkflowsurl, get_string('deactivated_workflows_list','tool_lifecycle'));
$this->view_footer();
}
......
......@@ -38,7 +38,7 @@ class workflow_definition_table extends workflow_table {
public function __construct($uniqueid) {
parent::__construct($uniqueid);
global $PAGE;
$this->set_sql("id, title, timeactive, displaytitle", '{tool_lifecycle_workflow}', "TRUE");
$this->set_sql("id, title, timeactive, displaytitle", '{tool_lifecycle_workflow}', "active = 0 AND timedeactive IS NULL");
$this->define_baseurl($PAGE->url);
$this->pageable(false);
$this->init();
......
......@@ -65,6 +65,19 @@ abstract class workflow_table extends \table_sql {
get_string('activateworkflow', 'tool_lifecycle'));
}
/**
* Render deactivated column.
* @param $row
* @return string deactivate time for workflows
*/
public function col_timedeactive($row) {
global $OUTPUT, $PAGE;
if ($row->timedeactive) {
return userdate($row->timedeactive, get_string('strftimedatetime'), 0);
}
return get_string('workflow_active', 'tool_lifecycle');
}
/**
* Render the trigger column.
* @param $row
......@@ -121,7 +134,7 @@ abstract class workflow_table extends \table_sql {
protected function format_icon_link($action, $workflowid, $icon, $alt) {
global $PAGE, $OUTPUT;
return $OUTPUT->action_icon(new \moodle_url($PAGE->url,
return $OUTPUT->action_icon(new \moodle_url( '/admin/tool/lifecycle/adminsettings.php',
array('action' => $action,
'sesskey' => sesskey(),
'workflowid' => $workflowid)),
......
......@@ -15,35 +15,34 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Displays the settings associated with one single workflow and handles action for it.
* Displays all deactivated workflows
*
* @package tool_lifecycle
* @copyright 2017 Tobias Reischmann WWU
* @copyright 2018 Yorick Reum, JMU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../../config.php');
require_once(__DIR__ . '/adminlib.php');
use tool_lifecycle\table\deactivated_workflows_table;
$PAGE->set_context(context_system::instance());
require_login(null, false);
require_capability('moodle/site:config', context_system::instance());
$workflowid = required_param('workflowid', PARAM_INT);
// admin_externalpage_setup('tool_lifecycle_deactivatedworkflows');
$PAGE->set_url(new \moodle_url('/admin/tool/lifecycle/deactivatedworkflows.php'));
$table = new deactivated_workflows_table('tool_lifecycle_deactivated_workflows');
$PAGE->set_title(get_string('deactivated_workflows_list_header', 'tool_lifecycle'));
$PAGE->set_heading(get_string('deactivated_workflows_list_header', 'tool_lifecycle'));
$workflow = tool_lifecycle\manager\workflow_manager::get_workflow($workflowid);
$renderer = $PAGE->get_renderer('tool_lifecycle');
if (!$workflow) {
throw new moodle_exception('workflownotfound', 'tool_lifecycle',
new \moodle_url('/admin/tool/lifecycle/adminsettings.php'), $workflowid);
}
echo $renderer->header();
// Create the class for this controller.
$workflowsettings = new tool_lifecycle\workflow_settings($workflowid);
$table->out(50, false);
// Execute the controller.
// @TODO what's the purpose of subplugin? why not workflowid?
$subplugin = optional_param('subplugin', null, PARAM_INT);
if ($subplugin == null && $workflowid) {
$subplugin = $workflowid;
}
$workflowsettings->execute(optional_param('action', null, PARAM_TEXT), $subplugin);
\ No newline at end of file
echo $renderer->footer();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment