ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once('./Services/Object/classes/class.ilObject2GUI.php');
5 include_once('./Modules/Portfolio/classes/class.ilObjPortfolio.php');
6 include_once('./Modules/Portfolio/classes/class.ilPortfolioPage.php');
7 
16 abstract 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  {
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
99  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
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/COPage/Layout/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/COPage/Layout/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::getAllPortfolioPages($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  global $ilUser;
772 
773  if(!$a_export)
774  {
775  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
777  $a_portfolio->getType(),
778  ($a_portfolio->getType() == "prtt")
779  ? $a_portfolio->getRefId()
780  : $a_portfolio->getId(),
781  $a_portfolio->getId(),
782  $ilUser->getId()
783  );
784  }
785 
786  $name = ilObjUser::_lookupName($a_user_id);
787  $name = $name["lastname"].", ".($t = $name["title"] ? $t . " " : "").$name["firstname"];
788 
789  // show banner?
790  $banner = $banner_width = $banner_height = false;
791  $prfa_set = new ilSetting("prfa");
792  if($prfa_set->get("banner"))
793  {
794  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
795  $banner = ilWACSignedPath::signFile($a_portfolio->getImageFullPath());
796  $banner_width = $prfa_set->get("banner_width");
797  $banner_height = $prfa_set->get("banner_height");
798  if($a_export)
799  {
800  $banner = basename($banner);
801  }
802  }
803 
804  // profile picture
805  $ppic = null;
806  if($a_portfolio->hasProfilePicture())
807  {
808  $ppic = ilObjUser::_getPersonalPicturePath($a_user_id, "xsmall", true, true);
809  if($a_export)
810  {
811  $ppic = basename($ppic);
812  }
813  }
814 
815  $a_tpl->resetHeaderBlock(false);
816  // $a_tpl->setBackgroundColor($a_portfolio->getBackgroundColor());
817  $a_tpl->setBanner($banner, $banner_width, $banner_height, $a_export);
818  $a_tpl->setTitleIcon($ppic);
819  $a_tpl->setTitle($a_portfolio->getTitle());
820  // $a_tpl->setTitleColor($a_portfolio->getFontColor());
821  $a_tpl->setDescription($name);
822 
823  // to get rid of locator in portfolio template preview
824  $a_tpl->setVariable("LOCATOR", "");
825 
826  // :TODO: obsolete?
827  // $a_tpl->setBodyClass("std ilExternal ilPortfolio");
828  }
829 
830  function export()
831  {
832  include_once "Modules/Portfolio/classes/class.ilPortfolioHTMLExport.php";
833  $export = new ilPortfolioHTMLExport($this, $this->object);
834  $zip = $export->buildExportFile();
835 
836  ilUtil::deliverFile($zip, $this->object->getTitle().".zip", '', false, true);
837  }
838 
839 
843  function copyPageForm($a_form = null)
844  {
845  if (!is_array($_POST["prtf_pages"]) || count($_POST["prtf_pages"]) == 0)
846  {
847  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
848  $this->ctrl->redirect($this, "view");
849  }
850  else
851  {
852  $this->tabs_gui->activateTab("pages");
853 
854  if(!$a_form)
855  {
856  $a_form = $this->initCopyPageForm();
857  }
858 
859  foreach($_POST["prtf_pages"] as $page_id)
860  {
861  $item = new ilHiddenInputGUI("prtf_pages[]");
862  $item->setValue($page_id);
863  $a_form->addItem($item);
864  }
865 
866  $this->tpl->setContent($a_form->getHTML());
867  }
868  }
869 
870  function copyPage()
871  {
872  $form = $this->initCopyPageForm();
873  if($form->checkInput())
874  {
875  // existing
876  if($form->getInput("target") == "old")
877  {
878  $portfolio_id = $form->getInput("prtf");
879  }
880  // new
881  else
882  {
883  $portfolio = new ilObjPortfolio();
884  $portfolio->setTitle($form->getInput("title"));
885  $portfolio->create();
886  $portfolio_id = $portfolio->getId();
887  }
888 
889  // copy page(s)
890  foreach($_POST["prtf_pages"] as $page_id)
891  {
892  $source = $this->getPageInstance($page_id);
893  $target = $this->getPageInstance(null, $portfolio_id);
894  $target->setXMLContent($source->copyXmlContent(true)); // copy mobs
895  $target->setType($source->getType());
896  $target->setTitle($source->getTitle());
897  $target->create();
898  }
899 
900  ilUtil::sendSuccess($this->lng->txt("prtf_pages_copied"), true);
901  $this->ctrl->redirect($this, "view");
902  }
903 
904  $form->setValuesByPost();
905  $this->copyPageForm($form);
906  }
907 
908  abstract protected function initCopyPageFormOptions(ilPropertyFormGUI $a_form);
909 
910  function initCopyPageForm()
911  {
912  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
913  $form = new ilPropertyFormGUI();
914  $form->setFormAction($this->ctrl->getFormAction($this));
915  $form->setTitle($this->lng->txt("prtf_copy_page"));
916 
917  $this->initCopyPageFormOptions($form);
918 
919  $form->addCommandButton("copyPage", $this->lng->txt("save"));
920  $form->addCommandButton("view", $this->lng->txt("cancel"));
921 
922  return $form;
923  }
924 
925 
929 
930  function setContentStyleSheet($a_tpl = null)
931  {
932  global $tpl;
933 
934  if ($a_tpl != null)
935  {
936  $ctpl = $a_tpl;
937  }
938  else
939  {
940  $ctpl = $tpl;
941  }
942 
943  $ctpl->setCurrentBlock("ContentStyle");
944  $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
945  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
946  $ctpl->parseCurrentBlock();
947  }
948 
950  {
951  $this->checkPermission("write");
952 
953  $this->tabs_gui->activateTab("settings");
954  $this->setSettingsSubTabs("style");
955 
956  $form = $this->initStylePropertiesForm();
957  $this->tpl->setContent($form->getHTML());
958  }
959 
961  {
962  global $ilSetting;
963 
964  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
965  $this->lng->loadLanguageModule("style");
966 
967  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
968  $form = new ilPropertyFormGUI();
969 
970  $fixed_style = $ilSetting->get("fixed_content_style_id");
971  $style_id = $this->object->getStyleSheetId();
972 
973  if ($fixed_style > 0)
974  {
975  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
976  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
977  $this->lng->txt("global_fixed").")");
978  $form->addItem($st);
979  }
980  else
981  {
982  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
983  $_GET["ref_id"]);
984 
985  $st_styles[0] = $this->lng->txt("default");
986  ksort($st_styles);
987 
988  if ($style_id > 0)
989  {
990  // individual style
991  if (!ilObjStyleSheet::_lookupStandard($style_id))
992  {
993  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
994  $st->setValue(ilObject::_lookupTitle($style_id));
995  $form->addItem($st);
996 
997  // delete command
998  $form->addCommandButton("editStyle", $this->lng->txt("style_edit_style"));
999  $form->addCommandButton("deleteStyle", $this->lng->txt("style_delete_style"));
1000  }
1001  }
1002 
1003  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1004  {
1005  $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"),
1006  "style_id");
1007  $style_sel->setOptions($st_styles);
1008  $style_sel->setValue($style_id);
1009  $form->addItem($style_sel);
1010 
1011  $form->addCommandButton("saveStyleSettings", $this->lng->txt("save"));
1012  $form->addCommandButton("createStyle", $this->lng->txt("sty_create_ind_style"));
1013  }
1014  }
1015 
1016  $form->setTitle($this->lng->txt($this->getType()."_style"));
1017  $form->setFormAction($this->ctrl->getFormAction($this));
1018 
1019  return $form;
1020  }
1021 
1022  function createStyle()
1023  {
1024  $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1025  }
1026 
1027  function editStyle()
1028  {
1029  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1030  }
1031 
1032  function deleteStyle()
1033  {
1034  $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1035  }
1036 
1038  {
1039  global $ilSetting;
1040 
1041  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1042  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1043  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1044  || $this->object->getStyleSheetId() == 0))
1045  {
1046  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1047  $this->object->update();
1048 
1049  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1050  }
1051  $this->ctrl->redirect($this, "editStyleProperties");
1052  }
1053 }
1054 
1055 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupName($a_user_id)
lookup user name
static getAllPortfolioPages($a_portfolio_id)
Get pages of portfolio.
This class represents an option in a radio group.
ILIAS Setting Class.
setTitle($a_title)
Set Title.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
confirmPortfolioPageDeletion()
Confirm portfolio deletion.
getItemByPostVar($a_post_var)
Get Item by POST variable.
static _lookupTitle($a_id)
This class represents a selection list property in a property form.
Portfolio HTML exporter class.
This class represents a property form user interface.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
view()
Show list of portfolio pages.
$_GET["client_id"]
setPermaLink($a_obj_id, $a_type)
Set custom perma link (used in public profile?)
static _getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
This class represents a checkbox property in a property form.
static fixOrdering($a_portfolio_id)
Fix ordering.
addPage()
Show portfolio page creation form.
static _lookupTitle($a_id)
lookup object title
addItem($a_item)
Add Item (Property, SectionHeader).
savePage()
Create new portfolio page.
Class ilPageLayout.
static _lookupStandard($a_id)
Lookup standard flag.
Notes GUI class.
deletePortfolioPages()
Delete portfolio pages.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$a_type
Definition: workflow.php:93
savePortfolioPagesOrdering()
Save ordering of portfolio pages.
This class represents a hidden form property in a property form.
This class represents a property in a property form.
$a_content
Definition: workflow.php:94
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
static setPersonalWorkspaceQuotaCheck($a_value)
setAdditional($a_additional)
Set Additonal Information (used in public profile?)
getType()
Functions that must be overwritten.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
getAdditional()
Get Additonal Information.
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
This class represents a text property in a property form.
initPageForm($a_mode="create")
Init portfolio page form.
$ilUser
Definition: imgupload.php:18
static _recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static signFile($path_to_file)
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
setOptions($a_options)
Set Options.
addBlog()
Show portfolio blog page creation form.
Create styles array
The data for the language used.
getPageGUIInstance($a_page_id)
Portfolio view gui base class.
static getContentStylePath($a_style_id)
get content style path
This class represents an image file property in a property form.
static checkExercise($a_user_id, $a_obj_id, $a_add_submit=false)
This class represents a non editable value in a property form.
static renderFullscreenHeader($a_portfolio, $a_tpl, $a_user_id, $a_export=false)
Render banner, user name.
Create new PHPExcel object
obj_idprivate
global $ilSetting
Definition: privfeed.php:17
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
$ret
Definition: parser.php:6
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
getPageInstance($a_page_id=null, $a_portfolio_id=null)
initEditCustomForm(ilPropertyFormGUI $a_form)
preview($a_return=false, $a_content=false, $a_show_notes=true)
Show user page.
updateCustom(ilPropertyFormGUI $a_form)
$_POST["username"]
setRequired($a_required)
Set Required.
copyPageForm($a_form=null)
Select target portfolio for page(s) copy.
Confirmation screen class.