ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjPortfolioBaseGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once('./Services/Object/classes/class.ilObject2GUI.php');
5include_once('./Modules/Portfolio/classes/class.ilObjPortfolio.php');
6include_once('./Modules/Portfolio/classes/class.ilPortfolioPage.php');
7
16abstract class ilObjPortfolioBaseGUI extends ilObject2GUI
17{
18 protected $user_id; // [int]
19 protected $additional = array();
20 protected $perma_link; // [string]
21 protected $page_id; // [int]
22 protected $page_mode; // [string] preview|edit
23
24 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
25 {
26 global $ilUser;
27
28 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
29
30 $this->user_id = $ilUser->getId();
31
32 $this->lng->loadLanguageModule("prtf");
33 $this->lng->loadLanguageModule("user");
34 }
35
36 protected function addLocatorItems()
37 {
38 global $ilLocator;
39
40 if($this->object)
41 {
42 $ilLocator->addItem(strip_tags($this->object->getTitle()),
43 $this->ctrl->getLinkTarget($this, "view"));
44 }
45
46 if($this->page_id)
47 {
48 $page = $this->getPageInstance($this->page_id);
49 $title = $page->getTitle();
50 if($page->getType() == ilPortfolioPage::TYPE_BLOG)
51 {
52 $title = ilObject::_lookupTitle($title);
53 }
54 $this->ctrl->setParameterByClass($this->getPageGUIClassName(), "ppage", $this->page_id);
55 $ilLocator->addItem($title,
56 $this->ctrl->getLinkTargetByClass($this->getPageGUIClassName(), "edit"));
57 }
58 }
59
60 protected function determinePageCall()
61 {
62 // edit
63 if(isset($_REQUEST["ppage"]))
64 {
65 if(!$this->checkPermissionBool("write"))
66 {
67 $this->ctrl->redirect($this, "view");
68 }
69
70 $this->page_id = $_REQUEST["ppage"];
71 $this->page_mode = "edit";
72 $this->ctrl->setParameter($this, "ppage", $this->page_id);
73 return true;
74 }
75 // preview
76 else
77 {
78 $this->page_id = $_REQUEST["user_page"];
79 $this->page_mode = "preview";
80 $this->ctrl->setParameter($this, "user_page", $this->page_id);
81 return false;
82 }
83 }
84
85 protected function handlePageCall($a_cmd)
86 {
87 $this->tabs_gui->clearTargets();
88 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
89 $this->ctrl->getLinkTarget($this, "view"));
90
91 if(!$this->page_id)
92 {
93 $this->ctrl->redirect($this, "view");
94 }
95
96 $page_gui = $this->getPageGUIInstance($this->page_id);
97
98 // needed for editor
100 $this->object->getStyleSheetId(), $this->getType()));
101
102 $ret = $this->ctrl->forwardCommand($page_gui);
103
104 if ($ret != "" && $ret !== true)
105 {
106 // preview (fullscreen)
107 if($this->page_mode == "preview")
108 {
109 // embedded call which did not generate any output (e.g. calendar month navigation)
111 {
112 // suppress (portfolio) notes for blog postings
113 $this->preview(false, $ret, ($a_cmd != "previewEmbedded"));
114 }
115 else
116 {
117 $this->preview(false);
118 }
119 }
120 // edit
121 else
122 {
123 $this->setContentStyleSheet();
124 $this->tpl->setContent($ret);
125 }
126 }
127 }
128
134 public function setAdditional($a_additional)
135 {
136 $this->additional = $a_additional;
137 }
138
144 public function getAdditional()
145 {
146 return $this->additional;
147 }
148
155 public function setPermaLink($a_obj_id, $a_type)
156 {
157 $this->perma_link = array("obj_id"=>$a_obj_id, "type"=>$a_type);
158 }
159
160
161 //
162 // CREATE/EDIT
163 //
164
165 protected function setSettingsSubTabs($a_active)
166 {
167 // #17455
168 $this->lng->loadLanguageModule($this->getType());
169
170 // general properties
171 $this->tabs_gui->addSubTab("properties",
172 $this->lng->txt($this->getType()."_properties"),
173 $this->ctrl->getLinkTarget($this, 'edit'));
174
175 $this->tabs_gui->addSubTab("style",
176 $this->lng->txt("obj_sty"),
177 $this->ctrl->getLinkTarget($this, 'editStyleProperties'));
178
179 $this->tabs_gui->activateSubTab($a_active);
180 }
181
182 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
183 {
184 $this->setSettingsSubTabs("properties");
185
186 // comments
187 $comments = new ilCheckboxInputGUI($this->lng->txt("prtf_public_comments"), "comments");
188 $a_form->addItem($comments);
189
190 // profile picture
191 $ppic = new ilCheckboxInputGUI($this->lng->txt("prtf_profile_picture"), "ppic");
192 $a_form->addItem($ppic);
193
194 $prfa_set = new ilSetting("prfa");
195 if($prfa_set->get("banner"))
196 {
197 include_once "Services/Form/classes/class.ilFileInputGUI.php";
199
200 $dimensions = " (".$prfa_set->get("banner_width")."x".
201 $prfa_set->get("banner_height").")";
202
203 $img = new ilImageFileInputGUI($this->lng->txt("prtf_banner").$dimensions, "banner");
204 $a_form->addItem($img);
205
206 // show existing file
207 $file = $this->object->getImageFullPath(true);
208 if($file)
209 {
210 $img->setImage($file);
211 }
212 }
213
214 /* #15000
215 $bg_color = new ilColorPickerInputGUI($this->lng->txt("prtf_background_color"), "bg_color");
216 $a_form->addItem($bg_color);
217
218 $font_color = new ilColorPickerInputGUI($this->lng->txt("prtf_font_color"), "font_color");
219 $a_form->addItem($font_color);
220 */
221 }
222
223 protected function getEditFormCustomValues(array &$a_values)
224 {
225 $a_values["comments"] = $this->object->hasPublicComments();
226 $a_values["ppic"] = $this->object->hasProfilePicture();
227 /*
228 $a_values["bg_color"] = $this->object->getBackgroundColor();
229 $a_values["font_color"] = $this->object->getFontColor();
230 */
231 }
232
233 public function updateCustom(ilPropertyFormGUI $a_form)
234 {
235 $this->object->setPublicComments($a_form->getInput("comments"));
236 $this->object->setProfilePicture($a_form->getInput("ppic"));
237 /*
238 $this->object->setBackgroundColor($a_form->getInput("bg_color"));
239 $this->object->setFontcolor($a_form->getInput("font_color"));
240 */
241
242 $prfa_set = new ilSetting("prfa");
243
244 if($_FILES["banner"]["tmp_name"])
245 {
246 $this->object->uploadImage($_FILES["banner"]);
247 }
248 else if($prfa_set->get('banner') and $a_form->getItemByPostVar("banner")->getDeletionFlag())
249 {
250 $this->object->deleteImage();
251 }
252 }
253
254
255 //
256 // PAGES
257 //
258
259 abstract protected function getPageInstance($a_page_id = null, $a_portfolio_id = null);
260
261 abstract protected function getPageGUIInstance($a_page_id);
262
263 abstract public function getPageGUIClassName();
264
268 public function view()
269 {
270 global $ilToolbar, $ilSetting, $tree;
271
272 if(!$this->checkPermissionBool("write"))
273 {
274 $this->ctrl->redirect($this, "infoScreen");
275 }
276
277 $this->tabs_gui->activateTab("pages");
278
279 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
280
281 $button = ilLinkButton::getInstance();
282 $button->setCaption("prtf_add_page");
283 $button->setUrl($this->ctrl->getLinkTarget($this, "addPage"));
284 $ilToolbar->addStickyItem($button);
285
286 if(!$ilSetting->get('disable_wsp_blogs'))
287 {
288 $button = ilLinkButton::getInstance();
289 $button->setCaption("prtf_add_blog");
290 $button->setUrl($this->ctrl->getLinkTarget($this, "addBlog"));
291 $ilToolbar->addStickyItem($button);
292 }
293
294 $ilToolbar->addSeparator();
295
296 // #16571
297 if($this->getType() == "prtf")
298 {
299 $button = ilLinkButton::getInstance();
300 $button->setCaption("export_html");
301 $button->setUrl($this->ctrl->getLinkTarget($this, "export"));
302 $ilToolbar->addButtonInstance($button);
303 }
304
305 include_once "Modules/Portfolio/classes/class.ilPortfolioPageTableGUI.php";
306 $table = new ilPortfolioPageTableGUI($this, "view");
307
308 // exercise portfolio?
309 include_once "Modules/Portfolio/classes/class.ilPortfolioExerciseGUI.php";
310 $exercises = ilPortfolioExerciseGUI::checkExercise($this->user_id, $this->object->getId(), $table->dataExists());
311 if($exercises)
312 {
313 ilUtil::sendInfo($exercises);
314 }
315
316 $this->tpl->setContent($table->getHTML());
317 }
318
322 protected function addPage()
323 {
324 global $ilHelp;
325
326 $this->tabs_gui->clearTargets();
327 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
328 $this->ctrl->getLinkTarget($this, "view"));
329
330 $ilHelp->setScreenIdComponent("prtf");
331 $ilHelp->setScreenId("add_page");
332
333
334 $form = $this->initPageForm("create");
335 $this->tpl->setContent($form->getHTML());
336 }
337
344 public function initPageForm($a_mode = "create")
345 {
346 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
347 $form = new ilPropertyFormGUI();
348 $form->setFormAction($this->ctrl->getFormAction($this));
349
350 // title
351 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
352 $ti->setMaxLength(200);
353 $ti->setRequired(true);
354 $form->addItem($ti);
355
356 // save and cancel commands
357 if ($a_mode == "create")
358 {
359 include_once "Services/Style/classes/class.ilPageLayout.php";
361 if($templates)
362 {
363 $use_template = new ilRadioGroupInputGUI($this->lng->txt("prtf_use_page_layout"), "tmpl");
364 $use_template->setRequired(true);
365 $form->addItem($use_template);
366
367 $opt = new ilRadioOption($this->lng->txt("none"), 0);
368 $use_template->addOption($opt);
369
370 foreach ($templates as $templ)
371 {
372 $templ->readObject();
373
374 $opt = new ilRadioOption($templ->getTitle().$templ->getPreview(), $templ->getId());
375 $use_template->addOption($opt);
376 }
377 }
378
379 $form->setTitle($this->lng->txt("prtf_add_page").": ".
380 $this->object->getTitle());
381 $form->addCommandButton("savePage", $this->lng->txt("save"));
382 $form->addCommandButton("view", $this->lng->txt("cancel"));
383 }
384 else
385 {
386 /* edit is done directly in table gui
387 $form->setTitle($this->lng->txt("prtf_edit_page"));
388 $form->addCommandButton("updatePage", $this->lng->txt("save"));
389 $form->addCommandButton("view", $this->lng->txt("cancel"));
390 */
391 }
392
393 return $form;
394 }
395
399 public function savePage()
400 {
401 $form = $this->initPageForm("create");
402 if ($form->checkInput() && $this->checkPermissionBool("write"))
403 {
404 include_once("Modules/Portfolio/classes/class.ilPortfolioPage.php");
405 $page = $this->getPageInstance();
406 $page->setType(ilPortfolioPage::TYPE_PAGE);
407 $page->setTitle($form->getInput("title"));
408
409 // use template as basis
410 $layout_id = $form->getInput("tmpl");
411 if($layout_id)
412 {
413 include_once("./Services/Style/classes/class.ilPageLayout.php");
414 $layout_obj = new ilPageLayout($layout_id);
415 $page->setXMLContent($layout_obj->getXMLContent());
416 }
417
418 $page->create();
419
420 ilUtil::sendSuccess($this->lng->txt("prtf_page_created"), true);
421 $this->ctrl->redirect($this, "view");
422 }
423
424 $this->tabs_gui->clearTargets();
425 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
426 $this->ctrl->getLinkTarget($this, "view"));
427
428 $form->setValuesByPost();
429 $this->tpl->setContent($form->getHtml());
430 }
431
435 protected function addBlog()
436 {
437 global $ilHelp;
438
439 $this->tabs_gui->clearTargets();
440 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
441 $this->ctrl->getLinkTarget($this, "view"));
442
443 $ilHelp->setScreenIdComponent("prtf");
444 $ilHelp->setScreenId("add_blog");
445
446 $form = $this->initBlogForm();
447 $this->tpl->setContent($form->getHTML());
448 }
449
450 abstract protected function initBlogForm();
451
452 abstract protected function saveBlog();
453
458 {
459 if(!$this->checkPermissionBool("write"))
460 {
461 return;
462 }
463
464 if (is_array($_POST["order"]))
465 {
466 foreach ($_POST["order"] as $k => $v)
467 {
468 $page = $this->getPageInstance(ilUtil::stripSlashes($k));
469 if($_POST["title"][$k])
470 {
471 $page->setTitle(ilUtil::stripSlashes($_POST["title"][$k]));
472 }
473 $page->setOrderNr(ilUtil::stripSlashes($v));
474 $page->update();
475 }
476 ilPortfolioPage::fixOrdering($this->object->getId());
477 }
478
479 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
480 $this->ctrl->redirect($this, "view");
481 }
482
487 {
488 if (!is_array($_POST["prtf_pages"]) || count($_POST["prtf_pages"]) == 0)
489 {
490 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
491 $this->ctrl->redirect($this, "view");
492 }
493 else
494 {
495 $this->tabs_gui->activateTab("pages");
496
497 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
498 $cgui = new ilConfirmationGUI();
499 $cgui->setFormAction($this->ctrl->getFormAction($this));
500 $cgui->setHeaderText($this->lng->txt("prtf_sure_delete_portfolio_pages"));
501 $cgui->setCancel($this->lng->txt("cancel"), "view");
502 $cgui->setConfirm($this->lng->txt("delete"), "deletePortfolioPages");
503
504 foreach ($_POST["prtf_pages"] as $id)
505 {
506 $page = $this->getPageInstance($id);
507 $title = $page->getTitle();
508 if($page->getType() == ilPortfolioPage::TYPE_BLOG)
509 {
510 $title = $this->lng->txt("obj_blog").": ".ilObject::_lookupTitle((int)$title);
511 }
512 $cgui->addItem("prtf_pages[]", $id, $title);
513 }
514
515 $this->tpl->setContent($cgui->getHTML());
516 }
517 }
518
523 {
524 if(!$this->checkPermissionBool("write"))
525 {
526 return;
527 }
528
529 if (is_array($_POST["prtf_pages"]))
530 {
531 foreach ($_POST["prtf_pages"] as $id)
532 {
533 $page = $this->getPageInstance($id);
534 $page->delete();
535 }
536 }
537 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_page_deleted"), true);
538 $this->ctrl->redirect($this, "view");
539 }
540
544 function preview($a_return = false, $a_content = false, $a_show_notes = true)
545 {
546 global $ilSetting, $ilUser;
547
548 $portfolio_id = $this->object->getId();
549 $user_id = $this->object->getOwner();
550
551 $this->tabs_gui->clearTargets();
552
553 $pages = ilPortfolioPage::getAllPages($portfolio_id);
554 $current_page = (int)$_GET["user_page"];
555
556 // validate current page
557 if($pages && $current_page)
558 {
559 $found = false;
560 foreach($pages as $page)
561 {
562 if($page["id"] == $current_page)
563 {
564 $found = true;
565 break;
566 }
567 }
568 if(!$found)
569 {
570 $current_page = null;
571 }
572 }
573
574 // display first page of portfolio if none given
575 if(!$current_page && $pages)
576 {
577 $current_page = $pages;
578 $current_page = array_shift($current_page);
579 $current_page = $current_page["id"];
580 }
581
582 // #13788 - keep page after login
583 if($this->user_id == ANONYMOUS_USER_ID &&
584 $this->getType() == "prtf")
585 {
586 $this->tpl->setLoginTargetPar("prtf_".$this->object->getId()."_".$current_page);
587 }
588
589 $back_caption = "";
590
591 // public profile
592 if($_REQUEST["back_url"])
593 {
594 $back = $_REQUEST["back_url"];
595 }
596 else if($_GET["baseClass"] != "ilPublicUserProfileGUI" &&
597 $this->user_id && $this->user_id != ANONYMOUS_USER_ID)
598 {
599 if(!$this->checkPermissionBool("write"))
600 {
601 // shared
602 if($this->getType() == "prtf")
603 {
604 $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $this->object->getOwner());
605 $back = $this->ctrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "showOther");
606 $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", "");
607 }
608 // listgui / parent container
609 else
610 {
611 // #12819
612 global $tree;
613 $parent_id = $tree->getParentId($this->node_id);
614 include_once "Services/Link/classes/class.ilLink.php";
616 }
617 }
618 // owner
619 else
620 {
621 $back = $this->ctrl->getLinkTarget($this, "view");
622 if($this->getType() == "prtf")
623 {
624 $back_caption = $this->lng->txt("prtf_back_to_portfolio_owner");
625 }
626 else
627 {
628 // #19316
629 $this->lng->loadLanguageModule("prtt");
630 $back_caption = $this->lng->txt("prtt_edit");
631 }
632 }
633 }
634
635 global $ilMainMenu;
636 $ilMainMenu->setMode(ilMainMenuGUI::MODE_TOPBAR_ONLY);
637 if($back)
638 {
639 // might already be set in ilPublicUserProfileGUI
640 $ilMainMenu->setTopBarBack($back, $back_caption);
641 }
642
643 // render tabs
644 $current_blog = null;
645 if(count($pages) > 1)
646 {
647 foreach ($pages as $p)
648 {
649 if($p["type"] == ilPortfolioPage::TYPE_BLOG)
650 {
651 // needed for blog comments (see below)
652 if($p["id"] == $current_page)
653 {
654 $current_blog = (int)$p["title"];
655 }
656 include_once "Modules/Blog/classes/class.ilObjBlog.php";
657 $p["title"] = ilObjBlog::_lookupTitle($p["title"]);
658 }
659
660 $this->ctrl->setParameter($this, "user_page", $p["id"]);
661 $this->tabs_gui->addTab("user_page_".$p["id"],
662 $p["title"],
663 $this->ctrl->getLinkTarget($this, "preview"));
664 }
665
666 $this->tabs_gui->activateTab("user_page_".$current_page);
667 }
668
669 $this->ctrl->setParameter($this, "user_page", $current_page);
670
671 if(!$a_content)
672 {
673 // #18291
674 if($current_page)
675 {
676 // get current page content
677 $page_gui = $this->getPageGUIInstance($current_page);
678 $page_gui->setEmbedded(true);
679
680 $content = $this->ctrl->getHTML($page_gui);
681 }
682 }
683 else
684 {
685 $content = $a_content;
686 }
687
688 if($a_return && $this->checkPermissionBool("write"))
689 {
690 return $content;
691 }
692
693 // blog posting comments are handled within the blog
694 $notes = "";
695 if($a_show_notes && $this->object->hasPublicComments() && !$current_blog && $current_page)
696 {
697 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
698 $note_gui = new ilNoteGUI($portfolio_id, $current_page, "pfpg");
699 $note_gui->setRepositoryMode(false);
700 $note_gui->enablePublicNotes(true);
701 $note_gui->enablePrivateNotes(false);
702
703 $note_gui->enablePublicNotesDeletion(($this->user_id == $user_id) &&
704 $ilSetting->get("comments_del_tutor", 1));
705
706 $next_class = $this->ctrl->getNextClass($this);
707 if ($next_class == "ilnotegui")
708 {
709 $notes = $this->ctrl->forwardCommand($note_gui);
710 }
711 else
712 {
713 $notes = $note_gui->getNotesHTML();
714 }
715 }
716
717 if($this->perma_link === null)
718 {
719 if($this->getType() == "prtf")
720 {
721 $this->tpl->setPermanentLink($this->getType(), $this->object->getId(), "_".$current_page);
722 }
723 else
724 {
725 $this->tpl->setPermanentLink($this->getType(), $this->object->getRefId());
726 }
727 }
728 else
729 {
730 $this->tpl->setPermanentLink($this->perma_link["type"], $this->perma_link["obj_id"]);
731 }
732
733 // #18208 - see ilPortfolioTemplatePageGUI::getPageContentUserId()
734 if($this->getType() == "prtt" && !$this->checkPermissionBool("write"))
735 {
736 $user_id = $ilUser->getId();
737 }
738
739 self::renderFullscreenHeader($this->object, $this->tpl, $user_id);
740
741 // #13564
742 $this->ctrl->setParameter($this, "user_page", "");
743 $this->tpl->setTitleUrl($this->ctrl->getLinkTarget($this, "preview"));
744 $this->ctrl->setParameter($this, "user_page", $this->page_id);
745
746 // blog pages do their own (page) style handling
747 if(!$current_blog)
748 {
749 $content = '<div id="ilCOPageContent" class="ilc_page_cont_PageContainer">'.
750 '<div class="ilc_page_Page">'.
751 $content.
752 '</div></div>';
753
754 $this->setContentStyleSheet($this->tpl);
755 }
756
757 // #10717
758 $this->tpl->setContent($content.
759 '<div class="ilClearFloat">'.$notes.'</div>');
760 }
761
769 public static function renderFullscreenHeader($a_portfolio, $a_tpl, $a_user_id, $a_export = false)
770 {
771 $name = ilObjUser::_lookupName($a_user_id);
772 $name = $name["lastname"].", ".($t = $name["title"] ? $t . " " : "").$name["firstname"];
773
774 // show banner?
775 $banner = $banner_width = $banner_height = false;
776 $prfa_set = new ilSetting("prfa");
777 if($prfa_set->get("banner"))
778 {
779 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
780 $banner = ilWACSignedPath::signFile($a_portfolio->getImageFullPath());
781 $banner_width = $prfa_set->get("banner_width");
782 $banner_height = $prfa_set->get("banner_height");
783 if($a_export)
784 {
785 $banner = basename($banner);
786 }
787 }
788
789 // profile picture
790 $ppic = null;
791 if($a_portfolio->hasProfilePicture())
792 {
793 $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "xsmall", true, true);
794 if($a_export)
795 {
796 $ppic = basename($ppic);
797 }
798 }
799
800 $a_tpl->resetHeaderBlock(false);
801 // $a_tpl->setBackgroundColor($a_portfolio->getBackgroundColor());
802 $a_tpl->setBanner($banner, $banner_width, $banner_height, $a_export);
803 $a_tpl->setTitleIcon($ppic);
804 $a_tpl->setTitle($a_portfolio->getTitle());
805 // $a_tpl->setTitleColor($a_portfolio->getFontColor());
806 $a_tpl->setDescription($name);
807
808 // to get rid of locator in portfolio template preview
809 $a_tpl->setVariable("LOCATOR", "");
810
811 // :TODO: obsolete?
812 // $a_tpl->setBodyClass("std ilExternal ilPortfolio");
813 }
814
815 function export()
816 {
817 include_once "Modules/Portfolio/classes/class.ilPortfolioHTMLExport.php";
818 $export = new ilPortfolioHTMLExport($this, $this->object);
819 $zip = $export->buildExportFile();
820
821 ilUtil::deliverFile($zip, $this->object->getTitle().".zip", '', false, true);
822 }
823
824
828 function copyPageForm($a_form = null)
829 {
830 if (!is_array($_POST["prtf_pages"]) || count($_POST["prtf_pages"]) == 0)
831 {
832 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
833 $this->ctrl->redirect($this, "view");
834 }
835 else
836 {
837 $this->tabs_gui->activateTab("pages");
838
839 if(!$a_form)
840 {
841 $a_form = $this->initCopyPageForm();
842 }
843
844 foreach($_POST["prtf_pages"] as $page_id)
845 {
846 $item = new ilHiddenInputGUI("prtf_pages[]");
847 $item->setValue($page_id);
848 $a_form->addItem($item);
849 }
850
851 $this->tpl->setContent($a_form->getHTML());
852 }
853 }
854
855 function copyPage()
856 {
857 $form = $this->initCopyPageForm();
858 if($form->checkInput())
859 {
860 // existing
861 if($form->getInput("target") == "old")
862 {
863 $portfolio_id = $form->getInput("prtf");
864 }
865 // new
866 else
867 {
868 $portfolio = new ilObjPortfolio();
869 $portfolio->setTitle($form->getInput("title"));
870 $portfolio->create();
871 $portfolio_id = $portfolio->getId();
872 }
873
874 // copy page(s)
875 foreach($_POST["prtf_pages"] as $page_id)
876 {
877 $source = $this->getPageInstance($page_id);
878 $target = $this->getPageInstance(null, $portfolio_id);
879 $target->setXMLContent($source->copyXmlContent(true)); // copy mobs
880 $target->setType($source->getType());
881 $target->setTitle($source->getTitle());
882 $target->create();
883 }
884
885 ilUtil::sendSuccess($this->lng->txt("prtf_pages_copied"), true);
886 $this->ctrl->redirect($this, "view");
887 }
888
889 $form->setValuesByPost();
890 $this->copyPageForm($form);
891 }
892
893 abstract protected function initCopyPageFormOptions(ilFormPropertyGUI $a_tgt);
894
896 {
897 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
898 $form = new ilPropertyFormGUI();
899 $form->setFormAction($this->ctrl->getFormAction($this));
900 $form->setTitle($this->lng->txt("prtf_copy_page"));
901
902 $tgt = new ilRadioGroupInputGUI($this->lng->txt("target"), "target");
903 $tgt->setRequired(true);
904 $form->addItem($tgt);
905
906 $this->initCopyPageFormOptions($tgt);
907
908 $form->addCommandButton("copyPage", $this->lng->txt("save"));
909 $form->addCommandButton("view", $this->lng->txt("cancel"));
910
911 return $form;
912 }
913
914
918
919 function setContentStyleSheet($a_tpl = null)
920 {
921 global $tpl;
922
923 if ($a_tpl != null)
924 {
925 $ctpl = $a_tpl;
926 }
927 else
928 {
929 $ctpl = $tpl;
930 }
931
932 $ctpl->setCurrentBlock("ContentStyle");
933 $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
934 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
935 $ctpl->parseCurrentBlock();
936 }
937
939 {
940 $this->checkPermission("write");
941
942 $this->tabs_gui->activateTab("settings");
943 $this->setSettingsSubTabs("style");
944
945 $form = $this->initStylePropertiesForm();
946 $this->tpl->setContent($form->getHTML());
947 }
948
950 {
951 global $ilSetting;
952
953 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
954 $this->lng->loadLanguageModule("style");
955
956 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
957 $form = new ilPropertyFormGUI();
958
959 $fixed_style = $ilSetting->get("fixed_content_style_id");
960 $style_id = $this->object->getStyleSheetId();
961
962 if ($fixed_style > 0)
963 {
964 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
965 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
966 $this->lng->txt("global_fixed").")");
967 $form->addItem($st);
968 }
969 else
970 {
971 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
972 $_GET["ref_id"]);
973
974 $st_styles[0] = $this->lng->txt("default");
975 ksort($st_styles);
976
977 if ($style_id > 0)
978 {
979 // individual style
980 if (!ilObjStyleSheet::_lookupStandard($style_id))
981 {
982 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
983 $st->setValue(ilObject::_lookupTitle($style_id));
984 $form->addItem($st);
985
986 // delete command
987 $form->addCommandButton("editStyle", $this->lng->txt("style_edit_style"));
988 $form->addCommandButton("deleteStyle", $this->lng->txt("style_delete_style"));
989 }
990 }
991
992 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
993 {
994 $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"),
995 "style_id");
996 $style_sel->setOptions($st_styles);
997 $style_sel->setValue($style_id);
998 $form->addItem($style_sel);
999
1000 $form->addCommandButton("saveStyleSettings", $this->lng->txt("save"));
1001 $form->addCommandButton("createStyle", $this->lng->txt("sty_create_ind_style"));
1002 }
1003 }
1004
1005 $form->setTitle($this->lng->txt($this->getType()."_style"));
1006 $form->setFormAction($this->ctrl->getFormAction($this));
1007
1008 return $form;
1009 }
1010
1011 function createStyle()
1012 {
1013 $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1014 }
1015
1016 function editStyle()
1017 {
1018 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1019 }
1020
1021 function deleteStyle()
1022 {
1023 $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1024 }
1025
1027 {
1028 global $ilSetting;
1029
1030 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1031 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1032 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1033 || $this->object->getStyleSheetId() == 0))
1034 {
1035 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1036 $this->object->update();
1037
1038 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1039 }
1040 $this->ctrl->redirect($this, "editStyleProperties");
1041 }
1042}
1043
1044?>
print $file
$_GET["client_id"]
This class represents a checkbox property in a property form.
Confirmation screen class.
setPersonalWorkspaceQuotaCheck($a_value)
This class represents a property in a property form.
This class represents a hidden form property in a property form.
This class represents an image file property in a property form.
static getInstance()
Factory.
This class represents a non editable value in a property form.
Notes GUI class.
Portfolio view gui base class.
initPageForm($a_mode="create")
Init portfolio page form.
setPermaLink($a_obj_id, $a_type)
Set custom perma link (used in public profile?)
addBlog()
Show portfolio blog page creation form.
addPage()
Show portfolio page creation form.
view()
Show list of portfolio pages.
savePage()
Create new portfolio page.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
getAdditional()
Get Additonal Information.
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
confirmPortfolioPageDeletion()
Confirm portfolio deletion.
initCopyPageFormOptions(ilFormPropertyGUI $a_tgt)
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
copyPageForm($a_form=null)
Select target portfolio for page(s) copy.
deletePortfolioPages()
Delete portfolio pages.
getPageInstance($a_page_id=null, $a_portfolio_id=null)
savePortfolioPagesOrdering()
Save ordering of portfolio pages.
addLocatorItems()
Functions to be overwritten.
static renderFullscreenHeader($a_portfolio, $a_tpl, $a_user_id, $a_export=false)
Render banner, user name.
setAdditional($a_additional)
Set Additonal Information (used in public profile?)
preview($a_return=false, $a_content=false, $a_show_notes=true)
Show user page.
getPageGUIInstance($a_page_id)
getContentStylePath($a_style_id)
get content style path
_getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
_lookupStandard($a_id)
Lookup standard flag.
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
static _lookupName($a_user_id)
lookup user name
New implementation of ilObjectGUI.
getType()
Functions that must be overwritten.
checkPermission($a_perm, $a_cmd="")
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_id)
lookup object title
Class ilPageLayout.
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
static checkExercise($a_user_id, $a_obj_id, $a_add_submit=false)
Portfolio HTML exporter class.
static getAllPages($a_portfolio_id)
Get pages of portfolio.
static fixOrdering($a_portfolio_id)
Fix ordering.
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.
getItemByPostVar($a_post_var)
Get Item by POST variable.
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.
ILIAS Setting Class.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static signFile($path_to_file)
$_POST['username']
Definition: cron.php:12
global $ilSetting
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15