ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPortfolioTableGUI.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 $user_id;
18
22 public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
23 {
24 global $DIC;
25
26 $this->ctrl = $DIC->ctrl();
27 $this->lng = $DIC->language();
28 $this->user = $DIC->user();
29 $ilCtrl = $DIC->ctrl();
30 $lng = $DIC->language();
31
32 $this->user_id = (int) $a_user_id;
33
34 parent::__construct($a_parent_obj, $a_parent_cmd);
35
36 $this->setTitle($lng->txt("prtf_portfolios"));
37
38 $this->addColumn($this->lng->txt(""), "", "1");
39 $this->addColumn($this->lng->txt("title"), "title", "50%");
40 $this->addColumn($this->lng->txt("online"), "is_online");
41 $this->addColumn($this->lng->txt("prtf_default_portfolio"), "is_default");
42 $this->addColumn($this->lng->txt("actions"));
43
44 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
45 $this->setRowTemplate("tpl.portfolio_row.html", "Modules/Portfolio");
46
47 $this->addMultiCommand("confirmPortfolioDeletion", $lng->txt("delete"));
48 $this->addCommandButton("saveTitles", $lng->txt("prtf_save_status_and_titles"));
49
50 $this->getItems();
51
52 $lng->loadLanguageModule("wsp");
53 }
54
55 protected function getItems()
56 {
58
59 $access_handler = new ilPortfolioAccessHandler();
60
62
63 $this->shared_objects = $access_handler->getObjectsIShare(false);
64
65 $this->setData($data);
66 }
67
71 protected function fillRow($a_set)
72 {
75
76 $this->tpl->setCurrentBlock("title_form");
77 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
78 $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
79 $this->tpl->parseCurrentBlock();
80
81 if (in_array($a_set["id"], $this->shared_objects)) {
82 $this->tpl->setCurrentBlock("shared");
83 $this->tpl->setVariable("TXT_SHARED", $lng->txt("wsp_status_shared"));
84 $this->tpl->parseCurrentBlock();
85 }
86
87 $this->tpl->setCurrentBlock("chck");
88 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
89 $this->tpl->parseCurrentBlock();
90
91 $this->tpl->setCurrentBlock("edit");
92 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
93 $this->tpl->setVariable(
94 "STATUS_ONLINE",
95 ($a_set["is_online"]) ? " checked=\"checked\"" : ""
96 );
97 $this->tpl->setVariable(
98 "VAL_DEFAULT",
99 ($a_set["is_default"]) ? $lng->txt("yes") : ""
100 );
101 $this->tpl->parseCurrentBlock();
102
103 $prtf_path = array(get_class($this->parent_obj), "ilobjportfoliogui");
104
105 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $a_set["id"]);
106 $this->tpl->setCurrentBlock("action");
107
108 $this->tpl->setVariable(
109 "URL_ACTION",
110 $ilCtrl->getLinkTargetByClass($prtf_path, "preview")
111 );
112 $this->tpl->setVariable("TXT_ACTION", $lng->txt("user_profile_preview"));
113 $this->tpl->parseCurrentBlock();
114
115 $this->tpl->setVariable(
116 "URL_ACTION",
117 $ilCtrl->getLinkTargetByClass($prtf_path, "view")
118 );
119 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_edit_portfolio"));
120 $this->tpl->parseCurrentBlock();
121
122 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
123
124 if ($a_set["is_online"]) {
125 if (!$a_set["is_default"]) {
126 $ilCtrl->setParameter($this->parent_obj, "prt_id", $a_set["id"]);
127
128 $this->tpl->setVariable(
129 "URL_ACTION",
130 $ilCtrl->getLinkTarget($this->parent_obj, "setDefaultConfirmation")
131 );
132 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_set_as_default"));
133 $this->tpl->parseCurrentBlock();
134
135 $ilCtrl->setParameter($this->parent_obj, "prt_id", "");
136 } else {
137 $this->tpl->setVariable(
138 "URL_ACTION",
139 $ilCtrl->getLinkTarget($this->parent_obj, "unsetDefault")
140 );
141 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_unset_as_default"));
142 $this->tpl->parseCurrentBlock();
143 }
144 }
145 }
146}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static getPortfoliosOfUser($a_user_id)
Get views of user.
Access handler for portfolio.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id)
Constructor.
fillRow($a_set)
Fill table row.
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.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46