40 $this->
lng = $DIC->language();
41 $this->
help = $DIC[
"ilHelp"];
43 $this->
access = $DIC->access();
44 $this->
user = $DIC->user();
45 $this->
ctrl = $DIC->ctrl();
46 $this->
ui = $DIC->ui();
48 $this->tool_context = $DIC->globalScreen()->tool()->context();
53 $this->
ctrl->saveParameter($this,
"exc_back_ref_id");
54 $this->notes_gui = $DIC->notes()->gui();
55 $this->skill_personal_service = $DIC->skills()->personal();
69 if ($perm ===
"create") {
75 return $this->access_handler->checkAccess($perm,
"",
$node_id);
83 $next_class = $this->
ctrl->getNextClass($this);
84 $cmd = $this->
ctrl->getCmd(
"view");
101 switch ($next_class) {
102 case "ilworkspaceaccessgui":
105 $this->tabs_gui->activateTab(
"share");
107 $this->tpl->setPermanentLink(
"prtf", $this->
object->getId());
111 $this->
ctrl->forwardCommand($wspacc);
115 case 'ilportfoliopagegui':
127 case "ilcommonactiondispatchergui":
158 case "ilobjectcontentstylesettingsgui":
162 $this->tabs_gui->activateTab(
"settings");
164 $settings_gui = $this->content_style_gui
165 ->objectSettingsGUIForObjId(
169 $this->
ctrl->forwardCommand($settings_gui);
172 case "ilportfolioexercisegui":
173 $this->
ctrl->setReturn($this,
"view");
180 if ($cmd !==
"preview") {
191 if (!is_object($this->
object) || $this->
object->getId() <= 0) {
196 $assignments = $pe->getAssignmentsOfPortfolio();
197 if (count($assignments) > 0) {
198 $ass_ids = array_map(
static function ($i) {
214 $this->tabs_gui->addTab(
216 $this->
lng->txt(
"content"),
217 $this->
ctrl->getLinkTarget($this,
"view")
220 $this->tabs_gui->addTab(
222 $this->
lng->txt(
"settings"),
223 $this->
ctrl->getLinkTarget($this,
"edit")
226 $this->tabs_gui->addNonTabbedLink(
228 $this->
lng->txt(
"preview"),
229 $this->
ctrl->getLinkTarget($this,
"preview")
232 $this->
lng->loadLanguageModule(
"wsp");
233 $this->tabs_gui->addTab(
235 $this->
lng->txt(
"wsp_permissions"),
236 $this->
ctrl->getLinkTargetByClass(
"ilworkspaceaccessgui",
"share")
243 if (!$this->creation_mode) {
244 $this->
ctrl->setParameter($this,
"prt_id", $this->
object->getId());
249 $this->tpl->setLocator();
256 $title = $this->
lng->txt(
"portfolio");
258 $title .=
": " . $this->
object->getTitle();
260 $this->tpl->setTitle($title);
261 $this->tpl->setTitleIcon(
263 $this->
lng->txt(
"portfolio")
267 !$this->
object->isOnline()) {
268 $this->tpl->setAlertProperties(array(
269 array(
"alert" =>
true,
270 "property" => $this->
lng->txt(
"status"),
271 "value" => $this->
lng->txt(
"offline"))
286 $new_type = $this->port_request->getNewType();
289 $this->
ctrl->saveParameter($this,
"crtptrefid");
291 $this->
ctrl->saveParameter($this,
"crtcb");
294 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
296 $this->
lng->loadLanguageModule($new_type);
297 $this->
ctrl->setParameter($this,
"new_type", $new_type);
302 if ($this->port_request->getCopyFormProcess() && isset($forms[self::CFORM_CLONE])) {
303 $forms = array(self::CFORM_CLONE => $forms[self::CFORM_CLONE]);
314 $new_type = $this->port_request->getNewType();
317 $this->
ctrl->saveParameter($this,
"crtptrefid");
319 $this->
ctrl->saveParameter($this,
"crtcb");
322 $ilErr->raiseError($this->
lng->txt(
"permission_denied"),
$ilErr->MESSAGE);
324 $this->
lng->loadLanguageModule($new_type);
325 $this->
ctrl->setParameter($this,
"new_type", $new_type);
347 if ($node[
"type"] ==
"blog") {
348 $options[$node[
"obj_id"]] = $node[
"title"];
353 if (!count($options)) {
355 $this->
lng->loadLanguageModule(
'pd');
356 $url = $this->
ctrl->getLinkTargetByClass(
"ilDashboardGUI",
"jumpToWorkspace");
357 $text = $this->
lng->txt(
"mm_personal_and_shared_r");
359 $text = sprintf($this->
lng->txt(
"prtf_no_blogs_info"), $text);
361 $mbox =
$ui->factory()->messageBox()->info($text)
362 ->withLinks([
$ui->factory()->link()->standard(
363 $this->
lng->txt(
"mm_personal_and_shared_r"),
376 return array(self::CFORM_NEW => $this->
initCreateForm($new_type));
383 $this->
ctrl->setParameter($this,
"new_type", $this->
getType());
386 $form->setFormAction($this->
ctrl->getFormAction($this));
392 $ti->setRequired(
true);
395 $form->setTitle($this->
lng->txt(
"prtf_create_portfolio"));
396 $form->addCommandButton(
"save", $this->
lng->txt(
"create"));
397 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
406 $this->
ctrl->setParameter($this,
"new_type", $this->
getType());
409 $form->setFormAction($this->
ctrl->getFormAction($this));
415 $ti->setRequired(
true);
420 if (count($templates)) {
423 $tmpl->setOptions(array(
"" => $this->
lng->txt(
"please_select")) + $templates);
424 $form->addItem($tmpl);
427 $template_id = $this->port_request->getPortfolioTemplateId();
428 if ($template_id > 0) {
429 $tmpl->setValue($template_id);
433 $form->setTitle($this->
lng->txt(
"prtf_add_portfolio_from_template"));
434 $form->addCommandButton(
"saveFromTemplate", $this->
lng->txt(
"create"));
435 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
450 if ($form->checkInput()) {
452 $form->getInput(
"title"),
453 $this->port_request->getPortfolioTemplate()
457 $form->setValuesByPost();
458 $this->tpl->setContent($form->getHTML());
464 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created"),
true);
465 $this->
ctrl->setParameter($this,
"prt_id", $new_object->
getId());
466 $this->
ctrl->redirect($this,
"view");
474 $exc_ref_id = $this->port_request->getExerciseRefId();
476 $ilAccess->checkAccess(
"read",
"", $exc_ref_id)) {
480 $this->
ctrl->redirectByClass(
"ilportfoliorepositorygui",
"show");
486 $form->setFormAction($this->
ctrl->getFormAction($this));
492 $ti->setRequired(
true);
493 $ti->setValue($this->
object->getTitle());
498 $online->setChecked($this->
object->isOnline());
499 $form->addItem($online);
503 $form->setTitle($this->
lng->txt(
"prtf_edit_portfolio"));
504 $form->addCommandButton(
"update", $this->
lng->txt(
"save"));
505 $form->addCommandButton(
"view", $this->
lng->txt(
"cancel"));
512 $a_values[
"online"] = $this->
object->isOnline();
514 parent::getEditFormCustomValues($a_values);
519 $this->
object->setOnline($form->
getInput(
"online"));
526 parent::updateCustom($form);
538 ?
int $a_page_id = null,
539 ?
int $a_portfolio_id = null
542 if (!$a_portfolio_id && $this->
object) {
543 $a_portfolio_id = $this->
object->
getId();
546 $page->setPortfolioId($a_portfolio_id);
560 $this->
object->hasPublicComments()
562 $page_gui->
setStyleId($this->content_style_domain->getEffectiveStyleId());
569 return "ilportfoliopagegui";
578 $old =
new ilRadioOption($this->
lng->txt(
"prtf_existing_portfolio"),
"old");
579 $a_tgt->addOption($old);
583 foreach ($all as $item) {
584 $options[$item[
"id"]] = $item[
"title"];
588 $prtf->setOptions($options);
589 $old->addSubItem($prtf);
592 $a_tgt->addOption($new);
595 $tf->setMaxLength(128);
597 $tf->setRequired(
true);
598 $new->addSubItem($tf);
609 $form->setFormAction($this->
ctrl->getFormAction($this));
617 $options[$node[
"obj_id"]] = $node[
"title"];
625 $radg->setValue(
"new");
626 $radg->setInfo($this->
lng->txt(
""));
628 $op1 =
new ilRadioOption($this->
lng->txt(
"prtf_add_new_blog"),
"new", $this->
lng->txt(
"prtf_add_new_blog_info"));
629 $radg->addOption($op1);
630 $form->addItem($radg);
634 $ti->setRequired(
true);
635 $op1->addSubItem($ti);
638 if (count($options)) {
639 $op2 =
new ilRadioOption($this->
lng->txt(
"prtf_add_existing_blog"),
"existing");
640 $radg->addOption($op2);
644 $op2->addSubItem($obj);
647 $form->setTitle($this->
lng->txt(
"prtf_add_blog") .
": " .
648 $this->
object->getTitle());
649 $form->addCommandButton(
"saveBlog", $this->
lng->txt(
"save"));
650 $form->addCommandButton(
"view", $this->
lng->txt(
"cancel"));
662 $ilUser = $DIC->user();
666 if ($form->getInput(
"creation_mode") ==
"existing") {
669 $page->setTitle($form->getInput(
"blog"));
672 $blog->setTitle($form->getInput(
"title"));
680 $tree->createTreeForUser($ilUser->getId());
689 $page->setTitle($blog->getId());
691 $page->create(
false);
693 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_blog_page_created"),
true);
694 $this->
ctrl->redirect($this,
"view");
697 $this->tabs_gui->clearTargets();
698 $this->tabs_gui->setBackTarget(
699 $this->
lng->txt(
"back"),
700 $this->
ctrl->getLinkTarget($this,
"view")
703 $form->setValuesByPost();
704 $this->tpl->setContent($form->getHTML());
715 $title = $this->port_request->getPortfolioTitle();
716 $prtt_id = $this->port_request->getPortfolioTemplate();
720 if (!count($templates) || !in_array($prtt_id, $templates)) {
725 $this->
ctrl->setParameter($this,
"prtt", $prtt_id);
731 $this->tpl->setContent($a_form->getHTML());
746 $exc_id = $this->port_request->getExerciseRefId();
747 $ass_id = $this->port_request->getExcAssId();
749 $this->
ctrl->setParameter($this,
"exc_id", $exc_id);
750 $this->
ctrl->setParameter($this,
"ass_id", $ass_id);
754 $form->setFormAction($this->
ctrl->getFormAction($this));
758 $form->addItem($tmpl);
761 $title->setValue($a_title);
762 $form->addItem($title);
766 $blog_options = array();
772 $blog_options[$node[
"obj_id"]] = $node[
"title"];
774 asort($blog_options);
778 $has_form_content =
false;
780 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
781 $skill_ids = array();
784 switch ($page[
"type"]) {
788 $source_page->buildDom(
true);
791 if (count($skill_ids)) {
792 $has_form_content =
true;
798 $has_form_content =
true;
800 $field_id =
"blog_" . $page[
"id"];
803 $page[
"title"], $field_id);
805 $blog->setValue(
"blog_create");
806 $form->addItem($blog);
808 $new_blog =
new ilRadioOption($this->
lng->txt(
"prtf_template_import_blog_create"),
"blog_create");
809 $blog->addOption($new_blog);
811 $title =
new ilTextInputGUI($this->
lng->txt(
"title"), $field_id .
"_create_title");
812 $title->setRequired(
true);
813 $new_blog->addSubItem($title);
815 if (count($blog_options)) {
816 $reuse_blog =
new ilRadioOption($this->
lng->txt(
"prtf_template_import_blog_reuse"),
"blog_resuse");
817 $blog->addOption($reuse_blog);
821 $obj->setOptions(array(
"" => $this->
lng->txt(
"please_select")) + $blog_options);
822 $reuse_blog->addSubItem($obj);
825 $blog->addOption(
new ilRadioOption($this->
lng->txt(
"prtf_template_import_blog_ignore"),
"blog_ignore"));
833 $skills->
setInfo($this->
lng->txt(
"prtf_template_import_new_skills"));
834 $skills->setValue($skill_ids);
835 foreach ($skill_ids as $skill_id) {
838 $form->addItem($skills);
841 if (!$has_form_content) {
845 $form->setTitle($this->
lng->txt(
"prtf_creation_mode") .
": " . $this->
lng->txt(
"prtf_creation_mode_template"));
846 $form->addCommandButton(
"createPortfolioFromTemplateProcess", $this->
lng->txt(
"continue"));
847 $form->addCommandButton(
"toRepository", $this->
lng->txt(
"cancel"));
853 bool $a_process_form =
true 857 $title = $this->port_request->getPortfolioTitle();
858 $prtt_id = $this->port_request->getPortfolioTemplate();
862 if (!count($templates) || !in_array($prtt_id, $templates)) {
869 if ($a_process_form) {
870 $this->
ctrl->setParameter($this,
"prtt", $prtt_id);
873 if ($form->checkInput()) {
876 $field_id =
"blog_" . $page[
"id"];
877 switch ($form->getInput($field_id)) {
879 $recipe[$page[
"id"]] = array(
"blog",
881 trim($form->getInput($field_id .
"_create_title"))
886 $recipe[$page[
"id"]] = array(
"blog",
888 (
int) $form->getInput($field_id .
"_reuse_blog")
893 $recipe[$page[
"id"]] = array(
"blog",
"ignore");
899 $recipe[
"skills"] = (array) $form->getInput(
"skill_ids");
901 $form->setValuesByPost();
911 $target->setTitle($title);
913 $target_id = $target->getId();
920 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
921 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
922 $this->
ctrl->redirect($this,
"preview");
932 if ($prtt_id === 0) {
933 $prtt_id = $this->port_request->getPortfolioTemplateId();
941 if (!count($templates) || !in_array($prtt_id, $templates)) {
950 $target->setTitle($title);
952 $target_id = $target->getId();
959 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
960 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
961 $this->
ctrl->redirect($this,
"preview");
965 public static function _goto(
string $a_target): void
969 $ctrl = $DIC->ctrl();
971 $id = explode(
"_", $a_target);
974 if (count(
$id) === 2) {
987 $title = $this->port_request->getPortfolioTitle();
988 $prtt_id = $this->port_request->getPortfolioTemplate();
991 $ass_template_id = 0;
992 $ass_id = $this->port_request->getExcAssId();
1000 if (!count($templates) || !in_array($prtt_id, $templates)) {
1001 if ($ass_template_id !== $prtt_id) {
1007 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
1008 $skill_ids = array();
1012 switch ($page[
"type"]) {
1015 $recipe[$page[
"id"]] = array(
"blog",
"create", $page[
'title']);
1020 $source_page->buildDom(
true);
1027 $recipe[
"skills"] = $skill_ids;
1033 $target->setTitle($title);
1035 $target_id = $target->getId();
1045 $this->
ctrl->setParameter($this,
"prt_id", $target_id);
1047 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created_from_template"),
true);
1048 $this->
ctrl->redirect($this,
"preview");
1050 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_created"),
true);
1051 $this->
ctrl->redirect($this,
"view");
1060 $exc_ref_id = $this->port_request->getExerciseRefId();
1061 $ass_id = $this->port_request->getExcAssId();
1065 $ilAccess->checkAccess(
"read",
"", $exc_ref_id)) {
1068 if ($ass->getExerciseId() === $exc->getId() &&
1084 $nodes = $xpath->query(
"//PageContent/Skills");
1085 foreach ($nodes as $node) {
1086 $skill_id = $node->getAttribute(
"Id");
1087 if (!in_array($skill_id, $a_pskills)) {
1088 $a_skill_ids[] = $skill_id;
1091 unset($nodes, $xpath, $dom);
1093 return $a_skill_ids;
1101 $view = $this->getPrintView();
1111 $printview = $this->getPrintView();
1112 $printview->sendPrintView();
1124 if (!$this->
object->isOnline()) {
1125 $f =
$ui->factory();
1126 $renderer =
$ui->renderer();
1128 $buttons = [
$f->button()->standard(
1133 return $renderer->render(
$f->messageBox()->info(
$lng->
txt(
"prtf_no_offline_share_info"))
1134 ->withButtons($buttons));
1148 $this->
object->setOnline(
true);
1149 $this->
object->update();
1150 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"prtf_has_been_set_online"),
true);
1152 $ilCtrl->redirectByClass(
"ilworkspaceaccessgui",
"");
checkPermission(string $perm, string $cmd="", string $type="", int $ref_id=null)
createPortfolioFromTemplate(ilPropertyFormGUI $a_form=null)
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
updateCustom(ilPropertyFormGUI $form)
getSkillsToPortfolioAssignment(array $a_pskills, array $a_skill_ids, ilPortfolioTemplatePage $a_source_page)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
createPortfolioFromTemplateProcess(bool $a_process_form=true)
getCreationFormsHTML(array $forms)
Get HTML for creation forms (accordion)
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...
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)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initCreationForms(string $new_type)
linkPortfolioToAssignment(int $a_target_id)
saveBlog()
Create new portfolio blog page.
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.
Portfolio view gui class.
addResourceObject(string $a_wsp_id, string $a_text=null)
Add personal resource or repository object (ref_id) to assigment.
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
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 _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...
static setUserDefault(int $a_user_id, ?int $a_portfolio_id=null)
Set the user default portfolio.
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.
static redirect(string $a_script)
setOnlineAndShare()
Set online and switch to share screen.
setBlockingMessage(string $a_val)
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
initCreateForm(string $new_type)
setSettingsSubTabs(string $a_active)
ContextServices $tool_context
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initEditCustomForm(ilPropertyFormGUI $a_form)
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node
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)