ILIAS  release_8 Revision v8.24
class.ilPortfolioPageTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected array $blogs;
27 protected ilObjUser $user;
29 protected bool $is_template;
30 protected string $page_gui;
31
32 public function __construct(
33 ilObjPortfolioBaseGUI $a_parent_obj,
34 string $a_parent_cmd
35 ) {
36 global $DIC;
37
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 $this->user = $DIC->user();
41 $ilCtrl = $DIC->ctrl();
42 $lng = $DIC->language();
43
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45 $this->disable("numinfo");
46 $this->setLimit(9999);
47
49 $portfolio = $a_parent_obj->getObject();
50 $this->portfolio = $portfolio;
51 $this->page_gui = $this->parent_obj->getPageGUIClassName();
52 $this->is_template = ($this->portfolio->getType() === "prtt");
53
54 $this->setTitle($lng->txt("content"));
55
56 //$this->addColumn($this->lng->txt(""), "", "1");
57 $this->addColumn($this->lng->txt("user_order"));
58 $this->addColumn($this->lng->txt("title"));
59 $this->addColumn($this->lng->txt("type"));
60 $this->addColumn($this->lng->txt("actions"));
61
62 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
63 $this->setRowTemplate("tpl.portfolio_page_row.html", "Modules/Portfolio");
64
65 //$this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
66 //$this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
67
68 $this->addCommandButton(
69 "savePortfolioPagesOrdering",
70 $lng->txt("user_save_ordering_and_titles")
71 );
72
73 $this->getItems();
74
75 $lng->loadLanguageModule("blog");
76 }
77
78 public function getItems(): void
79 {
81
82 $data = ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
83 $this->setData($data);
84
85 if (!$this->is_template) {
86 $this->blogs = array();
87 $tree = new ilWorkspaceTree($ilUser->getId());
88 $root = $tree->readRootId();
89 if ($root) {
90 $root = $tree->getNodeData($root);
91 foreach ($tree->getSubTree($root) as $node) {
92 if ($node["type"] == "blog") {
93 $this->blogs[$node["obj_id"]] = $node["wsp_id"];
94 }
95 }
96 }
97 }
98 }
99
100 protected function fillRow(array $a_set): void
101 {
103 $ilCtrl = $this->ctrl;
104 $action_items = [];
105
106 switch ($a_set["type"]) {
108 $this->tpl->setCurrentBlock("title_field");
109 $this->tpl->setVariable("ID", $a_set["id"]);
110 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
111 $this->tpl->parseCurrentBlock();
112
113 $ilCtrl->setParameterByClass(
114 $this->page_gui,
115 "ppage",
116 $a_set["id"]
117 );
118 $action_item = ilLinkButton::getInstance();
119 $action_item->setCaption('edit_page');
120 $action_item->setUrl($ilCtrl->getLinkTargetByClass($this->page_gui, "edit"));
121 $action_items[] = $action_item;
122
123
124 $this->tpl->setVariable("TYPE", $lng->txt("page"));
125 break;
126
128 if (!$this->is_template) {
129 $this->tpl->setCurrentBlock("title_static");
130 $this->tpl->setVariable("VAL_TITLE_STATIC", ilObjBlog::_lookupTitle($a_set["title"]));
131 $this->tpl->parseCurrentBlock();
132
133 $obj_id = (int) $a_set["title"];
134 if (isset($this->blogs[$obj_id])) {
135 $node_id = $this->blogs[$obj_id];
136 $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $obj_id);
137
138 // #11519
139 $ilCtrl->setParameterByClass(
140 $this->page_gui,
141 "ppage",
142 $a_set["id"]
143 );
144 $link = $ilCtrl->getLinkTargetByClass(array($this->page_gui, "ilobjbloggui"), "render");
145
146 $action_item = ilLinkButton::getInstance();
147 $action_item->setCaption('blog_edit');
148 $action_item->setUrl($link);
149 $action_items[] = $action_item;
150 }
151 $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
152 }
153 break;
154
156 if ($this->is_template) {
157 $this->tpl->setCurrentBlock("title_field");
158 $this->tpl->setVariable("ID", $a_set["id"]);
159 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
160 $this->tpl->parseCurrentBlock();
161
162 $this->tpl->setCurrentBlock("title_static");
163 //$this->tpl->setVariable("VAL_TITLE_STATIC", $lng->txt("obj_blog"));
164 $this->tpl->parseCurrentBlock();
165 $this->tpl->setVariable("TYPE", $lng->txt("obj_blog"));
166 }
167 break;
168 }
169
170 $ilCtrl->setParameter($this->parent_obj, "prtf_page", $a_set["id"]);
171
172 // copy
173 $action_item = ilLinkButton::getInstance();
174 if ((int) $a_set["type"] === ilPortfolioPage::TYPE_PAGE) {
175 $action_item->setCaption('prtf_copy_pg');
176 } else {
177 $action_item->setCaption('prtf_copy_blog_pg');
178 }
179 $action_item->setUrl($ilCtrl->getLinkTarget($this->parent_obj, "copyPageForm"));
180 $action_items[] = $action_item;
181
182 // delete
183 $action_item = ilLinkButton::getInstance();
184 $action_item->setCaption('delete');
185 $action_item->setUrl($ilCtrl->getLinkTarget($this->parent_obj, "confirmPortfolioPageDeletion"));
186 $action_items[] = $action_item;
187
188 $ilCtrl->setParameter($this->parent_obj, "prtf_page", "");
189
190 if (count($action_items) > 0) {
191 $split_button = ilSplitButtonGUI::getInstance();
192 $i = 0;
193 foreach ($action_items as $item) {
194 if ($i++ === 0) {
195 $split_button->setDefaultButton($item);
196 } else {
197 $split_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($item));
198 }
199 }
200 $this->tpl->setVariable("SPLIT_BUTTON", $split_button->render());
201 }
202
203
204 $this->tpl->setVariable("ID", $a_set["id"]);
205 $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
206 }
207}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
Portfolio view gui base class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User class.
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
disable(string $a_module_name)
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
$i
Definition: metadata.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc