ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjWorkflowEngineGUI.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/Object/classes/class.ilObject2GUI.php';
7 require_once './Services/WorkflowEngine/classes/class.ilWorkflowEngine.php';
8 
22 {
24  public $ilCtrl;
25 
27  public $ilTabs;
28 
30  public $lng;
31 
33  public $tpl;
34 
36  public $tree;
37 
39  public $ilLocator;
40 
42  public $ilToolbar;
43 
47  protected $dic;
48 
52  public function __construct()
53  {
54  global $DIC;
55 
56  $this->ilTabs = $DIC['ilTabs'];
57  $this->lng = $DIC['lng'];
58  $this->lng->loadLanguageModule('wfe');
59  $this->ilCtrl = $DIC['ilCtrl'];
60  $this->tpl = $DIC['tpl'];
61  $this->tree = $DIC['tree'];
62  $this->ilLocator = $DIC['ilLocator'];
63  $this->ilToolbar = $DIC['ilToolbar'];
64  $this->dic = $DIC;
65 
66  parent::__construct((int) $_GET['ref_id']);
67  $this->assignObject();
68  }
69 
73  public function getType()
74  {
75  return null;
76  }
77 
91  public static function _goto($params)
92  {
93  global $DIC;
95  $lng = $DIC['lng'];
96 
97  $workflow = substr($params, 2, strpos($params, 'EVT')-2);
98  $event = substr($params, strpos($params, 'EVT')+3);
99 
100  $type = 'endpoint_event';
101  $content = 'was_requested';
102  $subject_type = 'workflow';
103  $subject_id = $workflow;
104  $context_type = 'event';
105  $context_id = $event;
106 
107  $engine = new ilWorkflowEngine();
108  $engine->processEvent(
109  $type,
110  $content,
111  $subject_type,
112  $subject_id,
113  $context_type,
114  $context_id
115  );
116 
117  ilUtil::sendSuccess($lng->txt('ok'), true);
118  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
119  }
120 
121  public function executeCommand()
122  {
123  $next_class = $this->ilCtrl->getNextClass();
124 
125  if ($next_class == '') {
126  $this->prepareAdminOutput();
127  $this->tpl->setContent($this->dispatchCommand($this->ilCtrl->getCmd('dashboard.view')));
128  return;
129  }
130 
131  switch ($next_class) {
132  case 'ilpermissiongui':
133  $this->prepareAdminOutput();
134  $this->initTabs('permissions');
135  $this->ilTabs->setTabActive('perm_settings');
136  require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
137  $perm_gui = new ilPermissionGUI($this);
138  $this->ctrl->forwardCommand($perm_gui);
139  break;
140  default:
141  $this->prepareAdminOutput();
142  $ilObjBibliographicAdminLibrariesGUI = new ilObjBibliographicAdminLibrariesGUI($this);
143  $this->ctrl->forwardCommand($ilObjBibliographicAdminLibrariesGUI);
144  break;
145  }
146  }
147 
153  public function dispatchCommand($cmd)
154  {
155  $cmd_parts = explode('.', $cmd);
156 
157  switch ($cmd_parts[0]) {
158  case 'definitions':
159  return $this->dispatchToDefinitions($cmd_parts[1]);
160 
161  case 'instances':
162  return $this->dispatchToInstances($cmd_parts[1]);
163 
164  case 'settings':
165  return $this->dispatchToSettings($cmd_parts[1]);
166 
167  case 'dashboard':
168  return $this->dispatchToDashboard($cmd_parts[1]);
169 
170  default:
171  return $this->dispatchToDefinitions($cmd_parts[0]);
172  }
173  }
174 
178  public function prepareAdminOutput()
179  {
180  $this->tpl->getStandardTemplate();
181 
182  $this->tpl->setTitleIcon(ilUtil::getImagePath('icon_wfe.svg'));
183  $this->tpl->setTitle($this->object->getPresentationTitle());
184  $this->tpl->setDescription($this->object->getLongDescription());
185 
186  $this->initLocator();
187  }
188 
192  public function initTabs($section)
193  {
194  global $DIC;
196  $rbacsystem = $DIC['rbacsystem'];
197 
198  /*
199  $this->ilTabs->addTab(
200  'dashboard',
201  $this->lng->txt('dashboard'),
202  $this->ilCtrl->getLinkTarget($this, 'dashboard.view')
203  );
204  */
205  if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId())) {
206  $this->ilTabs->addTab(
207  'definitions',
208  $this->lng->txt('definitions'),
209  $this->ilCtrl->getLinkTarget($this, 'definitions.view')
210  );
211  $this->ilTabs->addTab(
212  'settings',
213  $this->lng->txt('settings'),
214  $this->ilCtrl->getLinkTarget($this, 'settings.view')
215  );
216  }
217  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
218  $this->ilTabs->addTab(
219  'perm_settings',
220  $this->lng->txt('perm_settings'),
221  $this->ilCtrl->getLinkTargetByClass(array('ilobjworkflowenginegui','ilpermissiongui'), 'perm')
222  );
223  }
224  /*
225  $this->ilTabs->addTab(
226  'instances',
227  $this->lng->txt('instances'),
228  $this->ilCtrl->getLinkTarget($this, 'instances.view')
229  );
230  */
231 
232  $this->ilTabs->setTabActive($section);
233  }
234 
238  public function initLocator()
239  {
240  $path = $this->tree->getPathFull((int) $_GET["ref_id"]);
241  foreach ((array) $path as $key => $row) {
242  if ($row["title"] == "Workflow Engine") {
243  $row["title"] = $this->lng->txt("obj_wfe");
244  }
245 
246  $this->ilCtrl->setParameter($this, "ref_id", $row["child"]);
247  $this->ilLocator->addItem(
248  $row["title"],
249  $this->ilCtrl->getLinkTarget($this, "dashboard.view"),
250  ilFrameTargetInfo::_getFrame("MainContent"),
251  $row["child"]
252  );
253 
254  $this->ilCtrl->setParameter($this, "ref_id", $_GET["ref_id"]);
255  }
256 
257  $this->tpl->setLocator();
258  }
259 
265  public function dispatchToDashboard($command)
266  {
267  $this->initTabs('dashboard');
269  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDashboardGUI.php';
270  $target_handler = new ilWorkflowEngineDashboardGUI($this);
271  return $target_handler->handle($command);
272  }
273 
279  public function dispatchToDefinitions($command)
280  {
281  $this->initTabs('definitions');
283  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsGUI.php';
284  $target_handler = new ilWorkflowEngineDefinitionsGUI($this, $this->dic);
285  return $target_handler->handle($command);
286  }
287 
293  public function dispatchToInstances($command)
294  {
295  $this->initTabs('instances');
297  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineInstancesGUI.php';
298  $target_handler = new ilWorkflowEngineInstancesGUI($this);
299  return $target_handler->handle($command);
300  }
301 
307  public function dispatchToSettings($command)
308  {
309  $this->initTabs('settings');
311  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineSettingsGUI.php';
312  $target_handler = new ilWorkflowEngineSettingsGUI($this);
313  return $target_handler->handle($command);
314  }
315 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$params
Definition: disable.php:11
setParameter($a_obj, $a_parameter, $a_value)
Set parameters that should be passed a form and link of a gui class.
This class provides processing control methods.
getLinkTarget( $a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui object.
New implementation of ilObjectGUI.
$type
global $DIC
Definition: saml.php:7
Class ilWorkflowEngineDefinitionsGUI.
$_GET["client_id"]
Class ilWorkflowEngineInstancesGUI.
$engine
Definition: workflow.php:89
Class ilWorkflowEngineDashboardGUI.
Class ilWorkflowEngineSettingsGUI.
$section
Definition: Utf8Test.php:83
getNextClass($a_gui_class=null)
Get next class in the control path from the current class to the target command class.
ilWorkflowEngine is part of the petri net based workflow engine.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
Create styles array
The data for the language used.
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
__construct()
ilObjWorkflowEngineGUI constructor.
static _getFrame($a_class, $a_type='')
Get content frame name.
Create new PHPExcel object
obj_idprivate
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
assignObject()
create object instance as internal property (repository/workspace switch)
static redirect($a_script)
$key
Definition: croninfo.php:18