ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPortfolioPageTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once("./Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php");
6 include_once("./Modules/Portfolio/classes/class.ilPortfolioPage.php");
7 
17 {
21  protected $user;
22 
23  protected $portfolio; // [ilObjPortfolio]
24  protected $is_template; // [bool]
25  protected $page_gui; // [string]
26 
30  public function __construct(ilObjPortfolioBaseGUI $a_parent_obj, $a_parent_cmd)
31  {
32  global $DIC;
33 
34  $this->ctrl = $DIC->ctrl();
35  $this->lng = $DIC->language();
36  $this->user = $DIC->user();
37  $ilCtrl = $DIC->ctrl();
38  $lng = $DIC->language();
39 
40  parent::__construct($a_parent_obj, $a_parent_cmd);
41  $this->disable("numinfo");
42  $this->setLimit(9999);
43 
44  $this->portfolio = $a_parent_obj->object;
45  $this->page_gui = $this->parent_obj->getPageGUIClassName();
46  $this->is_template = ($this->portfolio->getType() == "prtt");
47 
48  $this->setTitle($lng->txt("tabs"));
49 
50  //$this->addColumn($this->lng->txt(""), "", "1");
51  $this->addColumn($this->lng->txt("user_order"));
52  $this->addColumn($this->lng->txt("title"));
53  $this->addColumn($this->lng->txt("type"));
54  $this->addColumn($this->lng->txt("actions"));
55 
56  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
57  $this->setRowTemplate("tpl.portfolio_page_row.html", "Modules/Portfolio");
58 
59  //$this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
60  //$this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
61 
62  $this->addCommandButton(
63  "savePortfolioPagesOrdering",
64  $lng->txt("user_save_ordering_and_titles")
65  );
66 
67  $this->getItems();
68 
69  $lng->loadLanguageModule("blog");
70  }
71 
72  public function getItems()
73  {
75 
76  $data = ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
77  $this->setData($data);
78 
79  if (!$this->is_template) {
80  $this->blogs = array();
81  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
82  $tree = new ilWorkspaceTree($ilUser->getId());
83  $root = $tree->readRootId();
84  if ($root) {
85  $root = $tree->getNodeData($root);
86  foreach ($tree->getSubTree($root) as $node) {
87  if ($node["type"] == "blog") {
88  $this->blogs[$node["obj_id"]] = $node["wsp_id"];
89  }
90  }
91  }
92 
93  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
94  include_once("./Modules/Blog/classes/class.ilObjBlog.php");
95  }
96  }
97 
101  protected function fillRow($a_set)
102  {
103  $lng = $this->lng;
104  $lng = $this->lng;
106  $action_items = [];
107 
108  switch ($a_set["type"]) {
110  $this->tpl->setCurrentBlock("title_field");
111  $this->tpl->setVariable("ID", $a_set["id"]);
112  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
113  $this->tpl->parseCurrentBlock();
114 
115  $ilCtrl->setParameterByClass(
116  $this->page_gui,
117  "ppage",
118  $a_set["id"]
119  );
120  $action_item = ilLinkButton::getInstance();
121  $action_item->setCaption('edit_page');
122  $action_item->setUrl($ilCtrl->getLinkTargetByClass($this->page_gui, "edit"));
123  $action_items[] = $action_item;
124 
125 
126  $this->tpl->setVariable("TYPE", $lng->txt("page"));
127  break;
128 
130  if (!$this->is_template) {
131  $this->tpl->setCurrentBlock("title_static");
132  $this->tpl->setVariable("VAL_TITLE_STATIC", ilObjBlog::_lookupTitle($a_set["title"]));
133  $this->tpl->parseCurrentBlock();
134 
135  $obj_id = (int) $a_set["title"];
136  if (isset($this->blogs[$obj_id])) {
137  $node_id = $this->blogs[$obj_id];
138  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id);
139 
140  // #11519
141  $ilCtrl->setParameterByClass(
142  $this->page_gui,
143  "ppage",
144  $a_set["id"]
145  );
146  $link = $ilCtrl->getLinkTargetByClass(array($this->page_gui, "ilobjbloggui"), "render");
147 
148  $action_item = ilLinkButton::getInstance();
149  $action_item->setCaption('blog_edit');
150  $action_item->setUrl($link);
151  $action_items[] = $action_item;
152  }
153  $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
154  }
155  break;
156 
158  if ($this->is_template) {
159  $this->tpl->setCurrentBlock("title_field");
160  $this->tpl->setVariable("ID", $a_set["id"]);
161  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
162  $this->tpl->parseCurrentBlock();
163 
164  $this->tpl->setCurrentBlock("title_static");
165  //$this->tpl->setVariable("VAL_TITLE_STATIC", $lng->txt("obj_blog"));
166  $this->tpl->parseCurrentBlock();
167  $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
168  }
169  break;
170  }
171 
172  $ilCtrl->setParameter($this->parent_obj, "prtf_pages[]", $a_set["id"]);
173 
174  // copy
175  $action_item = ilLinkButton::getInstance();
176  $action_item->setCaption('prtf_copy_tab');
177  $action_item->setUrl($ilCtrl->getLinkTarget($this->parent_obj, "copyPageForm"));
178  $action_items[] = $action_item;
179 
180  // delete
181  $action_item = ilLinkButton::getInstance();
182  $action_item->setCaption('delete');
183  $action_item->setUrl($ilCtrl->getLinkTarget($this->parent_obj, "confirmPortfolioPageDeletion"));
184  $action_items[] = $action_item;
185 
186 
187  $ilCtrl->setParameter($this->parent_obj, "prtf_pages[]", "");
188 
189  if (count($action_items) > 0) {
190  $split_button = ilSplitButtonGUI::getInstance();
191  $i = 0;
192  foreach ($action_items as $item) {
193  if ($i++ == 0) {
194  $split_button->setDefaultButton($item);
195  } else {
196  $split_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($item));
197  }
198  }
199  $this->tpl->setVariable("SPLIT_BUTTON", $split_button->render());
200  }
201 
202 
203  $this->tpl->setVariable("ID", $a_set["id"]);
204  $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
205  }
206 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _lookupTitle($a_id)
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
Tree handler for personal workspace.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
$ilUser
Definition: imgupload.php:18
$root
Definition: sabredav.php:45
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Portfolio view gui base class.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
$i
Definition: disco.tpl.php:19
__construct(ilObjPortfolioBaseGUI $a_parent_obj, $a_parent_cmd)
Constructor.
setLimit($a_limit=0, $a_default_limit=0)