ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  public function __construct()
48  {
49  global $DIC;
50 
51  $this->ilTabs = $DIC['ilTabs'];
52  $this->lng = $DIC['lng'];
53  $this->lng->loadLanguageModule('wfe');
54  $this->ilCtrl = $DIC['ilCtrl'];
55  $this->tpl = $DIC['tpl'];
56  $this->tree = $DIC['tree'];
57  $this->ilLocator = $DIC['ilLocator'];
58  $this->ilToolbar = $DIC['ilToolbar'];
59 
60  parent::__construct((int)$_GET['ref_id']);
61  $this->assignObject();
62  }
63 
67  public function getType()
68  {
69  return null;
70  }
71 
85  public static function _goto($params)
86  {
87  global $DIC;
89  $lng = $DIC['lng'];
90 
91  $workflow = substr($params, 2, strpos($params,'EVT')-2);
92  $event = substr($params, strpos($params, 'EVT')+3);
93 
94  $type = 'endpoint_event';
95  $content = 'was_requested';
96  $subject_type = 'workflow';
97  $subject_id = $workflow;
98  $context_type = 'event';
99  $context_id = $event;
100 
101  $engine = new ilWorkflowEngine();
102  $engine->processEvent(
103  $type,
104  $content,
105  $subject_type,
106  $subject_id,
107  $context_type,
108  $context_id
109  );
110 
111  ilUtil::sendSuccess($lng->txt('ok'), true);
112  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
113  }
114 
115  public function executeCommand()
116  {
117  $next_class = $this->ilCtrl->getNextClass();
118 
119  if($next_class == '')
120  {
121  $this->prepareAdminOutput();
122  $this->tpl->setContent($this->dispatchCommand($this->ilCtrl->getCmd('dashboard.view')));
123  return;
124  }
125 
126  switch ($next_class) {
127  case 'ilpermissiongui':
128  $this->prepareAdminOutput();
129  $this->initTabs('permissions');
130  $this->ilTabs->setTabActive('perm_settings');
131  require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
132  $perm_gui = new ilPermissionGUI($this);
133  $this->ctrl->forwardCommand($perm_gui);
134  break;
135  default:
136  $this->prepareAdminOutput();
137  $ilObjBibliographicAdminLibrariesGUI = new ilObjBibliographicAdminLibrariesGUI($this);
138  $this->ctrl->forwardCommand($ilObjBibliographicAdminLibrariesGUI);
139  break;
140  }
141  }
142 
148  public function dispatchCommand($cmd)
149  {
150  $cmd_parts = explode('.', $cmd);
151 
152  switch($cmd_parts[0])
153  {
154  case 'definitions':
155  return $this->dispatchToDefinitions($cmd_parts[1]);
156 
157  case 'instances':
158  return $this->dispatchToInstances($cmd_parts[1]);
159 
160  case 'settings':
161  return $this->dispatchToSettings($cmd_parts[1]);
162 
163  case 'dashboard':
164  return $this->dispatchToDashboard($cmd_parts[1]);
165 
166  default:
167  return $this->dispatchToDefinitions($cmd_parts[0]);
168  }
169  }
170 
174  public function prepareAdminOutput()
175  {
176  $this->tpl->getStandardTemplate();
177 
178  $this->tpl->setTitleIcon(ilUtil::getImagePath('icon_wfe.svg'));
179  $this->tpl->setTitle($this->object->getPresentationTitle());
180  $this->tpl->setDescription($this->object->getLongDescription());
181 
182  $this->initLocator();
183  }
184 
188  public function initTabs($section)
189  {
190 
191  global $DIC;
193  $rbacsystem = $DIC['rbacsystem'];
194 
195  /*
196  $this->ilTabs->addTab(
197  'dashboard',
198  $this->lng->txt('dashboard'),
199  $this->ilCtrl->getLinkTarget($this, 'dashboard.view')
200  );
201  */
202  if ($rbacsystem->checkAccess('visible,read', $this->object->getRefId()))
203  {
204  $this->ilTabs->addTab(
205  'definitions',
206  $this->lng->txt('definitions'),
207  $this->ilCtrl->getLinkTarget($this, 'definitions.view')
208  );
209  $this->ilTabs->addTab(
210  'settings',
211  $this->lng->txt('settings'),
212  $this->ilCtrl->getLinkTarget($this, 'settings.view')
213  );
214  }
215  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId()))
216  {
217  $this->ilTabs->addTab(
218  'perm_settings',
219  $this->lng->txt('permission'),
220  $this->ilCtrl->getLinkTargetByClass(array('ilobjworkflowenginegui','ilpermissiongui'), 'perm')
221  );
222  }
223  /*
224  $this->ilTabs->addTab(
225  'instances',
226  $this->lng->txt('instances'),
227  $this->ilCtrl->getLinkTarget($this, 'instances.view')
228  );
229  */
230 
231  $this->ilTabs->setTabActive($section);
232  }
233 
237  public function initLocator()
238  {
239  $path = $this->tree->getPathFull((int)$_GET["ref_id"]);
240  foreach ((array)$path as $key => $row) {
241  if ($row["title"] == "Workflow Engine") {
242  $row["title"] = $this->lng->txt("obj_wfe");
243  }
244 
245  $this->ilCtrl->setParameter($this, "ref_id", $row["child"]);
246  $this->ilLocator->addItem(
247  $row["title"],
248  $this->ilCtrl->getLinkTarget($this, "dashboard.view"),
249  ilFrameTargetInfo::_getFrame("MainContent"),
250  $row["child"]
251  );
252 
253  $this->ilCtrl->setParameter($this, "ref_id", $_GET["ref_id"]);
254  }
255 
256  $this->tpl->setLocator();
257  }
258 
264  public function dispatchToDashboard($command)
265  {
266  $this->initTabs('dashboard');
268  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDashboardGUI.php';
269  $target_handler = new ilWorkflowEngineDashboardGUI($this);
270  return $target_handler->handle($command);
271  }
272 
278  public function dispatchToDefinitions($command)
279  {
280  $this->initTabs('definitions');
282  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineDefinitionsGUI.php';
283  $target_handler = new ilWorkflowEngineDefinitionsGUI($this);
284  return $target_handler->handle($command);
285  }
286 
292  public function dispatchToInstances($command)
293  {
294  $this->initTabs('instances');
296  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineInstancesGUI.php';
297  $target_handler = new ilWorkflowEngineInstancesGUI($this);
298  return $target_handler->handle($command);
299  }
300 
306  public function dispatchToSettings($command)
307  {
308  $this->initTabs('settings');
310  require_once './Services/WorkflowEngine/classes/administration/class.ilWorkflowEngineSettingsGUI.php';
311  $target_handler = new ilWorkflowEngineSettingsGUI($this);
312  return $target_handler->handle($command);
313  }
314 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setParameter($a_obj, $a_parameter, $a_value)
Set parameters that should be passed a form and link of a gui class.
$path
Definition: aliased.php:25
This class provides processing control methods.
New implementation of ilObjectGUI.
Class ilWorkflowEngineDefinitionsGUI.
$_GET["client_id"]
Class ilWorkflowEngineInstancesGUI.
$engine
Definition: workflow.php:90
$cmd
Definition: sahs_server.php:35
getLinkTargetByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
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.
__construct()
ilObjWorkflowEngineGUI constructor.
static _getFrame($a_class, $a_type='')
Get content frame name.
Create new PHPExcel object
obj_idprivate
getLinkTarget($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui object.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
global $DIC
assignObject()
create object instance as internal property (repository/workspace switch)
static redirect($a_script)
http redirect to other script
$params
Definition: example_049.php:96