ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 // general properties
168 $this->tabs_gui->addSubTab("properties",
169 $this->lng->txt($this->getType()."_properties"),
170 $this->ctrl->getLinkTarget($this, 'edit'));
171
172 $this->tabs_gui->addSubTab("style",
173 $this->lng->txt("obj_sty"),
174 $this->ctrl->getLinkTarget($this, 'editStyleProperties'));
175
176 $this->tabs_gui->activateSubTab($a_active);
177 }
178
179 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
180 {
181 $this->setSettingsSubTabs("properties");
182
183 // comments
184 $comments = new ilCheckboxInputGUI($this->lng->txt("prtf_public_comments"), "comments");
185 $a_form->addItem($comments);
186
187 // profile picture
188 $ppic = new ilCheckboxInputGUI($this->lng->txt("prtf_profile_picture"), "ppic");
189 $a_form->addItem($ppic);
190
191 $prfa_set = new ilSetting("prfa");
192 if($prfa_set->get("banner"))
193 {
194 include_once "Services/Form/classes/class.ilFileInputGUI.php";
196
197 $dimensions = " (".$prfa_set->get("banner_width")."x".
198 $prfa_set->get("banner_height").")";
199
200 $img = new ilImageFileInputGUI($this->lng->txt("prtf_banner").$dimensions, "banner");
201 $a_form->addItem($img);
202
203 // show existing file
204 $file = $this->object->getImageFullPath(true);
205 if($file)
206 {
207 $img->setImage($file);
208 }
209 }
210
211 /* #15000
212 $bg_color = new ilColorPickerInputGUI($this->lng->txt("prtf_background_color"), "bg_color");
213 $a_form->addItem($bg_color);
214
215 $font_color = new ilColorPickerInputGUI($this->lng->txt("prtf_font_color"), "font_color");
216 $a_form->addItem($font_color);
217 */
218 }
219
220 protected function getEditFormCustomValues(array &$a_values)
221 {
222 $a_values["comments"] = $this->object->hasPublicComments();
223 $a_values["ppic"] = $this->object->hasProfilePicture();
224 /*
225 $a_values["bg_color"] = $this->object->getBackgroundColor();
226 $a_values["font_color"] = $this->object->getFontColor();
227 */
228 }
229
230 public function updateCustom(ilPropertyFormGUI $a_form)
231 {
232 $this->object->setPublicComments($a_form->getInput("comments"));
233 $this->object->setProfilePicture($a_form->getInput("ppic"));
234 /*
235 $this->object->setBackgroundColor($a_form->getInput("bg_color"));
236 $this->object->setFontcolor($a_form->getInput("font_color"));
237 */
238
239 $prfa_set = new ilSetting("prfa");
240
241 if($_FILES["banner"]["tmp_name"])
242 {
243 $this->object->uploadImage($_FILES["banner"]);
244 }
245 else if($prfa_set->get('banner') and $a_form->getItemByPostVar("banner")->getDeletionFlag())
246 {
247 $this->object->deleteImage();
248 }
249 }
250
251
252 //
253 // PAGES
254 //
255
256 abstract protected function getPageInstance($a_page_id = null, $a_portfolio_id = null);
257
258 abstract protected function getPageGUIInstance($a_page_id);
259
260 abstract public function getPageGUIClassName();
261
265 public function view()
266 {
267 global $ilToolbar, $ilSetting, $tree;
268
269 if(!$this->checkPermissionBool("write"))
270 {
271 $this->ctrl->redirect($this, "infoScreen");
272 }
273
274 $this->tabs_gui->activateTab("pages");
275
276 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
277
278 $button = ilLinkButton::getInstance();
279 $button->setCaption("prtf_add_page");
280 $button->setUrl($this->ctrl->getLinkTarget($this, "addPage"));
281 $ilToolbar->addButtonInstance($button);
282
283 if(!$ilSetting->get('disable_wsp_blogs'))
284 {
285 $button = ilLinkButton::getInstance();
286 $button->setCaption("prtf_add_blog");
287 $button->setUrl($this->ctrl->getLinkTarget($this, "addBlog"));
288 $ilToolbar->addButtonInstance($button);
289 }
290
291 $ilToolbar->addSeparator();
292
293 $button = ilLinkButton::getInstance();
294 $button->setCaption("export_html");
295 $button->setUrl($this->ctrl->getLinkTarget($this, "export"));
296 $ilToolbar->addButtonInstance($button);
297
298 include_once "Modules/Portfolio/classes/class.ilPortfolioPageTableGUI.php";
299 $table = new ilPortfolioPageTableGUI($this, "view");
300
301 // exercise portfolio?
302 include_once "Modules/Exercise/classes/class.ilObjExercise.php";
303 $exercises = ilObjExercise::findUserFiles($this->user_id, $this->object->getId());
304 if($exercises)
305 {
306 $info = array();
307 foreach($exercises as $exercise)
308 {
309 // #9988
310 $active_ref = false;
311 foreach(ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id)
312 {
313 if(!$tree->isSaved($ref_id))
314 {
315 $active_ref = true;
316 break;
317 }
318 }
319 if($active_ref)
320 {
321 $part = $this->getExerciseInfo($exercise["ass_id"], $table->dataExists());
322 if($part)
323 {
324 $info[] = $part;
325 }
326 }
327 }
328 if(sizeof($info))
329 {
330 ilUtil::sendInfo(implode("<br />", $info));
331 }
332 }
333
334 $this->tpl->setContent($table->getHTML());
335 }
336
340 protected function addPage()
341 {
342 global $ilHelp;
343
344 $this->tabs_gui->clearTargets();
345 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
346 $this->ctrl->getLinkTarget($this, "view"));
347
348 $ilHelp->setScreenIdComponent("prtf");
349 $ilHelp->setScreenId("add_page");
350
351
352 $form = $this->initPageForm("create");
353 $this->tpl->setContent($form->getHTML());
354 }
355
362 public function initPageForm($a_mode = "create")
363 {
364 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
365 $form = new ilPropertyFormGUI();
366 $form->setFormAction($this->ctrl->getFormAction($this));
367
368 // title
369 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
370 $ti->setMaxLength(200);
371 $ti->setRequired(true);
372 $form->addItem($ti);
373
374 // save and cancel commands
375 if ($a_mode == "create")
376 {
377 include_once "Services/Style/classes/class.ilPageLayout.php";
379 if($templates)
380 {
381 $use_template = new ilRadioGroupInputGUI($this->lng->txt("prtf_use_page_layout"), "tmpl");
382 $use_template->setRequired(true);
383 $form->addItem($use_template);
384
385 $opt = new ilRadioOption($this->lng->txt("none"), 0);
386 $use_template->addOption($opt);
387
388 foreach ($templates as $templ)
389 {
390 $templ->readObject();
391
392 $opt = new ilRadioOption($templ->getTitle().$templ->getPreview(), $templ->getId());
393 $use_template->addOption($opt);
394 }
395 }
396
397 $form->setTitle($this->lng->txt("prtf_add_page").": ".
398 $this->object->getTitle());
399 $form->addCommandButton("savePage", $this->lng->txt("save"));
400 $form->addCommandButton("view", $this->lng->txt("cancel"));
401 }
402 else
403 {
404 /* edit is done directly in table gui
405 $form->setTitle($this->lng->txt("prtf_edit_page"));
406 $form->addCommandButton("updatePage", $this->lng->txt("save"));
407 $form->addCommandButton("view", $this->lng->txt("cancel"));
408 */
409 }
410
411 return $form;
412 }
413
417 public function savePage()
418 {
419 $form = $this->initPageForm("create");
420 if ($form->checkInput() && $this->checkPermissionBool("write"))
421 {
422 include_once("Modules/Portfolio/classes/class.ilPortfolioPage.php");
423 $page = $this->getPageInstance();
424 $page->setType(ilPortfolioPage::TYPE_PAGE);
425 $page->setTitle($form->getInput("title"));
426
427 // use template as basis
428 $layout_id = $form->getInput("tmpl");
429 if($layout_id)
430 {
431 include_once("./Services/Style/classes/class.ilPageLayout.php");
432 $layout_obj = new ilPageLayout($layout_id);
433 $page->setXMLContent($layout_obj->getXMLContent());
434 }
435
436 $page->create();
437
438 ilUtil::sendSuccess($this->lng->txt("prtf_page_created"), true);
439 $this->ctrl->redirect($this, "view");
440 }
441
442 $this->tabs_gui->clearTargets();
443 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
444 $this->ctrl->getLinkTarget($this, "view"));
445
446 $form->setValuesByPost();
447 $this->tpl->setContent($form->getHtml());
448 }
449
453 protected function addBlog()
454 {
455 global $ilHelp;
456
457 $this->tabs_gui->clearTargets();
458 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
459 $this->ctrl->getLinkTarget($this, "view"));
460
461 $ilHelp->setScreenIdComponent("prtf");
462 $ilHelp->setScreenId("add_blog");
463
464 $form = $this->initBlogForm();
465 $this->tpl->setContent($form->getHTML());
466 }
467
468 abstract protected function initBlogForm();
469
470 abstract protected function saveBlog();
471
476 {
477 if(!$this->checkPermissionBool("write"))
478 {
479 return;
480 }
481
482 if (is_array($_POST["order"]))
483 {
484 foreach ($_POST["order"] as $k => $v)
485 {
486 $page = $this->getPageInstance(ilUtil::stripSlashes($k));
487 if($_POST["title"][$k])
488 {
489 $page->setTitle(ilUtil::stripSlashes($_POST["title"][$k]));
490 }
491 $page->setOrderNr(ilUtil::stripSlashes($v));
492 $page->update();
493 }
494 ilPortfolioPage::fixOrdering($this->object->getId());
495 }
496
497 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
498 $this->ctrl->redirect($this, "view");
499 }
500
505 {
506 if (!is_array($_POST["prtf_pages"]) || count($_POST["prtf_pages"]) == 0)
507 {
508 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
509 $this->ctrl->redirect($this, "view");
510 }
511 else
512 {
513 $this->tabs_gui->activateTab("pages");
514
515 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
516 $cgui = new ilConfirmationGUI();
517 $cgui->setFormAction($this->ctrl->getFormAction($this));
518 $cgui->setHeaderText($this->lng->txt("prtf_sure_delete_portfolio_pages"));
519 $cgui->setCancel($this->lng->txt("cancel"), "view");
520 $cgui->setConfirm($this->lng->txt("delete"), "deletePortfolioPages");
521
522 foreach ($_POST["prtf_pages"] as $id)
523 {
524 $page = $this->getPageInstance($id);
525 $title = $page->getTitle();
526 if($page->getType() == ilPortfolioPage::TYPE_BLOG)
527 {
528 $title = $this->lng->txt("obj_blog").": ".ilObject::_lookupTitle((int)$title);
529 }
530 $cgui->addItem("prtf_pages[]", $id, $title);
531 }
532
533 $this->tpl->setContent($cgui->getHTML());
534 }
535 }
536
541 {
542 if(!$this->checkPermissionBool("write"))
543 {
544 return;
545 }
546
547 if (is_array($_POST["prtf_pages"]))
548 {
549 foreach ($_POST["prtf_pages"] as $id)
550 {
551 $page = $this->getPageInstance($id);
552 $page->delete();
553 }
554 }
555 ilUtil::sendSuccess($this->lng->txt("prtf_portfolio_page_deleted"), true);
556 $this->ctrl->redirect($this, "view");
557 }
558
562 function preview($a_return = false, $a_content = false, $a_show_notes = true)
563 {
564 global $ilSetting;
565
566 $portfolio_id = $this->object->getId();
567 $user_id = $this->object->getOwner();
568
569 $this->tabs_gui->clearTargets();
570
571 $pages = ilPortfolioPage::getAllPages($portfolio_id);
572 $current_page = (int)$_GET["user_page"];
573
574 // validate current page
575 if($pages && $current_page)
576 {
577 $found = false;
578 foreach($pages as $page)
579 {
580 if($page["id"] == $current_page)
581 {
582 $found = true;
583 break;
584 }
585 }
586 if(!$found)
587 {
588 $current_page = null;
589 }
590 }
591
592 // display first page of portfolio if none given
593 if(!$current_page && $pages)
594 {
595 $current_page = $pages;
596 $current_page = array_shift($current_page);
597 $current_page = $current_page["id"];
598 }
599
600 // #13788 - keep page after login
601 if($this->user_id == ANONYMOUS_USER_ID &&
602 $this->getType() == "prtf")
603 {
604 $this->tpl->setLoginTargetPar("prtf_".$this->object->getId()."_".$current_page);
605 }
606
607 // public profile
608 if($_REQUEST["back_url"])
609 {
610 $back = $_REQUEST["back_url"];
611 }
612 else if($_GET["baseClass"] != "ilPublicUserProfileGUI" &&
613 $this->user_id && $this->user_id != ANONYMOUS_USER_ID)
614 {
615 if(!$this->checkPermissionBool("write"))
616 {
617 // shared
618 if($this->getType() == "prtf")
619 {
620 $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $this->object->getOwner());
621 $back = $this->ctrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "showOther");
622 $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", "");
623 }
624 // listgui / parent container
625 else
626 {
627 // #12819
628 global $tree;
629 $parent_id = $tree->getParentId($this->node_id);
630 include_once "Services/Link/classes/class.ilLink.php";
632 }
633 }
634 // owner
635 else
636 {
637 $back = $this->ctrl->getLinkTarget($this, "view");
638 }
639 }
640
641 global $ilMainMenu;
642 $ilMainMenu->setMode(ilMainMenuGUI::MODE_TOPBAR_ONLY);
643 if($back)
644 {
645 // might already be set in ilPublicUserProfileGUI
646 $ilMainMenu->setTopBarBack($back);
647 }
648
649 // render tabs
650 $current_blog = null;
651 if(count($pages) > 1)
652 {
653 foreach ($pages as $p)
654 {
655 if($p["type"] == ilPortfolioPage::TYPE_BLOG)
656 {
657 // needed for blog comments (see below)
658 if($p["id"] == $current_page)
659 {
660 $current_blog = (int)$p["title"];
661 }
662 include_once "Modules/Blog/classes/class.ilObjBlog.php";
663 $p["title"] = ilObjBlog::_lookupTitle($p["title"]);
664 }
665
666 $this->ctrl->setParameter($this, "user_page", $p["id"]);
667 $this->tabs_gui->addTab("user_page_".$p["id"],
668 $p["title"],
669 $this->ctrl->getLinkTarget($this, "preview"));
670 }
671
672 $this->tabs_gui->activateTab("user_page_".$current_page);
673 }
674
675 $this->ctrl->setParameter($this, "user_page", $current_page);
676
677 if(!$a_content)
678 {
679 // get current page content
680 $page_gui = $this->getPageGUIInstance($current_page);
681 $page_gui->setEmbedded(true);
682
683 $content = $this->ctrl->getHTML($page_gui);
684 }
685 else
686 {
687 $content = $a_content;
688 }
689
690 if($a_return && $this->checkPermissionBool("write"))
691 {
692 return $content;
693 }
694
695 // blog posting comments are handled within the blog
696 $notes = "";
697 if($a_show_notes && $this->object->hasPublicComments() && !$current_blog)
698 {
699 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
700 $note_gui = new ilNoteGUI($portfolio_id, $current_page, "pfpg");
701 $note_gui->setRepositoryMode(false);
702 $note_gui->enablePublicNotes(true);
703 $note_gui->enablePrivateNotes(false);
704
705 $note_gui->enablePublicNotesDeletion(($this->user_id == $user_id) &&
706 $ilSetting->get("comments_del_tutor", 1));
707
708 $next_class = $this->ctrl->getNextClass($this);
709 if ($next_class == "ilnotegui")
710 {
711 $notes = $this->ctrl->forwardCommand($note_gui);
712 }
713 else
714 {
715 $notes = $note_gui->getNotesHTML();
716 }
717 }
718
719 if($this->perma_link === null)
720 {
721 if($this->getType() == "prtf")
722 {
723 $this->tpl->setPermanentLink($this->getType(), $this->object->getId(), "_".$current_page);
724 }
725 else
726 {
727 $this->tpl->setPermanentLink($this->getType(), $this->object->getRefId());
728 }
729 }
730 else
731 {
732 $this->tpl->setPermanentLink($this->perma_link["type"], $this->perma_link["obj_id"]);
733 }
734
735 self::renderFullscreenHeader($this->object, $this->tpl, $user_id);
736
737 // #13564
738 $this->ctrl->setParameter($this, "user_page", "");
739 $this->tpl->setTitleUrl($this->ctrl->getLinkTarget($this, "preview"));
740 $this->ctrl->setParameter($this, "user_page", $this->page_id);
741
742 // blog pages do their own (page) style handling
743 if(!$current_blog)
744 {
745 $content = '<div id="ilCOPageContent" class="ilc_page_cont_PageContainer">'.
746 '<div class="ilc_page_Page">'.
747 $content.
748 '</div></div>';
749
750 $this->setContentStyleSheet($this->tpl);
751 }
752
753 // #10717
754 $this->tpl->setContent($content.
755 '<div class="ilClearFloat">'.$notes.'</div>');
756 }
757
765 public static function renderFullscreenHeader($a_portfolio, $a_tpl, $a_user_id, $a_export = false)
766 {
767 $name = ilObjUser::_lookupName($a_user_id);
768 $name = $name["lastname"].", ".($t = $name["title"] ? $t . " " : "").$name["firstname"];
769
770 // show banner?
771 $banner = $banner_width = $banner_height = false;
772 $prfa_set = new ilSetting("prfa");
773 if($prfa_set->get("banner"))
774 {
775 $banner = $a_portfolio->getImageFullPath();
776 $banner_width = $prfa_set->get("banner_width");
777 $banner_height = $prfa_set->get("banner_height");
778 if($a_export)
779 {
780 $banner = basename($banner);
781 }
782 }
783
784 // profile picture
785 $ppic = null;
786 if($a_portfolio->hasProfilePicture())
787 {
788 $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "xsmall", true, true);
789 if($a_export)
790 {
791 $ppic = basename($ppic);
792 }
793 }
794
795 $a_tpl->resetHeaderBlock(false);
796 // $a_tpl->setBackgroundColor($a_portfolio->getBackgroundColor());
797 $a_tpl->setBanner($banner, $banner_width, $banner_height, $a_export);
798 $a_tpl->setTitleIcon($ppic);
799 $a_tpl->setTitle($a_portfolio->getTitle());
800 // $a_tpl->setTitleColor($a_portfolio->getFontColor());
801 $a_tpl->setDescription($name);
802
803 // to get rid of locator in portfolio template preview
804 $a_tpl->setVariable("LOCATOR", "");
805
806 // :TODO: obsolete?
807 // $a_tpl->setBodyClass("std ilExternal ilPortfolio");
808 }
809
810 function export()
811 {
812 include_once "Modules/Portfolio/classes/class.ilPortfolioHTMLExport.php";
813 $export = new ilPortfolioHTMLExport($this, $this->object);
814 $zip = $export->buildExportFile();
815
816 ilUtil::deliverFile($zip, $this->object->getTitle().".zip", '', false, true);
817 }
818
819
823 function copyPageForm($a_form = null)
824 {
825 if (!is_array($_POST["prtf_pages"]) || count($_POST["prtf_pages"]) == 0)
826 {
827 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
828 $this->ctrl->redirect($this, "view");
829 }
830 else
831 {
832 $this->tabs_gui->activateTab("pages");
833
834 if(!$a_form)
835 {
836 $a_form = $this->initCopyPageForm();
837 }
838
839 foreach($_POST["prtf_pages"] as $page_id)
840 {
841 $item = new ilHiddenInputGUI("prtf_pages[]");
842 $item->setValue($page_id);
843 $a_form->addItem($item);
844 }
845
846 $this->tpl->setContent($a_form->getHTML());
847 }
848 }
849
850 function copyPage()
851 {
852 $form = $this->initCopyPageForm();
853 if($form->checkInput())
854 {
855 // existing
856 if($form->getInput("target") == "old")
857 {
858 $portfolio_id = $form->getInput("prtf");
859 }
860 // new
861 else
862 {
863 $portfolio = new ilObjPortfolio();
864 $portfolio->setTitle($form->getInput("title"));
865 $portfolio->create();
866 $portfolio_id = $portfolio->getId();
867 }
868
869 // copy page(s)
870 foreach($_POST["prtf_pages"] as $page_id)
871 {
872 $source = $this->getPageInstance($page_id);
873 $target = $this->getPageInstance(null, $portfolio_id);
874 $target->setXMLContent($source->copyXmlContent(true)); // copy mobs
875 $target->setType($source->getType());
876 $target->setTitle($source->getTitle());
877 $target->create();
878 }
879
880 ilUtil::sendSuccess($this->lng->txt("prtf_pages_copied"), true);
881 $this->ctrl->redirect($this, "view");
882 }
883
884 $form->setValuesByPost();
885 $this->copyPageForm($form);
886 }
887
888 abstract protected function initCopyPageFormOptions(ilFormPropertyGUI $a_tgt);
889
891 {
892 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
893 $form = new ilPropertyFormGUI();
894 $form->setFormAction($this->ctrl->getFormAction($this));
895 $form->setTitle($this->lng->txt("prtf_copy_page"));
896
897 $tgt = new ilRadioGroupInputGUI($this->lng->txt("target"), "target");
898 $tgt->setRequired(true);
899 $form->addItem($tgt);
900
901 $this->initCopyPageFormOptions($tgt);
902
903 $form->addCommandButton("copyPage", $this->lng->txt("save"));
904 $form->addCommandButton("view", $this->lng->txt("cancel"));
905
906 return $form;
907 }
908
909
913
914 function setContentStyleSheet($a_tpl = null)
915 {
916 global $tpl;
917
918 if ($a_tpl != null)
919 {
920 $ctpl = $a_tpl;
921 }
922 else
923 {
924 $ctpl = $tpl;
925 }
926
927 $ctpl->setCurrentBlock("ContentStyle");
928 $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
929 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
930 $ctpl->parseCurrentBlock();
931 }
932
934 {
935 $this->checkPermission("write");
936
937 $this->tabs_gui->activateTab("settings");
938 $this->setSettingsSubTabs("style");
939
940 $form = $this->initStylePropertiesForm();
941 $this->tpl->setContent($form->getHTML());
942 }
943
945 {
946 global $ilSetting;
947
948 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
949 $this->lng->loadLanguageModule("style");
950
951 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
952 $form = new ilPropertyFormGUI();
953
954 $fixed_style = $ilSetting->get("fixed_content_style_id");
955 $style_id = $this->object->getStyleSheetId();
956
957 if ($fixed_style > 0)
958 {
959 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
960 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
961 $this->lng->txt("global_fixed").")");
962 $form->addItem($st);
963 }
964 else
965 {
966 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
967 $_GET["ref_id"]);
968
969 $st_styles[0] = $this->lng->txt("default");
970 ksort($st_styles);
971
972 if ($style_id > 0)
973 {
974 // individual style
975 if (!ilObjStyleSheet::_lookupStandard($style_id))
976 {
977 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
978 $st->setValue(ilObject::_lookupTitle($style_id));
979 $form->addItem($st);
980
981 // delete command
982 $form->addCommandButton("editStyle", $this->lng->txt("style_edit_style"));
983 $form->addCommandButton("deleteStyle", $this->lng->txt("style_delete_style"));
984 }
985 }
986
987 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
988 {
989 $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"),
990 "style_id");
991 $style_sel->setOptions($st_styles);
992 $style_sel->setValue($style_id);
993 $form->addItem($style_sel);
994
995 $form->addCommandButton("saveStyleSettings", $this->lng->txt("save"));
996 $form->addCommandButton("createStyle", $this->lng->txt("sty_create_ind_style"));
997 }
998 }
999
1000 $form->setTitle($this->lng->txt($this->getType()."_style"));
1001 $form->setFormAction($this->ctrl->getFormAction($this));
1002
1003 return $form;
1004 }
1005
1006 function createStyle()
1007 {
1008 $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1009 }
1010
1011 function editStyle()
1012 {
1013 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1014 }
1015
1016 function deleteStyle()
1017 {
1018 $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1019 }
1020
1022 {
1023 global $ilSetting;
1024
1025 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1026 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1027 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1028 || $this->object->getStyleSheetId() == 0))
1029 {
1030 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1031 $this->object->update();
1032
1033 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1034 }
1035 $this->ctrl->redirect($this, "editStyleProperties");
1036 }
1037}
1038
1039?>
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.
static findUserFiles($a_user_id, $a_filetitle)
Check if given file was assigned.
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
static _getAllReferences($a_id)
get all reference ids of object
Class ilPageLayout.
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
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.
$_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