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