ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjPortfolioGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
15{
19 protected $help;
20
21 protected $ws_access; // [ilWorkspaceAccessHandler]
22
26 protected $ui;
27
31 protected $tool_context;
32
37
38 public function __construct($a_id = 0)
39 {
40 global $DIC;
41
42 $this->lng = $DIC->language();
43 $this->help = $DIC["ilHelp"];
44 $this->settings = $DIC->settings();
45 $this->access = $DIC->access();
46 $this->user = $DIC->user();
47 $this->ctrl = $DIC->ctrl();
48 $this->ui = $DIC->ui();
49
50 $this->tool_context = $DIC->globalScreen()->tool()->context();
51
52 parent::__construct($a_id, self::PORTFOLIO_OBJECT_ID, 0);
53 $this->declaration_authorship = new ilPortfolioDeclarationOfAuthorship();
54
55 $this->ctrl->saveParameter($this, "exc_back_ref_id");
56 }
57
58 public function getType()
59 {
60 return "prtf";
61 }
62
63 protected function checkPermissionBool($a_perm, $a_cmd = "", $a_type = "", $a_node_id = null)
64 {
65 if ($a_perm == "create") {
66 return true;
67 }
68 if (!$a_node_id) {
69 $a_node_id = $this->obj_id;
70 }
71 return $this->access_handler->checkAccess($a_perm, "", $a_node_id);
72 }
73
74 public function executeCommand()
75 {
77
78 $this->checkPermission("read");
79
81
82 $next_class = $this->ctrl->getNextClass($this);
83 $cmd = $this->ctrl->getCmd("view");
84
85
86 // trigger assignment tool
87 $this->triggerAssignmentTool();
88
89 switch ($next_class) {
90 case "ilworkspaceaccessgui":
91 if ($this->checkPermissionBool("write")) {
92 $this->setTabs();
93 $this->tabs_gui->activateTab("share");
94
95 if ($this->access_handler->getPermissions($this->object->getId()) &&
96 !$this->object->isOnline()) {
97 //ilUtil::sendInfo($lng->txt("prtf_shared_offline_info"));
98 }
99
100 $this->tpl->setPermanentLink("prtf", $this->object->getId());
101
102 $wspacc = new ilWorkspaceAccessGUI($this->object->getId(), $this->access_handler, true);
103 $wspacc->setBlockingMessage($this->getOfflineMessage());
104 $this->ctrl->forwardCommand($wspacc);
105 }
106 break;
107
108 case 'ilportfoliopagegui':
109 if ($this->determinePageCall()) {
110 // only in edit mode
111 $this->addLocator();
112
114 }
115 $this->handlePageCall($cmd);
116 break;
117
118 case "ilnotegui":
119 $this->preview();
120 break;
121
122 case "ilobjstylesheetgui":
123 $this->ctrl->setReturn($this, "editStyleProperties");
124 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
125 $style_gui->enableWrite(true);
126 $style_gui->omitLocator();
127 if ($cmd == "create" || $_GET["new_type"] == "sty") {
128 $style_gui->setCreationMode(true);
129 }
130
131 if ($cmd == "confirmedDelete") {
132 $this->object->setStyleSheetId(0);
133 $this->object->update();
134 }
135
136 $ret = $this->ctrl->forwardCommand($style_gui);
137
138 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
139 $style_id = $ret;
140 $this->object->setStyleSheetId($style_id);
141 $this->object->update();
142 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
143 }
144 break;
145
146 case "ilportfolioexercisegui":
147 $this->ctrl->setReturn($this, "view");
148 $gui = new ilPortfolioExerciseGUI($this->user_id, $this->object->getId());
149 $this->ctrl->forwardCommand($gui);
150 break;
151
152 default:
153
154 if ($cmd != "preview") {
155 $this->addLocator();
156 $this->setTabs();
157 }
158 $this->$cmd();
159 break;
160 }
161
162 return true;
163 }
164
170 protected function triggerAssignmentTool()
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(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()
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->getLinkTarget($this, "edit")
205 );
206
207 $this->tabs_gui->addNonTabbedLink(
208 "preview",
209 $this->lng->txt("user_profile_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()
223 {
224 if (!$this->creation_mode) {
225 $this->ctrl->setParameter($this, "prt_id", $this->object->getId());
226 }
227
228 parent::addLocatorItems();
229
230 $this->tpl->setLocator();
231 }
232
233 protected function setTitleAndDescription()
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("icon_prtf.svg"),
244 $this->lng->txt("portfolio")
245 );
246
247 if ($this->object &&
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"))
253 ));
254 }
255 }
256
257
258 //
259 // CREATE/EDIT
260 //
261
267 public function create()
268 {
271
272 $new_type = $_REQUEST["new_type"];
273
274 // add new object to custom parent container
275 $this->ctrl->saveParameter($this, "crtptrefid");
276 // use forced callback after object creation
277 $this->ctrl->saveParameter($this, "crtcb");
278
279 if (!$this->checkPermissionBool("create", "", $new_type)) {
280 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
281 } else {
282 $this->lng->loadLanguageModule($new_type);
283 $this->ctrl->setParameter($this, "new_type", $new_type);
284
285 $forms = $this->initCreationForms($new_type);
286
287 // copy form validation error: do not show other creation forms
288 if ($_GET["cpfl"] && isset($forms[self::CFORM_CLONE])) {
289 $forms = array(self::CFORM_CLONE => $forms[self::CFORM_CLONE]);
290 }
291 $tpl->setContent($this->getCreateInfoMessage() . $this->getCreationFormsHTML($forms));
292 }
293 }
294
301 protected function getCreateInfoMessage()
302 {
303 global $DIC;
304
307 $ui = $DIC->ui();
308 $ilSetting = $DIC->settings();
309
310 $message = "";
311 // page type: blog
312 if (!$ilSetting->get('disable_wsp_blogs')) {
313 $options = array();
314 $tree = new ilWorkspaceTree($this->user_id);
315 $root = $tree->readRootId();
316 if ($root) {
317 $root = $tree->getNodeData($root);
318 foreach ($tree->getSubTree($root) as $node) {
319 if ($node["type"] == "blog") {
320 $options[$node["obj_id"]] = $node["title"];
321 }
322 }
323 asort($options);
324 }
325 if (!sizeof($options)) {
326
327 // #18147
328 $this->lng->loadLanguageModule('pd');
329 $url = $this->ctrl->getLinkTargetByClass("ilDashboardGUI", "jumpToWorkspace");
330 $text = $this->lng->txt("mm_personal_and_shared_r");
331
332 $text = sprintf($this->lng->txt("prtf_no_blogs_info"), $text);
333
334 $mbox = $ui->factory()->messageBox()->info($text)
335 ->withLinks([$ui->factory()->link()->standard(
336 $this->lng->txt("mm_personal_and_shared_r"),
337 $url
338 )]);
339
340 $message = $ui->renderer()->render($mbox);
341 }
342 }
343 return $message;
344 }
345
346
347 protected function initCreationForms($a_new_type)
348 {
349 return array(self::CFORM_NEW => $this->initCreateForm($a_new_type));
350 }
351
352 protected function initCreateForm($a_new_type)
353 {
355
356 $this->ctrl->setParameter($this, "new_type", $this->getType());
357
358 $form = new ilPropertyFormGUI();
359 $form->setFormAction($this->ctrl->getFormAction($this));
360
361 // title
362 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
363 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
364 $ti->setMaxLength(ilObject::TITLE_LENGTH);
365 $ti->setRequired(true);
366 $form->addItem($ti);
367
368 $main = new ilRadioGroupInputGUI($this->lng->txt("prtf_creation_mode"), "mode");
369 $main->setValue("mode_scratch");
370 $form->addItem($main);
371
372 $opt_scratch = new ilRadioOption($this->lng->txt("prtf_creation_mode_scratch"), "mode_scratch");
373 $main->addOption($opt_scratch);
374
375
376 // 1st page
377
378 $type = new ilRadioGroupInputGUI($this->lng->txt("prtf_first_page_title"), "ptype");
379 $type->setRequired(true);
380 $opt_scratch->addSubItem($type);
381
382 $type_page = new ilRadioOption($this->lng->txt("page"), "page");
383 $type->addOption($type_page);
384
385 // page type: page
386 $tf = new ilTextInputGUI($this->lng->txt("title"), "fpage");
387 $tf->setMaxLength(128);
388 $tf->setSize(40);
389 $tf->setRequired(true);
390 $type_page->addSubItem($tf);
391
392 // page templates
394 if ($templates) {
395 $options = array(0 => $this->lng->txt("none"));
396 foreach ($templates as $templ) {
397 $templ->readObject();
398 $options[$templ->getId()] = $templ->getTitle();
399 }
400
401 $use_template = new ilSelectInputGUI($this->lng->txt("prtf_use_page_layout"), "tmpl");
402 $use_template->setRequired(true);
403 $use_template->setOptions($options);
404 $type_page->addSubItem($use_template);
405 }
406
407 // page type: blog
408 if (!$ilSetting->get('disable_wsp_blogs')) {
409 $options = array();
410 $tree = new ilWorkspaceTree($this->user_id);
411 $root = $tree->readRootId();
412 if ($root) {
413 $root = $tree->getNodeData($root);
414 foreach ($tree->getSubTree($root) as $node) {
415 if ($node["type"] == "blog") {
416 $options[$node["obj_id"]] = $node["title"];
417 }
418 }
419 asort($options);
420 }
421 if (sizeof($options)) {
422 $type_blog = new ilRadioOption($this->lng->txt("obj_blog"), "blog");
423 $type->addOption($type_blog);
424
425 $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), "blog");
426 $obj->setRequired(true);
427 $obj->setOptions(array("" => $this->lng->txt("please_select")) + $options);
428 $type_blog->addSubItem($obj);
429 } else {
430 $type->setValue("page");
431 }
432 }
433
434
435 // portfolio templates
436
437 $opt_tmpl = new ilRadioOption($this->lng->txt("prtf_creation_mode_template"), "mode_tmpl");
438 $main->addOption($opt_tmpl);
439
441 if (!sizeof($templates)) {
442 $opt_tmpl->setDisabled(true);
443 } else {
444 $tmpl = new ilSelectInputGUI($this->lng->txt("obj_prtt"), "prtt");
445 $tmpl->setRequired(true);
446 $tmpl->setOptions(array("" => $this->lng->txt("please_select")) + $templates);
447 $opt_tmpl->addSubItem($tmpl);
448
449 // incoming from repository
450 if ((int) $_REQUEST["prtt_pre"]) {
451 $tmpl->setValue((int) $_REQUEST["prtt_pre"]);
452 $main->setValue("mode_tmpl");
453 }
454 }
455
456
457 $form->setTitle($this->lng->txt("prtf_create_portfolio"));
458 $form->addCommandButton("save", $this->lng->txt("create"));
459 $form->addCommandButton("toRepository", $this->lng->txt("cancel"));
460
461 return $form;
462 }
463
464 public function save()
465 {
466 $form = $this->initCreateForm("prtf");
467 if ($form->checkInput()) {
468 // trigger portfolio template "import" process
469 if ($form->getInput("mode") == "mode_tmpl") {
470 $_REQUEST["pt"] = $form->getInput("title");
471 $_REQUEST["prtt_pre"] = (int) $_REQUEST["prtt"];
472 return $this->createFromTemplateDirect($form->getInput("title"));
473 //return $this->createPortfolioFromTemplate();
474 }
475 }
476
477 return parent::save();
478 }
479
480 protected function afterSave(ilObject $a_new_object)
481 {
482 // create 1st page / blog
483 $page = $this->getPageInstance(null, $a_new_object->getId());
484 if ($_POST["ptype"] == "page") {
485 $page->setType(ilPortfolioPage::TYPE_PAGE);
486 $page->setTitle($_POST["fpage"]);
487
488 // use template as basis
489 $layout_id = $_POST["tmpl"];
490 if ($layout_id) {
491 $layout_obj = new ilPageLayout($layout_id);
492 $page->setXMLContent($layout_obj->getXMLContent());
493 }
494 } else {
495 $page->setType(ilPortfolioPage::TYPE_BLOG);
496 $page->setTitle($_POST["blog"]);
497 }
498 $page->create();
499
500 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created"), true);
501 $this->ctrl->setParameter($this, "prt_id", $a_new_object->getId());
502 $this->ctrl->redirect($this, "view");
503 }
504
505 protected function toRepository()
506 {
507 $ilAccess = $this->access;
508
509 // return to exercise (portfolio assignment)
510 $exc_ref_id = (int) $_REQUEST["exc_id"];
511 if ($exc_ref_id &&
512 $ilAccess->checkAccess("read", "", $exc_ref_id)) {
513 ilUtil::redirect(ilLink::_getLink($exc_ref_id, "exc"));
514 }
515
516 $this->ctrl->redirectByClass("ilportfoliorepositorygui", "show");
517 }
518
519 protected function initEditForm()
520 {
521 $form = new ilPropertyFormGUI();
522 $form->setFormAction($this->ctrl->getFormAction($this));
523
524 // title
525 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
526 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
527 $ti->setMaxLength(ilObject::TITLE_LENGTH);
528 $ti->setRequired(true);
529 $ti->setValue($this->object->getTitle());
530 $form->addItem($ti);
531
532 /* description
533 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
534 $ta->setCols(40);
535 $ta->setRows(2);
536 $ta->setValue($this->object->getDescription());
537 $form->addItem($ta);
538 */
539
540 // :TODO: online
541 $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
542 $online->setChecked($this->object->isOnline());
543 $form->addItem($online);
544
545 $this->initEditCustomForm($form);
546
547 $form->setTitle($this->lng->txt("prtf_edit_portfolio"));
548 $form->addCommandButton("update", $this->lng->txt("save"));
549 $form->addCommandButton("view", $this->lng->txt("cancel"));
550
551 return $form;
552 }
553
554 protected function getEditFormCustomValues(array &$a_values)
555 {
556 $a_values["online"] = $this->object->isOnline();
557
558 parent::getEditFormCustomValues($a_values);
559 }
560
561 public function updateCustom(ilPropertyFormGUI $a_form)
562 {
563 $this->object->setOnline($a_form->getInput("online"));
564
565 // if portfolio is not online, it cannot be default
566 if (!$a_form->getInput("online")) {
567 ilObjPortfolio::setUserDefault($this->user_id, 0);
568 }
569
570 parent::updateCustom($a_form);
571 }
572
573
574 //
575 // PAGES
576 //
577
585 protected function getPageInstance($a_page_id = null, $a_portfolio_id = null)
586 {
587 // #11531
588 if (!$a_portfolio_id && $this->object) {
589 $a_portfolio_id = $this->object->getId();
590 }
591 $page = new ilPortfolioPage($a_page_id);
592 $page->setPortfolioId($a_portfolio_id);
593 return $page;
594 }
595
602 protected function getPageGUIInstance($a_page_id)
603 {
604 $page_gui = new ilPortfolioPageGUI(
605 $this->object->getId(),
606 $a_page_id,
607 0,
608 $this->object->hasPublicComments()
609 );
610 $page_gui->setAdditional($this->getAdditional());
611 return $page_gui;
612 }
613
614 public function getPageGUIClassName()
615 {
616 return "ilportfoliopagegui";
617 }
618
619 protected function initCopyPageFormOptions(ilPropertyFormGUI $a_form)
620 {
621 $a_tgt = new ilRadioGroupInputGUI($this->lng->txt("target"), "target");
622 $a_tgt->setRequired(true);
623 $a_form->addItem($a_tgt);
624
625 $old = new ilRadioOption($this->lng->txt("prtf_existing_portfolio"), "old");
626 $a_tgt->addOption($old);
627
628 $options = array();
629 $all = ilObjPortfolio::getPortfoliosOfUser($this->user_id);
630 foreach ($all as $item) {
631 $options[$item["id"]] = $item["title"];
632 }
633 $prtf = new ilSelectInputGUI($this->lng->txt("portfolio"), "prtf");
634 $prtf->setRequired(true);
635 $prtf->setOptions($options);
636 $old->addSubItem($prtf);
637
638 $new = new ilRadioOption($this->lng->txt("prtf_new_portfolio"), "new");
639 $a_tgt->addOption($new);
640
641 $tf = new ilTextInputGUI($this->lng->txt("title"), "title");
642 $tf->setMaxLength(128);
643 $tf->setSize(40);
644 $tf->setRequired(true);
645 $new->addSubItem($tf);
646 }
647
648
649 //
650 // BLOG
651 //
652
659 public function initBlogForm()
660 {
661 $form = new ilPropertyFormGUI();
662 $form->setFormAction($this->ctrl->getFormAction($this));
663
664 $options = array();
665 $tree = new ilWorkspaceTree($this->user_id);
666 $root = $tree->readRootId();
667 if ($root) {
668 $root = $tree->getNodeData($root);
669 foreach ($tree->getSubTree($root, true, "blog") as $node) {
670 $options[$node["obj_id"]] = $node["title"];
671 }
672 asort($options);
673 }
674
675 // add blog
676 $radg = new ilRadioGroupInputGUI($this->lng->txt("obj_blog"), "creation_mode");
677 $radg->setInfo($this->lng->txt(""));
678 $radg->setValue("new");
679 $radg->setInfo($this->lng->txt(""));
680
681 $op1 = new ilRadioOption($this->lng->txt("prtf_add_new_blog"), "new", $this->lng->txt("prtf_add_new_blog_info"));
682 $radg->addOption($op1);
683 $form->addItem($radg);
684
685 // Blog title
686 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
687 $ti->setRequired(true);
688 $op1->addSubItem($ti);
689
690
691 if (sizeof($options)) {
692 $op2 = new ilRadioOption($this->lng->txt("prtf_add_existing_blog"), "existing");
693 $radg->addOption($op2);
694
695 $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), "blog");
696 $obj->setOptions($options);
697 $op2->addSubItem($obj);
698 }
699
700 $form->setTitle($this->lng->txt("prtf_add_blog") . ": " .
701 $this->object->getTitle());
702 $form->addCommandButton("saveBlog", $this->lng->txt("save"));
703 $form->addCommandButton("view", $this->lng->txt("cancel"));
704
705 return $form;
706 }
707
711 public function saveBlog()
712 {
713 global $DIC;
714
715 $ilUser = $DIC->user();
716
717 $form = $this->initBlogForm();
718 if ($form->checkInput() && $this->checkPermissionBool("write")) {
719 if ($form->getInput("creation_mode") == "existing") {
720 $page = $this->getPageInstance();
721 $page->setType(ilPortfolioPage::TYPE_BLOG);
722 $page->setTitle($form->getInput("blog"));
723 $page->create();
724 } else {
725 $blog = new ilObjBlog();
726 $blog->setTitle($form->getInput("title"));
727 $blog->create();
728
729 $tree = new ilWorkspaceTree($ilUser->getId());
730
731 // @todo: see also e.g. ilExSubmissionObjectGUI->getOverviewContentBlog, this needs refactoring, consumer should not
732 // be responsibel to handle this
733 if (!$tree->getRootId()) {
734 $tree->createTreeForUser($ilUser->getId());
735 }
736
738 $node_id = $tree->insertObject($tree->readRootId(), $blog->getId());
739 $access_handler->setPermissions($tree->readRootId(), $node_id);
740
741 $page = $this->getPageInstance();
742 $page->setType(ilPortfolioPage::TYPE_BLOG);
743 $page->setTitle($blog->getId());
744 $page->create();
745 }
746
747 ilUtil::sendSuccess($this->lng->txt("prtf_blog_page_created"), true);
748 $this->ctrl->redirect($this, "view");
749 }
750
751 $this->tabs_gui->clearTargets();
752 $this->tabs_gui->setBackTarget(
753 $this->lng->txt("back"),
754 $this->ctrl->getLinkTarget($this, "view")
755 );
756
757 $form->setValuesByPost();
758 $this->tpl->setContent($form->getHtml());
759 }
760
761
762 //
763 // CREATE FROM TEMPLATE
764 //
765
766 protected function createPortfolioFromTemplate(ilPropertyFormGUI $a_form = null)
767 {
768 $title = trim($_REQUEST["pt"]);
769 $prtt_id = (int) $_REQUEST["prtt"];
770
771 // valid template?
773 if (!sizeof($templates) || !in_array($prtt_id, $templates)) {
774 $this->toRepository();
775 }
776 unset($templates);
777
778 $this->ctrl->setParameter($this, "prtt", $prtt_id);
779
780 if (!$a_form) {
781 $a_form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title);
782 }
783 if ($a_form) {
784 $this->tpl->setContent($a_form->getHTML());
785 } else {
787 }
788 }
789
790 protected function initCreatePortfolioFromTemplateForm($a_prtt_id, $a_title)
791 {
794
795 if ((int) $_REQUEST["exc_id"]) {
796 $this->ctrl->setParameter($this, "exc_id", (int) $_REQUEST["exc_id"]);
797 $this->ctrl->setParameter($this, "ass_id", (int) $_REQUEST["ass_id"]);
798 }
799
800 $form = new ilPropertyFormGUI();
801 $form->setFormAction($this->ctrl->getFormAction($this));
802
803 $tmpl = new ilNonEditableValueGUI($this->lng->txt("obj_prtt"));
804 $tmpl->setValue(ilObject::_lookupTitle($a_prtt_id));
805 $form->addItem($tmpl);
806
807 $title = new ilNonEditableValueGUI($this->lng->txt("title"), "pt");
808 $title->setValue($a_title);
809 $form->addItem($title);
810
811 // gather user blogs
812 if (!$ilSetting->get('disable_wsp_blogs')) {
813 $blog_options = array();
814 $tree = new ilWorkspaceTree($this->user_id);
815 $root = $tree->readRootId();
816 if ($root) {
817 $root = $tree->getNodeData($root);
818 foreach ($tree->getSubTree($root, true, "blog") as $node) {
819 $blog_options[$node["obj_id"]] = $node["title"];
820 }
821 asort($blog_options);
822 }
823 }
824
825 $has_form_content = false;
826
828 $quota_sum = 0;
829
830 $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId()));
831 $skill_ids = array();
832
833 foreach (ilPortfolioTemplatePage::getAllPortfolioPages($a_prtt_id) as $page) {
834 switch ($page["type"]) {
836 // skills
837 $source_page = new ilPortfolioTemplatePage($page["id"]);
838 $source_page->buildDom(true);
839 $skill_ids = $this->getSkillsToPortfolioAssignment($pskills, $skill_ids, $source_page);
840
841 if ($check_quota) {
842 $quota_sum += $source_page->getPageDiskSize();
843 }
844 if (sizeof($skill_ids)) {
845 $has_form_content = true;
846 }
847 break;
848
850 if (!$ilSetting->get('disable_wsp_blogs')) {
851 $has_form_content = true;
852
853 $field_id = "blog_" . $page["id"];
854
855 $blog = new ilRadioGroupInputGUI($this->lng->txt("obj_blog") . ": " .
856 $page["title"], $field_id);
857 $blog->setRequired(true);
858 $blog->setValue("blog_create");
859 $form->addItem($blog);
860
861 $new_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_create"), "blog_create");
862 $blog->addOption($new_blog);
863
864 $title = new ilTextInputGUI($this->lng->txt("title"), $field_id . "_create_title");
865 $title->setRequired(true);
866 $new_blog->addSubItem($title);
867
868 if (sizeof($blog_options)) {
869 $reuse_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_reuse"), "blog_resuse");
870 $blog->addOption($reuse_blog);
871
872 $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), $field_id . "_reuse_blog");
873 $obj->setRequired(true);
874 $obj->setOptions(array("" => $this->lng->txt("please_select")) + $blog_options);
875 $reuse_blog->addSubItem($obj);
876 }
877
878 $blog->addOption(new ilRadioOption($this->lng->txt("prtf_template_import_blog_ignore"), "blog_ignore"));
879 }
880 break;
881 }
882 }
883
884 if ($skill_ids) {
885 $skills = new ilCheckboxGroupInputGUI($this->lng->txt("skills"), "skill_ids");
886 $skills->setInfo($this->lng->txt("prtf_template_import_new_skills"));
887 $skills->setValue($skill_ids);
888 foreach ($skill_ids as $skill_id) {
889 $skills->addOption(new ilCheckboxOption(ilSkillTreeNode::_lookupTitle($skill_id), $skill_id));
890 }
891 $form->addItem($skills);
892 }
893
894 if ($quota_sum) {
895 if (!ilDiskQuotaHandler::isUploadPossible($quota_sum)) {
896 ilUtil::sendFailure($this->lng->txt("prtf_template_import_quota_failure"), true);
897 $this->ctrl->redirect($this, "create");
898 }
899 }
900
901 // no dialog needed, go ahead
902 if (!$has_form_content) {
903 return;
904 }
905
906 $form->setTitle($this->lng->txt("prtf_creation_mode") . ": " . $this->lng->txt("prtf_creation_mode_template"));
907 $form->addCommandButton("createPortfolioFromTemplateProcess", $this->lng->txt("continue"));
908 $form->addCommandButton("toRepository", $this->lng->txt("cancel"));
909
910 return $form;
911 }
912
913 protected function createPortfolioFromTemplateProcess($a_process_form = true)
914 {
917 $ilAccess = $this->access;
918
919 $title = trim($_REQUEST["pt"]);
920 $prtt_id = (int) $_REQUEST["prtt"];
921
922 // valid template?
924 if (!sizeof($templates) || !in_array($prtt_id, $templates)) {
925 $this->toRepository();
926 }
927 unset($templates);
928
929 // build page recipe (aka import form values)
930 $recipe = null;
931 if ($a_process_form) {
932 $this->ctrl->setParameter($this, "prtt", $prtt_id);
933
934 $form = $this->initCreatePortfolioFromTemplateForm($prtt_id, $title);
935 if ($form->checkInput()) {
936 foreach (ilPortfolioTemplatePage::getAllPortfolioPages($prtt_id) as $page) {
937 switch ($page["type"]) {
939 if (!$ilSetting->get('disable_wsp_blogs')) {
940 $field_id = "blog_" . $page["id"];
941 switch ($form->getInput($field_id)) {
942 case "blog_create":
943 $recipe[$page["id"]] = array("blog", "create",
944 trim($form->getInput($field_id . "_create_title")));
945 break;
946
947 case "blog_resuse":
948 $recipe[$page["id"]] = array("blog", "reuse",
949 (int) $form->getInput($field_id . "_reuse_blog"));
950 break;
951
952 case "blog_ignore":
953 $recipe[$page["id"]] = array("blog", "ignore");
954 break;
955 }
956 }
957 break;
958 }
959 }
960
961 $recipe["skills"] = (array) $form->getInput("skill_ids");
962 } else {
963 $form->setValuesByPost();
964 return $this->createPortfolioFromTemplate($form);
965 }
966 }
967
968 $source = new ilObjPortfolioTemplate($prtt_id, false);
969
970 // create portfolio
971 $target = new ilObjPortfolio();
972 $target->setTitle($title);
973 $target->create();
974 $target_id = $target->getId();
975
976 $source->clonePagesAndSettings($source, $target, $recipe);
977
978 // link portfolio to exercise assignment
980
981 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created_from_template"), true);
982 $this->ctrl->setParameter($this, "prt_id", $target_id);
983 $this->ctrl->redirect($this, "preview");
984 }
985
989 protected function createFromTemplateDirect($title = "")
990 {
991 $prtt_id = (int) $_REQUEST["prtt_pre"];
992 if ($title == "") {
993 $title = ilObject::_lookupTitle($prtt_id);
994 }
995
996 // valid template?
998 if (!sizeof($templates) || !in_array($prtt_id, $templates)) {
999 $this->toRepository();
1000 }
1001 unset($templates);
1002
1003 $source = new ilObjPortfolioTemplate($prtt_id, false);
1004
1005 // create portfolio
1006 $target = new ilObjPortfolio();
1007 $target->setTitle($title);
1008 $target->create();
1009 $target_id = $target->getId();
1010
1011 $source->clonePagesAndSettings($source, $target, null, true);
1012
1013 // link portfolio to exercise assignment
1014 //$this->linkPortfolioToAssignment($target_id);
1015
1016 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created_from_template"), true);
1017 $this->ctrl->setParameter($this, "prt_id", $target_id);
1018 $this->ctrl->redirect($this, "preview");
1019 }
1020
1021
1022 public static function _goto($a_target)
1023 {
1025 global $DIC;
1026
1027 $ctrl = $DIC->ctrl();
1028
1029 $id = explode("_", $a_target);
1030
1031 $_GET["baseClass"] = "ilsharedresourceGUI";
1032 $ctrl->setParameterByClass("ilobjportfoliogui", "prt_id", $id[0]);
1033 if (sizeof($id) == 2) {
1034 $ctrl->setParameterByClass("ilobjportfoliogui", "user_page", $id[1]);
1035 }
1036 $ctrl->redirectByClass(["ilsharedresourceGUI", "ilobjportfoliogui"], "preview");
1037 }
1038
1040 {
1043
1044 $title = trim($_REQUEST["pt"]);
1045 $prtt_id = (int) $_REQUEST["prtt"];
1046
1047 // get assignment template
1048 $ass_template_id = 0;
1049 if ((int) $_REQUEST["ass_id"] > 0) {
1050 $ass = new ilExAssignment((int) $_REQUEST["ass_id"]);
1051 $ass_template_id = ilObject::_lookupObjectId($ass->getPortfolioTemplateId());
1052 }
1053
1054 if ($prtt_id > 0) {
1056 if (!sizeof($templates) || !in_array($prtt_id, $templates)) {
1057 if ($ass_template_id != $prtt_id) {
1058 $this->toRepository();
1059 }
1060 }
1061
1062 //quota manipulation
1064 $quota_sum = 0;
1065
1066 //skills manipulation
1067 $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId()));
1068 $skill_ids = array();
1069
1070 $recipe = array();
1071 foreach (ilPortfolioTemplatePage::getAllPortfolioPages($prtt_id) as $page) {
1072 switch ($page["type"]) {
1074 if (!$ilSetting->get('disable_wsp_blogs')) {
1075 $recipe[$page["id"]] = array("blog", "create", $page['title']);
1076 }
1077 break;
1079 $source_page = new ilPortfolioTemplatePage($page["id"]);
1080 $source_page->buildDom(true);
1081 if ($check_quota) {
1082 $quota_sum += $source_page->getPageDiskSize();
1083 }
1084 $skill_ids = $this->getSkillsToPortfolioAssignment($pskills, $skill_ids, $source_page);
1085 break;
1086 }
1087 }
1088
1089 if ($quota_sum) {
1090 if (!ilDiskQuotaHandler::isUploadPossible($quota_sum)) {
1091 ilUtil::sendFailure($this->lng->txt("prtf_template_import_quota_failure"), true);
1092 $this->ctrl->redirect($this, "create");
1093 }
1094 }
1095
1096 if ($skill_ids) {
1097 $recipe["skills"] = $skill_ids;
1098 }
1099 }
1100
1101 // create portfolio
1102 $target = new ilObjPortfolio();
1103 $target->setTitle($title);
1104 $target->create();
1105 $target_id = $target->getId();
1106
1107 if ($prtt_id) {
1108 $source = new ilObjPortfolioTemplate($prtt_id, false);
1109 $source->clonePagesAndSettings($source, $target, $recipe);
1110 }
1111
1112 // link portfolio to exercise assignment
1114
1115 $this->ctrl->setParameter($this, "prt_id", $target_id);
1116 if ($prtt_id) {
1117 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created_from_template"), true);
1118 $this->ctrl->redirect($this, "preview");
1119 } else {
1120 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_created"), true);
1121 $this->ctrl->redirect($this, "view");
1122 }
1123 }
1124
1125 public function linkPortfolioToAssignment($a_target_id)
1126 {
1127 $ilAccess = $this->access;
1129
1130 $exc_ref_id = (int) $_REQUEST["exc_id"];
1131 $ass_id = (int) $_REQUEST["ass_id"];
1132
1133 if ($exc_ref_id &&
1134 $ass_id &&
1135 $ilAccess->checkAccess("read", "", $exc_ref_id)) {
1136 $exc = new ilObjExercise($exc_ref_id);
1137 $ass = new ilExAssignment($ass_id);
1138 if ($ass->getExerciseId() == $exc->getId() &&
1139 $ass->getType() == ilExAssignment::TYPE_PORTFOLIO) {
1140 // #16205
1141 $sub = new ilExSubmission($ass, $ilUser->getId());
1142 $sub->addResourceObject($a_target_id);
1143 }
1144 }
1145 }
1146
1153 public function getSkillsToPortfolioAssignment($a_pskills, $a_skill_ids, $a_source_page)
1154 {
1155 $dom = $a_source_page->getDom();
1156 if ($dom instanceof php4DOMDocument) {
1157 $dom = $dom->myDOMDocument;
1158 }
1159 $xpath = new DOMXPath($dom);
1160 $nodes = $xpath->query("//PageContent/Skills");
1161 foreach ($nodes as $node) {
1162 $skill_id = $node->getAttribute("Id");
1163 if (!in_array($skill_id, $a_pskills)) {
1164 $a_skill_ids[] = $skill_id;
1165 }
1166 }
1167 unset($nodes);
1168 unset($xpath);
1169 unset($dom);
1170
1171 return $a_skill_ids;
1172 }
1173
1179 public function exportPDFSelection()
1180 {
1181 global $DIC;
1182
1183 $tpl = $DIC["tpl"];
1184
1185 $form = $this->initPDFSelectionForm();
1186
1187 $tpl->setContent($form->getHTML());
1188 }
1189
1193 public function initPDFSelectionForm()
1194 {
1195 global $DIC;
1196
1197 $lng = $this->lng;
1199
1200 $tabs = $DIC->tabs();
1201
1202 $tabs->clearTargets();
1203 $tabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "view"));
1204
1205 $pages = ilPortfolioPage::getAllPortfolioPages($this->object->getId());
1206
1207
1208 $form = new ilPropertyFormGUI();
1209
1210 // because of PDF export
1211 $form->setPreventDoubleSubmission(false);
1212
1213 // declaration of authorship
1214 if ($this->declaration_authorship->getForUser($this->user) != "") {
1215 $cb = new ilCheckboxInputGUI($this->lng->txt("prtf_decl_authorship"), "decl_author");
1216 $cb->setInfo($this->declaration_authorship->getForUser($this->user));
1217 $form->addItem($cb);
1218 }
1219
1220 // signature
1221 $cb = new ilCheckboxInputGUI($this->lng->txt("prtf_signature"), "signature");
1222 $cb->setInfo($this->lng->txt("prtf_signature_info"));
1223 $form->addItem($cb);
1224
1225
1226 // selection type
1227 $radg = new ilRadioGroupInputGUI($lng->txt("prtf_print_selection"), "sel_type");
1228 $radg->setValue("all_pages");
1229 $op2 = new ilRadioOption($lng->txt("prtf_all_pages"), "all_pages");
1230 $radg->addOption($op2);
1231 $op3 = new ilRadioOption($lng->txt("prtf_selected_pages"), "selection");
1232 $radg->addOption($op3);
1233
1234 $nl = new ilNestedListInputGUI("", "obj_id");
1235 $op3->addSubItem($nl);
1236
1237 foreach ($pages as $p) {
1238 if ($p["type"] != ilPortfolioPage::TYPE_BLOG) {
1239 $nl->addListNode(
1240 $p["id"],
1241 $p["title"],
1242 0,
1243 false,
1244 false,
1245 ilUtil::getImagePath("icon_pg.svg"),
1246 $lng->txt("page")
1247 );
1248 } else {
1249 $nl->addListNode(
1250 $p["id"],
1251 $lng->txt("obj_blog") . ": " . ilObject::_lookupTitle($p["title"]),
1252 0,
1253 false,
1254 false,
1255 ilUtil::getImagePath("icon_blog.svg"),
1256 $lng->txt("obj_blog")
1257 );
1258 $pages2 = ilBlogPosting::getAllPostings($p["title"]);
1259 foreach ($pages2 as $p2) {
1260 $nl->addListNode(
1261 "b" . $p2["id"],
1262 $p2["title"],
1263 $p["id"],
1264 false,
1265 false,
1266 ilUtil::getImagePath("icon_pg.svg"),
1267 $lng->txt("page")
1268 );
1269 }
1270 }
1271 }
1272
1273 $form->addItem($radg);
1274
1275 $form->addCommandButton("exportPDF", $lng->txt("prtf_pdf"));
1276 if (DEVMODE == "1") {
1277 $form->addCommandButton("exportPDFDev", $lng->txt("prtf_pdf") . " (DEV)");
1278 }
1279
1280 $form->setTitle($lng->txt("prtf_print_options"));
1281 $form->setFormAction($ilCtrl->getFormAction($this, "exportPDF"));
1282
1283 return $form;
1284 }
1285
1289 public function exportPDFDev()
1290 {
1291 $this->exportPDF(true);
1292 }
1293
1298 public function exportPDF($a_dev_mode = false)
1299 {
1301
1302 // prepare generation before contents are processed (for mathjax)
1303 ilPDFGeneratorUtils::prepareGenerationRequest("Portfolio", "ContentExport");
1304
1305 $html = $this->printView(true);
1306
1307 // :TODO: fixing css dummy parameters
1308 $html = preg_replace("/\?dummy\=[0-9]+/", "", $html);
1309 $html = preg_replace("/\?vers\=[0-9A-Za-z\-]+/", "", $html);
1310
1311 $html = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $html);
1312 $html = preg_replace("/href=\"\\.\\//ims", "href=\"" . ILIAS_HTTP_PATH . "/", $html);
1313
1314
1315 if ($a_dev_mode) {
1316 echo $html;
1317 exit;
1318 }
1319
1320 //$html = str_replace("&amp;", "&", $html);
1321
1322 $pdf_factory = new ilHtmlToPdfTransformerFactory();
1323 $pdf_factory->deliverPDFFromHTMLString($html, "portfolio.pdf", ilHtmlToPdfTransformerFactory::PDF_OUTPUT_DOWNLOAD, "Portfolio", "ContentExport");
1324 }
1325
1326 public function printView($a_pdf_export = false)
1327 {
1328 //global $tpl;
1329
1330 $lng = $this->lng;
1331
1332 $pages = ilPortfolioPage::getAllPortfolioPages($this->object->getId());
1333
1334
1335 $tpl = new ilGlobalTemplate("tpl.pdf_print_view.html", true, true, "Services/Export/PDF");
1336
1337 $resource_collector = new \ILIAS\COPage\ResourcesCollector(
1339 new ilPortfolioPage()
1340 );
1341 $resource_injector = new \ILIAS\COPage\ResourcesInjector($resource_collector);
1342
1343 $tpl->setBodyClass("ilPrtfPdfBody");
1344
1345 $tpl->addCss(ilUtil::getStyleSheetLocation("filesystem"));
1346 $tpl->addCss(ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId(), false));
1349
1350 $resource_injector->inject($tpl);
1351
1352
1353 $page_content = "";
1354
1355 // cover page
1356 $cover_tpl = new ilTemplate("tpl.prtf_cover.html", true, true, "Modules/Portfolio");
1357 foreach ($pages as $page) {
1358 if ($page["type"] != ilPortfolioPage::TYPE_BLOG) {
1359 if ($_POST["sel_type"] == "selection" && (!is_array($_POST["obj_id"]) || !in_array($page["id"], $_POST["obj_id"]))) {
1360 continue;
1361 }
1362 $cover_tpl->setCurrentBlock("content_item");
1363 $cover_tpl->setVariable("ITEM_TITLE", $page["title"]);
1364 $cover_tpl->parseCurrentBlock();
1365 } else {
1366 $cover_tpl->setCurrentBlock("content_item");
1367 $cover_tpl->setVariable("ITEM_TITLE", $lng->txt("obj_blog") . ": " . ilObject::_lookupTitle($page["title"]));
1368 $cover_tpl->parseCurrentBlock();
1369 }
1370 }
1371
1372 if ($_POST["signature"]) {
1373 $cover_tpl->setCurrentBlock("signature");
1374 $cover_tpl->setVariable("TXT_SIGNATURE", $lng->txt("prtf_signature_date"));
1375 $cover_tpl->parseCurrentBlock();
1376 }
1377
1378 if ($_POST["decl_author"]) {
1379 $cover_tpl->setCurrentBlock("decl_author");
1380 $cover_tpl->setVariable(
1381 "TXT_DECL_AUTHOR",
1382 nl2br($this->declaration_authorship->getForUser($this->user))
1383 );
1384 $cover_tpl->parseCurrentBlock();
1385 }
1386
1387 $cover_tpl->setVariable("PORTFOLIO_TITLE", $this->object->getTitle());
1388 $cover_tpl->setVariable("PORTFOLIO_ICON", ilUtil::getImagePath("icon_prtf.svg"));
1389
1390 $cover_tpl->setVariable("TXT_AUTHOR", $lng->txt("prtf_author"));
1391 $cover_tpl->setVariable("TXT_LINK", $lng->txt("prtf_link"));
1392 $cover_tpl->setVariable("TXT_DATE", $lng->txt("prtf_date_of_print"));
1393
1394 $author = ilObjUser::_lookupName($this->object->getOwner());
1395 $author_str = $author["firstname"] . " " . $author["lastname"];
1396 $cover_tpl->setVariable("AUTHOR", $author_str);
1397
1398 $href = ilLink::_getStaticLink($this->object->getId(), "prtf");
1399 $cover_tpl->setVariable("LINK", $href);
1400
1402 $date_str = ilDatePresentation::formatDate(new ilDate(date("Y-m-d"), IL_CAL_DATE));
1403 $cover_tpl->setVariable("DATE", $date_str);
1404
1405 $page_content .= $cover_tpl->get();
1406 $page_content .= '<p style="page-break-after:always;"></p>';
1407
1408 $page_head_tpl = new ilTemplate("tpl.prtf_page_head.html", true, true, "Modules/Portfolio");
1409 $page_head_tpl->setVariable("AUTHOR", $author_str);
1410 $page_head_tpl->setVariable("DATE", $date_str);
1411 $page_head_str = $page_head_tpl->get();
1412
1413 foreach ($pages as $page) {
1414 if ($page["type"] != ilPortfolioPage::TYPE_BLOG) {
1415 if ($_POST["sel_type"] == "selection" && (!is_array($_POST["obj_id"]) || !in_array($page["id"], $_POST["obj_id"]))) {
1416 continue;
1417 }
1418
1419 $page_gui = new ilPortfolioPageGUI($this->object->getId(), $page["id"]);
1420 $page_gui->setOutputMode("print");
1421 $page_gui->setPresentationTitle($page["title"]);
1422 $html = $this->ctrl->getHTML($page_gui);
1423 $page_content .= $page_head_str . $html;
1424
1425 if ($a_pdf_export) {
1426 $page_content .= '<p style="page-break-after:always;"></p>';
1427 }
1428 } else {
1429 $pages2 = ilBlogPosting::getAllPostings($page["title"]);
1430 foreach ($pages2 as $p2) {
1431 if ($_POST["sel_type"] == "selection" && (!is_array($_POST["obj_id"]) || !in_array("b" . $p2["id"], $_POST["obj_id"]))) {
1432 continue;
1433 }
1434 $page_gui = new ilBlogPostingGUI(0, null, $p2["id"]);
1435 $page_gui->setFileDownloadLink("#");
1436 $page_gui->setFullscreenLink("#");
1437 $page_gui->setSourcecodeDownloadScript("#");
1438 $page_gui->setOutputMode("print");
1439 $page_content .= $page_head_str . $page_gui->showPage(ilObject::_lookupTitle($page["title"]) . ": " . $page_gui->getBlogPosting()->getTitle());
1440
1441 if ($a_pdf_export) {
1442 $page_content .= '<p style="page-break-after:always;"></p>';
1443 }
1444 }
1445 }
1446 }
1447
1448 $page_content = '<div class="ilInvisibleBorder">' . $page_content . '</div>';
1449
1450 if (!$a_pdf_export) {
1451 $page_content .= '<script type="text/javascript" language="javascript1.2">
1452 <!--
1453 il.Util.addOnLoad(function () {
1454 il.Util.print();
1455 });
1456 //-->
1457 </script>';
1458 }
1459
1460 $tpl->setVariable("CONTENT", $page_content);
1461
1462 if (!$a_pdf_export) {
1463 $tpl->printToStdout(false);
1464 exit;
1465 } else {
1466 $ret = $tpl->printToString();
1467 //$tpl->fillJavaScriptFiles();
1468 //$ret = $tpl->getSpecial("DEFAULT", false, false, false, true, false, false);
1469 return $ret;
1470 }
1471 }
1472
1478 protected function getOfflineMessage()
1479 {
1480 $ui = $this->ui;
1481 $lng = $this->lng;
1483
1484 if (!$this->object->isOnline()) {
1485 $f = $ui->factory();
1486 $renderer = $ui->renderer();
1487
1488 $buttons = [$f->button()->standard(
1489 $lng->txt("prtf_set_online"),
1490 $ctrl->getLinkTarget($this, "setOnlineAndShare")
1491 )];
1492
1493 return $renderer->render($f->messageBox()->info($lng->txt("prtf_no_offline_share_info"))
1494 ->withButtons($buttons));
1495 }
1496 return "";
1497 }
1498
1502 protected function setOnlineAndShare()
1503 {
1505 $lng = $this->lng;
1506
1507 if (ilObjPortfolio::_lookupOwner($this->object->getId()) == $this->user_id) {
1508 $this->object->setOnline(true);
1509 $this->object->update();
1510 ilUtil::sendSuccess($lng->txt("prtf_has_been_set_online"), true);
1511 }
1512 $ilCtrl->redirectByClass("ilworkspaceaccessgui", "");
1513 }
1514}
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATE
Class ilBlogPosting GUI class.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
This class represents a property in a property form.
This class represents a checkbox property in a property form.
This class represents an option in a checkbox group.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
Class for single dates.
static isUploadPossible($a_additional_size=null)
Exercise assignment.
Exercise submission //TODO: This class has to much static methods related to delivered "files".
static setPersonalWorkspaceQuotaCheck($a_value)
special template class to simplify handling of ITX/PEAR
Class ilHtmlToPdfTransformerFactory.
This class represents a (nested) list of checkboxes (could be extended for radio items,...
This class represents a non editable value in a property form.
Class ilObjBlog.
Class ilObjExercise.
Portfolio view gui base class.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
getAdditional()
Get Additonal Information.
preview($a_return=false, $a_content=false, $a_show_notes=true)
Show user page.
Portfolio view gui class.
setOnlineAndShare()
Set online and switch to share screen.
triggerAssignmentTool()
Trigger assignment tool.
getType()
Functions that must be overwritten.
getSkillsToPortfolioAssignment($a_pskills, $a_skill_ids, $a_source_page)
getOfflineMessage()
Get offline message for sharing tab.
initEditForm()
Init object edit form.
exportPDFSelection()
Export PDF selection.
executeCommand()
execute command
getPageGUIInstance($a_page_id)
Get portfolio template page gui instance.
exportPDF($a_dev_mode=false)
create()
create new object form
saveBlog()
Create new portfolio blog page.
initCreateForm($a_new_type)
Init object creation form.
getPageInstance($a_page_id=null, $a_portfolio_id=null)
Get portfolio template page instance.
getCreateInfoMessage()
Get cereat info message.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
printView($a_pdf_export=false)
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
setTitleAndDescription()
called by prepare output
createPortfolioFromTemplate(ilPropertyFormGUI $a_form=null)
createFromTemplateDirect($title="")
Create portfolio template direct.
createPortfolioFromTemplateProcess($a_process_form=true)
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
setTabs()
create tabs (repository/workspace switch)
initBlogForm()
Init blog page form.
initPDFSelectionForm()
Init print view selection form.
initCreationForms($a_new_type)
Init creation froms.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
initCreatePortfolioFromTemplateForm($a_prtt_id, $a_title)
linkPortfolioToAssignment($a_target_id)
static getAvailablePortfolioTemplates($a_permission="read")
static setUserDefault($a_user_id, $a_portfolio_id=null)
Set the user default portfolio.
static getPortfoliosOfUser($a_user_id)
Get views of user.
Class ilObjStyleSheetGUI.
static getContentPrintStyle()
get content print style
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _lookupName($a_user_id)
lookup user name
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
static _lookupOwner($a_id)
lookup object owner
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
Class ilObject Basic functions for all objects.
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
getId()
get object id @access public
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
Class ilPageLayout.
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
Class ilPortfolioExerciseGUI.
Exercise info for portfolios.
Portfolio page gui class.
Page for user portfolio.
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
Page for portfolio template.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
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($a_obj_id, $a_tref_id=0)
Lookup Title.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
Access handler for personal workspace.
Tree handler for personal workspace.
$target_id
Definition: goto.php:49
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:29
$i
Definition: metadata.php:24
$source
Definition: metadata.php:76
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
$url
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18
ui()
Definition: ui.php:5
$a_type
Definition: workflow.php:92
$message
Definition: xapiexit.php:14
$DIC
Definition: xapitoken.php:46