ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilWorkflowLauncherGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
6 
17 {
19  protected $form_action;
20 
22  protected $lng;
23 
29  public function __construct($form_action)
30  {
31  global $DIC;
33  $this->lng = $DIC['lng'];
34 
35  $this->form_action = $form_action;
36  }
37 
43  public function getForm($input_vars)
44  {
45  $form = new ilPropertyFormGUI();
46  $form->setTitle($this->lng->txt('input_variables_required'));
47  $form->setDescription($this->lng->txt('input_variables_desc'));
48 
49  foreach($input_vars as $input_var)
50  {
51  $item = null;
52  switch(strtolower($input_var['type']))
53  {
54  case 'robjselect':
55  $item = $this->getRepositoryObjectSelector($input_var);
56  break;
57 
58  case 'text':
59  default:
60  $item = new ilTextInputGUI($input_var['caption'], $input_var['name']);
61  break;
62 
63  }
64  $item->setRequired($input_var['requirement'] == 'required' ? true : false);
65  $item->setInfo($input_var['description']);
66  $form->addItem($item);
67  }
68 
69  $form->addCommandButton('start', $this->lng->txt('start_process'));
70  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
71  return $form;
72  }
73 
74  public function getRepositoryObjectSelector($config)
75  {
77  global $DIC;
78  $tree = $DIC['tree'];
79 
80  $item = new ilSelectInputGUI($config['caption'], $config['name']);
81 
82  $children = $tree->getFilteredSubTree($tree->getRootId());
83 
84  $options = array();
85  foreach($children as $child)
86  {
87  if(strtolower($config['allowedtype']) != $child['type'])
88  {
89  continue;
90  }
91 
92  $path = $tree->getPathFull($child['child']);
93  $option_elements = array();
94  foreach($path as $node)
95  {
96  if($node['type'] == 'root')
97  {
98  continue;
99  }
100  $option_elements[] = $node['title'];
101  }
102 
103  $options[$child['child']] = implode(' / ', $option_elements);
104  }
105 
106  $item->setOptions($options);
107 
108  return $item;
109  }
110 }
$path
Definition: aliased.php:25
This class represents a selection list property in a property form.
This class represents a property form user interface.
if(!is_array($argv)) $options
This class represents a text property in a property form.
Create styles array
The data for the language used.
global $DIC