ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

Member Function Documentation

◆ applyFilter()

ilWorkflowEngineDefinitionsGUI::applyFilter ( )
Returns
string HTML

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

References showDefinitionsTable().

Referenced by handle().

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

◆ confirmDeleteDefinition()

ilWorkflowEngineDefinitionsGUI::confirmDeleteDefinition ( )
Returns
string

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

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

Referenced by handle().

486  {
487  $this->ensureProcessIdInRequest();
488 
489  $processId = $this->getProcessIdFromRequest();
490 
491  require_once 'Services/WorkflowEngine/classes/administration/class.ilWorkflowDefinitionRepository.php';
492  $repository = new ilWorkflowDefinitionRepository(
493  $this->dic->database(),
494  $this->dic->filesystem(),
496  );
497  $processDefinition = $repository->getById($processId);
498 
499  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
500  $confirmation = new ilConfirmationGUI();
501  $confirmation->addItem('process_id[]', $processDefinition['id'], $processDefinition['title']);
502  $this->parent_gui->ilCtrl->setParameter($this->parent_gui, 'process_id', $processDefinition['id']);
503  $confirmation->setFormAction($this->parent_gui->ilCtrl->getFormAction($this->parent_gui, 'definitions.view'));
504  $confirmation->setHeaderText($this->parent_gui->lng->txt('wfe_sure_to_delete_process_def'));
505  $confirmation->setConfirm($this->parent_gui->lng->txt('confirm'), 'definitions.delete');
506  $confirmation->setCancel($this->parent_gui->lng->txt('cancel'), 'definitions.view');
507 
508  return $confirmation->getHTML();
509  }
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 458 of file class.ilWorkflowEngineDefinitionsGUI.php.

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

Referenced by handle().

459  {
460  $this->ensureProcessIdInRequest();
461 
462  $processId = $this->getProcessIdFromRequest();
463 
464  $pathToProcessPhpFile = ilObjWorkflowEngine::getRepositoryDir() . '/' . $processId . '.php';
465  $pathToProcessBpmn2File = ilObjWorkflowEngine::getRepositoryDir() . '/' . $processId . '.bpmn2';
466 
467  if (file_exists($pathToProcessPhpFile)) {
468  unlink($pathToProcessPhpFile);
469  }
470  if (file_exists($pathToProcessBpmn2File)) {
471  unlink($pathToProcessBpmn2File);
472  }
473 
474  ilUtil::sendSuccess($this->parent_gui->lng->txt('definition_deleted'), true);
476  html_entity_decode(
477  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
478  )
479  );
480  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 437 of file class.ilWorkflowEngineDefinitionsGUI.php.

References ilUtil\sendInfo().

Referenced by confirmDeleteDefinition(), and deleteDefinition().

438  {
439  if (!isset($this->dic->http()->request()->getQueryParams()['process_id'])) {
440  ilUtil::sendInfo($this->parent_gui->lng->txt('wfe_request_missing_process_id'));
441  $this->parent_gui->ilCtrl->redirect($this->parent_gui, 'definitions.view');
442  }
443  }
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 448 of file class.ilWorkflowEngineDefinitionsGUI.php.

Referenced by confirmDeleteDefinition(), and deleteDefinition().

449  {
450  $processId = str_replace(['\\', '/'], '', stripslashes($this->dic->http()->request()->getQueryParams()['process_id']));
451 
452  return basename($processId);
453  }
+ 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 255 of file class.ilWorkflowEngineDefinitionsGUI.php.

References ilLinkButton\getInstance().

Referenced by showDefinitionsTable().

256  {
257  require_once './Services/UIComponent/Button/classes/class.ilLinkButton.php';
258  $upload_wizard_button = ilLinkButton::getInstance();
259  $upload_wizard_button->setCaption($this->parent_gui->lng->txt('upload_process'), false);
260  $upload_wizard_button->setUrl(
261  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.uploadform')
262  );
263  $this->parent_gui->ilToolbar->addButtonInstance($upload_wizard_button);
264  }
+ 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 269 of file class.ilWorkflowEngineDefinitionsGUI.php.

References $_GET, $_POST, $action, $form, array, ilObjWorkflowEngine\getRepositoryDir(), ilUtil\redirect(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

Referenced by showUploadForm().

270  {
271  if (isset($_POST['cmd']['cancel'])) {
272  ilUtil::sendInfo($this->parent_gui->lng->txt('action_aborted'), true);
274  html_entity_decode(
275  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
276  )
277  );
278  }
279  }
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 122 of file class.ilWorkflowEngineDefinitionsGUI.php.

References showDefinitionsTable().

Referenced by handle().

123  {
124  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
125  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
126  $table_gui->resetOffset();
127  $table_gui->resetFilter();
128 
129  return $this->showDefinitionsTable();
130  }
+ 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 initToolbar().

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

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

◆ showUploadForm()

ilWorkflowEngineDefinitionsGUI::showUploadForm ( )
Returns
string

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

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

Referenced by handle().

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

◆ stopListening()

ilWorkflowEngineDefinitionsGUI::stopListening ( )

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

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

Referenced by handle().

347  {
348  $process_id = ilUtil::stripSlashes($_GET['process_id']);
349 
350  require_once './Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
351  ilWorkflowDbHelper::deleteStartEventData($process_id);
352 
353  ilUtil::sendSuccess($this->parent_gui->lng->txt('wfe_stopped_listening'), true);
355  html_entity_decode(
356  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
357  )
358  );
359  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_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: