ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilWorkflowArmerGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
5require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
6
19{
21 protected $form_action;
22
24 protected $lng;
25
27 protected $tree;
28
34 public function __construct($form_action)
35 {
36 global $DIC;
37 $this->lng = $DIC['lng'];
38 $this->tree = $DIC['tree'];
39
40 $this->form_action = $form_action;
41 }
42
49 public function getForm($input_vars, $event_definition)
50 {
52 $form->setTitle($this->lng->txt('input_variables_required'));
53 $form->setDescription($this->lng->txt('input_static_variables_desc'));
54
55 $process_id_input = new ilHiddenInputGUI('process_id');
56 $process_id_input->setValue(stripslashes($_GET['process_id']));
57 $form->addItem($process_id_input);
58
59 $event = $event_definition[0];
60 $this->addStartEventInputItems($this->lng, $event, $form);
61
62 $this->addStaticInputItems($this->lng, $input_vars, $form);
63
64 $form->addCommandButton('listen', $this->lng->txt('start_listening'));
65 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
66 return $form;
67 }
68
70 {
71 $item = new ilSelectInputGUI($config['caption'], $config['name']);
72
73 $children = $this->tree->getFilteredSubTree($this->tree->getRootId());
74
75 $options = array();
76 foreach ($children as $child) {
77 if (strtolower($config['allowedtype']) != $child['type']) {
78 continue;
79 }
80
81 $path = $this->tree->getPathFull($child['child']);
82 $option_elements = array();
83 foreach ($path as $node) {
84 if ($node['type'] == 'root') {
85 continue;
86 }
87 $option_elements[] = $node['title'];
88 }
89
90 $options[ $child['child'] ] = implode(' / ', $option_elements);
91 }
92
93 $item->setOptions($options);
94
95 return $item;
96 }
97
103 public function addStaticInputItems($lng, $input_vars, $form)
104 {
105 if (count($input_vars)) {
107 $section->setTitle($lng->txt('static_input_form_header'));
108 $form->addItem($section);
109 }
110
111 foreach ($input_vars as $input_var) {
112 $item = null;
113
114 switch (strtolower($input_var['type'])) {
115 case 'robjselect':
116 $item = $this->getRepositoryObjectSelector($input_var);
117 break;
118
119 case 'text':
120 default:
121 $item = new ilTextInputGUI($input_var['caption'], $input_var['name']);
122 break;
123
124 }
125
126 $item->setRequired($input_var['requirement'] == 'required' ? true : false);
127 $item->setInfo($input_var['description']);
128 $form->addItem($item);
129 }
130 }
131
137 public function addStartEventInputItems($lng, $event, $form)
138 {
140 $section->setTitle($lng->txt('start_event_form_header'));
141 $form->addItem($section);
142
143 $type_input = new ilTextInputGUI($lng->txt('type'), 'se_type');
144 $type_input->setValue($event['type']);
145 $type_input->setDisabled(true);
146 $form->addItem($type_input);
147
148 $content_input = new ilTextInputGUI($lng->txt('content'), 'se_content');
149 $content_input->setValue($event['content']);
150 $content_input->setDisabled(true);
151 $form->addItem($content_input);
152
153 $subject_type_input = new ilTextInputGUI($lng->txt('subject_type'), 'se_subject_type');
154 $subject_type_input->setValue($event['subject_type']);
155 $subject_type_input->setDisabled(true);
156 $form->addItem($subject_type_input);
157
158 $subject_selector = new ilRadioGroupInputGUI($lng->txt('subject_id'), 'se_subject_id');
159
160 $subject_by_id_selector = new ilRadioOption($lng->txt('subject_by_id'), 'se_subject_by_id');
161 $subject_id_input = new ilNumberInputGUI($lng->txt('subject_id'), 'se_subject_id');
162 $subject_id_input->setValue($event['subject_id']);
163 $subject_by_id_selector->addSubItem($subject_id_input);
164 $subject_selector->addOption($subject_by_id_selector);
165
166 $subject_by_mask_selector = new ilRadioOption($lng->txt('subject_by_mask'), 'se_subject_by_mask');
167 $subject_by_mask_selector->setValue($event['subject_id']);
168 $subject_selector->addOption($subject_by_mask_selector);
169
170 $subject_selector->setValue($event['subject_id']);
171 $form->addItem($subject_selector);
172
173 $context_type_input = new ilTextInputGUI($lng->txt('context_type'), 'se_context_type');
174 $context_type_input->setValue($event['context_type']);
175 $context_type_input->setDisabled(true);
176 $form->addItem($context_type_input);
177
178 $context_selector = new ilRadioGroupInputGUI($lng->txt('context_id'), 'se_context_id');
179
180 $context_by_id_selector = new ilRadioOption($lng->txt('context_by_id'), 'se_context_by_id');
181 $context_id_input = new ilNumberInputGUI($lng->txt('context_id'), 'se_context_id');
182 $context_id_input->setValue($event['context_id']);
183 $context_by_id_selector->addSubItem($context_id_input);
184 $context_selector->addOption($context_by_id_selector);
185
186 $context_by_mask_selector = new ilRadioOption($lng->txt('context_by_mask'), 'se_context_by_mask');
187 $context_by_mask_selector->setValue($event['subject_id']);
188 $context_selector->addOption($context_by_mask_selector);
189
190 $context_selector->setValue($event['subject_id']);
191 $form->addItem($context_selector);
192 }
193}
$section
Definition: Utf8Test.php:83
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a text property in a property form.
@noinspection PhpIncludeInspection
getForm($input_vars, $event_definition)
addStartEventInputItems($lng, $event, $form)
addStaticInputItems($lng, $input_vars, $form)
__construct($form_action)
ilWorkflowLauncherGUI constructor.
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7