41 protected \ILIAS\DI\UIServices
$ui;
47 $this->
lng = $DIC->language();
48 $this->
user = $DIC->user();
49 $this->
ctrl = $DIC->ctrl();
50 $this->tpl =
$DIC[
"tpl"];
51 $this->
tabs = $DIC->tabs();
52 $this->
help = $DIC[
"ilHelp"];
53 $this->
locator = $DIC[
"ilLocator"];
54 $this->
toolbar = $DIC->toolbar();
56 $this->
ui = $DIC->ui();
65 $this->port_request =
$DIC->portfolio()
70 $this->user_id =
$ilUser->getId();
80 if (!$this->access_handler->editPortfolios()) {
84 $next_class = $ilCtrl->getNextClass($this);
85 $cmd = $ilCtrl->getCmd(
"show");
93 switch ($next_class) {
94 case "ilobjportfoliogui":
98 if ($cmd !==
"preview") {
101 $exercise_back_ref_id = $this->port_request->getExcBackRefId();
102 if ($exercise_back_ref_id > 0) {
105 $ilTabs->setBack2Target(
$lng->
txt(
"prtf_tab_portfolios"), $ilCtrl->getLinkTarget($this,
"show"));
109 $ilCtrl->forwardCommand($gui);
131 $lng->
txt(
"prtf_tab_portfolios"),
132 $ilCtrl->getLinkTarget($this)
137 $lng->
txt(
"prtf_tab_other_users"),
138 $ilCtrl->getLinkTarget($this,
"showotherFilter")
141 $ilTabs->activateTab(
"mypf");
153 $ilCtrl->getLinkTarget($this,
"show")
160 string $a_permission,
161 ?
int $a_portfolio_id =
null
163 if ($a_portfolio_id) {
164 return $this->access_handler->checkAccess($a_permission,
"", $a_portfolio_id);
175 protected function show(): void
178 $ilToolbar = $this->toolbar;
179 $ilCtrl = $this->ctrl;
182 $button->setCaption(
"prtf_add_portfolio");
183 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilObjPortfolioGUI",
"create"));
184 $ilToolbar->addButtonInstance($button);
185 $portfolio_list = $this->getPortfolioList();
187 $tpl->setContent($portfolio_list);
194 $renderer = $ui->renderer();
200 $shared_objects = $access_handler->getObjectsIShare(
false);
206 $icon =
$f->symbol()->icon()->custom(
208 $lng->txt(
"obj_portfolio"),
211 if (!$port[
"is_online"] || !in_array($port[
"id"], $shared_objects)) {
212 $icon = $icon->withDisabled(
true);
216 $prtf_path = array(get_class($this),
"ilobjportfoliogui");
219 $ctrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id", $port[
"id"]);
220 $preview_action = $ctrl->getLinkTargetByClass($prtf_path,
"preview");
221 $action[] =
$f->button()->shy(
$lng->txt(
"preview"), $preview_action);
223 $action[] =
$f->button()->shy(
224 $lng->txt(
"prtf_edit_content"),
225 $ctrl->getLinkTargetByClass($prtf_path,
"view")
227 $ctrl->setParameter($this,
"prt_id", $port[
"id"]);
228 if ($port[
"is_online"]) {
230 $action[] =
$f->button()->shy(
231 $lng->txt(
"prtf_set_offline"),
232 $ctrl->getLinkTarget($this,
"setOffline")
236 $action[] =
$f->button()->shy(
237 $lng->txt(
"prtf_set_online"),
238 $ctrl->getLinkTarget($this,
"setOnline")
241 $ctrl->setParameter($this,
"prt_id",
"");
243 $action[] =
$f->button()->shy(
244 $lng->txt(
"settings"),
245 $ctrl->getLinkTargetByClass($prtf_path,
"edit")
248 $action[] =
$f->button()->shy(
249 $lng->txt(
"wsp_permissions"),
250 $ctrl->getLinkTargetByClass(array(get_class($this),
"ilobjportfoliogui",
"ilWorkspaceAccessGUI"),
"share")
252 $ctrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id",
"");
254 if ($port[
"is_online"]) {
255 if (!$port[
"is_default"]) {
257 $ctrl->setParameter($this,
"prt_id", $port[
"id"]);
259 $action[] =
$f->button()->shy(
260 $lng->txt(
"prtf_set_as_default"),
261 $ctrl->getLinkTarget($this,
"setDefaultConfirmation")
264 $ctrl->setParameter($this,
"prt_id",
"");
267 $action[] =
$f->button()->shy(
268 $lng->txt(
"prtf_unset_as_default"),
269 $ctrl->getLinkTarget($this,
"unsetDefault")
274 $ctrl->setParameter($this,
"prtf", $port[
"id"]);
275 $action[] =
$f->button()->shy(
277 $ctrl->getLinkTarget($this,
"confirmPortfolioDeletion")
279 $ctrl->setParameter($this,
"prtf",
"");
280 $actions =
$f->dropdown()->standard($action);
286 $props[
$lng->txt(
"online")] = ($port[
"is_online"])
291 $props[
$lng->txt(
"wsp_status_shared")] = (in_array($port[
"id"], $shared_objects))
296 if ($port[
"is_default"]) {
297 $props[
$lng->txt(
"prtf_default_portfolio")] =
$lng->txt(
"yes");
302 foreach ($exercises as $exinfo) {
303 if ($exinfo[
"submitted"]) {
304 $props[$exinfo[
"ass_title"]] =
305 str_replace(
"$1", $exinfo[
"submitted_date"],
$lng->txt(
"prtf_submission_on"));
307 $props[$exinfo[
"ass_title"]] =
$lng->txt(
"prtf_no_submission");
313 $items[] =
$f->item()->standard(
$f->button()->shy($port[
"title"], $preview_action))
314 ->withActions($actions)
315 ->withProperties($props)
316 ->withLeadIcon($icon);
320 $std_list =
$f->panel()->listing()->standard(
$lng->txt(
"prtf_portfolios"), array(
321 $f->item()->group(
"", $items)
324 return $renderer->render($std_list);
330 $ilCtrl = $this->ctrl;
333 $prt_id = $this->port_request->getPortfolioId();
336 $portfolio->setOnline(
true);
337 $portfolio->update();
338 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"saved_successfully"),
true);
339 $ilCtrl->redirect($this,
"show");
341 $ilCtrl->redirect($this,
"show");
346 $ilCtrl = $this->ctrl;
349 $prt_id = $this->port_request->getPortfolioId();
352 $portfolio->setOnline(
false);
353 $portfolio->update();
354 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"saved_successfully"),
true);
355 $ilCtrl->redirect($this,
"show");
357 $ilCtrl->redirect($this,
"show");
363 $ilCtrl = $this->ctrl;
366 $titles = $this->port_request->getTitles();
367 $online = $this->port_request->getOnline();
368 foreach ($titles as
$id => $title) {
369 if (trim($title) && $this->checkAccess(
"write",
$id)) {
373 if (in_array(
$id, $online)) {
374 $portfolio->setOnline(
true);
376 $portfolio->setOnline(
false);
379 $portfolio->update();
383 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"saved_successfully"),
true);
384 $ilCtrl->redirect($this,
"show");
389 $ilCtrl = $this->ctrl;
393 $prtfs = $this->port_request->getPortfolioIds();
395 if (count($prtfs) === 0) {
396 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"no_checkbox"),
true);
397 $ilCtrl->redirect($this,
"show");
400 $cgui->setFormAction($ilCtrl->getFormAction($this));
401 $cgui->setHeaderText(
$lng->txt(
"prtf_sure_delete_portfolios"));
402 $cgui->setCancel(
$lng->txt(
"cancel"),
"show");
403 $cgui->setConfirm(
$lng->txt(
"delete"),
"deletePortfolios");
405 foreach ($prtfs as
$id) {
409 $tpl->setContent($cgui->getHTML());
416 $ilCtrl = $this->ctrl;
418 $port_ids = $this->port_request->getPortfolioIds();
419 foreach ($port_ids as
$id) {
420 if ($this->checkAccess(
"write",
$id)) {
422 if ($portfolio->getOwner() === $this->user_id) {
423 $this->access_handler->removePermission(
$id);
424 $portfolio->delete();
428 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"prtf_portfolio_deleted"),
true);
429 $ilCtrl->redirect($this,
"show");
439 $ilCtrl = $this->ctrl;
443 if ($this->checkAccess(
"write")) {
445 $ilUser->setPref(
"public_profile",
"n");
449 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"prtf_unset_default_share_info"),
true);
451 $ilCtrl->redirect($this,
"show");
459 $ilCtrl = $this->ctrl;
462 $ilTabs = $this->tabs;
465 $prtf_id = $this->port_request->getPortfolioId();
467 if ($prtf_id && $this->checkAccess(
"write")) {
469 if ($this->access_handler->hasRegisteredPermission($prtf_id) ||
470 $this->access_handler->hasGlobalPermission($prtf_id)) {
471 $this->setDefault($prtf_id);
475 $ilTabs->clearTargets();
476 $ilTabs->setBackTarget(
478 $ilCtrl->getLinkTarget($this,
"show")
481 $ilCtrl->setParameter($this,
"prt_id", $prtf_id);
484 if (!
$ilSetting->get(
"enable_global_profiles")) {
485 $ilCtrl->redirect($this,
"setDefaultRegistered");
489 $cgui->setFormAction($ilCtrl->getFormAction($this));
490 $cgui->setHeaderText(
$lng->txt(
"prtf_set_default_publish_confirmation"));
491 $cgui->setCancel(
$lng->txt(
"prtf_set_default_publish_global"),
"setDefaultGlobal");
492 $cgui->setConfirm(
$lng->txt(
"prtf_set_default_publish_registered"),
"setDefaultRegistered");
493 $tpl->setContent($cgui->getHTML());
498 $ilCtrl->redirect($this,
"show");
503 $ilCtrl = $this->ctrl;
505 $prtf_id = $this->port_request->getPortfolioId();
506 if ($prtf_id && $this->checkAccess(
"write")) {
508 $this->setDefault($prtf_id);
510 $ilCtrl->redirect($this,
"show");
515 $ilCtrl = $this->ctrl;
517 $prtf_id = $this->port_request->getPortfolioId();
518 if ($prtf_id && $this->checkAccess(
"write")) {
520 $this->setDefault($prtf_id);
522 $ilCtrl->redirect($this,
"show");
527 $ilCtrl = $this->ctrl;
531 if ($a_prtf_id && $this->checkAccess(
"write")) {
533 if ($this->access_handler->hasGlobalPermission($a_prtf_id)) {
534 $ilUser->setPref(
"public_profile",
"g");
536 } elseif ($this->access_handler->hasRegisteredPermission($a_prtf_id)) {
537 $ilUser->setPref(
"public_profile",
"y");
543 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
545 $ilCtrl->redirect($this,
"show");
551 $wsp_access = $this->access_handler;
563 $this->showOther(
false);
567 bool $a_load_data =
true
570 $ilTabs = $this->tabs;
572 $ilTabs->activateTab(
"otpf");
575 $tpl->setContent($tbl->getHTML());
582 $tbl->writeFilterToSession();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenIdComponent(string $a_comp)
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Portfolio view gui class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
static setUserDefault(int $a_user_id, ?int $a_portfolio_id=null)
Set the user default portfolio.
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _lookupTitle(int $obj_id)
Access handler for portfolio NOTE: This file needs to stay in the classes directory,...
static checkExercise(int $a_user_id, int $a_obj_id, bool $a_add_submit=false, bool $as_array=false)
Portfolio repository gui class.
checkAccess(string $a_permission, ?int $a_portfolio_id=null)
ilPortfolioAccessHandler $access_handler
showOther(bool $a_load_data=true)
setDefault(int $a_prtf_id)
StandardGUIRequest $port_request
setDefaultConfirmation()
Confirm sharing when setting default.
confirmPortfolioDeletion()
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const PERMISSION_REGISTERED
Workspace share handler table GUI class.
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setLocator()
Insert locator.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl