ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPortfolioRepositoryGUI Class Reference

Portfolio repository gui class. More...

+ Collaboration diagram for ilPortfolioRepositoryGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 setTabs ()
 

Protected Member Functions

 setLocator ()
 
 checkAccess ($a_permission, $a_portfolio_id=null)
 
 show ()
 
 saveTitles ()
 
 confirmPortfolioDeletion ()
 
 deletePortfolios ()
 
 unsetDefault ()
 
 setDefaultConfirmation ()
 Confirm sharing when setting default. More...
 
 setDefaultGlobal ()
 
 setDefaultRegistered ()
 
 setDefault ($a_prtf_id)
 
 showOtherFilter ()
 
 showOther ($a_load_data=true)
 
 applyShareFilter ()
 
 resetShareFilter ()
 

Protected Attributes

 $user_id
 
 $access_handler
 

Detailed Description

Portfolio repository gui class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

ilPortfolioRepositoryGUI: ilObjPortfolioGUI

Definition at line 16 of file class.ilPortfolioRepositoryGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPortfolioRepositoryGUI::__construct ( )

Definition at line 21 of file class.ilPortfolioRepositoryGUI.php.

References $ilUser, and $lng.

22  {
23  global $lng, $ilUser;
24 
25  $lng->loadLanguageModule("prtf");
26  $lng->loadLanguageModule("user");
27 
28  include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
29  $this->access_handler = new ilPortfolioAccessHandler();
30 
31  $this->user_id = $ilUser->getId();
32  }
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
Access handler for portfolio.

Member Function Documentation

◆ applyShareFilter()

ilPortfolioRepositoryGUI::applyShareFilter ( )
protected

Definition at line 348 of file class.ilPortfolioRepositoryGUI.php.

References $tbl, and showOther().

349  {
350  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
351  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler);
352  $tbl->resetOffset();
353  $tbl->writeFilterToSession();
354 
355  $this->showOther();
356  }
$tbl
Definition: example_048.php:81
Workspace share handler table GUI class.
+ Here is the call graph for this function:

◆ checkAccess()

ilPortfolioRepositoryGUI::checkAccess (   $a_permission,
  $a_portfolio_id = null 
)
protected

Definition at line 95 of file class.ilPortfolioRepositoryGUI.php.

Referenced by deletePortfolios(), saveTitles(), setDefault(), setDefaultConfirmation(), setDefaultGlobal(), setDefaultRegistered(), and unsetDefault().

96  {
97  if($a_portfolio_id)
98  {
99  return $this->access_handler->checkAccess($a_permission, "", $a_portfolio_id);
100  }
101  // currently only object-based permissions
102  return true;
103  }
+ Here is the caller graph for this function:

◆ confirmPortfolioDeletion()

ilPortfolioRepositoryGUI::confirmPortfolioDeletion ( )
protected

Definition at line 159 of file class.ilPortfolioRepositoryGUI.php.

References $_POST, $ilCtrl, $lng, $tpl, ilObject2\_lookupTitle(), and ilUtil\sendInfo().

160  {
161  global $ilCtrl, $tpl, $lng;
162 
163  if (!is_array($_POST["prtfs"]) || count($_POST["prtfs"]) == 0)
164  {
165  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
166  $ilCtrl->redirect($this, "show");
167  }
168  else
169  {
170  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
171  $cgui = new ilConfirmationGUI();
172  $cgui->setFormAction($ilCtrl->getFormAction($this));
173  $cgui->setHeaderText($lng->txt("prtf_sure_delete_portfolios"));
174  $cgui->setCancel($lng->txt("cancel"), "show");
175  $cgui->setConfirm($lng->txt("delete"), "deletePortfolios");
176 
177  foreach ($_POST["prtfs"] as $id)
178  {
179  $cgui->addItem("prtfs[]", $id, ilObjPortfolio::_lookupTitle($id));
180  }
181 
182  $tpl->setContent($cgui->getHTML());
183  }
184  }
static _lookupTitle($a_id)
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $lng
Definition: privfeed.php:17
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ deletePortfolios()

ilPortfolioRepositoryGUI::deletePortfolios ( )
protected

Definition at line 186 of file class.ilPortfolioRepositoryGUI.php.

References $_POST, $ilCtrl, $lng, $user_id, checkAccess(), and ilUtil\sendSuccess().

187  {
188  global $lng, $ilCtrl;
189 
190  if (is_array($_POST["prtfs"]))
191  {
192  foreach ($_POST["prtfs"] as $id)
193  {
194  if($this->checkAccess("write", $id))
195  {
196  $portfolio = new ilObjPortfolio($id, false);
197  if ($portfolio->getOwner() == $this->user_id)
198  {
199  $this->access_handler->removePermission($id);
200  $portfolio->delete();
201  }
202  }
203  }
204  }
205  ilUtil::sendSuccess($lng->txt("prtf_portfolio_deleted"), true);
206  $ilCtrl->redirect($this, "show");
207  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilPortfolioRepositoryGUI::executeCommand ( )

Definition at line 34 of file class.ilPortfolioRepositoryGUI.php.

References $cmd, $ilCtrl, $lng, $tpl, ilUtil\getImagePath(), setLocator(), and setTabs().

35  {
36  global $ilCtrl, $lng, $tpl, $ilTabs;
37 
38  $next_class = $ilCtrl->getNextClass($this);
39  $cmd = $ilCtrl->getCmd("show");
40 
41  $tpl->setTitle($lng->txt("portfolio"));
42  $tpl->setTitleIcon(ilUtil::getImagePath("icon_prtf.svg"),
43  $lng->txt("portfolio"));
44 
45  switch($next_class)
46  {
47  case "ilobjportfoliogui":
48  if($cmd != "preview")
49  {
50  $this->setLocator();
51 
52  $ilTabs->setBack2Target($lng->txt("prtf_tab_portfolios"),
53  $ilCtrl->getLinkTarget($this, "show"));
54  }
55  include_once('./Modules/Portfolio/classes/class.ilObjPortfolioGUI.php');
56  $gui = new ilObjPortfolioGUI($_REQUEST["prt_id"]);
57  $ilCtrl->forwardCommand($gui);
58  break;
59 
60  default:
61  $this->setLocator();
62  $this->setTabs();
63  $this->$cmd();
64  break;
65  }
66 
67  return true;
68  }
$cmd
Definition: sahs_server.php:35
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
Portfolio view gui class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ resetShareFilter()

ilPortfolioRepositoryGUI::resetShareFilter ( )
protected

Definition at line 358 of file class.ilPortfolioRepositoryGUI.php.

References $tbl, and showOther().

359  {
360  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
361  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler);
362  $tbl->resetOffset();
363  $tbl->resetFilter();
364 
365  $this->showOther();
366  }
$tbl
Definition: example_048.php:81
Workspace share handler table GUI class.
+ Here is the call graph for this function:

◆ saveTitles()

ilPortfolioRepositoryGUI::saveTitles ( )
protected

Definition at line 128 of file class.ilPortfolioRepositoryGUI.php.

References $_POST, $ilCtrl, $lng, $title, checkAccess(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

129  {
130  global $ilCtrl, $lng;
131 
132  foreach($_POST["title"] as $id => $title)
133  {
134  if(trim($title))
135  {
136  if($this->checkAccess("write", $id))
137  {
138  $portfolio = new ilObjPortfolio($id, false);
139  $portfolio->setTitle(ilUtil::stripSlashes($title));
140 
141  if(is_array($_POST["online"]) && in_array($id, $_POST["online"]))
142  {
143  $portfolio->setOnline(true);
144  }
145  else
146  {
147  $portfolio->setOnline(false);
148  }
149 
150  $portfolio->update();
151  }
152  }
153  }
154 
155  ilUtil::sendSuccess($lng->txt("saved_successfully"), true);
156  $ilCtrl->redirect($this, "show");
157  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:17
$_POST["username"]
+ Here is the call graph for this function:

◆ setDefault()

ilPortfolioRepositoryGUI::setDefault (   $a_prtf_id)
protected

Definition at line 300 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, $ilUser, $lng, checkAccess(), ilUtil\sendSuccess(), and ilObjPortfolio\setUserDefault().

Referenced by setDefaultConfirmation(), setDefaultGlobal(), and setDefaultRegistered().

301  {
302  global $ilCtrl, $lng, $ilUser;
303 
304  if($a_prtf_id && $this->checkAccess("write"))
305  {
306  // #12845
307  if($this->access_handler->hasGlobalPermission($a_prtf_id))
308  {
309  $ilUser->setPref("public_profile", "g");
310  $ilUser->writePrefs();
311  }
312  else if($this->access_handler->hasRegisteredPermission($a_prtf_id))
313  {
314  $ilUser->setPref("public_profile", "y");
315  $ilUser->writePrefs();
316  }
317  else
318  {
319  return;
320  }
321  ilObjPortfolio::setUserDefault($this->user_id, $a_prtf_id);
322  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
323  }
324  $ilCtrl->redirect($this, "show");
325  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
static setUserDefault($a_user_id, $a_portfolio_id=null)
Set the user default portfolio.
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultConfirmation()

ilPortfolioRepositoryGUI::setDefaultConfirmation ( )
protected

Confirm sharing when setting default.

Definition at line 233 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, $ilSetting, $lng, $tpl, checkAccess(), and setDefault().

234  {
235  global $ilCtrl, $lng, $tpl, $ilTabs, $ilSetting;
236 
237  $prtf_id = (int)$_REQUEST["prt_id"];
238 
239  if($prtf_id && $this->checkAccess("write"))
240  {
241  // if already shared, no need to ask again
242  if($this->access_handler->hasRegisteredPermission($prtf_id) ||
243  $this->access_handler->hasGlobalPermission($prtf_id))
244  {
245  return $this->setDefault($prtf_id);
246  }
247 
248  $ilTabs->clearTargets();
249  $ilTabs->setBackTarget($lng->txt("cancel"),
250  $ilCtrl->getLinkTarget($this, "show"));
251 
252  $ilCtrl->setParameter($this, "prt_id", $prtf_id);
253 
254  // #20310
255  if(!$ilSetting->get("enable_global_profiles"))
256  {
257  $ilCtrl->redirect($this, "setDefaultRegistered");
258  }
259 
260  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
261  $cgui = new ilConfirmationGUI();
262  $cgui->setFormAction($ilCtrl->getFormAction($this));
263  $cgui->setHeaderText($lng->txt("prtf_set_default_publish_confirmation"));
264  $cgui->setCancel($lng->txt("prtf_set_default_publish_global"), "setDefaultGlobal");
265  $cgui->setConfirm($lng->txt("prtf_set_default_publish_registered"), "setDefaultRegistered");
266  $tpl->setContent($cgui->getHTML());
267 
268  return;
269  }
270 
271  $ilCtrl->redirect($this, "show");
272  }
checkAccess($a_permission, $a_portfolio_id=null)
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
Confirmation screen class.
+ Here is the call graph for this function:

◆ setDefaultGlobal()

ilPortfolioRepositoryGUI::setDefaultGlobal ( )
protected

Definition at line 274 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, checkAccess(), ilWorkspaceAccessGUI\PERMISSION_ALL, and setDefault().

275  {
276  global $ilCtrl;
277 
278  $prtf_id = (int)$_REQUEST["prt_id"];
279  if($prtf_id && $this->checkAccess("write"))
280  {
281  $this->access_handler->addPermission($prtf_id, ilWorkspaceAccessGUI::PERMISSION_ALL);
282  $this->setDefault($prtf_id);
283  }
284  $ilCtrl->redirect($this, "show");
285  }
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ setDefaultRegistered()

ilPortfolioRepositoryGUI::setDefaultRegistered ( )
protected

Definition at line 287 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, checkAccess(), ilWorkspaceAccessGUI\PERMISSION_REGISTERED, and setDefault().

288  {
289  global $ilCtrl;
290 
291  $prtf_id = (int)$_REQUEST["prt_id"];
292  if($prtf_id && $this->checkAccess("write"))
293  {
294  $this->access_handler->addPermission($prtf_id, ilWorkspaceAccessGUI::PERMISSION_REGISTERED);
295  $this->setDefault($prtf_id);
296  }
297  $ilCtrl->redirect($this, "show");
298  }
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ setLocator()

ilPortfolioRepositoryGUI::setLocator ( )
protected

Definition at line 85 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, $lng, and $tpl.

Referenced by executeCommand().

86  {
87  global $ilLocator, $lng, $ilCtrl, $tpl;
88 
89  $ilLocator->addItem($lng->txt("portfolio"),
90  $ilCtrl->getLinkTarget($this, "show"));
91 
92  $tpl->setLocator();
93  }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ setTabs()

ilPortfolioRepositoryGUI::setTabs ( )

Definition at line 70 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, and $lng.

Referenced by executeCommand().

71  {
72  global $ilTabs, $lng, $ilCtrl, $ilHelp;
73 
74  $ilHelp->setScreenIdComponent("prtf");
75 
76  $ilTabs->addTab("mypf", $lng->txt("prtf_tab_portfolios"),
77  $ilCtrl->getLinkTarget($this));
78 
79  $ilTabs->addTab("otpf", $lng->txt("prtf_tab_other_users"),
80  $ilCtrl->getLinkTarget($this, "showotherFilter"));
81 
82  $ilTabs->activateTab("mypf");
83  }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ show()

ilPortfolioRepositoryGUI::show ( )
protected

Definition at line 110 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, $lng, $tpl, and ilLinkButton\getInstance().

111  {
112  global $tpl, $lng, $ilToolbar, $ilCtrl;
113 
114  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
115  $button = ilLinkButton::getInstance();
116  $button->setCaption("prtf_add_portfolio");
117  $button->setUrl($ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
118  $ilToolbar->addButtonInstance($button);
119 
120  include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
121  $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
122 
123  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
124 
125  $tpl->setContent($table->getHTML().ilDiskQuotaHandler::getStatusLegend());
126  }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ showOther()

ilPortfolioRepositoryGUI::showOther (   $a_load_data = true)
protected

Definition at line 337 of file class.ilPortfolioRepositoryGUI.php.

References $tbl, and $tpl.

Referenced by applyShareFilter(), resetShareFilter(), and showOtherFilter().

338  {
339  global $tpl, $ilTabs;
340 
341  $ilTabs->activateTab("otpf");
342 
343  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
344  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler, null, $a_load_data);
345  $tpl->setContent($tbl->getHTML());
346  }
$tbl
Definition: example_048.php:81
global $tpl
Definition: ilias.php:8
Workspace share handler table GUI class.
+ Here is the caller graph for this function:

◆ showOtherFilter()

ilPortfolioRepositoryGUI::showOtherFilter ( )
protected

Definition at line 332 of file class.ilPortfolioRepositoryGUI.php.

References showOther().

333  {
334  $this->showOther(false);
335  }
+ Here is the call graph for this function:

◆ unsetDefault()

ilPortfolioRepositoryGUI::unsetDefault ( )
protected

Definition at line 214 of file class.ilPortfolioRepositoryGUI.php.

References $ilCtrl, $ilUser, $lng, checkAccess(), ilUtil\sendSuccess(), and ilObjPortfolio\setUserDefault().

215  {
216  global $ilCtrl, $lng, $ilUser;
217 
218  if($this->checkAccess("write"))
219  {
220  // #12845
221  $ilUser->setPref("public_profile", "n");
222  $ilUser->writePrefs();
223 
224  ilObjPortfolio::setUserDefault($this->user_id);
225  ilUtil::sendSuccess($lng->txt("prtf_unset_default_share_info"), true);
226  }
227  $ilCtrl->redirect($this, "show");
228  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
static setUserDefault($a_user_id, $a_portfolio_id=null)
Set the user default portfolio.
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Field Documentation

◆ $access_handler

ilPortfolioRepositoryGUI::$access_handler
protected

Definition at line 19 of file class.ilPortfolioRepositoryGUI.php.

◆ $user_id

ilPortfolioRepositoryGUI::$user_id
protected

Definition at line 18 of file class.ilPortfolioRepositoryGUI.php.

Referenced by deletePortfolios().


The documentation for this class was generated from the following file: