ILIAS  release_8 Revision v8.24
class.ilPortfolioTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected array $shared_objects;
27 protected ilObjUser $user;
28 protected int $user_id;
29
30 public function __construct(
31 object $a_parent_obj,
32 string $a_parent_cmd,
33 int $a_user_id
34 ) {
35 global $DIC;
36
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $this->user = $DIC->user();
40 $ilCtrl = $DIC->ctrl();
41 $lng = $DIC->language();
42
43 $this->user_id = $a_user_id;
44
45 parent::__construct($a_parent_obj, $a_parent_cmd);
46
47 $this->setTitle($lng->txt("prtf_portfolios"));
48
49 $this->addColumn($this->lng->txt(""), "", "1");
50 $this->addColumn($this->lng->txt("title"), "title", "50%");
51 $this->addColumn($this->lng->txt("online"), "is_online");
52 $this->addColumn($this->lng->txt("prtf_default_portfolio"), "is_default");
53 $this->addColumn($this->lng->txt("actions"));
54
55 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
56 $this->setRowTemplate("tpl.portfolio_row.html", "Modules/Portfolio");
57
58 $this->addMultiCommand("confirmPortfolioDeletion", $lng->txt("delete"));
59 $this->addCommandButton("saveTitles", $lng->txt("prtf_save_status_and_titles"));
60
61 $this->getItems();
62
64 }
65
66 protected function getItems(): void
67 {
68 $access_handler = new ilPortfolioAccessHandler();
70 $this->shared_objects = $access_handler->getObjectsIShare(false);
71
72 $this->setData($data);
73 }
74
75 protected function fillRow(array $a_set): void
76 {
78 $ilCtrl = $this->ctrl;
79
80 $this->tpl->setCurrentBlock("title_form");
81 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
82 $this->tpl->setVariable("VAL_TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
83 $this->tpl->parseCurrentBlock();
84
85 if (in_array($a_set["id"], $this->shared_objects)) {
86 $this->tpl->setCurrentBlock("shared");
87 $this->tpl->setVariable("TXT_SHARED", $lng->txt("wsp_status_shared"));
88 $this->tpl->parseCurrentBlock();
89 }
90
91 $this->tpl->setCurrentBlock("chck");
92 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
93 $this->tpl->parseCurrentBlock();
94
95 $this->tpl->setCurrentBlock("edit");
96 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
97 $this->tpl->setVariable(
98 "STATUS_ONLINE",
99 ($a_set["is_online"]) ? " checked=\"checked\"" : ""
100 );
101 $this->tpl->setVariable(
102 "VAL_DEFAULT",
103 ($a_set["is_default"]) ? $lng->txt("yes") : ""
104 );
105 $this->tpl->parseCurrentBlock();
106
107 $prtf_path = array(get_class($this->parent_obj), "ilobjportfoliogui");
108
109 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $a_set["id"]);
110 $this->tpl->setCurrentBlock("action");
111
112 $this->tpl->setVariable(
113 "URL_ACTION",
114 $ilCtrl->getLinkTargetByClass($prtf_path, "preview")
115 );
116 $this->tpl->setVariable("TXT_ACTION", $lng->txt("preview"));
117 $this->tpl->parseCurrentBlock();
118
119 $this->tpl->setVariable(
120 "URL_ACTION",
121 $ilCtrl->getLinkTargetByClass($prtf_path, "view")
122 );
123 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_edit_portfolio"));
124 $this->tpl->parseCurrentBlock();
125
126 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
127
128 if ($a_set["is_online"]) {
129 if (!$a_set["is_default"]) {
130 $ilCtrl->setParameter($this->parent_obj, "prt_id", $a_set["id"]);
131
132 $this->tpl->setVariable(
133 "URL_ACTION",
134 $ilCtrl->getLinkTarget($this->parent_obj, "setDefaultConfirmation")
135 );
136 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_set_as_default"));
137 $this->tpl->parseCurrentBlock();
138
139 $ilCtrl->setParameter($this->parent_obj, "prt_id", "");
140 } else {
141 $this->tpl->setVariable(
142 "URL_ACTION",
143 $ilCtrl->getLinkTarget($this->parent_obj, "unsetDefault")
144 );
145 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_unset_as_default"));
146 $this->tpl->parseCurrentBlock();
147 }
148 }
149 }
150}
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)
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
User class.
Access handler for portfolio NOTE: This file needs to stay in the classes directory,...
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.
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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="")
addMultiCommand(string $a_cmd, string $a_text)
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
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc