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