48 switch (strtolower($command)) {
54 return $this->handleUploadSubmit();
66 return $this->startProcess();
77 case 'startlistening':
78 return $this->startListening();
97 require_once
'./Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
99 $table_gui->setFilterCommand(
"definitions.applyfilter");
100 $table_gui->setResetCommand(
"definitions.resetFilter");
101 $table_gui->setDisableFilterHiding(
false);
103 return $table_gui->getHTML();
111 require_once
'./Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
113 $table_gui->writeFilterToSession();
114 $table_gui->resetOffset();
124 require_once
'./Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsTableGUI.php';
126 $table_gui->resetOffset();
127 $table_gui->resetFilter();
137 require_once
'./Services/WorkflowEngine/classes/administration/class.ilUploadDefinitionForm.php';
139 $form = $form_definition->getForm(
140 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.upload')
143 return $form->getHTML();
152 public function handleUploadSubmit()
156 require_once
'./Services/WorkflowEngine/classes/administration/class.ilUploadDefinitionForm.php';
158 $form = $form_definition->getForm(
159 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.upload')
162 if (!
$form->checkInput()) {
163 $form->setValuesByPost();
164 return $form->getHTML();
167 $fs = $this->dic->filesystem()->storage();
168 $upload = $this->dic->upload();
171 if (!$fs->hasDir($repositoryDirectory)) {
172 $fs->createDir($repositoryDirectory);
176 if (!$fs->hasDir($tmpDirectory)) {
177 $fs->createDir($tmpDirectory);
180 if (!$upload->hasUploads() || $upload->hasBeenProcessed()) {
181 $form->setValuesByPost();
182 return $form->getHTML();
188 $uploadResult = array_values($upload->getResults())[0];
190 $form->setValuesByPost();
191 return $form->getHTML();
194 $upload->moveOneFileTo(
197 \
ILIAS\FileUpload\Location::STORAGE,
198 $uploadResult->getName(),
202 $repo_base_name =
'il' . substr($uploadResult->getName(), 0, strpos($uploadResult->getName(),
'.'));
203 $wf_base_name =
'wfd.' . $repo_base_name .
'_v';
206 $fileList = $fs->listContents($repositoryDirectory,
true);
208 foreach ($fileList as
$file) {
209 if ($file->isDir()) {
213 $fileBaseName = basename($file->getPath());
216 substr(strtolower($fileBaseName), 0, strlen($wf_base_name)) == strtolower($wf_base_name) &&
217 substr($fileBaseName, -4) ==
'.php' 219 $number = substr($fileBaseName, strlen($wf_base_name), -4);
227 $repo_name = $repo_base_name .
'_v' .
$version .
'.php';
229 require_once
'./Services/WorkflowEngine/classes/parser/class.ilBPMN2Parser.php';
231 $bpmn = $fs->read($tmpDirectory . $uploadResult->getName());
234 $fs->put($repositoryDirectory .
'wfd.' . $repo_name,
$code);
235 $fs->put($repositoryDirectory .
'wfd.' . $repo_base_name .
'_v' .
$version .
'.bpmn2', $bpmn);
236 $fs->delete($tmpDirectory . $uploadResult->getName());
240 $sourceFile = $absRepositoryDirectory . str_replace(
'.',
'',
'wfd.' . $repo_name) .
'.sec';
241 $targetFile = $absRepositoryDirectory .
'wfd.' . $repo_name;
242 if (file_exists($sourceFile)) {
243 rename($sourceFile, $targetFile);
248 html_entity_decode($this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view'))
257 require_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
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')
263 $this->parent_gui->ilToolbar->addButtonInstance($upload_wizard_button);
271 if (isset(
$_POST[
'cmd'][
'cancel'])) {
275 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view')
284 public function startListening()
286 $identifier = basename(
$_GET[
'process_id']);
289 $class = substr($identifier, 4);
291 $workflow_instance =
new $class;
293 $workflow_instance->setWorkflowClass(
'wfd.' . $class .
'.php');
296 $show_armer_form =
true;
298 case isset(
$_POST[
'process_id']):
299 case isset(
$_POST[
'se_type']):
300 case isset(
$_POST[
'se_content']):
301 case isset(
$_POST[
'se_subject_type']):
302 case isset(
$_POST[
'se_context_type']):
303 $show_armer_form =
false;
306 $show_armer_form =
true;
310 require_once
'./Services/WorkflowEngine/classes/administration/class.ilWorkflowArmerGUI.php';
311 $this->parent_gui->ilCtrl->saveParameter($this->parent_gui,
'process_id', $identifier);
312 $action = $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.start');
315 $form = $armer->getForm($workflow_instance->getInputVars(), $workflow_instance->getStartEventInfo());
317 if ($show_armer_form) {
318 return $form->getHTML();
322 'type' => stripslashes(
$_POST[
'se_type']),
323 'content' => stripslashes(
$_POST[
'se_content']),
324 'subject_type' => stripslashes(
$_POST[
'se_subject_type']),
325 'subject_id' => (
int)
$_POST[
'se_subject_id'],
326 'context_type' => stripslashes($_POST[
'se_context_type']),
327 'context_id' => (
int) $_POST[
'se_context_id']
329 $process_id = stripslashes($_POST[
'process_id']);
331 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
332 $event_id = ilWorkflowDbHelper::writeStartEventData($event_data, $process_id);
334 foreach ($workflow_instance->getInputVars() as $input_var) {
335 ilWorkflowDbHelper::writeStaticInput($input_var[
'name'], stripslashes($_POST[$input_var[
'name']]), $event_id);
341 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view')
350 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
351 ilWorkflowDbHelper::deleteStartEventData($process_id);
356 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view')
366 public function startProcess()
368 if (isset(
$_POST[
'cmd'][
'cancel'])) {
372 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view')
377 $identifier = basename(
$_GET[
'process_id']);
380 $class = substr($identifier, 4);
382 $workflow_instance =
new $class;
384 $workflow_instance->setWorkflowClass(
'wfd.' . $class .
'.php');
387 if (count($workflow_instance->getInputVars())) {
388 $show_launcher_form =
false;
389 foreach ($workflow_instance->getInputVars() as $input_var) {
390 if (!isset(
$_POST[$input_var[
'name']])) {
391 $show_launcher_form =
true;
393 $workflow_instance->setInstanceVarById($input_var[
'name'],
$_POST[$input_var[
'name']]);
397 require_once
'./Services/WorkflowEngine/classes/administration/class.ilWorkflowLauncherGUI.php';
398 $this->parent_gui->ilCtrl->saveParameter($this->parent_gui,
'process_id', $identifier);
399 $action = $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.start');
401 $form = $launcher->getForm($workflow_instance->getInputVars());
403 if ($show_launcher_form ||
$form->checkInput() ==
false) {
404 $form->setValuesByPost();
405 return $form->getHTML();
409 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
410 ilWorkflowDbHelper::writeWorkflow($workflow_instance);
412 $workflow_instance->startWorkflow();
413 $workflow_instance->handleEvent(
424 ilWorkflowDbHelper::writeWorkflow($workflow_instance);
429 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view')
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');
450 $processId = str_replace([
'\\',
'/'],
'', stripslashes($this->dic->http()->request()->getQueryParams()[
'process_id']));
452 return basename($processId);
467 if (file_exists($pathToProcessPhpFile)) {
468 unlink($pathToProcessPhpFile);
470 if (file_exists($pathToProcessBpmn2File)) {
471 unlink($pathToProcessBpmn2File);
477 $this->parent_gui->ilCtrl->getLinkTarget($this->parent_gui,
'definitions.view')
491 require_once
'Services/WorkflowEngine/classes/administration/class.ilWorkflowDefinitionRepository.php';
493 $this->dic->database(),
494 $this->dic->filesystem(),
497 $processDefinition = $repository->
getById($processId);
499 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
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');
508 return $confirmation->getHTML();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
processUploadFormCancellation()
Class ilWorkflowEngineDefinitionsGUI.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
ensureProcessIdInRequest()
static getRepositoryDir($relative=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
confirmDeleteDefinition()
Class ilWorkflowDefinitionRepository.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
__construct(ilObjWorkflowEngineGUI $parent_gui, \ILIAS\DI\Container $dic=null)
ilWorkflowEngineDefinitionsGUI constructor.
static getTempDir($relative=false)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
getProcessIdFromRequest()
handle($command)
Handle the command given.
static redirect($a_script)
Confirmation screen class.