41 $this->
lng = $DIC->language();
42 $this->
help = $DIC[
"ilHelp"];
44 $this->
access = $DIC->access();
45 $this->
user = $DIC->user();
46 $this->
ctrl = $DIC->ctrl();
47 $this->
ui = $DIC->ui();
49 $this->tool_context = $DIC->globalScreen()->tool()->context();
54 $this->
ctrl->saveParameter($this,
"exc_back_ref_id");
55 $this->notes_gui = $DIC->notes()->gui();
56 $this->skill_personal_service = $DIC->skills()->personal();
70 if ($perm ===
"create") {
76 return $this->access_handler->checkAccess($perm,
"",
$node_id);
84 $next_class = $this->
ctrl->getNextClass($this);
85 $cmd = $this->
ctrl->getCmd(
"view");
89 switch ($next_class) {
90 case "ilworkspaceaccessgui":
93 $this->tabs_gui->activateTab(
"share");
95 $this->tpl->setPermanentLink(
"prtf", $this->
object->getId());
99 $this->
ctrl->forwardCommand($wspacc);
103 case 'ilportfoliopagegui':
115 case "ilcommonactiondispatchergui":
121 case "ilobjectcontentstylesettingsgui":
125 $this->tabs_gui->activateTab(
"settings");
127 $settings_gui = $this->content_style_gui
128 ->objectSettingsGUIForObjId(
132 $this->
ctrl->forwardCommand($settings_gui);
135 case "ilportfolioexercisegui":
136 $this->
ctrl->setReturn($this,
"view");
141 case strtolower(SettingsGUI::class):
145 $this->tabs_gui->activateTab(
"settings");
147 $gui = $this->gui->settings()->settingsGUI(
156 if ($cmd !==
"preview") {
167 $this->
ctrl->redirectByClass(SettingsGUI::class);
172 if (!is_object($this->
object) || $this->
object->getId() <= 0) {
177 $assignments = $pe->getAssignmentsOfPortfolio();
178 if (count($assignments) > 0) {
179 $ass_ids =
array_map(
static function ($i) {
195 $this->tabs_gui->addTab(
197 $this->
lng->txt(
"content"),
198 $this->
ctrl->getLinkTarget($this,
"view")
201 $this->tabs_gui->addTab(
203 $this->
lng->txt(
"settings"),
204 $this->
ctrl->getLinkTargetByClass(SettingsGUI::class)
207 $this->tabs_gui->addNonTabbedLink(
209 $this->
lng->txt(
"preview"),
210 $this->
ctrl->getLinkTarget($this,
"preview")
213 $this->
lng->loadLanguageModule(
"wsp");
214 $this->tabs_gui->addTab(
216 $this->
lng->txt(
"wsp_permissions"),
217 $this->
ctrl->getLinkTargetByClass(
"ilworkspaceaccessgui",
"share")
224 if (!$this->creation_mode) {
225 $this->
ctrl->setParameter($this,
"prt_id", $this->
object->getId());
230 $this->tpl->setLocator();
237 $title = $this->
lng->txt(
"portfolio");
239 $title .=
": " . $this->
object->getTitle();
241 $this->tpl->setTitle($title);
242 $this->tpl->setTitleIcon(
244 $this->
lng->txt(
"portfolio")
248 !$this->
object->isOnline()) {
249 $this->tpl->setAlertProperties(array(
250 array(
"alert" =>
true,
251 "property" => $this->
lng->txt(
"status"),
252 "value" => $this->
lng->txt(
"offline"))
267 $new_type = $this->port_request->getNewType();
270 $this->
ctrl->saveParameter($this,
"crtptrefid");
272 $this->
ctrl->saveParameter($this,
"crtcb");
275 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
277 $this->
lng->loadLanguageModule($new_type);
278 $this->
ctrl->setParameter($this,
"new_type", $new_type);
291 $new_type = $this->port_request->getNewType();
294 $this->
ctrl->saveParameter($this,
"crtptrefid");
296 $this->
ctrl->saveParameter($this,
"crtcb");
299 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
301 $this->
lng->loadLanguageModule($new_type);
302 $this->
ctrl->setParameter($this,
"new_type", $new_type);
322 $this->
ctrl->setParameter($this,
"new_type", $this->
getType());
324 return $this->gui->form([static::class],
"save")
325 ->section(
"prop", $this->
lng->txt(
"prtf_create_portfolio"))
336 $this->
ctrl->setParameter($this,
"new_type", $this->
getType());
339 $form->setFormAction($this->
ctrl->getFormAction($this));
345 $ti->setRequired(
true);
350 if (count($templates)) {
353 $tmpl->setOptions(array(
"" => $this->
lng->txt(
"please_select")) + $templates);
354 $form->addItem($tmpl);
357 $template_id = $this->port_request->getPortfolioTemplateId();
358 if ($template_id > 0) {
359 $tmpl->setValue($template_id);
363 $form->setTitle($this->
lng->txt(
"prtf_add_portfolio_from_template"));
364 $form->addCommandButton(
"saveFromTemplate", $this->
lng->txt(
"create"));
365 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
373 if ($form->isValid()) {
375 $port->setTitle($form->getData(
"title"));
377 $this->
ctrl->setParameter($this,
"prt_id", $port->getId());
378 $this->
ctrl->redirect($this,
"view");
380 $this->tpl->setContent($form->render());
387 if ($form->checkInput()) {
389 $form->getInput(
"title"),
390 $this->port_request->getPortfolioTemplate()
394 $form->setValuesByPost();
395 $this->tpl->setContent($form->getHTML());
401 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created"),
true);
402 $this->
ctrl->setParameter($this,
"prt_id", $new_object->
getId());
403 $this->
ctrl->redirect($this,
"view");
411 $exc_ref_id = $this->port_request->getExerciseRefId();
413 $ilAccess->checkAccess(
"read",
"", $exc_ref_id)) {
417 $this->
ctrl->redirectByClass(
"ilportfoliorepositorygui",
"show");
423 $form->setFormAction($this->
ctrl->getFormAction($this));
429 $ti->setRequired(
true);
430 $ti->setValue($this->
object->getTitle());
435 $online->setChecked($this->
object->isOnline());
436 $form->addItem($online);
440 $form->setTitle($this->
lng->txt(
"prtf_edit_portfolio"));
441 $form->addCommandButton(
"update", $this->
lng->txt(
"save"));
442 $form->addCommandButton(
"view", $this->
lng->txt(
"cancel"));
449 $a_values[
"online"] = $this->
object->isOnline();
451 parent::getEditFormCustomValues($a_values);
456 $this->
object->setOnline($form->
getInput(
"online"));
460 ilObjPortfolio::setUserDefault($this->user_id, 0);
463 parent::updateCustom($form);
475 ?
int $a_page_id =
null,
476 ?
int $a_portfolio_id =
null 479 if (!$a_portfolio_id && $this->
object) {
480 $a_portfolio_id = $this->
object->
getId();
483 $page->setPortfolioId($a_portfolio_id);
497 $this->
object->hasPublicComments()
499 $page_gui->
setStyleId($this->content_style_domain->getEffectiveStyleId());
506 return "ilportfoliopagegui";
515 $old =
new ilRadioOption($this->
lng->txt(
"prtf_existing_portfolio"),
"old");
516 $a_tgt->addOption($old);
520 foreach ($all as $item) {
521 $options[$item[
"id"]] = $item[
"title"];
525 $prtf->setOptions($options);
526 $old->addSubItem($prtf);
529 $a_tgt->addOption($new);
532 $tf->setMaxLength(128);
534 $tf->setRequired(
true);
535 $new->addSubItem($tf);
546 $title = $this->port_request->getPortfolioTitle();
547 $prtt_id = $this->port_request->getPortfolioTemplate();
551 if (!count($templates) || !in_array($prtt_id, $templates)) {
556 $this->
ctrl->setParameter($this,
"prtt", $prtt_id);
562 $this->tpl->setContent($a_form->getHTML());
575 $exc_id = $this->port_request->getExerciseRefId();
576 $ass_id = $this->port_request->getExcAssId();
578 $this->
ctrl->setParameter($this,
"exc_id", $exc_id);
579 $this->
ctrl->setParameter($this,
"ass_id",
$ass_id);
583 $form->setFormAction($this->
ctrl->getFormAction($this));
587 $form->addItem($tmpl);
590 $title->setValue($a_title);
591 $form->addItem($title);
593 $has_form_content =
false;
595 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
596 $skill_ids = array();
599 switch ($page[
"type"]) {
603 $source_page->buildDom(
true);
606 if (count($skill_ids)) {
607 $has_form_content =
true;
615 $skills->
setInfo($this->
lng->txt(
"prtf_template_import_new_skills"));
616 $skills->setValue($skill_ids);
617 foreach ($skill_ids as $skill_id) {
620 $form->addItem($skills);
623 if (!$has_form_content) {
627 $form->setTitle($this->
lng->txt(
"prtf_creation_mode") .
": " . $this->
lng->txt(
"prtf_creation_mode_template"));
628 $form->addCommandButton(
"createPortfolioFromTemplateProcess", $this->
lng->txt(
"continue"));
629 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
635 bool $a_process_form =
true 639 $title = $this->port_request->getPortfolioTitle();
640 $prtt_id = $this->port_request->getPortfolioTemplate();
644 if (!count($templates) || !in_array($prtt_id, $templates)) {
651 if ($a_process_form) {
652 $this->
ctrl->setParameter($this,
"prtt", $prtt_id);
655 if ($form->checkInput()) {
657 $recipe[
"skills"] = (array) $form->getInput(
"skill_ids");
659 $form->setValuesByPost();
669 $target->setTitle($title);
671 $target_id = $target->getId();
678 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
679 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
680 $this->
ctrl->redirect($this,
"preview");
690 if ($prtt_id === 0) {
691 $prtt_id = $this->port_request->getPortfolioTemplateId();
699 if (!count($templates) || !in_array($prtt_id, $templates)) {
708 $target->setTitle($title);
710 $target_id = $target->getId();
717 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
718 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
719 $this->
ctrl->redirect($this,
"preview");
723 public static function _goto(
string $a_target): void
727 $ctrl = $DIC->ctrl();
729 $id = explode(
"_", $a_target);
732 if (count(
$id) === 2) {
745 $title = $this->port_request->getPortfolioTitle();
746 $prtt_id = $this->port_request->getPortfolioTemplate();
749 $ass_template_id = 0;
750 $ass_id = $this->port_request->getExcAssId();
758 if (!count($templates) || !in_array($prtt_id, $templates)) {
759 if ($ass_template_id !== $prtt_id) {
765 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
766 $skill_ids = array();
770 switch ($page[
"type"]) {
773 $source_page->buildDom(
true);
780 $recipe[
"skills"] = $skill_ids;
786 $target->setTitle($title);
788 $target_id = $target->getId();
798 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
800 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
801 $this->
ctrl->redirect($this,
"preview");
803 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created"),
true);
804 $this->
ctrl->redirect($this,
"view");
813 $exc_ref_id = $this->port_request->getExerciseRefId();
814 $ass_id = $this->port_request->getExcAssId();
818 $ilAccess->checkAccess(
"read",
"", $exc_ref_id)) {
821 if ($ass->getExerciseId() === $exc->getId() &&
837 $nodes = $xpath->query(
"//PageContent/Skills");
838 foreach ($nodes as $node) {
839 $skill_id = $node->getAttribute(
"Id");
840 if (!in_array($skill_id, $a_pskills)) {
841 $a_skill_ids[] = $skill_id;
844 unset($nodes, $xpath, $dom);
854 $view = $this->getPrintView();
864 $printview = $this->getPrintView();
865 $printview->sendPrintView();
877 if (!$this->
object->isOnline()) {
881 $buttons = [
$f->button()->standard(
886 return $renderer->render(
$f->messageBox()->info(
$lng->
txt(
"prtf_no_offline_share_info"))
887 ->withButtons($buttons));
901 $this->
object->setOnline(
true);
902 $this->
object->update();
903 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"prtf_has_been_set_online"),
true);
905 $ilCtrl->redirectByClass(
"ilworkspaceaccessgui",
"");
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
This class represents an option in a radio group.
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
addResourceObject(string $a_wsp_id, ?string $a_text=null)
Add personal resource or repository object (ref_id) to assigment.
updateCustom(ilPropertyFormGUI $form)
getSkillsToPortfolioAssignment(array $a_pskills, array $a_skill_ids, ilPortfolioTemplatePage $a_source_page)
This class represents an option in a checkbox group.
ILIAS Portfolio InternalGUIService $gui
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...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
initCreateFromTemplateForm()
ilPortfolioDeclarationOfAuthorship $declaration_authorship
createPortfolioFromTemplateProcess(bool $a_process_form=true)
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getOfflineMessage()
Get offline message for sharing tab.
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
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...
getDomDoc()
Get dom doc (DOMDocument)
getEditFormCustomValues(array &$a_values)
setStyleId(int $a_styleid)
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
handlePageCall(string $a_cmd)
Class ilPortfolioExerciseGUI.
static getAvailablePortfolioTemplates(string $a_permission="read")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
preview()
description: > Example for rendering a Preview Glyph.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
linkPortfolioToAssignment(int $a_target_id)
static _goto(string $a_target)
static clonePagesAndSettings(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, ?array $a_recipe=null, bool $copy_all=false)
Build template from portfolio and vice versa.
ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI ilObjPortfolioGUI: ilWorkspaceAccessGUI, ilCommentGUI, ilCommonActionDispatcherGUI ilObjPortfolioGUI: ilObjectContentStyleSettingsGUI, ilPortfolioExerciseGUI ilObjPortfolioGUI: ILIAS
static _lookupTitle(int $obj_id)
setScreenIdComponent(string $a_comp)
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
ILIAS Skill Service SkillPersonalService $skill_personal_service
createFromTemplateDirect(string $title="", int $prtt_id=0)
Create portfolio template direct.
ilGlobalTemplateInterface $tpl
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _lookupObjectId(int $ref_id)
createPortfolioFromAssignment()
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...
getPageInstance(?int $a_page_id=null, ?int $a_portfolio_id=null)
Get portfolio template page instance.
afterSave(ilObject $new_object)
Portfolio view gui base class.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static redirect(string $a_script)
createPortfolioFromTemplate(?ilPropertyFormGUI $a_form=null)
setOnlineAndShare()
Set online and switch to share screen.
setBlockingMessage(string $a_val)
setSettingsSubTabs(string $a_active)
__construct(Container $dic, ilPlugin $plugin)
ContextServices $tool_context
Exercise submission //TODO: This class has many static methods related to delivered "files"...
initEditCustomForm(ilPropertyFormGUI $a_form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilWorkspaceAccessHandler $ws_access
ILIAS Notes GUIService $notes_gui
getPageGUIInstance(int $a_page_id)
Get portfolio template page gui instance.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
initCreatePortfolioFromTemplateForm(int $a_prtt_id, string $a_title)