ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $item = null;
51  switch (strtolower($input_var['type'])) {
52  case 'robjselect':
53  $item = $this->getRepositoryObjectSelector($input_var);
54  break;
55 
56  case 'text':
57  default:
58  $item = new ilTextInputGUI($input_var['caption'], $input_var['name']);
59  break;
60 
61  }
62  $item->setRequired($input_var['requirement'] == 'required' ? true : false);
63  $item->setInfo($input_var['description']);
64  $form->addItem($item);
65  }
66 
67  $form->addCommandButton('start', $this->lng->txt('start_process'));
68  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
69  return $form;
70  }
71 
72  public function getRepositoryObjectSelector($config)
73  {
75  global $DIC;
76  $tree = $DIC['tree'];
77 
78  $item = new ilSelectInputGUI($config['caption'], $config['name']);
79 
80  $children = $tree->getFilteredSubTree($tree->getRootId());
81 
82  $options = array();
83  foreach ($children as $child) {
84  if (strtolower($config['allowedtype']) != $child['type']) {
85  continue;
86  }
87 
88  $path = $tree->getPathFull($child['child']);
89  $option_elements = array();
90  foreach ($path as $node) {
91  if ($node['type'] == 'root') {
92  continue;
93  }
94  $option_elements[] = $node['title'];
95  }
96 
97  $options[$child['child']] = implode(' / ', $option_elements);
98  }
99 
100  $item->setOptions($options);
101 
102  return $item;
103  }
104 }
This class represents a selection list property in a property form.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
Create styles array
The data for the language used.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20