ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 $lng
 
 $user
 
 $ctrl
 
 $tpl
 
 $tabs
 
 $help
 
 $locator
 
 $toolbar
 
 $settings
 
 $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, ilObjExerciseGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPortfolioRepositoryGUI::__construct ( )

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

References $DIC, $ilUser, $lng, settings(), and user().

67  {
68  global $DIC;
69 
70  $this->lng = $DIC->language();
71  $this->user = $DIC->user();
72  $this->ctrl = $DIC->ctrl();
73  $this->tpl = $DIC["tpl"];
74  $this->tabs = $DIC->tabs();
75  $this->help = $DIC["ilHelp"];
76  $this->locator = $DIC["ilLocator"];
77  $this->toolbar = $DIC->toolbar();
78  $this->settings = $DIC->settings();
79  $lng = $DIC->language();
80  $ilUser = $DIC->user();
81 
82  $lng->loadLanguageModule("prtf");
83  $lng->loadLanguageModule("user");
84 
85  include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
86  $this->access_handler = new ilPortfolioAccessHandler();
87 
88  $this->user_id = $ilUser->getId();
89  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
$ilUser
Definition: imgupload.php:18
settings()
Definition: settings.php:2
Access handler for portfolio.
+ Here is the call graph for this function:

Member Function Documentation

◆ applyShareFilter()

ilPortfolioRepositoryGUI::applyShareFilter ( )
protected

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

References $tbl, and showOther().

421  {
422  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
423  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler);
424  $tbl->resetOffset();
425  $tbl->writeFilterToSession();
426 
427  $this->showOther();
428  }
$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 176 of file class.ilPortfolioRepositoryGUI.php.

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

177  {
178  if ($a_portfolio_id) {
179  return $this->access_handler->checkAccess($a_permission, "", $a_portfolio_id);
180  }
181  // currently only object-based permissions
182  return true;
183  }
+ Here is the caller graph for this function:

◆ confirmPortfolioDeletion()

ilPortfolioRepositoryGUI::confirmPortfolioDeletion ( )
protected

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

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

238  {
240  $tpl = $this->tpl;
241  $lng = $this->lng;
242 
243  if (!is_array($_POST["prtfs"]) || count($_POST["prtfs"]) == 0) {
244  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
245  $ilCtrl->redirect($this, "show");
246  } else {
247  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
248  $cgui = new ilConfirmationGUI();
249  $cgui->setFormAction($ilCtrl->getFormAction($this));
250  $cgui->setHeaderText($lng->txt("prtf_sure_delete_portfolios"));
251  $cgui->setCancel($lng->txt("cancel"), "show");
252  $cgui->setConfirm($lng->txt("delete"), "deletePortfolios");
253 
254  foreach ($_POST["prtfs"] as $id) {
255  $cgui->addItem("prtfs[]", $id, ilObjPortfolio::_lookupTitle($id));
256  }
257 
258  $tpl->setContent($cgui->getHTML());
259  }
260  }
static _lookupTitle($a_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ deletePortfolios()

ilPortfolioRepositoryGUI::deletePortfolios ( )
protected

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

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

263  {
264  $lng = $this->lng;
266 
267  if (is_array($_POST["prtfs"])) {
268  foreach ($_POST["prtfs"] as $id) {
269  if ($this->checkAccess("write", $id)) {
270  $portfolio = new ilObjPortfolio($id, false);
271  if ($portfolio->getOwner() == $this->user_id) {
272  $this->access_handler->removePermission($id);
273  $portfolio->delete();
274  }
275  }
276  }
277  }
278  ilUtil::sendSuccess($lng->txt("prtf_portfolio_deleted"), true);
279  $ilCtrl->redirect($this, "show");
280  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkAccess($a_permission, $a_portfolio_id=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilPortfolioRepositoryGUI::executeCommand ( )

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

References $_GET, $ctrl, $ilCtrl, $lng, $tabs, $tpl, ilLink\_getLink(), ilUtil\getImagePath(), setLocator(), and setTabs().

92  {
94  $lng = $this->lng;
95  $tpl = $this->tpl;
96  $ilTabs = $this->tabs;
97 
98  $next_class = $ilCtrl->getNextClass($this);
99  $cmd = $ilCtrl->getCmd("show");
100 
101  $tpl->setTitle($lng->txt("portfolio"));
102  $tpl->setTitleIcon(
103  ilUtil::getImagePath("icon_prtf.svg"),
104  $lng->txt("portfolio")
105  );
106 
107  switch ($next_class) {
108  case "ilobjportfoliogui":
109 
110  include_once('./Modules/Portfolio/classes/class.ilObjPortfolioGUI.php');
111  $gui = new ilObjPortfolioGUI((int) $_REQUEST["prt_id"]);
112 
113  if ($cmd != "preview") {
114  $this->setLocator();
115 
116  if ((int) $_GET["exc_back_ref_id"] > 0) {
117  include_once("./Services/Link/classes/class.ilLink.php");
118  $ilTabs->setBack2Target($lng->txt("obj_exc"), ilLink::_getLink((int) $_GET["exc_back_ref_id"]));
119  } else {
120  $ilTabs->setBack2Target($lng->txt("prtf_tab_portfolios"), $ilCtrl->getLinkTarget($this, "show"));
121  }
122  }
123 
124  $ilCtrl->forwardCommand($gui);
125  break;
126 
127  default:
128  $this->setLocator();
129  $this->setTabs();
130  $this->$cmd();
131  break;
132  }
133 
134  return true;
135  }
$_GET["client_id"]
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)
+ Here is the call graph for this function:

◆ resetShareFilter()

ilPortfolioRepositoryGUI::resetShareFilter ( )
protected

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

References $tbl, and showOther().

431  {
432  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
433  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler);
434  $tbl->resetOffset();
435  $tbl->resetFilter();
436 
437  $this->showOther();
438  }
$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 211 of file class.ilPortfolioRepositoryGUI.php.

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

212  {
214  $lng = $this->lng;
215 
216  foreach ($_POST["title"] as $id => $title) {
217  if (trim($title)) {
218  if ($this->checkAccess("write", $id)) {
219  $portfolio = new ilObjPortfolio($id, false);
220  $portfolio->setTitle(ilUtil::stripSlashes($title));
221 
222  if (is_array($_POST["online"]) && in_array($id, $_POST["online"])) {
223  $portfolio->setOnline(true);
224  } else {
225  $portfolio->setOnline(false);
226  }
227 
228  $portfolio->update();
229  }
230  }
231  }
232 
233  ilUtil::sendSuccess($lng->txt("saved_successfully"), true);
234  $ilCtrl->redirect($this, "show");
235  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkAccess($a_permission, $a_portfolio_id=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ setDefault()

ilPortfolioRepositoryGUI::setDefault (   $a_prtf_id)
protected

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

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

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

376  {
378  $lng = $this->lng;
380 
381  if ($a_prtf_id && $this->checkAccess("write")) {
382  // #12845
383  if ($this->access_handler->hasGlobalPermission($a_prtf_id)) {
384  $ilUser->setPref("public_profile", "g");
385  $ilUser->writePrefs();
386  } elseif ($this->access_handler->hasRegisteredPermission($a_prtf_id)) {
387  $ilUser->setPref("public_profile", "y");
388  $ilUser->writePrefs();
389  } else {
390  return;
391  }
392  ilObjPortfolio::setUserDefault($this->user_id, $a_prtf_id);
393  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
394  }
395  $ilCtrl->redirect($this, "show");
396  }
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
+ 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 307 of file class.ilPortfolioRepositoryGUI.php.

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

308  {
310  $lng = $this->lng;
311  $tpl = $this->tpl;
312  $ilTabs = $this->tabs;
314 
315  $prtf_id = (int) $_REQUEST["prt_id"];
316 
317  if ($prtf_id && $this->checkAccess("write")) {
318  // if already shared, no need to ask again
319  if ($this->access_handler->hasRegisteredPermission($prtf_id) ||
320  $this->access_handler->hasGlobalPermission($prtf_id)) {
321  return $this->setDefault($prtf_id);
322  }
323 
324  $ilTabs->clearTargets();
325  $ilTabs->setBackTarget(
326  $lng->txt("cancel"),
327  $ilCtrl->getLinkTarget($this, "show")
328  );
329 
330  $ilCtrl->setParameter($this, "prt_id", $prtf_id);
331 
332  // #20310
333  if (!$ilSetting->get("enable_global_profiles")) {
334  $ilCtrl->redirect($this, "setDefaultRegistered");
335  }
336 
337  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
338  $cgui = new ilConfirmationGUI();
339  $cgui->setFormAction($ilCtrl->getFormAction($this));
340  $cgui->setHeaderText($lng->txt("prtf_set_default_publish_confirmation"));
341  $cgui->setCancel($lng->txt("prtf_set_default_publish_global"), "setDefaultGlobal");
342  $cgui->setConfirm($lng->txt("prtf_set_default_publish_registered"), "setDefaultRegistered");
343  $tpl->setContent($cgui->getHTML());
344 
345  return;
346  }
347 
348  $ilCtrl->redirect($this, "show");
349  }
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
Confirmation screen class.
+ Here is the call graph for this function:

◆ setDefaultGlobal()

ilPortfolioRepositoryGUI::setDefaultGlobal ( )
protected

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

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

352  {
354 
355  $prtf_id = (int) $_REQUEST["prt_id"];
356  if ($prtf_id && $this->checkAccess("write")) {
357  $this->access_handler->addPermission($prtf_id, ilWorkspaceAccessGUI::PERMISSION_ALL);
358  $this->setDefault($prtf_id);
359  }
360  $ilCtrl->redirect($this, "show");
361  }
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 363 of file class.ilPortfolioRepositoryGUI.php.

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

364  {
366 
367  $prtf_id = (int) $_REQUEST["prt_id"];
368  if ($prtf_id && $this->checkAccess("write")) {
369  $this->access_handler->addPermission($prtf_id, ilWorkspaceAccessGUI::PERMISSION_REGISTERED);
370  $this->setDefault($prtf_id);
371  }
372  $ilCtrl->redirect($this, "show");
373  }
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 161 of file class.ilPortfolioRepositoryGUI.php.

References $ctrl, $ilCtrl, $lng, $locator, and $tpl.

Referenced by executeCommand().

162  {
163  $ilLocator = $this->locator;
164  $lng = $this->lng;
166  $tpl = $this->tpl;
167 
168  $ilLocator->addItem(
169  $lng->txt("portfolio"),
170  $ilCtrl->getLinkTarget($this, "show")
171  );
172 
173  $tpl->setLocator();
174  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ setTabs()

ilPortfolioRepositoryGUI::setTabs ( )

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

References $ctrl, $help, $ilCtrl, $lng, and $tabs.

Referenced by executeCommand().

138  {
139  $ilTabs = $this->tabs;
140  $lng = $this->lng;
142  $ilHelp = $this->help;
143 
144  $ilHelp->setScreenIdComponent("prtf");
145 
146  $ilTabs->addTab(
147  "mypf",
148  $lng->txt("prtf_tab_portfolios"),
149  $ilCtrl->getLinkTarget($this)
150  );
151 
152  $ilTabs->addTab(
153  "otpf",
154  $lng->txt("prtf_tab_other_users"),
155  $ilCtrl->getLinkTarget($this, "showotherFilter")
156  );
157 
158  $ilTabs->activateTab("mypf");
159  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ show()

ilPortfolioRepositoryGUI::show ( )
protected

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

References $ctrl, $ilCtrl, $lng, $table, $toolbar, $tpl, ilLinkButton\getInstance(), and ilDiskQuotaHandler\getStatusLegend().

191  {
192  $tpl = $this->tpl;
193  $lng = $this->lng;
194  $ilToolbar = $this->toolbar;
196 
197  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
198  $button = ilLinkButton::getInstance();
199  $button->setCaption("prtf_add_portfolio");
200  $button->setUrl($ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
201  $ilToolbar->addButtonInstance($button);
202 
203  include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
204  $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
205 
206  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
207 
208  $tpl->setContent($table->getHTML() . ilDiskQuotaHandler::getStatusLegend());
209  }
global $ilCtrl
Definition: ilias.php:18
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:

◆ showOther()

ilPortfolioRepositoryGUI::showOther (   $a_load_data = true)
protected

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

References $tabs, $tbl, and $tpl.

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

409  {
410  $tpl = $this->tpl;
411  $ilTabs = $this->tabs;
412 
413  $ilTabs->activateTab("otpf");
414 
415  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
416  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler, null, $a_load_data);
417  $tpl->setContent($tbl->getHTML());
418  }
$tbl
Definition: example_048.php:81
Workspace share handler table GUI class.
+ Here is the caller graph for this function:

◆ showOtherFilter()

ilPortfolioRepositoryGUI::showOtherFilter ( )
protected

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

References showOther().

404  {
405  $this->showOther(false);
406  }
+ Here is the call graph for this function:

◆ unsetDefault()

ilPortfolioRepositoryGUI::unsetDefault ( )
protected

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

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

288  {
290  $lng = $this->lng;
292 
293  if ($this->checkAccess("write")) {
294  // #12845
295  $ilUser->setPref("public_profile", "n");
296  $ilUser->writePrefs();
297 
298  ilObjPortfolio::setUserDefault($this->user_id);
299  ilUtil::sendSuccess($lng->txt("prtf_unset_default_share_info"), true);
300  }
301  $ilCtrl->redirect($this, "show");
302  }
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
+ Here is the call graph for this function:

Field Documentation

◆ $access_handler

ilPortfolioRepositoryGUI::$access_handler
protected

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

◆ $ctrl

◆ $help

ilPortfolioRepositoryGUI::$help
protected

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

Referenced by setTabs().

◆ $lng

◆ $locator

ilPortfolioRepositoryGUI::$locator
protected

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

Referenced by setLocator().

◆ $settings

ilPortfolioRepositoryGUI::$settings
protected

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

Referenced by setDefaultConfirmation().

◆ $tabs

ilPortfolioRepositoryGUI::$tabs
protected

◆ $toolbar

ilPortfolioRepositoryGUI::$toolbar
protected

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

Referenced by show().

◆ $tpl

ilPortfolioRepositoryGUI::$tpl
protected

◆ $user

ilPortfolioRepositoryGUI::$user
protected

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

Referenced by setDefault(), and unsetDefault().

◆ $user_id

ilPortfolioRepositoryGUI::$user_id
protected

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

Referenced by deletePortfolios().


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