ILIAS  release_4-4 Revision
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  }
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
Access handler for portfolio.

Member Function Documentation

◆ applyShareFilter()

ilPortfolioRepositoryGUI::applyShareFilter ( )
protected

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

References showOther().

336  {
337  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
338  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler);
339  $tbl->resetOffset();
340  $tbl->writeFilterToSession();
341 
342  $this->showOther();
343  }
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 156 of file class.ilPortfolioRepositoryGUI.php.

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

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

◆ deletePortfolios()

ilPortfolioRepositoryGUI::deletePortfolios ( )
protected

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

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

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

◆ executeCommand()

ilPortfolioRepositoryGUI::executeCommand ( )

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

References $_REQUEST, $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_b.png"),
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 $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)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ resetShareFilter()

ilPortfolioRepositoryGUI::resetShareFilter ( )
protected

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

References showOther().

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

◆ saveTitles()

ilPortfolioRepositoryGUI::saveTitles ( )
protected

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

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

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

◆ setDefault()

ilPortfolioRepositoryGUI::setDefault (   $a_prtf_id)
protected

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

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

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

288  {
289  global $ilCtrl, $lng, $ilUser;
290 
291  if($a_prtf_id && $this->checkAccess("write"))
292  {
293  // #12845
294  if($this->access_handler->hasGlobalPermission($a_prtf_id))
295  {
296  $ilUser->setPref("public_profile", "g");
297  $ilUser->writePrefs();
298  }
299  else if($this->access_handler->hasRegisteredPermission($a_prtf_id))
300  {
301  $ilUser->setPref("public_profile", "y");
302  $ilUser->writePrefs();
303  }
304  else
305  {
306  return;
307  }
308  ilObjPortfolio::setUserDefault($this->user_id, $a_prtf_id);
309  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
310  }
311  $ilCtrl->redirect($this, "show");
312  }
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.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ 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 230 of file class.ilPortfolioRepositoryGUI.php.

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

231  {
232  global $ilCtrl, $lng, $tpl;
233 
234  $prtf_id = (int)$_REQUEST["prt_id"];
235 
236  if($prtf_id && $this->checkAccess("write"))
237  {
238  // if already shared, no need to ask again
239  if($this->access_handler->hasRegisteredPermission($prtf_id) ||
240  $this->access_handler->hasGlobalPermission($prtf_id))
241  {
242  return $this->setDefault($prtf_id);
243  }
244 
245  $ilCtrl->setParameter($this, "prt_id", $prtf_id);
246 
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_set_default_publish_confirmation"));
251  $cgui->setCancel($lng->txt("yes"), "setDefaultGlobal");
252  $cgui->setConfirm($lng->txt("no"), "setDefaultRegistered");
253 
254  $tpl->setContent($cgui->getHTML());
255  return;
256  }
257 
258  $ilCtrl->redirect($this, "show");
259  }
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ Here is the call graph for this function:

◆ setDefaultGlobal()

ilPortfolioRepositoryGUI::setDefaultGlobal ( )
protected

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

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

262  {
263  global $ilCtrl;
264 
265  $prtf_id = (int)$_REQUEST["prt_id"];
266  if($prtf_id && $this->checkAccess("write"))
267  {
268  $this->access_handler->addPermission($prtf_id, ilWorkspaceAccessGUI::PERMISSION_ALL);
269  $this->setDefault($prtf_id);
270  }
271  $ilCtrl->redirect($this, "show");
272  }
checkAccess($a_permission, $a_portfolio_id=null)
global $ilCtrl
Definition: ilias.php:18
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ setDefaultRegistered()

ilPortfolioRepositoryGUI::setDefaultRegistered ( )
protected

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

References $_REQUEST, $ilCtrl, checkAccess(), ilWorkspaceAccessGUI\PERMISSION_REGISTERED, 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_REGISTERED);
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
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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 $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
+ 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:40
+ Here is the caller graph for this function:

◆ show()

ilPortfolioRepositoryGUI::show ( )
protected

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

References $ilCtrl, $lng, and $tpl.

111  {
112  global $tpl, $lng, $ilToolbar, $ilCtrl;
113 
114  $ilToolbar->addButton($lng->txt("prtf_add_portfolio"),
115  $ilCtrl->getLinkTargetByClass("ilObjPortfolioGUI", "create"));
116 
117  include_once "Modules/Portfolio/classes/class.ilPortfolioTableGUI.php";
118  $table = new ilPortfolioTableGUI($this, "show", $this->user_id);
119 
120  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
121 
122  $tpl->setContent($table->getHTML().ilDiskQuotaHandler::getStatusLegend());
123  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40

◆ showOther()

ilPortfolioRepositoryGUI::showOther (   $a_load_data = true)
protected

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

References $tpl.

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

325  {
326  global $tpl, $ilTabs;
327 
328  $ilTabs->activateTab("otpf");
329 
330  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
331  $tbl = new ilWorkspaceShareTableGUI($this, "showOther", $this->access_handler, null, $a_load_data);
332  $tpl->setContent($tbl->getHTML());
333  }
Workspace share handler table GUI class.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the caller graph for this function:

◆ showOtherFilter()

ilPortfolioRepositoryGUI::showOtherFilter ( )
protected

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

References showOther().

320  {
321  $this->showOther(false);
322  }
+ Here is the call graph for this function:

◆ unsetDefault()

ilPortfolioRepositoryGUI::unsetDefault ( )
protected

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

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

212  {
213  global $ilCtrl, $lng, $ilUser;
214 
215  if($this->checkAccess("write"))
216  {
217  // #12845
218  $ilUser->setPref("public_profile", "n");
219  $ilUser->writePrefs();
220 
221  ilObjPortfolio::setUserDefault($this->user_id);
222  ilUtil::sendSuccess($lng->txt("prtf_unset_default_share_info"), true);
223  }
224  $ilCtrl->redirect($this, "show");
225  }
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.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ 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: