ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilWorkflowEngineDefinitionsGUI Class Reference

Class ilWorkflowEngineDefinitionsGUI. More...

+ Collaboration diagram for ilWorkflowEngineDefinitionsGUI:

Public Member Functions

 __construct (ilObjWorkflowEngineGUI $parent_gui)
 ilWorkflowEngineDefinitionsGUI constructor. More...
 
 handle ($command)
 Handle the command given. More...
 
 showDefinitionsTable ()
 
 applyFilter ()
 
 resetFilter ()
 
 showUploadForm ()
 
 handleUploadSubmit ()
 
 initToolbar ()
 
 stopListening ()
 
 deleteDefinition ()
 

Protected Member Functions

 processUploadFormCancellation ()
 

Protected Attributes

 $parent_gui
 

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)

ilWorkflowEngineDefinitionsGUI constructor.

Parameters
ilObjWorkflowEngineGUI$parent_gui

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

References $parent_gui.

24  {
25  $this->parent_gui = $parent_gui;
26  }

Member Function Documentation

◆ applyFilter()

ilWorkflowEngineDefinitionsGUI::applyFilter ( )
Returns
string HTML

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

References showDefinitionsTable().

Referenced by handle().

96  {
97  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
98  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
99  $table_gui->writeFilterToSession();
100  $table_gui->resetOffset();
101 
102  return $this->showDefinitionsTable();
103  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDefinition()

ilWorkflowEngineDefinitionsGUI::deleteDefinition ( )
Returns
void

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

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

Referenced by handle().

405  {
406  unlink(ilObjWorkflowEngine::getRepositoryDir() . '/' . stripslashes($_GET['process_id']).'.php');
407  unlink(ilObjWorkflowEngine::getRepositoryDir() . '/' . stripslashes($_GET['process_id']).'.bpmn2');
408 
409  ilUtil::sendSuccess($this->parent_gui->lng->txt('definition_deleted'), true);
411  html_entity_decode(
412  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
413  )
414  );
415  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:
+ 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 35 of file class.ilWorkflowEngineDefinitionsGUI.php.

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

36  {
37  switch(strtolower($command))
38  {
39  case 'uploadform':
40  return $this->showUploadForm();
41  break;
42 
43  case 'upload':
44  return $this->handleUploadSubmit();
45  break;
46 
47  case 'applyfilter':
48  return $this->applyFilter();
49  break;
50 
51  case 'resetfilter':
52  return $this->resetFilter();
53  break;
54 
55  case 'start':
56  return $this->startProcess();
57  break;
58 
59  case 'delete':
60  return $this->deleteDefinition();
61  break;
62 
63  case 'startlistening':
64  return $this->startListening();
65  break;
66 
67  case'stoplistening':
68  return $this->stopListening();
69  break;
70 
71  case 'view':
72  default:
73  return $this->showDefinitionsTable();
74  }
75  }
+ Here is the call graph for this function:

◆ handleUploadSubmit()

ilWorkflowEngineDefinitionsGUI::handleUploadSubmit ( )
Returns
void

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

References $code, $file, $parser, $version, ilObjWorkflowEngine\getRepositoryDir(), ilObjWorkflowEngine\getTempDir(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), processUploadFormCancellation(), ilUtil\redirect(), and ilUtil\sendSuccess().

Referenced by handle().

136  {
137 
139 
140  require_once './Services/WorkflowEngine/classes/administration/class.ilUploadDefinitionForm.php';
141  $form_definition = new ilUploadDefinitionForm();
142  $form = $form_definition->getForm(
143  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,'definitions.upload')
144  );
145 
146  if(!$form->checkInput())
147  {
148  $form->setValuesByPost();
149  return $form->getHTML();
150  }
151 
152  $repo_dir_name = ilObjWorkflowEngine::getRepositoryDir() . '/';
153  if(!is_dir($repo_dir_name))
154  {
155  \ilUtil::makeDirParents($repo_dir_name);
156  }
157 
158  $temp_dir_name = ilObjWorkflowEngine::getTempDir();
159  if(!is_dir($temp_dir_name))
160  {
161  \ilUtil::makeDirParents($temp_dir_name);
162  }
163 
164  $file_name = $_FILES['process_file']['name'];
165  $temp_name = $_FILES['process_file']['tmp_name'];
167  $temp_name,
168  $file_name,
169  $temp_dir_name . $file_name
170  );
171 
172  $repo_base_name = 'il'.substr($file_name,0,strpos($file_name,'.'));
173  $wf_base_name = 'wfd.'.$repo_base_name.'_v';
174  $version = 0;
175  if ($handle = opendir($repo_dir_name))
176  {
177  while (false !== ($file = readdir($handle)))
178  {
179  if(substr(strtolower($file), 0, strlen($wf_base_name)) == strtolower($wf_base_name)
180  && substr($file, -4) == '.php')
181  {
182  $number = substr($file, strlen($wf_base_name), -4);
183  if($number > $version)
184  {
185  $version = $number;
186  }
187  }
188  }
189  closedir($handle);
190  }
191  $version++;
192 
193  $repo_name = $repo_base_name.'_v'.$version.'.php';
194 
195  // Parse
196  require_once './Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
197  $parser = new ilBPMN2Parser();
198  $bpmn = file_get_contents($temp_dir_name.$file_name);
199  $code = $parser->parseBPMN2XML($bpmn,$repo_name);
200 
201  file_put_contents($repo_dir_name.'wfd.'.$repo_name,$code);
202  file_put_contents($repo_dir_name.'wfd.'.$repo_base_name.'_v'.$version.'.bpmn2', $bpmn);
203  unlink($temp_dir_name.$file_name);
204 
205  ilUtil::sendSuccess($this->parent_gui->lng->txt('upload_parse_success'), true);
207  html_entity_decode($this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view'))
208  );
209  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$code
Definition: example_050.php:99
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
$parser
Definition: BPMN2Parser.php:24
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static redirect($a_script)
http redirect to other script
Class ilBPMN2Parser.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initToolbar()

ilWorkflowEngineDefinitionsGUI::initToolbar ( )
Returns
void

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

References ilLinkButton\getInstance().

Referenced by showDefinitionsTable().

215  {
216  require_once './Services/UIComponent/Button/classes/class.ilLinkButton.php';
217  $upload_wizard_button = ilLinkButton::getInstance();
218  $upload_wizard_button->setCaption($this->parent_gui->lng->txt('upload_process'), false);
219  $upload_wizard_button->setUrl(
220  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.uploadform')
221  );
222  $this->parent_gui->ilToolbar->addButtonInstance($upload_wizard_button);
223  }
+ 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 228 of file class.ilWorkflowEngineDefinitionsGUI.php.

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

Referenced by handleUploadSubmit().

229  {
230  if (isset($_POST['cmd']['cancel'])) {
231  ilUtil::sendInfo($this->parent_gui->lng->txt('action_aborted'), true);
233  html_entity_decode(
234  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
235  )
236  );
237  }
238  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static redirect($a_script)
http redirect to other 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 108 of file class.ilWorkflowEngineDefinitionsGUI.php.

References showDefinitionsTable().

Referenced by handle().

109  {
110  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
111  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
112  $table_gui->resetOffset();
113  $table_gui->resetFilter();
114 
115  return $this->showDefinitionsTable();
116  }
+ 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 80 of file class.ilWorkflowEngineDefinitionsGUI.php.

References initToolbar().

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

81  {
82  $this->initToolbar();
83  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
84  $table_gui = new ilWorkflowEngineDefinitionsTableGUI($this->parent_gui, 'definitions.view');
85  $table_gui->setFilterCommand("definitions.applyfilter");
86  $table_gui->setResetCommand("definitions.resetFilter");
87  $table_gui->setDisableFilterHiding(false);
88 
89  return $table_gui->getHTML();
90  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUploadForm()

ilWorkflowEngineDefinitionsGUI::showUploadForm ( )
Returns
string

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

Referenced by handle().

122  {
123  require_once './Services/WorkflowEngine/classes/administration/class.ilUploadDefinitionForm.php';
124  $form_definition = new ilUploadDefinitionForm();
125  $form = $form_definition->getForm(
126  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,'definitions.upload')
127  );
128 
129  return $form->getHTML();
130  }
+ Here is the caller graph for this function:

◆ stopListening()

ilWorkflowEngineDefinitionsGUI::stopListening ( )

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

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

Referenced by handle().

309  {
310  $process_id = ilUtil::stripSlashes($_GET['process_id']);
311 
312  require_once './Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
313  ilWorkflowDbHelper::deleteStartEventData($process_id);
314 
315  ilUtil::sendSuccess($this->parent_gui->lng->txt('wfe_stopped_listening'), true);
317  html_entity_decode(
318  $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui, 'definitions.view')
319  )
320  );
321  }
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)
http redirect to other script
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $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: