ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjTaxonomyGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObject2GUI.php";
5 require_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
6 include_once("./Services/Taxonomy/interfaces/interface.ilTaxAssignedItemInfo.php");
7 
19 {
23  protected $tabs;
24 
28  protected $help;
29 
30  protected $multiple = false;
31  protected $assigned_item_sorting = false;
32 
36  public function __construct($a_id = 0)
37  {
38  global $DIC;
39 
40  $this->ctrl = $DIC->ctrl();
41  $this->lng = $DIC->language();
42  $this->user = $DIC->user();
43  $this->tabs = $DIC->tabs();
44  $this->toolbar = $DIC->toolbar();
45  $this->tpl = $DIC["tpl"];
46  $this->help = $DIC["ilHelp"];
47  $ilCtrl = $DIC->ctrl();
48  $lng = $DIC->language();
49 
51 
52  $ilCtrl->saveParameter($this, "tax_node");
53  $ilCtrl->saveParameter($this, "tax_id");
54 
55  $lng->loadLanguageModule("tax");
56  }
57 
63  public function getType()
64  {
65  return "tax";
66  }
67 
73  public function setAssignedObject($a_val)
74  {
75  $this->assigned_object_id = $a_val;
76  }
77 
83  public function getAssignedObject()
84  {
85  return $this->assigned_object_id;
86  }
87 
93  public function setMultiple($a_val)
94  {
95  $this->multiple = $a_val;
96  }
97 
103  public function getMultiple()
104  {
105  return $this->multiple;
106  }
107 
113  public function setListInfo($a_val)
114  {
115  $this->list_info = trim($a_val);
116  }
117 
123  public function getListInfo()
124  {
125  return $this->list_info;
126  }
127 
133  public function activateAssignedItemSorting(ilTaxAssignedItemInfo $a_item_info_obj, $a_component_id, $a_obj_id, $a_item_type)
134  {
135  $this->assigned_item_sorting = true;
136  $this->assigned_item_info_obj = $a_item_info_obj;
137  $this->assigned_item_comp_id = $a_component_id;
138  $this->assigned_item_obj_id = $a_obj_id;
139  $this->assigned_item_type = $a_item_type;
140  }
141 
142 
146  public function executeCommand()
147  {
150  $ilTabs = $this->tabs;
151 
152  $next_class = $ilCtrl->getNextClass();
153 
154  switch ($next_class) {
155  default:
156  $cmd = $ilCtrl->getCmd("listTaxonomies");
157  $this->$cmd();
158  break;
159  }
160  }
161 
165  protected function initCreationForms($a_new_type)
166  {
167  $forms = array(
168  self::CFORM_NEW => $this->initCreateForm("tax")
169  );
170 
171  return $forms;
172  }
173 
174 
178 
185  public function editAOTaxonomySettings()
186  {
187  $ilToolbar = $this->toolbar;
189  $lng = $this->lng;
190 
191 
192  // if (count($tax_ids) != 0 && !$this->getMultiple())
193  // {
194  // $this->listNodes();
195  // }
196  // else if ($this->getMultiple())
197  // {
198  $this->listTaxonomies();
199  // }
200 
201  // currently we support only one taxonomy, otherwise we may need to provide
202  // a list here
203  }
204 
211  public function getCurrentTaxonomyId()
212  {
214  $tax_id = (int) $_GET["tax_id"];
215  if (in_array($tax_id, $tax_ids)) {
216  return $tax_id;
217  }
218  return false;
219  }
220 
221 
228  public function getCurrentTaxonomy()
229  {
230  $tax_id = $this->getCurrentTaxonomyId();
231  if ($tax_id > 0) {
232  $tax = new ilObjTaxonomy($tax_id);
233  return $tax;
234  }
235 
236  return false;
237  }
238 
239 
246  public function listNodes()
247  {
248  $tpl = $this->tpl;
249  $ilToolbar = $this->toolbar;
250  $lng = $this->lng;
252 
253  $tax = $this->getCurrentTaxonomy();
254 
255  $this->setTabs("list_items");
256 
257  // show toolbar
258  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
259  $ilToolbar->addFormButton($lng->txt("tax_create_node"), "createTaxNode");
260 
261  $ilToolbar->setCloseFormTag(false);
262 
263 
264  // show tree
265  $this->showTree();
266 
267  // show subitems
268  include_once("./Services/Taxonomy/classes/class.ilTaxonomyTableGUI.php");
269  $table = new ilTaxonomyTableGUI(
270  $this,
271  "listNodes",
272  $tax->getTree(),
273  (int) $_GET["tax_node"],
274  $this->getCurrentTaxonomy()
275  );
276  $table->setOpenFormTag(false);
277 
278  $tpl->setContent($table->getHTML());
279  }
280 
281 
288  public function createAssignedTaxonomy()
289  {
290  $this->create();
291  }
292 
293 
298  protected function checkPermissionBool($a_perm, $a_cmd = "", $a_type = "", $a_node_id = null)
299  {
300  if ($this->getAssignedObject() > 0) {
301  return true;
302  } else {
303  return parent::checkPermissionBool($a_perm, $a_cmd, $a_type, $a_node_id);
304  }
305  }
306 
313  public function cancel()
314  {
316 
317  if ($this->getAssignedObject() > 0) {
318  $ilCtrl->redirect($this, "listTaxonomies");
319  }
320 
321  return parent::cancel();
322  }
323 
330  public function save()
331  {
333 
334  if ($this->getAssignedObject() > 0) {
335  $_REQUEST["new_type"] = "tax";
336  }
337 
338  parent::saveObject();
339  }
340 
347  protected function afterSave(ilObject $a_new_object)
348  {
350  $lng = $this->lng;
351 
352  if ($this->getAssignedObject() > 0) {
354  $a_new_object->getId(),
355  $this->getAssignedObject()
356  );
357  $ilCtrl->setParameter($this, "tax_id", $a_new_object->getId());
358  ilUtil::sendSuccess($lng->txt("tax_added"), true);
359  $ilCtrl->redirect($this, "editSettings");
360  }
361  }
362 
368  public function showTree($a_ass_items = false)
369  {
370  global $DIC;
371 
372  $tax = $this->getCurrentTaxonomy();
373  $ctrl = $this->ctrl;
374 
375  $cmd = $a_ass_items
376  ? "listAssignedItems"
377  : "listNodes";
378 
379  $DIC->globalScreen()->tool()->context()->current()
380  ->addAdditionalData(
382  true
383  );
384  $DIC->globalScreen()->tool()->context()->current()
385  ->addAdditionalData(
387  $ctrl->getCurrentClassPath()
388  );
389  $DIC->globalScreen()->tool()->context()->current()
390  ->addAdditionalData(
392  $tax->getId()
393  );
394  $DIC->globalScreen()->tool()->context()->current()
395  ->addAdditionalData(
397  $cmd
398  );
399  $DIC->globalScreen()->tool()->context()->current()
400  ->addAdditionalData(
402  "showTree"
403  );
404 
405  $tax_exp = new ilTaxonomyExplorerGUI(
406  $this,
407  "showTree",
408  $tax->getId(),
409  "ilobjtaxonomygui",
410  $cmd
411  );
412  $tax_exp->handleCommand();
413  return;
414  }
415 
422  public static function getTreeHTML(
423  $a_tax_id,
424  $a_class,
425  $a_cmd,
426  $a_target_class,
427  $a_target_cmd,
428  $a_root_node_title = ""
429  ) {
430  die("ilObjTaxonomyGUI::getTreeHTML is deprecated.");
431  include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
432  $tax_exp = new ilTaxonomyExplorerGUI(
433  $a_class,
434  $a_cmd,
435  $a_tax_id,
436  $a_target_class,
437  $a_target_cmd
438  );
439  if (!$tax_exp->handleCommand()) {
440  return $tax_exp->getHTML() . "&nbsp;";
441  }
442  return;
443  }
444 
445 
452  public function createTaxNode()
453  {
454  $tpl = $this->tpl;
455  $ilHelp = $this->help;
456 
457  $this->setTabs("list_items");
458  $ilHelp->setSubScreenId("create_node");
459 
460  $this->initTaxNodeForm("create");
461  $tpl->setContent($this->form->getHTML());
462  }
463 
464 
470  public function initTaxNodeForm($a_mode = "edit")
471  {
472  $lng = $this->lng;
474 
475  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
476  $this->form = new ilPropertyFormGUI();
477 
478  // title
479  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
480  $this->form->addItem($ti);
481 
482  // order nr
483  $tax = $this->getCurrentTaxonomy();
484  if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
485  $or = new ilTextInputGUI($this->lng->txt("tax_order_nr"), "order_nr");
486  $or->setMaxLength(5);
487  $or->setSize(5);
488  $this->form->addItem($or);
489  }
490 
491  if ($a_mode == "edit") {
492  $node = new ilTaxonomyNode((int) $_GET["tax_node"]);
493  $ti->setValue($node->getTitle());
494  $or->setValue($node->getOrderNr());
495  }
496 
497  // save and cancel commands
498  if ($a_mode == "create") {
499  $this->form->addCommandButton("saveTaxNode", $lng->txt("save"));
500  $this->form->addCommandButton("listNodes", $lng->txt("cancel"));
501  $this->form->setTitle($lng->txt("tax_new_tax_node"));
502  } else {
503  $this->form->addCommandButton("updateTaxNode", $lng->txt("save"));
504  $this->form->addCommandButton("listNodes", $lng->txt("cancel"));
505  $this->form->setTitle($lng->txt("tax_edit_tax_node"));
506  }
507 
508  $this->form->setFormAction($ilCtrl->getFormAction($this));
509  }
510 
515  public function saveTaxNode()
516  {
517  $tpl = $this->tpl;
518  $lng = $this->lng;
520 
521  $this->initTaxNodeForm("create");
522  if ($this->form->checkInput()) {
523  $tax = $this->getCurrentTaxonomy();
524 
525  // create node
526  include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
527  $node = new ilTaxonomyNode();
528  $node->setTitle($this->form->getInput("title"));
529 
530  $tax = $this->getCurrentTaxonomy();
531  if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
532  $order_nr = $this->form->getInput("order_nr");
533  }
534  if ($order_nr === "") {
535  $order_nr = ilTaxonomyNode::getNextOrderNr($tax->getId(), (int) $_GET["tax_node"]);
536  }
537  //echo $order_nr; exit;
538  $node->setOrderNr($order_nr);
539  $node->setTaxonomyId($tax->getId());
540  $node->create();
541 
542  // put in tree
543  ilTaxonomyNode::putInTree($tax->getId(), $node, (int) $_GET["tax_node"]);
544 
545  ilTaxonomyNode::fixOrderNumbers($tax->getId(), (int) $_GET["tax_node"]);
546 
547  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
548  $ilCtrl->redirect($this, "listNodes");
549  } else {
550  $this->form->setValuesByPost();
551  $tpl->setContent($this->form->getHtml());
552  }
553  }
554 
555 
559  public function updateTaxNode()
560  {
561  $lng = $this->lng;
563  $tpl = $this->tpl;
564 
565  $this->initTaxNodeForm("edit");
566  if ($this->form->checkInput()) {
567  // create node
568  $node = new ilTaxonomyNode($_GET["tax_node"]);
569  $node->setTitle($this->form->getInput("title"));
570 
571  $tax = $this->getCurrentTaxonomy();
572  if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
573  $node->setOrderNr($this->form->getInput("order_nr"));
574  }
575 
576  $node->update();
577 
578  ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
579  $ilCtrl->redirect($this, "");
580  } else {
581  $this->form->setValuesByPost();
582  $tpl->setContent($this->form->getHtml());
583  }
584  }
585 
589  public function deleteItems()
590  {
591  $lng = $this->lng;
592  $tpl = $this->tpl;
594  $ilTabs = $this->tabs;
595  $ilHelp = $this->help;
596 
597  if (!isset($_POST["id"])) {
598  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
599  $ilCtrl->redirect($this, "listNodes");
600  }
601 
602  $this->setTabs("list_items");
603  $ilHelp->setSubScreenId("del_items");
604 
605  // $ilTabs->clearTargets();
606 
607  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
608  $confirmation_gui = new ilConfirmationGUI();
609 
610  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
611  $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
612 
613  // Add items to delete
614  include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
615  foreach ($_POST["id"] as $id) {
616  $confirmation_gui->addItem(
617  "id[]",
618  $id,
620  );
621  }
622 
623  $confirmation_gui->setCancel($lng->txt("cancel"), "listNodes");
624  $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
625 
626  $tpl->setContent($confirmation_gui->getHTML());
627  }
628 
632  public function confirmedDelete()
633  {
635 
636  include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
637 
638  // delete all selected objects
639  foreach ($_POST["id"] as $id) {
640  $node = new ilTaxonomyNode($id);
641  $tax = new ilObjTaxonomy($node->getTaxonomyId());
642  $tax_tree = $tax->getTree();
643  $node_data = $tax_tree->getNodeData($id);
644  if (is_object($node)) {
645  $node->delete();
646  }
647  if ($tax_tree->isInTree($id)) {
648  $tax_tree->deleteTree($node_data);
649  }
650  ilTaxonomyNode::fixOrderNumbers($node->getTaxonomyId(), $node_data["parent"]);
651  }
652 
653  // feedback
654  ilUtil::sendInfo($this->lng->txt("info_deleted"), true);
655 
656  $ilCtrl->redirect($this, "listNodes");
657  }
658 
665  public function saveSorting()
666  {
668  $lng = $this->lng;
669 
670  // save sorting
671  include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
672  if (is_array($_POST["order"])) {
673  // asort($_POST["order"]);
674  // $cnt = 10;
675  foreach ($_POST["order"] as $k => $v) {
677  }
678  ilTaxonomyNode::fixOrderNumbers($this->getCurrentTaxonomyId(), (int) $_GET["tax_node"]);
679  }
680 
681  // save titles
682  if (is_array($_POST["title"])) {
683  foreach ($_POST["title"] as $k => $v) {
685  (int) $k,
687  );
688  }
689  }
690 
691 
692  ilUtil::sendSuccess($lng->txt("msg_obj_modified"));
693  $ilCtrl->redirect($this, "listNodes");
694  }
695 
699  public function moveItems()
700  {
701  $tpl = $this->tpl;
703  $lng = $this->lng;
704  $ilToolbar = $this->toolbar;
705  $ilHelp = $this->help;
706 
707  if (!isset($_POST["id"])) {
708  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
709  $ilCtrl->redirect($this, "listNodes");
710  }
711 
712  $this->setTabs("list_items");
713  $ilHelp->setSubScreenId("move_items");
714 
715  $ilToolbar->addButton(
716  $lng->txt("cancel"),
717  $ilCtrl->getLinkTarget($this, "listNodes")
718  );
719 
720  ilUtil::sendInfo($lng->txt("tax_please_select_target"));
721 
722  if (is_array($_POST["id"])) {
723  $ilCtrl->setParameter($this, "move_ids", implode(",", $_POST["id"]));
724 
726  $tpl = $this->tpl;
728  $lng = $this->lng;
729 
730  include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
731  $tax_exp = new ilTaxonomyExplorerGUI(
732  $this,
733  "moveItems",
734  $this->getCurrentTaxonomy()->getId(),
735  "ilobjtaxonomygui",
736  "pasteItems"
737  );
738  if (!$tax_exp->handleCommand()) {
739  //$tpl->setLeftNavContent($tax_exp->getHTML());
740  $tpl->setContent($tax_exp->getHTML() . "&nbsp;");
741  }
742  }
743  }
744 
748  public function pasteItems()
749  {
750  $lng = $this->lng;
752  //var_dump($_GET);
753  //var_dump($_POST);
754  if ($_GET["move_ids"] != "") {
755  $move_ids = explode(",", $_GET["move_ids"]);
756  $tax = $this->getCurrentTaxonomy();
757  $tree = $tax->getTree();
758 
759  include_once("./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
760  $target_node = new ilTaxonomyNode((int) $_GET["tax_node"]);
761  foreach ($move_ids as $m_id) {
762  // cross check taxonomy
763  $node = new ilTaxonomyNode((int) $m_id);
764  if ($node->getTaxonomyId() == $tax->getId() &&
765  ($target_node->getTaxonomyId() == $tax->getId() ||
766  $target_node->getId() == $tree->readRootId())) {
767  // check if target is not within the selected nodes
768  if ($tree->isGrandChild((int) $m_id, $target_node->getId())) {
769  ilUtil::sendFailure($lng->txt("tax_target_within_nodes"), true);
770  $this->ctrl->redirect($this, "listNodes");
771  }
772 
773  // if target is not current place, move
774  $parent_id = $tree->getParentId((int) $m_id);
775  if ($parent_id != $target_node->getId()) {
776  $tree->moveTree((int) $m_id, $target_node->getId());
777  ilTaxonomyNode::fixOrderNumbers($tax->getId(), $target_node->getId());
779  }
780  }
781  }
782  }
783 
784  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
785  $ilCtrl->redirect($this, "listNodes");
786  }
787 
791  public function confirmDeleteTaxonomy()
792  {
794  $tpl = $this->tpl;
795  $lng = $this->lng;
796 
797  $tax = $this->getCurrentTaxonomy();
798 
799  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
800  $cgui = new ilConfirmationGUI();
801  $cgui->setFormAction($ilCtrl->getFormAction($this));
802  $cgui->setHeaderText($lng->txt("tax_confirm_deletion"));
803  $cgui->setCancel($lng->txt("cancel"), "listTaxonomies");
804  $cgui->setConfirm($lng->txt("delete"), "deleteTaxonomy");
805 
806  $cgui->addItem("id[]", $i, $tax->getTitle());
807 
808  $tpl->setContent($cgui->getHTML());
809  }
810 
817  public function deleteTaxonomy()
818  {
820  $lng = $this->lng;
821 
822  $tax = $this->getCurrentTaxonomy();
823  $tax->delete();
824 
825  ilUtil::sendSuccess($lng->txt("tax_tax_deleted"), true);
826  $ilCtrl->redirect($this, "listTaxonomies");
827  }
828 
835  public function listTaxonomies()
836  {
837  $tpl = $this->tpl;
838  $ilToolbar = $this->toolbar;
839  $lng = $this->lng;
841 
843  if (count($tax_ids) == 0 || $this->getMultiple()) {
844  $ilToolbar->addButton(
845  $lng->txt("tax_add_taxonomy"),
846  $ilCtrl->getLinkTarget($this, "createAssignedTaxonomy")
847  );
848  } else {
849  ilUtil::sendInfo($lng->txt("tax_max_one_tax"));
850  }
851 
852  include_once("./Services/Taxonomy/classes/class.ilTaxonomyListTableGUI.php");
853 
855  $this,
856  "listTaxonomies",
857  $this->getAssignedObject(),
858  $this->getListInfo()
859  );
860 
861  $tpl->setContent($tab->getHTML());
862  }
863 
869  public function setTabs($a_id = "")
870  {
871  $ilTabs = $this->tabs;
873  $tpl = $this->tpl;
874  $lng = $this->lng;
875  $ilHelp = $this->help;
876 
877  $ilTabs->clearTargets();
878 
879  $ilHelp->setScreenIdComponent("tax");
880 
881  $tpl->setTitle(ilObject::_lookupTitle($this->getCurrentTaxonomyId()));
882  $tpl->setDescription(ilObject::_lookupDescription($this->getCurrentTaxonomyId()));
883  $tpl->setTitleIcon(ilUtil::getImagePath("icon_tax.svg"));
884 
885  $ilTabs->setBackTarget(
886  $lng->txt("back"),
887  $ilCtrl->getLinkTarget($this, "listTaxonomies")
888  );
889 
890  $ilTabs->addTab(
891  "list_items",
892  $lng->txt("tax_nodes"),
893  $ilCtrl->getLinkTarget($this, "listNodes")
894  );
895  if ($this->assigned_item_sorting) {
896  $ilTabs->addTab(
897  "ass_items",
898  $lng->txt("tax_assigned_items"),
899  $ilCtrl->getLinkTarget($this, "listAssignedItems")
900  );
901  }
902  $ilTabs->addTab(
903  "settings",
904  $lng->txt("settings"),
905  $ilCtrl->getLinkTarget($this, "editSettings")
906  );
907 
908  $ilTabs->activateTab($a_id);
909  }
910 
917  public function editSettings()
918  {
919  $tpl = $this->tpl;
920 
921  $this->setTabs("settings");
922 
923  $form = $this->initSettingsForm();
924  $tpl->setContent($form->getHTML());
925  }
926 
930  public function initSettingsForm()
931  {
932  $lng = $this->lng;
934 
935  $tax = $this->getCurrentTaxonomy();
936 
937  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
938  $form = new ilPropertyFormGUI();
939 
940  // title
941  $ti = new ilTextInputGUI($lng->txt("title"), "title");
942  $ti->setMaxLength(200);
943  $form->addItem($ti);
944  $ti->setValue($tax->getTitle());
945 
946  // description
947  $ta = new ilTextAreaInputGUI($lng->txt("description"), "description");
948  //$ta->setCols();
949  //$ta->setRows();
950  $form->addItem($ta);
951  $ta->setValue($tax->getDescription());
952 
953  // sorting
954  $options = array(
955  ilObjTaxonomy::SORT_ALPHABETICAL => $lng->txt("tax_alphabetical"),
956  ilObjTaxonomy::SORT_MANUAL => $lng->txt("tax_manual")
957  );
958  $si = new ilSelectInputGUI($lng->txt("tax_node_sorting"), "sorting");
959  $si->setOptions($options);
960  $form->addItem($si);
961  $si->setValue($tax->getSortingMode());
962 
963  // assigned item sorting
964  if ($this->assigned_item_sorting) {
965  $cb = new ilCheckboxInputGUI($lng->txt("tax_item_sorting"), "item_sorting");
966  $cb->setChecked($tax->getItemSorting());
967  $form->addItem($cb);
968  }
969 
970  $form->addCommandButton("updateSettings", $lng->txt("save"));
971 
972  $form->setTitle($lng->txt("settings"));
973  $form->setFormAction($ilCtrl->getFormAction($this));
974 
975  return $form;
976  }
977 
981  public function updateSettings()
982  {
983  $tpl = $this->tpl;
984  $lng = $this->lng;
986 
987  $form = $this->initSettingsForm();
988  if ($form->checkInput()) {
989  $tax = $this->getCurrentTaxonomy();
990  $tax->setTitle($form->getInput("title"));
991  $tax->setDescription($form->getInput("description"));
992  $tax->setSortingMode($form->getInput("sorting"));
993  $tax->setItemSorting($form->getInput("item_sorting"));
994  $tax->update();
995 
996  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
997  $ilCtrl->redirect($this, "editSettings");
998  } else {
999  $form->setValuesByPost();
1000  $tpl->setContent($form->getHtml());
1001  }
1002  }
1003 
1010  public function listAssignedItems()
1011  {
1012  $tpl = $this->tpl;
1013  $ilToolbar = $this->toolbar;
1014  $lng = $this->lng;
1015  $ilCtrl = $this->ctrl;
1016 
1017  $tax = $this->getCurrentTaxonomy();
1018 
1019  $this->setTabs("ass_items");
1020 
1021  // show tree
1022  $this->showTree(true);
1023 
1024  // list assigned items
1025  include_once("./Services/Taxonomy/classes/class.ilTaxAssignedItemsTableGUI.php");
1026  $table = new ilTaxAssignedItemsTableGUI(
1027  $this,
1028  "listAssignedItems",
1029  (int) $_GET["tax_node"],
1030  $this->getCurrentTaxonomy(),
1031  $this->assigned_item_comp_id,
1032  $this->assigned_item_obj_id,
1033  $this->assigned_item_type,
1034  $this->assigned_item_info_obj
1035  );
1036 
1037  $tpl->setContent($table->getHTML());
1038  }
1039 
1046  public function saveAssignedItemsSorting()
1047  {
1048  $lng = $this->lng;
1049  $ilCtrl = $this->ctrl;
1050 
1051  include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
1052  if (is_array($_POST["order"])) {
1053  $order = $_POST["order"];
1054  //asort($order, SORT_NUMERIC);
1055  //$cnt = 10;
1056  $tax_node = (int) $_GET["tax_node"];
1057  foreach ($order as $a_item_id => $ord_nr) {
1058  $tax_ass = new ilTaxNodeAssignment(
1059  $this->assigned_item_comp_id,
1060  $this->assigned_item_obj_id,
1061  $this->assigned_item_type,
1062  $this->getCurrentTaxonomyId()
1063  );
1064  $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
1065  //$cnt+= 10;
1066  }
1067  $tax_ass = new ilTaxNodeAssignment(
1068  $this->assigned_item_comp_id,
1069  $this->assigned_item_obj_id,
1070  $this->assigned_item_type,
1071  $this->getCurrentTaxonomyId()
1072  );
1073  $tax_ass->fixOrderNr($tax_node);
1074  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1075  }
1076  $ilCtrl->redirect($this, "listAssignedItems");
1077  }
1078 }
deleteTaxonomy()
Delete taxonomy.
setMultiple($a_val)
Set multiple.
__construct($a_id=0)
Execute command.
Taxonomy node <-> item assignment.
static getNextOrderNr($a_tax_id, $a_parent_id)
Put this node into the taxonomy tree.
static writeTitle($a_node_id, $a_title)
Write title.
setAssignedObject($a_val)
Set assigned object.
editSettings()
Edit settings.
deleteItems()
Confirm deletion screen for items.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
This class represents a property form user interface.
saveTaxNode()
Save tax node form.
New implementation of ilObjectGUI.
cancel()
Cancel creation.
updateSettings()
Update taxonomy settings.
$_GET["client_id"]
getMultiple()
Get multiple.
listTaxonomies()
List taxonomies.
TableGUI class for taxonomy list.
createTaxNode()
Create tax node.
Taxonomy explorer GUI class.
create()
Deleted in ilObject.
activateAssignedItemSorting(ilTaxAssignedItemInfo $a_item_info_obj, $a_component_id, $a_obj_id, $a_item_type)
Activate sorting mode of assigned objects.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
executeCommand()
Execute command.
static _lookupTitle($a_id)
lookup object title
saveAssignedItemsSorting()
Save assigned items sorting.
createAssignedTaxonomy()
Create assigned taxonomy.
static _lookupTitle($a_obj_id)
Lookup Title.
handleCommand()
Handle explorer internal command.
confirmDeleteTaxonomy()
Confirm taxonomy deletion.
user()
Definition: user.php:4
afterSave(ilObject $a_new_object)
After saving,.
getCurrentTaxonomyId()
Get current taxonomy id.
static writeOrderNr($a_node_id, $a_order_nr)
Write order nr.
global $ilCtrl
Definition: ilias.php:18
help()
Definition: help.php:2
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$a_type
Definition: workflow.php:92
setChecked($a_checked)
Set Checked.
static getTreeHTML( $a_tax_id, $a_class, $a_cmd, $a_target_class, $a_target_cmd, $a_root_node_title="")
Get tree html.
getId()
get object id public
setTabs($a_id="")
Set tabs.
Taxonomy GUI class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupDescription($a_id)
lookup object description
TableGUI class for taxonomies.
pasteItems()
Paste items (move operation)
$ilUser
Definition: imgupload.php:18
updateTaxNode()
Update tax node.
initCreateForm($a_new_type)
Init object creation form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setListInfo($a_val)
Set list info.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
If we run under an assigned object, the permission should be checked on the upper level...
confirmedDelete()
Delete taxonomy nodes.
setTabs()
create tabs (repository/workspace switch)
Interface for assigned items of taxonomies.
listAssignedItems()
List assigned items.
static putInTree( $a_tax_id, $a_node, $a_parent_id="", $a_target_node_id="", $a_order_nr=0)
Put this node into the taxonomy tree.
initCreationForms($a_new_type)
Init creation forms.
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
initTaxNodeForm($a_mode="edit")
Init tax node form.
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
$DIC
Definition: xapitoken.php:46
saveSorting()
Save settings and sorting.
setOpenFormTag($a_val)
Set open form tag.
getCurrentTaxonomy()
Get current taxonomy.
TableGUI class for taxonomy list.
$_POST["username"]
showTree($a_ass_items=false)
Show Editing Tree.
getAssignedObject()
Get assigned object.
static fixOrderNumbers($a_tax_id, $a_parent_id)
Fix order numbers.
$i
Definition: metadata.php:24
Confirmation screen class.
getListInfo()
Get list info.