ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPortfolioTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
19  protected $user;
20 
21  protected $user_id;
22 
26  public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
27  {
28  global $DIC;
29 
30  $this->ctrl = $DIC->ctrl();
31  $this->lng = $DIC->language();
32  $this->user = $DIC->user();
33  $ilCtrl = $DIC->ctrl();
34  $lng = $DIC->language();
35 
36  $this->user_id = (int) $a_user_id;
37 
38  parent::__construct($a_parent_obj, $a_parent_cmd);
39 
40  $this->setTitle($lng->txt("prtf_portfolios"));
41 
42  $this->addColumn($this->lng->txt(""), "", "1");
43  $this->addColumn($this->lng->txt("title"), "title", "50%");
44  $this->addColumn($this->lng->txt("online"), "is_online");
45  $this->addColumn($this->lng->txt("prtf_default_portfolio"), "is_default");
46  $this->addColumn($this->lng->txt("actions"));
47 
48  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
49  $this->setRowTemplate("tpl.portfolio_row.html", "Modules/Portfolio");
50 
51  $this->addMultiCommand("confirmPortfolioDeletion", $lng->txt("delete"));
52  $this->addCommandButton("saveTitles", $lng->txt("prtf_save_status_and_titles"));
53 
54  $this->getItems();
55 
56  $lng->loadLanguageModule("wsp");
57 
58  include_once('./Services/Link/classes/class.ilLink.php');
59  }
60 
61  protected function getItems()
62  {
64 
65  include_once "Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php";
66  $access_handler = new ilPortfolioAccessHandler();
67 
68  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
70 
71  $this->shared_objects = $access_handler->getObjectsIShare(false);
72 
73  $this->setData($data);
74  }
75 
79  protected function fillRow($a_set)
80  {
81  $lng = $this->lng;
83 
84  $this->tpl->setCurrentBlock("title_form");
85  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
86  $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
87  $this->tpl->parseCurrentBlock();
88 
89  if (in_array($a_set["id"], $this->shared_objects)) {
90  $this->tpl->setCurrentBlock("shared");
91  $this->tpl->setVariable("TXT_SHARED", $lng->txt("wsp_status_shared"));
92  $this->tpl->parseCurrentBlock();
93  }
94 
95  $this->tpl->setCurrentBlock("chck");
96  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
97  $this->tpl->parseCurrentBlock();
98 
99  $this->tpl->setCurrentBlock("edit");
100  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
101  $this->tpl->setVariable(
102  "STATUS_ONLINE",
103  ($a_set["is_online"]) ? " checked=\"checked\"" : ""
104  );
105  $this->tpl->setVariable(
106  "VAL_DEFAULT",
107  ($a_set["is_default"]) ? $lng->txt("yes") : ""
108  );
109  $this->tpl->parseCurrentBlock();
110 
111  $prtf_path = array(get_class($this->parent_obj), "ilobjportfoliogui");
112 
113  $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $a_set["id"]);
114  $this->tpl->setCurrentBlock("action");
115 
116  $this->tpl->setVariable(
117  "URL_ACTION",
118  $ilCtrl->getLinkTargetByClass($prtf_path, "preview")
119  );
120  $this->tpl->setVariable("TXT_ACTION", $lng->txt("user_profile_preview"));
121  $this->tpl->parseCurrentBlock();
122 
123  $this->tpl->setVariable(
124  "URL_ACTION",
125  $ilCtrl->getLinkTargetByClass($prtf_path, "view")
126  );
127  $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_edit_portfolio"));
128  $this->tpl->parseCurrentBlock();
129 
130  $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
131 
132  if ($a_set["is_online"]) {
133  if (!$a_set["is_default"]) {
134  $ilCtrl->setParameter($this->parent_obj, "prt_id", $a_set["id"]);
135 
136  $this->tpl->setVariable(
137  "URL_ACTION",
138  $ilCtrl->getLinkTarget($this->parent_obj, "setDefaultConfirmation")
139  );
140  $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_set_as_default"));
141  $this->tpl->parseCurrentBlock();
142 
143  $ilCtrl->setParameter($this->parent_obj, "prt_id", "");
144  } else {
145  $this->tpl->setVariable(
146  "URL_ACTION",
147  $ilCtrl->getLinkTarget($this->parent_obj, "unsetDefault")
148  );
149  $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_unset_as_default"));
150  $this->tpl->parseCurrentBlock();
151  }
152  }
153  }
154 }
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 public
global $DIC
Definition: saml.php:7
static getPortfoliosOfUser($a_user_id)
Get views of user.
user()
Definition: user.php:4
__construct($a_parent_obj, $a_parent_cmd, $a_user_id)
Constructor.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
fillRow($a_set)
Fill table row.
addMultiCommand($a_cmd, $a_text)
Add Command button.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
Access handler for portfolio.