ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPortfolioPageTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected \ILIAS\Portfolio\InternalGUIService $gui;
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 $this->gui = $DIC->portfolio()->internal()->gui();
44
45 parent::__construct($a_parent_obj, $a_parent_cmd);
46 $this->disable("numinfo");
47 $this->setLimit(9999);
48
50 $portfolio = $a_parent_obj->getObject();
51 $this->portfolio = $portfolio;
52 $this->page_gui = $this->parent_obj->getPageGUIClassName();
53 $this->is_template = ($this->portfolio->getType() === "prtt");
54
55 $this->setTitle($lng->txt("content"));
56
57 //$this->addColumn($this->lng->txt(""), "", "1");
58 $this->addColumn($this->lng->txt("user_order"));
59 $this->addColumn($this->lng->txt("title"));
60 $this->addColumn($this->lng->txt("type"));
61 $this->addColumn($this->lng->txt("actions"));
62
63 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
64 $this->setRowTemplate("tpl.portfolio_page_row.html", "components/ILIAS/Portfolio");
65
66 //$this->addMultiCommand("confirmPortfolioPageDeletion", $lng->txt("delete"));
67 //$this->addMultiCommand("copyPageForm", $lng->txt("prtf_copy_page"));
68
69 $this->addCommandButton(
70 "savePortfolioPagesOrdering",
71 $lng->txt("user_save_ordering_and_titles")
72 );
73
74 $this->getItems();
75 }
76
77 public function getItems(): void
78 {
79 $ilUser = $this->user;
80
81 $data = ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
82 $this->setData($data);
83
84 }
85
86 protected function fillRow(array $a_set): void
87 {
88 $f = $this->gui->ui()->factory();
90 $ilCtrl = $this->ctrl;
91 $action_items = [];
92 switch ($a_set["type"]) {
94 $this->tpl->setCurrentBlock("title_field");
95 $this->tpl->setVariable("ID", $a_set["id"]);
96 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
97 $this->tpl->parseCurrentBlock();
98
99 $ilCtrl->setParameterByClass(
100 $this->page_gui,
101 "ppage",
102 $a_set["id"]
103 );
104 //$action_item = ilLinkButton::getInstance();
105 //$action_item->setCaption('edit_page');
106 //$action_item->setUrl($ilCtrl->getLinkTargetByClass($this->page_gui, "edit"));
107 $action_items[] = $f->button()->shy(
108 $lng->txt('edit_page'),
109 $ilCtrl->getLinkTargetByClass($this->page_gui, "edit")
110 );
111
112
113 $this->tpl->setVariable("TYPE", $lng->txt("page"));
114 break;
115
116 }
117
118 $ilCtrl->setParameter($this->parent_obj, "prtf_page", $a_set["id"]);
119
120 // copy
121 //$action_item = ilLinkButton::getInstance();
122 $txt = "";
123 if ((int) $a_set["type"] === ilPortfolioPage::TYPE_PAGE) {
124 $txt = $lng->txt('prtf_copy_pg');
125 }
126 $action_items[] = $f->button()->shy(
127 $txt,
128 $ilCtrl->getLinkTarget($this->parent_obj, "copyPageForm")
129 );
130
131 $action_items[] = $f->button()->shy(
132 $lng->txt("delete"),
133 $ilCtrl->getLinkTarget($this->parent_obj, "confirmPortfolioPageDeletion")
134 );
135
136
137 $ilCtrl->setParameter($this->parent_obj, "prtf_page", "");
138
139 $ks = [];
140 if (count($action_items) > 0) {
141 $first = array_shift($action_items);
142 $ks[] = $f->button()->standard(
143 $first->getLabel(),
144 $first->getAction()
145 );
146 /*$split_button = ilSplitButtonGUI::getInstance();
147 $i = 0;
148 foreach ($action_items as $item) {
149 if ($i++ === 0) {
150 $split_button->setDefaultButton($item);
151 } else {
152 $split_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($item));
153 }
154 }*/
155 if (count($action_items) > 0) {
156 $ks[] = $f->dropdown()->standard($action_items);
157 }
158 $this->tpl->setVariable(
159 "SPLIT_BUTTON",
160 $this->gui->ui()->renderer()->render([$ks])
161 );
162 }
163
164
165 $this->tpl->setVariable("ID", $a_set["id"]);
166 $this->tpl->setVariable("VAL_ORDER_NR", $a_set["order_nr"]);
167 }
168}
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.
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.
ILIAS Portfolio InternalGUIService $gui
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)
$txt
Definition: error.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26