ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWorkflowEngineDefinitionsGUI Class Reference

Class ilWorkflowEngineDefinitionsGUI. More...

+ Collaboration diagram for ilWorkflowEngineDefinitionsGUI:

Public Member Functions

 __construct (ilObjWorkflowEngineGUI $parent_gui, \ILIAS\DI\Container $dic=null)
 ilWorkflowEngineDefinitionsGUI constructor. More...
 
 handle ($command)
 Handle the command given. More...
 
 showDefinitionsTable ()
 
 applyFilter ()
 
 resetFilter ()
 
 showUploadForm ()
 
 initToolbar ()
 
 stopListening ()
 
 deleteDefinition ()
 
 confirmDeleteDefinition ()
 

Protected Member Functions

 processUploadFormCancellation ()
 

Protected Attributes

 $parent_gui
 
 $dic
 

Private Member Functions

 ensureProcessIdInRequest ()
 
 getProcessIdFromRequest ()
 

Detailed Description

Class ilWorkflowEngineDefinitionsGUI.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 13 of file class.ilWorkflowEngineDefinitionsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilWorkflowEngineDefinitionsGUI::__construct ( ilObjWorkflowEngineGUI  $parent_gui,
\ILIAS\DI\Container  $dic = null 
)

ilWorkflowEngineDefinitionsGUI constructor.

Parameters
ilObjWorkflowEngineGUI$parent_gui

Definition at line 29 of file class.ilWorkflowEngineDefinitionsGUI.php.

References $dic, $GLOBALS, and $parent_gui.

30  {
31  $this->parent_gui = $parent_gui;
32 
33  if ($dic === null) {
34  $dic = $GLOBALS['DIC'];
35  }
36  $this->dic = $dic;
37  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

Member Function Documentation

◆ applyFilter()

ilWorkflowEngineDefinitionsGUI::applyFilter ( )
Returns
string HTML

Definition at line 111 of file class.ilWorkflowEngineDefinitionsGUI.php.

References showDefinitionsTable().

Referenced by handle().

112  {
113  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
114  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
115  $table_gui->writeFilterToSession();
116  $table_gui->resetOffset();
117 
118  return $this->showDefinitionsTable();
119  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteDefinition()

ilWorkflowEngineDefinitionsGUI::confirmDeleteDefinition ( )
Returns
string

Definition at line 487 of file class.ilWorkflowEngineDefinitionsGUI.php.

References ensureProcessIdInRequest(), ilWorkflowDefinitionRepository\getById(), getProcessIdFromRequest(), and ilObjWorkflowEngine\getRepositoryDir().

Referenced by handle().

488  {
489  $this->ensureProcessIdInRequest();
490 
491  $processId = $this->getProcessIdFromRequest();
492 
493  require_once 'Services/WorkflowEngine/classes/administration/class.ilWorkflowDefinitionRepository.php';
494  $repository = new ilWorkflowDefinitionRepository(
495  $this->dic->database(),
496  $this->dic->filesystem(),
498  );
499  $processDefinition = $repository->getById($processId);
500 
501  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
502  $confirmation = new ilConfirmationGUI();
503  $confirmation->addItem('process_id[]', $processDefinition['id'], $processDefinition['title']);
504  $this->parent_gui->ilCtrl->setParameter($this->parent_gui, 'process_id', $processDefinition['id']);
505  $confirmation->setFormAction($this->parent_gui->ilCtrl->getFormAction($this->parent_gui, 'definitions.view'));
506  $confirmation->setHeaderText($this->parent_gui->lng->txt('wfe_sure_to_delete_process_def'));
507  $confirmation->setConfirm($this->parent_gui->lng->txt('confirm'), 'definitions.delete');
508  $confirmation->setCancel($this->parent_gui->lng->txt('cancel'), 'definitions.view');
509 
510  return $confirmation->getHTML();
511  }
static getRepositoryDir($relative=false)
Class ilWorkflowDefinitionRepository.
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDefinition()

ilWorkflowEngineDefinitionsGUI::deleteDefinition ( )
Returns
void

Definition at line 460 of file class.ilWorkflowEngineDefinitionsGUI.php.

References ensureProcessIdInRequest(), getProcessIdFromRequest(), ilObjWorkflowEngine\getRepositoryDir(), and ilUtil\redirect().

Referenced by handle().

461  {
462  $this->ensureProcessIdInRequest();
463 
464  $processId = $this->getProcessIdFromRequest();
465 
466  $pathToProcessPhpFile = ilObjWorkflowEngine::getRepositoryDir() . '/' . $processId . '.php';
467  $pathToProcessBpmn2File = ilObjWorkflowEngine::getRepositoryDir() . '/' . $processId . '.bpmn2';
468 
469  if (file_exists($pathToProcessPhpFile)) {
470  unlink($pathToProcessPhpFile);
471  }
472  if (file_exists($pathToProcessBpmn2File)) {
473  unlink($pathToProcessBpmn2File);
474  }
475 
476  ilUtil::sendSuccess($this->parent_gui->lng->txt('definition_deleted'), true);
478  html_entity_decode(
479  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
480  )
481  );
482  }
static getRepositoryDir($relative=false)
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureProcessIdInRequest()

ilWorkflowEngineDefinitionsGUI::ensureProcessIdInRequest ( )
private

Definition at line 439 of file class.ilWorkflowEngineDefinitionsGUI.php.

References ilUtil\sendInfo().

Referenced by confirmDeleteDefinition(), and deleteDefinition().

440  {
441  if (!isset($this->dic->http()->request()->getQueryParams()['process_id'])) {
442  ilUtil::sendInfo($this->parent_gui->lng->txt('wfe_request_missing_process_id'));
443  $this->parent_gui->ilCtrl->redirect($this->parent_gui, 'definitions.view');
444  }
445  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProcessIdFromRequest()

ilWorkflowEngineDefinitionsGUI::getProcessIdFromRequest ( )
private
Returns
string

Definition at line 450 of file class.ilWorkflowEngineDefinitionsGUI.php.

Referenced by confirmDeleteDefinition(), and deleteDefinition().

451  {
452  $processId = str_replace(['\\', '/'], '', stripslashes($this->dic->http()->request()->getQueryParams()['process_id']));
453 
454  return basename($processId);
455  }
+ Here is the caller graph for this function:

◆ handle()

ilWorkflowEngineDefinitionsGUI::handle (   $command)

Handle the command given.

Parameters
string$command
Returns
string HTML

Definition at line 46 of file class.ilWorkflowEngineDefinitionsGUI.php.

References applyFilter(), confirmDeleteDefinition(), deleteDefinition(), resetFilter(), showDefinitionsTable(), showUploadForm(), and stopListening().

47  {
48  switch (strtolower($command)) {
49  case 'uploadform':
50  return $this->showUploadForm();
51  break;
52 
53  case 'upload':
54  return $this->handleUploadSubmit();
55  break;
56 
57  case 'applyfilter':
58  return $this->applyFilter();
59  break;
60 
61  case 'resetfilter':
62  return $this->resetFilter();
63  break;
64 
65  case 'start':
66  return $this->startProcess();
67  break;
68 
69  case 'delete':
70  return $this->deleteDefinition();
71  break;
72 
73  case 'confirmdelete':
74  return $this->confirmDeleteDefinition();
75  break;
76 
77  case 'startlistening':
78  return $this->startListening();
79  break;
80 
81  case'stoplistening':
82  return $this->stopListening();
83  break;
84 
85  case 'view':
86  default:
87  return $this->showDefinitionsTable();
88  }
89  }
+ Here is the call graph for this function:

◆ initToolbar()

ilWorkflowEngineDefinitionsGUI::initToolbar ( )
Returns
void

Definition at line 257 of file class.ilWorkflowEngineDefinitionsGUI.php.

References ilLinkButton\getInstance().

Referenced by showDefinitionsTable().

258  {
259  require_once './Services/UIComponent/Button/classes/class.ilLinkButton.php';
260  $upload_wizard_button = ilLinkButton::getInstance();
261  $upload_wizard_button->setCaption($this->parent_gui->lng->txt('upload_process'), false);
262  $upload_wizard_button->setUrl(
263  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.uploadform')
264  );
265  $this->parent_gui->ilToolbar->addButtonInstance($upload_wizard_button);
266  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processUploadFormCancellation()

ilWorkflowEngineDefinitionsGUI::processUploadFormCancellation ( )
protected
Returns
void

Definition at line 271 of file class.ilWorkflowEngineDefinitionsGUI.php.

References $_GET, $_POST, ilObjWorkflowEngine\getRepositoryDir(), ilUtil\redirect(), and ilUtil\sendInfo().

Referenced by showUploadForm().

272  {
273  if (isset($_POST['cmd']['cancel'])) {
274  ilUtil::sendInfo($this->parent_gui->lng->txt('action_aborted'), true);
276  html_entity_decode(
277  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
278  )
279  );
280  }
281  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static redirect($a_script)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilWorkflowEngineDefinitionsGUI::resetFilter ( )
Returns
string HTML

Definition at line 124 of file class.ilWorkflowEngineDefinitionsGUI.php.

References showDefinitionsTable().

Referenced by handle().

125  {
126  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
127  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
128  $table_gui->resetOffset();
129  $table_gui->resetFilter();
130 
131  return $this->showDefinitionsTable();
132  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showDefinitionsTable()

ilWorkflowEngineDefinitionsGUI::showDefinitionsTable ( )
Returns
string HTML

Definition at line 94 of file class.ilWorkflowEngineDefinitionsGUI.php.

References $_GET, and initToolbar().

Referenced by applyFilter(), handle(), and resetFilter().

95  {
96  if ($this->dic->rbac()->system()->checkAccess('write', $_GET['ref_id'])) {
97  $this->initToolbar();
98  }
99  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
100  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
101  $table_gui->setFilterCommand("definitions.applyfilter");
102  $table_gui->setResetCommand("definitions.resetFilter");
103  $table_gui->setDisableFilterHiding(false);
104 
105  return $table_gui->getHTML();
106  }
$_GET["client_id"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUploadForm()

ilWorkflowEngineDefinitionsGUI::showUploadForm ( )
Returns
string

Definition at line 137 of file class.ilWorkflowEngineDefinitionsGUI.php.

References $parser, ilObjWorkflowEngine\getRepositoryDir(), ilObjWorkflowEngine\getTempDir(), ILIAS\FileUpload\DTO\ProcessingStatus\OK, processUploadFormCancellation(), and ilUtil\redirect().

Referenced by handle().

138  {
139  require_once './Services/WorkflowEngine/classes/administration/class.ilUploadDefinitionForm.php';
140  $form_definition = new ilUploadDefinitionForm();
141  $form = $form_definition->getForm(
142  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.upload')
143  );
144 
145  return $form->getHTML();
146  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stopListening()

ilWorkflowEngineDefinitionsGUI::stopListening ( )

Definition at line 348 of file class.ilWorkflowEngineDefinitionsGUI.php.

References $_GET, $_POST, ilObjWorkflowEngine\getRepositoryDir(), ilUtil\redirect(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

Referenced by handle().

349  {
350  $process_id = ilUtil::stripSlashes($_GET['process_id']);
351 
352  require_once './Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
353  ilWorkflowDbHelper::deleteStartEventData($process_id);
354 
355  ilUtil::sendSuccess($this->parent_gui->lng->txt('wfe_stopped_listening'), true);
357  html_entity_decode(
358  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
359  )
360  );
361  }
$_GET["client_id"]
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static redirect($a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $dic

ilWorkflowEngineDefinitionsGUI::$dic
protected

Definition at line 21 of file class.ilWorkflowEngineDefinitionsGUI.php.

Referenced by __construct().

◆ $parent_gui

ilWorkflowEngineDefinitionsGUI::$parent_gui
protected

Definition at line 16 of file class.ilWorkflowEngineDefinitionsGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: