ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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{
19 protected $lng;
20
24 protected $ctrl;
25
29 protected $tpl;
30
34 protected $tabs;
35
39 protected $locator;
40
44 protected $user;
45
48
54 public function __construct($a_slm_obj, $a_node_id = 0)
55 {
56 global $DIC;
57
58 $this->lng = $DIC->language();
59 $this->ctrl = $DIC->ctrl();
60 $this->tpl = $DIC["tpl"];
61 $this->tabs = $DIC->tabs();
62 $this->locator = $DIC["ilLocator"];
63 $this->user = $DIC->user();
64 $this->slm_object = $a_slm_obj;
65 $this->node_object = null;
66
67 if ($a_node_id > 0) {
68 $this->getNodeObject($a_node_id);
69 }
70 }
71
77 public function setParentGUI($a_parentgui)
78 {
79 $this->parentgui = $a_parentgui;
80 }
81
87 public function getParentGUI()
88 {
89 return $this->parentgui;
90 }
91
95 public function getNodeObject($a_node_id)
96 {
97 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
98 $this->node_object = ilSCORM2004NodeFactory::getInstance(
99 $this->slm_object,
100 $a_node_id,
101 false
102 );
103 }
104
105
111 /* function delete()
112 {
113 $this->setTabs();
114
115 $cont_obj_gui = new ilObjContentObjectGUI("",$this->content_object->getRefId(),
116 true, false);
117 $cont_obj_gui->delete($this->obj->getId());
118 }
119 */
120
121
127 /* function cancelDelete()
128 {
129 ilSession::clear("saved_post");
130 $this->ctrl->redirect($this, $_GET["backcmd"]);
131 }*/
132
133
139 /* function confirmedDelete()
140 {
141 $cont_obj_gui = new ilObjContentObjectGUI("",$this->content_object->getRefId(),
142 true, false);
143 $cont_obj_gui->confirmedDelete($this->obj->getId());
144 $this->ctrl->redirect($this, $_GET["backcmd"]);
145 }
146 */
147
148
154 /* function checkTree()
155 {
156 $this->content_object->checkTree();
157 }
158 */
159
163 public function showOrganization()
164 {
168 $ilTabs = $this->tabs;
169
170 $this->setTabs();
171 $ilTabs->setTabActive("sahs_organization");
172 $this->setLocator();
173 $this->getParentGUI()->showOrganization(
174 $this->node_object->getId(),
175 $ilCtrl->getFormAction($this),
176 $this->node_object->getTitle(),
177 ilUtil::getImagePath("icon_" . $this->node_object->getType() . ".svg"),
178 $this,
179 "showOrganization"
180 );
181 }
182
186 public function insertChapter()
187 {
189
190 $res = $this->getParentGUI()->insertChapter(false);
191 $ilCtrl->setParameter($this, "highlight", $res["items"]);
192 $ilCtrl->redirect($this, "showOrganization", "node_" . $res["node_id"]);
193 }
194
198 public function insertSco()
199 {
201
202 $res = $this->getParentGUI()->insertSco(false);
203 $ilCtrl->setParameter($this, "highlight", $res["items"]);
204 $ilCtrl->redirect($this, "showOrganization", "node_" . $res["node_id"]);
205 }
206
210 public function insertAsset()
211 {
213
214 $res = $this->getParentGUI()->insertAsset(false);
215 $ilCtrl->setParameter($this, "highlight", $res["items"]);
216 $ilCtrl->redirect($this, "showOrganization", "node_" . $res["node_id"]);
217 }
218
222 public function insertPage()
223 {
225
226 $res = $this->getParentGUI()->insertPage(false);
227 $ilCtrl->setParameter($this, "highlight", $res["items"]);
228 $ilCtrl->redirect($this, "showOrganization", "node_" . $res["node_id"]);
229 }
230
234 public function insertTemplateGUI()
235 {
237 $this->getParentGUI()->insertTemplateGUI(true);
238 }
239
243 public function insertSpecialPage()
244 {
246 $this->getParentGUI()->insertSpecialPage(true);
247 }
248
252 public function collapseAll()
253 {
255
256 $this->getParentGUI()->collapseAll(false);
257 $ilCtrl->redirect($this, "showOrganization");
258 }
259
263 public function ExpandAll()
264 {
266
267 $this->getParentGUI()->expandAll(false);
268 $ilCtrl->redirect($this, "showOrganization");
269 }
270
274 public function saveAllTitles()
275 {
277
278 $this->getParentGUI()->saveAllTitles(false);
279 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
280 $ilCtrl->redirect($this, "showOrganization");
281 }
282
286 public function deleteNodes()
287 {
289
290 $ilCtrl->setParameter($this, "backcmd", $_GET["backcmd"]);
291 $this->getParentGUI()->deleteNodes($ilCtrl->getFormAction($this));
292 }
293
297 public function cancelDelete()
298 {
300 $ilCtrl->redirect($this, "showOrganization");
301 }
302
306 public function confirmedDelete()
307 {
309
310 $this->getParentGUI()->confirmedDelete(false);
311 $ilCtrl->redirect($this, "showOrganization");
312 }
313
317 public function setLocator()
318 {
319 $ilLocator = $this->locator;
322
323 $ilLocator->addRepositoryItems($_GET["ref_id"]);
324 $this->getParentGUI()->addLocatorItems();
325
326 if ($_GET["obj_id"] > 0) {
327 $tree = new ilTree($this->slm_object->getId());
328 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
329 $tree->setTreeTablePK("slm_id");
330 $path = $tree->getPathFull($_GET["obj_id"]);
331 for ($i = 1; $i < count($path); $i++) {
332 //var_dump($path[$i]);
333 switch ($path[$i]["type"]) {
334 case "chap":
335 $ilCtrl->setParameterByClass(
336 "ilscorm2004chaptergui",
337 "obj_id",
338 $path[$i]["child"]
339 );
340 $ilLocator->addItem(
341 $path[$i]["title"],
342 $ilCtrl->getLinkTargetByClass(
343 "ilscorm2004chaptergui",
344 "showOrganization"
345 ),
346 "",
347 0,
348 $path[$i]["type"],
349 ilUtil::getImagePath("icon_chap.svg")
350 );
351 break;
352
353 case "seqc":
354 $ilCtrl->setParameterByClass(
355 "ilscorm2004seqchaptergui",
356 "obj_id",
357 $path[$i]["child"]
358 );
359 $ilLocator->addItem(
360 $path[$i]["title"],
361 $ilCtrl->getLinkTargetByClass(
362 "ilscorm2004seqchaptergui",
363 "showOrganization"
364 ),
365 "",
366 0,
367 $path[$i]["type"],
368 ilUtil::getImagePath("icon_chap.svg")
369 );
370 break;
371
372 case "sco":
373 $ilCtrl->setParameterByClass(
374 "ilscorm2004scogui",
375 "obj_id",
376 $path[$i]["child"]
377 );
378 $ilLocator->addItem(
379 $path[$i]["title"],
380 $ilCtrl->getLinkTargetByClass(
381 "ilscorm2004scogui",
382 "showOrganization"
383 ),
384 "",
385 0,
386 $path[$i]["type"],
387 ilUtil::getImagePath("icon_sco.svg")
388 );
389 break;
390
391 case "ass":
392 $ilCtrl->setParameterByClass(
393 "ilscorm2004assetgui",
394 "obj_id",
395 $path[$i]["child"]
396 );
397 $ilLocator->addItem(
398 $path[$i]["title"],
399 $ilCtrl->getLinkTargetByClass(
400 "ilscorm2004assetgui",
401 "showOrganization"
402 ),
403 "",
404 0,
405 $path[$i]["type"],
406 ilUtil::getImagePath("icon_sca.svg")
407 );
408 break;
409
410 case "page":
411 $ilCtrl->setParameterByClass(
412 "ilscorm2004pagegui",
413 "obj_id",
414 $path[$i]["child"]
415 );
416 $ilLocator->addItem(
417 $path[$i]["title"],
418 $ilCtrl->getLinkTargetByClass(
419 "ilscorm2004pagegui",
420 "edit"
421 ),
422 "",
423 0,
424 $path[$i]["type"],
425 ilUtil::getImagePath("icon_pg.svg")
426 );
427 break;
428 }
429 }
430 }
431 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
432
433 $tpl->setLocator();
434 }
435
439 public function setContentStyle()
440 {
442
443 // content styles
444 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
445 $tpl->setCurrentBlock("ContentStyle");
446 $tpl->setVariable(
447 "LOCATION_CONTENT_STYLESHEET",
448 ilObjStyleSheet::getContentStylePath($this->slm_object->getStyleSheetId())
449 );
450 $tpl->setVariable(
451 "LOCATION_ADDITIONAL_STYLESHEET",
453 );
454 $tpl->parseCurrentBlock();
455
456 $tpl->setCurrentBlock("SyntaxStyle");
457 $tpl->setVariable(
458 "LOCATION_SYNTAX_STYLESHEET",
460 );
461 $tpl->parseCurrentBlock();
462 }
463
467 public function copyItems($a_return = "showOrganization")
468 {
471
472 $items = ilUtil::stripSlashesArray($_POST["id"]);
473 $todel = array(); // delete IDs < 0 (needed for non-js editing)
474 foreach ($items as $k => $item) {
475 if ($item < 0) {
476 $todel[] = $k;
477 }
478 }
479 foreach ($todel as $k) {
480 unset($items[$k]);
481 }
483 ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
484 $ilCtrl->redirect($this, $a_return);
485 }
486 ilSCORM2004Node::clipboardCopy($this->slm_object->getId(), $items);
487
488 // @todo: move this to a service since it can be used here, too
489 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
491 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
492
493 $ilCtrl->redirect($this, $a_return);
494 }
495
499 public function cutItems($a_return = "showOrganization")
500 {
503
504 $items = ilUtil::stripSlashesArray($_POST["id"]);
505 $todel = array(); // delete IDs < 0 (needed for non-js editing)
506 foreach ($items as $k => $item) {
507 if ($item < 0) {
508 $todel[] = $k;
509 }
510 }
511 foreach ($todel as $k) {
512 unset($items[$k]);
513 }
514
516 ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
517 $ilCtrl->redirect($this, $a_return);
518 }
519
520 ilSCORM2004Node::clipboardCut($this->slm_object->getId(), $items);
521
522 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
524
525 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
526
527 $ilCtrl->redirect($this, $a_return);
528 }
529
533 public function insertPageClip()
534 {
537
538 ilSCORM2004Node::insertPageClip($this->slm_object);
539
540 $ilCtrl->redirect(
541 $this,
542 "showOrganization",
544 );
545 }
546
550 public function insertScoClip()
551 {
554
555 ilSCORM2004Node::insertScoClip($this->slm_object);
556
557 $ilCtrl->redirect(
558 $this,
559 "showOrganization",
561 );
562 }
563
567 public function insertAssetClip()
568 {
571
572 ilSCORM2004Node::insertAssetClip($this->slm_object);
573
574 $ilCtrl->redirect(
575 $this,
576 "showOrganization",
578 );
579 }
580
584 public function insertLMChapterClip()
585 {
588
589 $this->setLocator();
590 $this->setTabs();
591 $this->getParentGUI()->insertLMChapterClip();
592 }
593}
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static setAction($a_action)
static getPostNodeId()
Get node ID of _POST input.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
Class ilSCORM2004NodeGUI.
copyItems($a_return="showOrganization")
Copy items to clipboard.
insertAssetClip()
Insert assets from clipboard.
getNodeObject($a_node_id)
Get node object (chapter/sco/page)
cutItems($a_return="showOrganization")
Copy items to clipboard, then cut them from the current tree.
__construct($a_slm_obj, $a_node_id=0)
constructor
insertPageClip()
Insert pages from clipboard.
insertSpecialPage()
Insert special page.
showOrganization()
Confirm deletion screen (delete page or structure objects)
setContentStyle()
Set content style sheet.
setParentGUI($a_parentgui)
Set Parent GUI class (ilObjSCORM2004LearningModuleGUI).
deleteNodes()
Delete nodes in the hierarchy.
insertLMChapterClip()
Insert scos from clipboard.
getParentGUI()
Get Parent GUI class (ilObjSCORM2004LearningModuleGUI).
confirmedDelete()
confirmed delete
setLocator()
Set Locator Items.
insertTemplateGUI()
Insert Page with Layout.
insertScoClip()
Insert scos from clipboard.
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters or all scos)
static insertAssetClip($a_slm_obj, $a_type="ass")
Insert assets from clipboard.
static clipboardCopy($a_slm_obj_id, $a_ids)
Copy a set of chapters/pages/scos into the clipboard.
static insertPageClip($a_slm_obj)
Insert pages from clipboard.
static insertScoClip($a_slm_obj)
Insert scos from clipboard.
static clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the 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 sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
global $ilCtrl
Definition: ilias.php:18
$i
Definition: metadata.php:24
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46