ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilObjPortfolioGUI.php
Go to the documentation of this file.
1<?php
2
22
30{
31 protected \ILIAS\Notes\GUIService $notes_gui;
35 protected \ILIAS\Skill\Service\SkillPersonalService $skill_personal_service;
36
37 public function __construct(int $a_id = 0)
38 {
39 global $DIC;
40
41 $this->lng = $DIC->language();
42 $this->help = $DIC["ilHelp"];
43 $this->settings = $DIC->settings();
44 $this->access = $DIC->access();
45 $this->user = $DIC->user();
46 $this->ctrl = $DIC->ctrl();
47 $this->ui = $DIC->ui();
48
49 $this->tool_context = $DIC->globalScreen()->tool()->context();
50
51 parent::__construct($a_id, self::PORTFOLIO_OBJECT_ID, 0);
52 $this->declaration_authorship = new ilPortfolioDeclarationOfAuthorship();
53
54 $this->ctrl->saveParameter($this, "exc_back_ref_id");
55 $this->notes_gui = $DIC->notes()->gui();
56 $this->skill_personal_service = $DIC->skills()->personal();
57 }
58
59 public function getType(): string
60 {
61 return "prtf";
62 }
63
64 protected function checkPermissionBool(
65 string $perm,
66 string $cmd = "",
67 string $type = "",
68 ?int $node_id = null
69 ): bool {
70 if ($perm === "create") {
71 return true;
72 }
73 if (!$node_id) {
75 }
76 return $this->access_handler->checkAccess($perm, "", $node_id);
77 }
78
79 public function executeCommand(): void
80 {
81 $this->checkPermission("read");
82 $this->setTitleAndDescription();
83
84 $next_class = $this->ctrl->getNextClass($this);
85 $cmd = $this->ctrl->getCmd("view");
86
87 // trigger assignment tool
88 $this->triggerAssignmentTool();
89 switch ($next_class) {
90 case "ilworkspaceaccessgui":
91 if ($this->checkPermissionBool("write")) {
92 $this->setTabs();
93 $this->tabs_gui->activateTab("share");
94
95 $this->tpl->setPermanentLink("prtf", $this->object->getId());
96
97 $wspacc = new ilWorkspaceAccessGUI($this->object->getId(), $this->access_handler, true);
98 $wspacc->setBlockingMessage($this->getOfflineMessage());
99 $this->ctrl->forwardCommand($wspacc);
100 }
101 break;
102
103 case 'ilportfoliopagegui':
104 if ($this->determinePageCall()) {
105 // only in edit mode
106 $this->addLocator();
107 }
108 $this->handlePageCall($cmd);
109 break;
110
111 case "ilcommentgui":
112 $this->preview();
113 break;
114
115 case "ilcommonactiondispatchergui":
116 //$this->prepareOutput();
118 $this->ctrl->forwardCommand($gui);
119 break;
120
121 case "ilobjectcontentstylesettingsgui":
122 $this->checkPermission("write");
123 $this->addLocator();
124 $this->setTabs();
125 $this->tabs_gui->activateTab("settings");
126 $this->setSettingsSubTabs("style");
127 $settings_gui = $this->content_style_gui
128 ->objectSettingsGUIForObjId(
129 null,
130 $this->object->getId()
131 );
132 $this->ctrl->forwardCommand($settings_gui);
133 break;
134
135 case "ilportfolioexercisegui":
136 $this->ctrl->setReturn($this, "view");
137 $gui = new ilPortfolioExerciseGUI($this->user_id, $this->object->getId());
138 $this->ctrl->forwardCommand($gui);
139 break;
140
141 case strtolower(SettingsGUI::class):
142 $this->checkPermission("write");
143 $this->addLocator();
144 $this->setTabs();
145 $this->tabs_gui->activateTab("settings");
146 $this->setSettingsSubTabs("properties");
147 $gui = $this->gui->settings()->settingsGUI(
148 $this->object->getId(),
149 false
150 );
151 $this->ctrl->forwardCommand($gui);
152 break;
153
154 default:
155
156 if ($cmd !== "preview") {
157 $this->addLocator();
158 $this->setTabs();
159 }
160 $this->$cmd();
161 break;
162 }
163 }
164
165 public function edit(): void
166 {
167 $this->ctrl->redirectByClass(SettingsGUI::class);
168 }
169
170 protected function triggerAssignmentTool(): void
171 {
172 if (!is_object($this->object) || $this->object->getId() <= 0) {
173 return;
174 }
175 $pe = new ilPortfolioExercise($this->user_id, $this->object->getId());
176 $pe_gui = new ilPortfolioExerciseGUI($this->user_id, $this->object->getId());
177 $assignments = $pe->getAssignmentsOfPortfolio();
178 if (count($assignments) > 0) {
179 $ass_ids = array_map(static function ($i) {
180 return $i["ass_id"];
181 }, $assignments);
182 $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::SHOW_EXC_ASSIGNMENT_INFO, true);
183 $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::EXC_ASS_IDS, $ass_ids);
184 $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::EXC_ASS_BUTTONS, $pe_gui->getActionButtons());
185 }
186 }
187
188 protected function setTabs(): void
189 {
190 $ilHelp = $this->help;
191
192 $ilHelp->setScreenIdComponent("prtf");
193
194 if ($this->checkPermissionBool("write")) {
195 $this->tabs_gui->addTab(
196 "pages",
197 $this->lng->txt("content"),
198 $this->ctrl->getLinkTarget($this, "view")
199 );
200
201 $this->tabs_gui->addTab(
202 "settings",
203 $this->lng->txt("settings"),
204 $this->ctrl->getLinkTargetByClass(SettingsGUI::class)
205 );
206
207 $this->tabs_gui->addNonTabbedLink(
208 "preview",
209 $this->lng->txt("preview"),
210 $this->ctrl->getLinkTarget($this, "preview")
211 );
212
213 $this->lng->loadLanguageModule("wsp");
214 $this->tabs_gui->addTab(
215 "share",
216 $this->lng->txt("wsp_permissions"),
217 $this->ctrl->getLinkTargetByClass("ilworkspaceaccessgui", "share")
218 );
219 }
220 }
221
222 protected function addLocator(): void
223 {
224 if (!$this->creation_mode) {
225 $this->ctrl->setParameter($this, "prt_id", $this->object->getId());
226 }
227
228 $this->addLocatorItems();
229
230 $this->tpl->setLocator();
231 }
232
233 protected function setTitleAndDescription(): void
234 {
235 // parent::setTitleAndDescription();
236
237 $title = $this->lng->txt("portfolio");
238 if ($this->object) {
239 $title .= ": " . $this->object->getTitle();
240 }
241 $this->tpl->setTitle($title);
242 $this->tpl->setTitleIcon(
243 ilUtil::getImagePath("standard/icon_prtf.svg"),
244 $this->lng->txt("portfolio")
245 );
246
247 if ($this->object &&
248 $this->object->getOfflineStatus()) {
249 $this->tpl->setAlertProperties(array(
250 array("alert" => true,
251 "property" => $this->lng->txt("status"),
252 "value" => $this->lng->txt("offline"))
253 ));
254 }
255 }
256
257
258 //
259 // CREATE/EDIT
260 //
261
262 public function create(): void
263 {
264 $tpl = $this->tpl;
265 $ilErr = $this->error;
266
267 $new_type = $this->port_request->getNewType();
268
269 // add new object to custom parent container
270 $this->ctrl->saveParameter($this, "crtptrefid");
271 // use forced callback after object creation
272 $this->ctrl->saveParameter($this, "crtcb");
273
274 if (!$this->checkPermissionBool("create", "", $new_type)) {
275 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
276 } else {
277 $this->lng->loadLanguageModule($new_type);
278 $this->ctrl->setParameter($this, "new_type", $new_type);
279
280 $form = $this->getCreationForm();
281
282 $tpl->setContent($form->render());
283 }
284 }
285
286 public function createFromTemplate(): void
287 {
288 $tpl = $this->tpl;
289 $ilErr = $this->error;
290
291 $new_type = $this->port_request->getNewType();
292
293 // add new object to custom parent container
294 $this->ctrl->saveParameter($this, "crtptrefid");
295 // use forced callback after object creation
296 $this->ctrl->saveParameter($this, "crtcb");
297
298 if (!$this->checkPermissionBool("create", "", $new_type)) {
299 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
300 } else {
301 $this->lng->loadLanguageModule($new_type);
302 $this->ctrl->setParameter($this, "new_type", $new_type);
303 $form = $this->initCreateFromTemplateForm();
304 $tpl->setContent($form->getHTML());
305 }
306 }
307
308 protected function getCreateInfoMessage(): string
309 {
310 global $DIC;
311
312 $ui = $DIC->ui();
313 $ilSetting = $DIC->settings();
314
315 $message = "";
316 return $message;
317 }
318
319 protected function getCreationForm(): FormAdapterGUI
320 {
321 $ilSetting = $this->settings;
322 $this->ctrl->setParameter($this, "new_type", $this->getType());
323
324 return $this->gui->form([static::class], "save")
325 ->section("prop", $this->lng->txt("prtf_create_portfolio"))
326 ->addStdTitle(
327 0,
328 "prtf"
329 );
330 }
331
333 {
334 $ilSetting = $this->settings;
335
336 $this->ctrl->setParameter($this, "new_type", $this->getType());
337
338 $form = new ilPropertyFormGUI();
339 $form->setFormAction($this->ctrl->getFormAction($this));
340
341 // title
342 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
343 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
344 $ti->setMaxLength(ilObject::TITLE_LENGTH);
345 $ti->setRequired(true);
346 $form->addItem($ti);
347
348 // portfolio templates
350 if (count($templates)) {
351 $tmpl = new ilSelectInputGUI($this->lng->txt("obj_prtt"), "prtt");
352 $tmpl->setRequired(true);
353 $tmpl->setOptions(array("" => $this->lng->txt("please_select")) + $templates);
354 $form->addItem($tmpl);
355
356 // incoming from repository
357 $template_id = $this->port_request->getPortfolioTemplateId();
358 if ($template_id > 0) {
359 $tmpl->setValue($template_id);
360 }
361 }
362
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"));
366
367 return $form;
368 }
369
370 public function save(): void
371 {
372 $form = $this->getCreationForm();
373 if ($form->isValid()) {
374 $port = new ilObjPortfolio();
375 $port->setTitle($form->getData("title"));
376 $port->create();
377 $this->ctrl->setParameter($this, "prt_id", $port->getId());
378 $this->ctrl->redirect($this, "view");
379 }
380 $this->tpl->setContent($form->render());
381 }
382
383 public function saveFromTemplate(): void
384 {
385 $form = $this->initCreateFromTemplateForm();
386 // trigger portfolio template "import" process
387 if ($form->checkInput()) {
388 $this->createFromTemplateDirect(
389 $form->getInput("title"),
390 $this->port_request->getPortfolioTemplate()
391 );
392 return;
393 } else {
394 $form->setValuesByPost();
395 $this->tpl->setContent($form->getHTML());
396 }
397 }
398
399 protected function afterSave(ilObject $new_object): void
400 {
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");
404 }
405
406 protected function toRepository(): void
407 {
408 $ilAccess = $this->access;
409
410 // return to exercise (portfolio assignment)
411 $exc_ref_id = $this->port_request->getExerciseRefId();
412 if ($exc_ref_id &&
413 $ilAccess->checkAccess("read", "", $exc_ref_id)) {
414 ilUtil::redirect(ilLink::_getLink($exc_ref_id, "exc"));
415 }
416
417 $this->ctrl->redirectByClass("ilportfoliorepositorygui", "show");
418 }
419
420
421 //
422 // PAGES
423 //
424
428 protected function getPageInstance(
429 ?int $a_page_id = null,
430 ?int $a_portfolio_id = null
431 ): ilPortfolioPage {
432 // #11531
433 if (!$a_portfolio_id && $this->object) {
434 $a_portfolio_id = $this->object->getId();
435 }
436 $page = new ilPortfolioPage((int) $a_page_id);
437 $page->setPortfolioId($a_portfolio_id);
438 return $page;
439 }
440
444 protected function getPageGUIInstance(
445 int $a_page_id
447 $page_gui = new ilPortfolioPageGUI(
448 $this->object->getId(),
449 $a_page_id,
450 0,
451 $this->object->hasPublicComments()
452 );
453 $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
454 $page_gui->setAdditional($this->getAdditional());
455 return $page_gui;
456 }
457
458 public function getPageGUIClassName(): string
459 {
460 return "ilportfoliopagegui";
461 }
462
463 protected function initCopyPageFormOptions(ilPropertyFormGUI $a_form): void
464 {
465 $a_tgt = new ilRadioGroupInputGUI($this->lng->txt("target"), "target");
466 $a_tgt->setRequired(true);
467 $a_form->addItem($a_tgt);
468
469 $old = new ilRadioOption($this->lng->txt("prtf_existing_portfolio"), "old");
470 $a_tgt->addOption($old);
471
472 $options = array();
473 $all = ilObjPortfolio::getPortfoliosOfUser($this->user_id);
474 foreach ($all as $item) {
475 $options[$item["id"]] = $item["title"];
476 }
477 $prtf = new ilSelectInputGUI($this->lng->txt("portfolio"), "prtf");
478 $prtf->setRequired(true);
479 $prtf->setOptions($options);
480 $old->addSubItem($prtf);
481
482 $new = new ilRadioOption($this->lng->txt("prtf_new_portfolio"), "new");
483 $a_tgt->addOption($new);
484
485 $tf = new ilTextInputGUI($this->lng->txt("title"), "title");
486 $tf->setMaxLength(128);
487 $tf->setSize(40);
488 $tf->setRequired(true);
489 $new->addSubItem($tf);
490 }
491
492
493 //
494 // CREATE FROM TEMPLATE
495 //
496
497 protected function createPortfolioFromTemplate(
498 ?ilPropertyFormGUI $a_form = null
499 ): void {
500 $title = $this->port_request->getPortfolioTitle();
501 $prtt_id = $this->port_request->getPortfolioTemplate();
502
503 // valid template?
505 if (!count($templates) || !in_array($prtt_id, $templates)) {
506 $this->toRepository();
507 }
508 unset($templates);
509
510 $this->ctrl->setParameter($this, "prtt", $prtt_id);
511
512 if (!$a_form) {
513 $a_form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title);
514 }
515 if ($a_form) {
516 $this->tpl->setContent($a_form->getHTML());
517 } else {
518 $this->createPortfolioFromTemplateProcess(false);
519 }
520 }
521
523 int $a_prtt_id,
524 string $a_title
526 $ilSetting = $this->settings;
527 $ilUser = $this->user;
528
529 $exc_id = $this->port_request->getExerciseRefId();
530 $ass_id = $this->port_request->getExcAssId();
531 if ($exc_id > 0) {
532 $this->ctrl->setParameter($this, "exc_id", $exc_id);
533 $this->ctrl->setParameter($this, "ass_id", $ass_id);
534 }
535
536 $form = new ilPropertyFormGUI();
537 $form->setFormAction($this->ctrl->getFormAction($this));
538
539 $tmpl = new ilNonEditableValueGUI($this->lng->txt("obj_prtt"));
540 $tmpl->setValue(ilObject::_lookupTitle($a_prtt_id));
541 $form->addItem($tmpl);
542
543 $title = new ilNonEditableValueGUI($this->lng->txt("title"), "pt");
544 $title->setValue($a_title);
545 $form->addItem($title);
546
547 $has_form_content = false;
548
549 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
550 $skill_ids = array();
551
552 foreach (ilPortfolioTemplatePage::getAllPortfolioPages($a_prtt_id) as $page) {
553 switch ($page["type"]) {
555 // skills
556 $source_page = new ilPortfolioTemplatePage($page["id"]);
557 $source_page->buildDom(true);
558 $skill_ids = $this->getSkillsToPortfolioAssignment($pskills, $skill_ids, $source_page);
559
560 if (count($skill_ids)) {
561 $has_form_content = true;
562 }
563 break;
564 }
565 }
566
567 if ($skill_ids) {
568 $skills = new ilCheckboxGroupInputGUI($this->lng->txt("skills"), "skill_ids");
569 $skills->setInfo($this->lng->txt("prtf_template_import_new_skills"));
570 $skills->setValue($skill_ids);
571 foreach ($skill_ids as $skill_id) {
572 $skills->addOption(new ilCheckboxOption(ilSkillTreeNode::_lookupTitle($skill_id), $skill_id));
573 }
574 $form->addItem($skills);
575 }
576 // no dialog needed, go ahead
577 if (!$has_form_content) {
578 return null;
579 }
580
581 $form->setTitle($this->lng->txt("prtf_creation_mode") . ": " . $this->lng->txt("prtf_creation_mode_template"));
582 $form->addCommandButton("createPortfolioFromTemplateProcess", $this->lng->txt("continue"));
583 $form->addCommandButton("toRepository", $this->lng->txt("cancel"));
584
585 return $form;
586 }
587
589 bool $a_process_form = true
590 ): void {
591 $ilSetting = $this->settings;
592
593 $title = $this->port_request->getPortfolioTitle();
594 $prtt_id = $this->port_request->getPortfolioTemplate();
595
596 // valid template?
598 if (!count($templates) || !in_array($prtt_id, $templates)) {
599 $this->toRepository();
600 }
601 unset($templates);
602
603 // build page recipe (aka import form values)
604 $recipe = null;
605 if ($a_process_form) {
606 $this->ctrl->setParameter($this, "prtt", $prtt_id);
607
608 $form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title);
609 if ($form->checkInput()) {
610
611 $recipe["skills"] = (array) $form->getInput("skill_ids");
612 } else {
613 $form->setValuesByPost();
614 $this->createPortfolioFromTemplate($form);
615 return;
616 }
617 }
618
619 $source = new ilObjPortfolioTemplate($prtt_id, false);
620
621 // create portfolio
622 $target = new ilObjPortfolio();
623 $target->setTitle($title);
624 $target->create();
625 $target_id = $target->getId();
626
627 ilObjPortfolioTemplate::clonePagesAndSettings($source, $target, $recipe);
628
629 // link portfolio to exercise assignment
630 $this->linkPortfolioToAssignment($target_id);
631
632 $this->tpl->setOnScreenMessage('success', $this->lng->txt("prtf_portfolio_created_from_template"), true);
633 $this->ctrl->setParameter($this, "prt_id", $target_id);
634 $this->ctrl->redirect($this, "preview");
635 }
636
640 protected function createFromTemplateDirect(
641 string $title = "",
642 int $prtt_id = 0
643 ): void {
644 if ($prtt_id === 0) {
645 $prtt_id = $this->port_request->getPortfolioTemplateId();
646 }
647 if ($title === "") {
648 $title = ilObject::_lookupTitle($prtt_id);
649 }
650
651 // valid template?
653 if (!count($templates) || !in_array($prtt_id, $templates)) {
654 $this->toRepository();
655 }
656 unset($templates);
657
658 $source = new ilObjPortfolioTemplate($prtt_id, false);
659
660 // create portfolio
661 $target = new ilObjPortfolio();
662 $target->setTitle($title);
663 $target->create();
664 $target_id = $target->getId();
665
666 ilObjPortfolioTemplate::clonePagesAndSettings($source, $target, null, true);
667
668 // link portfolio to exercise assignment
669 //$this->linkPortfolioToAssignment($target_id);
670
671 $this->tpl->setOnScreenMessage('success', $this->lng->txt("prtf_portfolio_created_from_template"), true);
672 $this->ctrl->setParameter($this, "prt_id", $target_id);
673 $this->ctrl->redirect($this, "preview");
674 }
675
676
677 public static function _goto(string $a_target): void
678 {
679 global $DIC;
680
681 $ctrl = $DIC->ctrl();
682
683 $id = explode("_", $a_target);
684
685 $ctrl->setParameterByClass(self::class, 'prt_id', $id[0]);
686 if (count($id) === 2 && is_numeric($id[1])) {
687 $ctrl->setParameterByClass(self::class, 'user_page', $id[1]);
688 }
689 $ctrl->redirectByClass([ilSharedResourceGUI::class, self::class], 'preview');
690 }
691
692 public function createPortfolioFromAssignment(): void
693 {
694 $ilUser = $this->user;
695 $ilSetting = $this->settings;
696
697 $recipe = [];
698
699 $title = $this->port_request->getPortfolioTitle();
700 $prtt_id = $this->port_request->getPortfolioTemplate();
701
702 // get assignment template
703 $ass_template_id = 0;
704 $ass_id = $this->port_request->getExcAssId();
705 if ($ass_id > 0) {
706 $ass = new ilExAssignment($ass_id);
707 $ass_template_id = ilObject::_lookupObjectId($ass->getPortfolioTemplateId());
708 }
709
710 if ($prtt_id > 0) {
712 if (!count($templates) || !in_array($prtt_id, $templates)) {
713 if ($ass_template_id !== $prtt_id) {
714 $this->toRepository();
715 }
716 }
717
718 //skills manipulation
719 $pskills = array_keys($this->skill_personal_service->getSelectedUserSkills($ilUser->getId()));
720 $skill_ids = array();
721
722 $recipe = array();
723 foreach (ilPortfolioTemplatePage::getAllPortfolioPages($prtt_id) as $page) {
724 switch ($page["type"]) {
726 $source_page = new ilPortfolioTemplatePage($page["id"]);
727 $source_page->buildDom(true);
728 $skill_ids = $this->getSkillsToPortfolioAssignment($pskills, $skill_ids, $source_page);
729 break;
730 }
731 }
732
733 if ($skill_ids) {
734 $recipe["skills"] = $skill_ids;
735 }
736 }
737
738 // create portfolio
739 $target = new ilObjPortfolio();
740 $target->setTitle($title);
741 $target->create();
742 $target_id = $target->getId();
743
744 if ($prtt_id) {
745 $source = new ilObjPortfolioTemplate($prtt_id, false);
746 ilObjPortfolioTemplate::clonePagesAndSettings($source, $target, $recipe);
747 }
748
749 // link portfolio to exercise assignment
750 $this->linkPortfolioToAssignment($target_id);
751
752 $this->ctrl->setParameter($this, "prt_id", $target_id);
753 if ($prtt_id) {
754 $this->tpl->setOnScreenMessage('success', $this->lng->txt("prtf_portfolio_created_from_template"), true);
755 $this->ctrl->redirect($this, "preview");
756 } else {
757 $this->tpl->setOnScreenMessage('success', $this->lng->txt("prtf_portfolio_created"), true);
758 $this->ctrl->redirect($this, "view");
759 }
760 }
761
762 public function linkPortfolioToAssignment(int $a_target_id): void
763 {
764 $ilAccess = $this->access;
765 $ilUser = $this->user;
766
767 $exc_ref_id = $this->port_request->getExerciseRefId();
768 $ass_id = $this->port_request->getExcAssId();
769
770 if ($exc_ref_id &&
771 $ass_id &&
772 $ilAccess->checkAccess("read", "", $exc_ref_id)) {
773 $exc = new ilObjExercise($exc_ref_id);
774 $ass = new ilExAssignment($ass_id);
775 if ($ass->getExerciseId() === $exc->getId() &&
776 $ass->getType() === ilExAssignment::TYPE_PORTFOLIO) {
777 // #16205
778 $sub = new ilExSubmission($ass, $ilUser->getId());
779 $sub->addResourceObject($a_target_id);
780 }
781 }
782 }
783
785 array $a_pskills,
786 array $a_skill_ids,
787 ilPortfolioTemplatePage $a_source_page
788 ): array {
789 $dom = $a_source_page->getDomDoc();
790 $xpath = new DOMXPath($dom);
791 $nodes = $xpath->query("//PageContent/Skills");
792 foreach ($nodes as $node) {
793 $skill_id = $node->getAttribute("Id");
794 if (!in_array($skill_id, $a_pskills)) {
795 $a_skill_ids[] = $skill_id;
796 }
797 }
798 unset($nodes, $xpath, $dom);
799
800 return $a_skill_ids;
801 }
802
806 public function printSelection(): void
807 {
808 $view = $this->getPrintView();
809 $view->sendForm();
810 }
811
816 public function showPrintView(
817 ): void {
818 $printview = $this->getPrintView();
819 $printview->sendPrintView();
820 }
821
825 protected function getOfflineMessage(): string
826 {
827 $ui = $this->ui;
829 $ctrl = $this->ctrl;
830
831 if ($this->object->getOfflineStatus()) {
832 $f = $ui->factory();
833 $renderer = $ui->renderer();
834
835 $buttons = [$f->button()->standard(
836 $lng->txt("prtf_set_online"),
837 $ctrl->getLinkTarget($this, "setOnlineAndShare")
838 )];
839
840 return $renderer->render($f->messageBox()->info($lng->txt("prtf_no_offline_share_info"))
841 ->withButtons($buttons));
842 }
843 return "";
844 }
845
849 protected function setOnlineAndShare(): void
850 {
851 $ilCtrl = $this->ctrl;
853
854 if (ilObjPortfolio::_lookupOwner($this->object->getId()) === $this->user_id) {
855 $this->object->setOfflineStatus(false);
856 $this->object->update();
857 $this->tpl->setOnScreenMessage('success', $lng->txt("prtf_has_been_set_online"), true);
858 }
859 $ilCtrl->redirectByClass("ilworkspaceaccessgui", "");
860 }
861}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$renderer
This class represents a property in a property form.
This class represents an option in a checkbox group.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Exercise assignment.
Exercise submission //TODO: This class has many static methods related to delivered "files".
This class represents a non editable value in a property form.
Class ilObjExercise.
Portfolio view gui base class.
static clonePagesAndSettings(ilObjPortfolioBase $a_source, ilObjPortfolioBase $a_target, ?array $a_recipe=null, bool $copy_all=false)
Build template from portfolio and vice versa.
@ilCtrl_Calls ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI @ilCtrl_Calls ilObjPortfolioGUI:...
getPageInstance(?int $a_page_id=null, ?int $a_portfolio_id=null)
Get portfolio template page instance.
setOnlineAndShare()
Set online and switch to share screen.
linkPortfolioToAssignment(int $a_target_id)
getType()
Functions that must be overwritten.
initCreatePortfolioFromTemplateForm(int $a_prtt_id, string $a_title)
getOfflineMessage()
Get offline message for sharing tab.
getPageGUIInstance(int $a_page_id)
Get portfolio template page gui instance.
executeCommand()
execute command
ilPortfolioDeclarationOfAuthorship $declaration_authorship
ILIAS Notes GUIService $notes_gui
getSkillsToPortfolioAssignment(array $a_pskills, array $a_skill_ids, ilPortfolioTemplatePage $a_source_page)
ILIAS Skill Service SkillPersonalService $skill_personal_service
ContextServices $tool_context
afterSave(ilObject $new_object)
Post (successful) object creation hook.
createPortfolioFromTemplateProcess(bool $a_process_form=true)
static _goto(string $a_target)
createPortfolioFromTemplate(?ilPropertyFormGUI $a_form=null)
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
createFromTemplateDirect(string $title="", int $prtt_id=0)
Create portfolio template direct.
setTabs()
create tabs (repository/workspace switch)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
ilWorkspaceAccessHandler $ws_access
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAvailablePortfolioTemplates(string $a_permission="read")
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.
Class ilObject Basic functions for all objects.
static _lookupObjectId(int $ref_id)
const TITLE_LENGTH
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _lookupTitle(int $obj_id)
setStyleId(int $a_styleid)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPortfolioExerciseGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Portfolio page gui class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
This class represents a text property in a property form.
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 redirect(string $a_script)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
global $ilSetting
Definition: privfeed.php:31
$ilErr
Definition: raiseError.php:33
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26