ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilBookmarkAdministrationTableGUI.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 include_once 'Services/Table/classes/class.ilTable2GUI.php';
5 
15 {
22  public function __construct($a_ref)
23  {
24  global $lng, $ilCtrl, $ilHelp;
25 
26 
27  $ilHelp->setScreenIdComponent("bookm");
28 
29  parent::__construct($a_ref);
30 
31  //$this->setTitle($lng->txt('bookmarks'));
32 
33  $this->setRowTemplate('tpl.bookmark_administration_row.html', 'Services/Bookmarks');
34  $this->addColumn('', '', '3%', true);
35  $this->addColumn($lng->txt('type'), '', '3%');
36  $this->addColumn($lng->txt('title'), 'title', '84%');
37  $this->addColumn($lng->txt('actions'), '', '10%');
38 
39  $hash = ($ilUser->prefs["screen_reader_optimization"])
40  ? "bookmark_top"
41  : "";
42 
43  $this->setFormAction($ilCtrl->getFormAction($a_ref, $hash));
44  $this->setSelectAllCheckbox('bm_id');
45 
46  $this->addMultiCommand('export', $lng->txt('export'));
47  $this->addMultiCommand('sendmail', $lng->txt('bkm_sendmail'));
48  $this->addMultiCommand('move', $lng->txt('move'));
49  $this->addMultiCommand('delete', $lng->txt('delete'));
50 
51  $this->setTopAnchor("bookmark_top");
52 
53  $ilCtrl->saveParameter($this->getParentObject(), 'bmf_id');
54  }
55 
56  public function fillRow($a_data)
57  {
58  global $lng, $ilCtrl, $ilUser;
59 
60  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
61  $current_selection_list = new ilAdvancedSelectionListGUI();
62  $current_selection_list->setListTitle($this->lng->txt("actions"));
63  $current_selection_list->setId("act_".$a_data['obj_id']);
64 
65 
66  $this->tpl->setVariable("VAL_ID", $a_data["obj_id"]);
67 
68  // edit link
69  $edit_link = '';
70  $delete_link = '';
71  $sendmail_link = '';
72  $export_link = '';
73 
74  if ($a_data["type"] != "parent")
75  {
76  $hash = ($ilUser->prefs["screen_reader_optimization"])
77  ? "bookmark_top"
78  : "";
79 
80  $ilCtrl->setParameter($this->parent_obj, "bmf_id", $this->parent_obj->id);
81  $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_data["obj_id"]);
82  $edit_link = ($a_data["type"] == "bmf")
83  ? $ilCtrl->getLinkTarget($this->parent_obj, "editFormBookmarkFolder", $hash)
84  : $ilCtrl->getLinkTarget($this->parent_obj, "editFormBookmark", $hash);
85 
86  $ilCtrl->clearParameters($this->parent_obj);
87  $ilCtrl->setParameter($this->parent_obj, "bm_id", $a_data['obj_id']);
88  $delete_link = $ilCtrl->getLinkTarget($this->parent_obj, 'delete', $hash);
89  $sendmail_link = $ilCtrl->getLinkTarget($this->parent_obj, 'sendmail', $hash);
90  $export_link = $ilCtrl->getLinkTarget($this->parent_obj, 'export', $hash);
91  }
92 
93  if ($edit_link)
94  $current_selection_list->addItem($this->lng->txt('edit'), '', $edit_link);
95 
96  if ($delete_link)
97  $current_selection_list->addItem($this->lng->txt('delete'), '', $delete_link);
98 
99  if ($export_link)
100  $current_selection_list->addItem($this->lng->txt('export'), '', $export_link);
101 
102  if ($sendmail_link)
103  $current_selection_list->addItem($this->lng->txt('bkm_sendmail'), '', $sendmail_link);
104 
105  $this->tpl->setVariable("COMMAND_SELECTION_LIST", $current_selection_list->getHTML());
106 
107  // icon
108  $img_type = ($a_data["type"] == "bmf" || $a_data["type"] == "parent") ? "bmf" : $a_data["type"]; // #10556
109  $val = ilUtil::getImagePath("icon_".$img_type.".svg");
110  $this->tpl->setVariable("VAL_ICON", $val);
111  $this->tpl->setVariable("VAL_ICON_ALT", $lng->txt("icon")." ".$lng->txt($a_data["type"]));
112 
113  // folder links
114  if ($a_data["type"] == "bmf" || $a_data["type"] == "parent")
115  {
116  $this->tpl->setVariable("VAL_BMF_TITLE", $a_data["title"]);
117  $ilCtrl->setParameter($this->parent_obj, "bmf_id", $a_data["obj_id"]);
118  $this->tpl->setVariable("VAL_BMF_TARGET", $ilCtrl->getLinkTarget($this->parent_obj));
119  //$this->tpl->setVariable("FRAME_TARGET_BMF", ilFrameTargetInfo::_getFrame("MainContent"));
120  }
121  else
122  {
123  $this->tpl->setVariable("VAL_BM_TITLE", $a_data["title"]);
124  $this->tpl->setVariable("VAL_BM_TARGET", htmlentities($a_data["target"]));
125  $this->tpl->setVariable("VAL_BM_DESCRIPTION", $a_data["description"]);
126  $this->tpl->setVariable("FRAME_TARGET_BM", ilFrameTargetInfo::_getFrame("ExternalContent"));
127  }
128  $ilCtrl->clearParameters($this->parent_obj);
129  }
130 }