ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
51 $form = new ilPropertyFormGUI();
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 {
78 if (strtolower($config['allowedtype']) != $child['type'])
79 {
80 continue;
81 }
82
83 $path = $this->tree->getPathFull($child['child']);
84 $option_elements = array();
85 foreach ($path as $node)
86 {
87 if ($node['type'] == 'root')
88 {
89 continue;
90 }
91 $option_elements[] = $node['title'];
92 }
93
94 $options[ $child['child'] ] = implode(' / ', $option_elements);
95 }
96
97 $item->setOptions($options);
98
99 return $item;
100 }
101
107 public function addStaticInputItems($lng, $input_vars, $form)
108 {
109 if(count($input_vars))
110 {
112 $section->setTitle($lng->txt('static_input_form_header'));
113 $form->addItem($section);
114 }
115
116 foreach ($input_vars as $input_var)
117 {
118 $item = null;
119
120 switch (strtolower($input_var['type']))
121 {
122 case 'robjselect':
123 $item = $this->getRepositoryObjectSelector($input_var);
124 break;
125
126 case 'text':
127 default:
128 $item = new ilTextInputGUI($input_var['caption'], $input_var['name']);
129 break;
130
131 }
132
133 $item->setRequired($input_var['requirement'] == 'required' ? true : false);
134 $item->setInfo($input_var['description']);
135 $form->addItem($item);
136 }
137 }
138
144 public function addStartEventInputItems($lng, $event, $form)
145 {
147 $section->setTitle($lng->txt('start_event_form_header'));
148 $form->addItem($section);
149
150 $type_input = new ilTextInputGUI($lng->txt('type'), 'se_type');
151 $type_input->setValue($event['type']);
152 $type_input->setDisabled(true);
153 $form->addItem($type_input);
154
155 $content_input = new ilTextInputGUI($lng->txt('content'), 'se_content');
156 $content_input->setValue($event['content']);
157 $content_input->setDisabled(true);
158 $form->addItem($content_input);
159
160 $subject_type_input = new ilTextInputGUI($lng->txt('subject_type'), 'se_subject_type');
161 $subject_type_input->setValue($event['subject_type']);
162 $subject_type_input->setDisabled(true);
163 $form->addItem($subject_type_input);
164
165 $subject_selector = new ilRadioGroupInputGUI($lng->txt('subject_id'), 'se_subject_id');
166
167 $subject_by_id_selector = new ilRadioOption($lng->txt('subject_by_id'), 'se_subject_by_id');
168 $subject_id_input = new ilNumberInputGUI($lng->txt('subject_id'), 'se_subject_id');
169 $subject_id_input->setValue($event['subject_id']);
170 $subject_by_id_selector->addSubItem($subject_id_input);
171 $subject_selector->addOption($subject_by_id_selector);
172
173 $subject_by_mask_selector = new ilRadioOption($lng->txt('subject_by_mask'), 'se_subject_by_mask');
174 $subject_by_mask_selector->setValue($event['subject_id']);
175 $subject_selector->addOption($subject_by_mask_selector);
176
177 $subject_selector->setValue($event['subject_id']);
178 $form->addItem($subject_selector);
179
180 $context_type_input = new ilTextInputGUI($lng->txt('context_type'), 'se_context_type');
181 $context_type_input->setValue($event['context_type']);
182 $context_type_input->setDisabled(true);
183 $form->addItem($context_type_input);
184
185 $context_selector = new ilRadioGroupInputGUI($lng->txt('context_id'), 'se_context_id');
186
187 $context_by_id_selector = new ilRadioOption($lng->txt('context_by_id'), 'se_context_by_id');
188 $context_id_input = new ilNumberInputGUI($lng->txt('context_id'), 'se_context_id');
189 $context_id_input->setValue($event['context_id']);
190 $context_by_id_selector->addSubItem($context_id_input);
191 $context_selector->addOption($context_by_id_selector);
192
193 $context_by_mask_selector = new ilRadioOption($lng->txt('context_by_mask'), 'se_context_by_mask');
194 $context_by_mask_selector->setValue($event['subject_id']);
195 $context_selector->addOption($context_by_mask_selector);
196
197 $context_selector->setValue($event['subject_id']);
198 $form->addItem($context_selector);
199 }
200}
$section
Definition: Utf8Test.php:83
$path
Definition: aliased.php:25
$_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(!is_array($argv)) $options
global $DIC