ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 {
19  protected $ctrl;
20 
24  protected $help;
25 
29  protected $user;
30 
37  public function __construct($a_ref)
38  {
39  global $DIC;
40 
41  $this->lng = $DIC->language();
42  $this->ctrl = $DIC->ctrl();
43  $this->help = $DIC["ilHelp"];
44  $this->user = $DIC->user();
45  $lng = $DIC->language();
46  $ilCtrl = $DIC->ctrl();
47  $ilHelp = $DIC["ilHelp"];
48 
49 
50  $ilHelp->setScreenIdComponent("bookm");
51 
52  parent::__construct($a_ref);
53 
54  //$this->setTitle($lng->txt('bookmarks'));
55 
56  $this->setRowTemplate('tpl.bookmark_administration_row.html', 'Services/Bookmarks');
57  $this->addColumn('', '', '3%', true);
58  $this->addColumn($lng->txt('type'), '', '3%');
59  $this->addColumn($lng->txt('title'), 'title', '84%');
60  $this->addColumn($lng->txt('actions'), '', '10%');
61 
62  $hash = ($ilUser->prefs["screen_reader_optimization"])
63  ? "bookmark_top"
64  : "";
65 
66  $this->setFormAction($ilCtrl->getFormAction($a_ref, $hash));
67  $this->setSelectAllCheckbox('bm_id');
68 
69  $this->addMultiCommand('export', $lng->txt('export'));
70  $this->addMultiCommand('sendmail', $lng->txt('bkm_sendmail'));
71  $this->addMultiCommand('move', $lng->txt('move'));
72  $this->addMultiCommand('delete', $lng->txt('delete'));
73 
74  $this->setTopAnchor("bookmark_top");
75 
76  $ilCtrl->saveParameter($this->getParentObject(), 'bmf_id');
77  }
78 
79  public function fillRow($a_data)
80  {
81  $lng = $this->lng;
84 
85  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
86  $current_selection_list = new ilAdvancedSelectionListGUI();
87  $current_selection_list->setListTitle($this->lng->txt("actions"));
88  $current_selection_list->setId("act_" . $a_data['obj_id']);
89 
90 
91  $this->tpl->setVariable("VAL_ID", $a_data["obj_id"]);
92 
93  // edit link
94  $edit_link = '';
95  $delete_link = '';
96  $sendmail_link = '';
97  $export_link = '';
98 
99  if ($a_data["type"] != "parent") {
100  $hash = ($ilUser->prefs["screen_reader_optimization"])
101  ? "bookmark_top"
102  : "";
103 
104  $ilCtrl->setParameter($this->parent_obj, "bmf_id", $this->parent_obj->id);
105  $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_data["obj_id"]);
106  $edit_link = ($a_data["type"] == "bmf")
107  ? $ilCtrl->getLinkTarget($this->parent_obj, "editFormBookmarkFolder", $hash)
108  : $ilCtrl->getLinkTarget($this->parent_obj, "editFormBookmark", $hash);
109 
110  $ilCtrl->clearParameters($this->parent_obj);
111  $ilCtrl->setParameter($this->parent_obj, "bm_id", $a_data['obj_id']);
112  $delete_link = $ilCtrl->getLinkTarget($this->parent_obj, 'delete', $hash);
113  $sendmail_link = $ilCtrl->getLinkTarget($this->parent_obj, 'sendmail', $hash);
114  $export_link = $ilCtrl->getLinkTarget($this->parent_obj, 'export', $hash);
115  }
116 
117  if ($edit_link) {
118  $current_selection_list->addItem($this->lng->txt('edit'), '', $edit_link);
119  }
120 
121  if ($delete_link) {
122  $current_selection_list->addItem($this->lng->txt('delete'), '', $delete_link);
123  }
124 
125  if ($export_link) {
126  $current_selection_list->addItem($this->lng->txt('export'), '', $export_link);
127  }
128 
129  if ($sendmail_link) {
130  $current_selection_list->addItem($this->lng->txt('bkm_sendmail'), '', $sendmail_link);
131  }
132 
133  $this->tpl->setVariable("COMMAND_SELECTION_LIST", $current_selection_list->getHTML());
134 
135  // icon
136  $img_type = ($a_data["type"] == "bmf" || $a_data["type"] == "parent") ? "bmf" : $a_data["type"]; // #10556
137  $val = ilUtil::getImagePath("icon_" . $img_type . ".svg");
138  $this->tpl->setVariable("VAL_ICON", $val);
139  $this->tpl->setVariable("VAL_ICON_ALT", $lng->txt("icon") . " " . $lng->txt($a_data["type"]));
140 
141  // folder links
142  if ($a_data["type"] == "bmf" || $a_data["type"] == "parent") {
143  $this->tpl->setVariable("VAL_BMF_TITLE", $a_data["title"]);
144  $ilCtrl->setParameter($this->parent_obj, "bmf_id", $a_data["obj_id"]);
145  $this->tpl->setVariable("VAL_BMF_TARGET", $ilCtrl->getLinkTarget($this->parent_obj));
146  //$this->tpl->setVariable("FRAME_TARGET_BMF", ilFrameTargetInfo::_getFrame("MainContent"));
147  } else {
148  $this->tpl->setVariable("VAL_BM_TITLE", $a_data["title"]);
149  $this->tpl->setVariable("VAL_BM_TARGET", ilUtil::secureUrl($a_data["target"]));
150  $this->tpl->setVariable("VAL_BM_REL", 'noopener');
151  $this->tpl->setVariable("VAL_BM_DESCRIPTION", $a_data["description"]);
152  $this->tpl->setVariable("FRAME_TARGET_BM", ilFrameTargetInfo::_getFrame("ExternalContent"));
153  }
154  $ilCtrl->clearParameters($this->parent_obj);
155  }
156 }
global $DIC
Definition: saml.php:7
getParentObject()
Get parent object.
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
static secureUrl($url)
Prepare secure href attribute.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static _getFrame($a_class, $a_type='')
Get content frame name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setTopAnchor($a_val)
Set top anchor.