ILIAS  Release_4_4_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->addCommandButton('newFormBookmark', $lng->txt("bookmark_new"));
47  $this->addCommandButton('newFormBookmarkFolder', $lng->txt("bookmark_folder_new"));
48 
49  $this->addMultiCommand('export', $lng->txt('export'));
50  $this->addMultiCommand('sendmail', $lng->txt('bkm_sendmail'));
51  $this->addMultiCommand('move', $lng->txt('move'));
52  $this->addMultiCommand('delete', $lng->txt('delete'));
53 
54  $this->setTopAnchor("bookmark_top");
55 
56  $ilCtrl->saveParameter($this->getParentObject(), 'bmf_id');
57  }
58 
59  public function fillRow($a_data)
60  {
61  global $lng, $ilCtrl, $ilUser;
62 
63  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
64  $current_selection_list = new ilAdvancedSelectionListGUI();
65  $current_selection_list->setListTitle($this->lng->txt("actions"));
66  $current_selection_list->setId("act_".$a_data['obj_id']);
67 
68 
69  $this->tpl->setVariable("VAL_ID", $a_data["obj_id"]);
70 
71  // edit link
72  $edit_link = '';
73  $delete_link = '';
74  $sendmail_link = '';
75  $export_link = '';
76 
77  if ($a_data["type"] != "parent")
78  {
79  $hash = ($ilUser->prefs["screen_reader_optimization"])
80  ? "bookmark_top"
81  : "";
82 
83  $ilCtrl->setParameter($this->parent_obj, "bmf_id", $this->parent_obj->id);
84  $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_data["obj_id"]);
85  $edit_link = ($a_data["type"] == "bmf")
86  ? $ilCtrl->getLinkTarget($this->parent_obj, "editFormBookmarkFolder", $hash)
87  : $ilCtrl->getLinkTarget($this->parent_obj, "editFormBookmark", $hash);
88 
89  $ilCtrl->clearParameters($this->parent_obj);
90  $ilCtrl->setParameter($this->parent_obj, "bm_id", $a_data['obj_id']);
91  $delete_link = $ilCtrl->getLinkTarget($this->parent_obj, 'delete', $hash);
92  $sendmail_link = $ilCtrl->getLinkTarget($this->parent_obj, 'sendmail', $hash);
93  $export_link = $ilCtrl->getLinkTarget($this->parent_obj, 'export', $hash);
94  }
95 
96  if ($edit_link)
97  $current_selection_list->addItem($this->lng->txt('edit'), '', $edit_link);
98 
99  if ($delete_link)
100  $current_selection_list->addItem($this->lng->txt('delete'), '', $delete_link);
101 
102  if ($export_link)
103  $current_selection_list->addItem($this->lng->txt('export'), '', $export_link);
104 
105  if ($sendmail_link)
106  $current_selection_list->addItem($this->lng->txt('bkm_sendmail'), '', $sendmail_link);
107 
108  $this->tpl->setVariable("COMMAND_SELECTION_LIST", $current_selection_list->getHTML());
109 
110  // icon
111  $img_type = ($a_data["type"] == "bmf" || $a_data["type"] == "parent") ? "bmf" : $a_data["type"]; // #10556
112  $val = ilUtil::getImagePath("icon_".$img_type.".png");
113  $this->tpl->setVariable("VAL_ICON", $val);
114  $this->tpl->setVariable("VAL_ICON_ALT", $lng->txt("icon")." ".$lng->txt($a_data["type"]));
115 
116  // folder links
117  if ($a_data["type"] == "bmf" || $a_data["type"] == "parent")
118  {
119  $this->tpl->setVariable("VAL_BMF_TITLE", $a_data["title"]);
120  $ilCtrl->setParameter($this->parent_obj, "bmf_id", $a_data["obj_id"]);
121  $this->tpl->setVariable("VAL_BMF_TARGET", $ilCtrl->getLinkTarget($this->parent_obj));
122  //$this->tpl->setVariable("FRAME_TARGET_BMF", ilFrameTargetInfo::_getFrame("MainContent"));
123  }
124  else
125  {
126  $this->tpl->setVariable("VAL_BM_TITLE", $a_data["title"]);
127  $this->tpl->setVariable("VAL_BM_TARGET", htmlentities($a_data["target"]));
128  $this->tpl->setVariable("VAL_BM_DESCRIPTION", $a_data["description"]);
129  $this->tpl->setVariable("FRAME_TARGET_BM", ilFrameTargetInfo::_getFrame("ExternalContent"));
130  }
131  $ilCtrl->clearParameters($this->parent_obj);
132  }
133 }