ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
class.ilSCORM2004NodeGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
15 {
18 
24  function ilSCORM2004NodeGUI($a_slm_obj, $a_node_id = 0)
25  {
26  $this->slm_object = $a_slm_obj;
27  $this->node_object = null;
28 
29  if ($a_node_id > 0)
30  {
31  $this->getNodeObject($a_node_id);
32  }
33  }
34 
40  function setParentGUI($a_parentgui)
41  {
42  $this->parentgui = $a_parentgui;
43  }
44 
50  function getParentGUI()
51  {
52  return $this->parentgui;
53  }
54 
58  function getNodeObject($a_node_id)
59  {
60  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
61  $this->node_object = ilSCORM2004NodeFactory::getInstance($this->slm_object,
62  $a_node_id, false);
63  }
64 
70  function putInTree($a_parent_id, $a_target)
71  {
72  $tree = new ilTree($this->slm_object->getId());
73  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
74  $tree->setTreeTablePK("slm_id");
75 
76  /*$parent_id = (!empty($_GET["obj_id"]))
77  ? $_GET["obj_id"]
78  : $tree->getRootId();*/
79 
80 /* if (!empty($_GET["target"]))
81  {
82  $target = $_GET["target"];
83  }
84  else
85  {
86  // determine last child of current type
87  $childs =& $tree->getChildsByType($parent_id, $this->obj->getType());
88  if (count($childs) == 0)
89  {
90  $target = IL_FIRST_NODE;
91  }
92  else
93  {
94  $target = $childs[count($childs) - 1]["obj_id"];
95  }
96  }*/
97  if (!$tree->isInTree($this->node_obj->getId()))
98  {
99  $tree->insertNode($this->node_obj->getId(), $parent_id, $target);
100  }
101  }
102 
103 
109 /* function delete()
110  {
111  $this->setTabs();
112 
113  $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
114  true, false);
115  $cont_obj_gui->delete($this->obj->getId());
116  }
117 */
118 
119 
125 /* function cancelDelete()
126  {
127  ilSession::clear("saved_post");
128  $this->ctrl->redirect($this, $_GET["backcmd"]);
129  }*/
130 
131 
137 /* function confirmedDelete()
138  {
139  $cont_obj_gui =& new ilObjContentObjectGUI("",$this->content_object->getRefId(),
140  true, false);
141  $cont_obj_gui->confirmedDelete($this->obj->getId());
142  $this->ctrl->redirect($this, $_GET["backcmd"]);
143  }
144 */
145 
146 
152 /* function checkTree()
153  {
154  $this->content_object->checkTree();
155  }
156 */
157 
161  function showOrganization()
162  {
163  global $lng, $ilCtrl, $tpl, $ilTabs;
164 
165  $this->setTabs();
166  $ilTabs->setTabActive("sahs_organization");
167  $this->setLocator();
168  $this->getParentGUI()->showOrganization($this->node_object->getId(),
169  $ilCtrl->getFormAction($this), $this->node_object->getTitle(),
170  ilUtil::getImagePath("icon_".$this->node_object->getType().".svg"),
171  $this, "showOrganization");
172  }
173 
177  function insertChapter()
178  {
179  global $ilCtrl;
180 
181  $res = $this->getParentGUI()->insertChapter(false);
182  $ilCtrl->setParameter($this, "highlight", $res["items"]);
183  $ilCtrl->redirect($this, "showOrganization", "node_".$res["node_id"]);
184  }
185 
189  function insertSco()
190  {
191  global $ilCtrl;
192 
193  $res = $this->getParentGUI()->insertSco(false);
194  $ilCtrl->setParameter($this, "highlight", $res["items"]);
195  $ilCtrl->redirect($this, "showOrganization", "node_".$res["node_id"]);
196  }
197 
201  function insertAsset()
202  {
203  global $ilCtrl;
204 
205  $res = $this->getParentGUI()->insertAsset(false);
206  $ilCtrl->setParameter($this, "highlight", $res["items"]);
207  $ilCtrl->redirect($this, "showOrganization", "node_".$res["node_id"]);
208  }
209 
213  function insertPage()
214  {
215  global $ilCtrl;
216 
217  $res = $this->getParentGUI()->insertPage(false);
218  $ilCtrl->setParameter($this, "highlight", $res["items"]);
219  $ilCtrl->redirect($this, "showOrganization", "node_".$res["node_id"]);
220  }
221 
225  function insertTemplateGUI()
226  {
227  global $ilCtrl;
228  $this->getParentGUI()->insertTemplateGUI(true);
229  }
230 
234  function insertSpecialPage()
235  {
236  global $ilCtrl;
237  $this->getParentGUI()->insertSpecialPage(true);
238  }
239 
243  function collapseAll()
244  {
245  global $ilCtrl;
246 
247  $this->getParentGUI()->collapseAll(false);
248  $ilCtrl->redirect($this, "showOrganization");
249  }
250 
254  function ExpandAll()
255  {
256  global $ilCtrl;
257 
258  $this->getParentGUI()->expandAll(false);
259  $ilCtrl->redirect($this, "showOrganization");
260  }
261 
265  function saveAllTitles()
266  {
267  global $ilCtrl;
268 
269  $this->getParentGUI()->saveAllTitles(false);
270  $ilCtrl->redirect($this, "showOrganization");
271  }
272 
276  function deleteNodes()
277  {
278  global $ilCtrl;
279 
280  $ilCtrl->setParameter($this, "backcmd", $_GET["backcmd"]);
281  $this->getParentGUI()->deleteNodes($ilCtrl->getFormAction($this));
282  }
283 
287  function cancelDelete()
288  {
289  global $ilCtrl;
290  $ilCtrl->redirect($this, "showOrganization");
291  }
292 
296  function confirmedDelete()
297  {
298  global $ilCtrl;
299 
300  $this->getParentGUI()->confirmedDelete(false);
301  $ilCtrl->redirect($this, "showOrganization");
302  }
303 
307  function setLocator()
308  {
309  global $ilLocator, $tpl, $ilCtrl;
310 
311  $ilLocator->addRepositoryItems($_GET["ref_id"]);
312  $this->getParentGUI()->addLocatorItems();
313 
314  if ($_GET["obj_id"] > 0)
315  {
316  $tree = new ilTree($this->slm_object->getId());
317  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
318  $tree->setTreeTablePK("slm_id");
319  $path = $tree->getPathFull($_GET["obj_id"]);
320  for( $i = 1; $i < count($path); $i++)
321  {
322 //var_dump($path[$i]);
323  switch($path[$i]["type"])
324  {
325  case "chap":
326  $ilCtrl->setParameterByClass("ilscorm2004chaptergui", "obj_id",
327  $path[$i]["child"]);
328  $ilLocator->addItem($path[$i]["title"],
329  $ilCtrl->getLinkTargetByClass("ilscorm2004chaptergui",
330  "showOrganization"), "", 0, $path[$i]["type"],
331  ilUtil::getImagePath("icon_chap.svg"));
332  break;
333 
334  case "seqc":
335  $ilCtrl->setParameterByClass("ilscorm2004seqchaptergui", "obj_id",
336  $path[$i]["child"]);
337  $ilLocator->addItem($path[$i]["title"],
338  $ilCtrl->getLinkTargetByClass("ilscorm2004seqchaptergui",
339  "showOrganization"), "", 0, $path[$i]["type"],
340  ilUtil::getImagePath("icon_chap.svg"));
341  break;
342 
343  case "sco":
344  $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id",
345  $path[$i]["child"]);
346  $ilLocator->addItem($path[$i]["title"],
347  $ilCtrl->getLinkTargetByClass("ilscorm2004scogui",
348  "showOrganization"), "", 0, $path[$i]["type"],
349  ilUtil::getImagePath("icon_sco.svg"));
350  break;
351 
352  case "ass":
353  $ilCtrl->setParameterByClass("ilscorm2004assetgui", "obj_id",
354  $path[$i]["child"]);
355  $ilLocator->addItem($path[$i]["title"],
356  $ilCtrl->getLinkTargetByClass("ilscorm2004assetgui",
357  "showOrganization"), "", 0, $path[$i]["type"],
358  ilUtil::getImagePath("icon_sca.svg"));
359  break;
360 
361  case "page":
362  $ilCtrl->setParameterByClass("ilscorm2004pagegui", "obj_id",
363  $path[$i]["child"]);
364  $ilLocator->addItem($path[$i]["title"],
365  $ilCtrl->getLinkTargetByClass("ilscorm2004pagegui",
366  "edit"), "", 0, $path[$i]["type"],
367  ilUtil::getImagePath("icon_pg.svg"));
368  break;
369  }
370  }
371  }
372  $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
373 
374  $tpl->setLocator();
375  }
376 
380  function setContentStyle()
381  {
382  global $tpl;
383 
384  // content styles
385  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
386  $tpl->setCurrentBlock("ContentStyle");
387  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
388  ilObjStyleSheet::getContentStylePath($this->slm_object->getStyleSheetId()));
389  $tpl->setVariable("LOCATION_ADDITIONAL_STYLESHEET",
391  $tpl->parseCurrentBlock();
392 
393  $tpl->setCurrentBlock("SyntaxStyle");
394  $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
396  $tpl->parseCurrentBlock();
397  }
398 
402  function copyItems($a_return = "showOrganization")
403  {
404  global $ilCtrl, $lng;
405 
406  $items = ilUtil::stripSlashesArray($_POST["id"]);
407  $todel = array(); // delete IDs < 0 (needed for non-js editing)
408  foreach($items as $k => $item)
409  {
410  if ($item < 0)
411  {
412  $todel[] = $k;
413  }
414  }
415  foreach($todel as $k)
416  {
417  unset($items[$k]);
418  }
420  {
421  ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
422  $ilCtrl->redirect($this, $a_return);
423  }
424  ilSCORM2004Node::clipboardCopy($this->slm_object->getId(), $items);
425 
426  // @todo: move this to a service since it can be used here, too
427  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
429  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
430 
431  $ilCtrl->redirect($this, $a_return);
432  }
433 
437  function cutItems($a_return = "showOrganization")
438  {
439  global $ilCtrl, $lng;
440 
441  $items = ilUtil::stripSlashesArray($_POST["id"]);
442  $todel = array(); // delete IDs < 0 (needed for non-js editing)
443  foreach($items as $k => $item)
444  {
445  if ($item < 0)
446  {
447  $todel[] = $k;
448  }
449  }
450  foreach($todel as $k)
451  {
452  unset($items[$k]);
453  }
454 
456  {
457  ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
458  $ilCtrl->redirect($this, $a_return);
459  }
460 
461  ilSCORM2004Node::clipboardCut($this->slm_object->getId(), $items);
462 
463  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
465 
466  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
467 
468  $ilCtrl->redirect($this, $a_return);
469  }
470 
474  function insertPageClip()
475  {
476  global $ilCtrl, $ilUser;
477 
478  ilSCORM2004Node::insertPageClip($this->slm_object);
479 
480  $ilCtrl->redirect($this, "showOrganization",
482  }
483 
487  function insertScoClip()
488  {
489  global $ilCtrl, $ilUser;
490 
491  ilSCORM2004Node::insertScoClip($this->slm_object);
492 
493  $ilCtrl->redirect($this, "showOrganization",
495  }
496 
500  function insertAssetClip()
501  {
502  global $ilCtrl, $ilUser;
503 
504  ilSCORM2004Node::insertAssetClip($this->slm_object);
505 
506  $ilCtrl->redirect($this, "showOrganization",
508  }
509 
510 }
511 ?>
$_POST['username']
Definition: cron.php:12
static clipboardCopy($a_slm_obj_id, $a_ids)
Copy a set of chapters/pages/scos into the clipboard.
setParentGUI($a_parentgui)
Set Parent GUI class (ilObjSCORM2004LearningModuleGUI).
Class ilSCORM2004NodeGUI.
$_GET["client_id"]
getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
static getPostNodeId()
Get node ID of _POST input.
getParentGUI()
Get Parent GUI class (ilObjSCORM2004LearningModuleGUI).
static insertPageClip($a_slm_obj)
Insert pages from clipboard.
setLocator()
Set Locator Items.
static insertScoClip($a_slm_obj)
Insert scos from clipboard.
getNodeObject($a_node_id)
Get node object (chapter/sco/page)
getSyntaxStylePath()
get syntax style path
insertScoClip()
Insert scos from clipboard.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
cutItems($a_return="showOrganization")
Copy items to clipboard, then cut them from the current tree.
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
ilSCORM2004NodeGUI($a_slm_obj, $a_node_id=0)
constructor
insertPageClip()
Insert pages from clipboard.
confirmedDelete()
confirmed delete
putInTree($a_parent_id, $a_target)
put this object into content object tree
showOrganization()
Confirm deletion screen (delete page or structure objects)
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters or all scos)
insertAssetClip()
Insert assets from clipboard.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
deleteNodes()
Delete nodes in the hierarchy.
clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the clipboard.
global $ilUser
Definition: imgupload.php:15
getContentStylePath($a_style_id)
get content style path
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
insertSpecialPage()
Insert special page.
copyItems($a_return="showOrganization")
Copy items to clipboard.
setContentStyle()
Set content style sheet.
insertTemplateGUI()
Insert Page with Layout.
static insertAssetClip($a_slm_obj, $a_type="ass")
Insert assets from clipboard.
insertChapter()
Insert Chapter.