ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilPageLayoutGUI.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/COPage/classes/class.ilPageObjectGUI.php");
5include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
6
18{
19 protected $layout_object = null;
20
21
25 function __construct($a_parent_type, $a_id = 0, $a_old_nr = 0, $a_prevent_get_id = false, $a_lang = "")
26 {
27 global $tpl;
28
29 parent::__construct($a_parent_type, $a_id, $a_old_nr, $a_prevent_get_id, $a_lang);
30
31 //associated object
32 include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
33
34 $this->layout_object = new ilPageLayout($a_id);
35 $this->layout_object->readObject();
36
37 // content style
38 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
39 $tpl->setCurrentBlock("ContentStyle");
40 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
41 ilObjStyleSheet::getContentStylePath($this->layout_object->getStyleId()));
42 $tpl->parseCurrentBlock();
43
44 $tpl->setCurrentBlock("SyntaxStyle");
45 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
47 $tpl->setVariable("LOCATION_ADDITIONAL_STYLESHEET",
49 $tpl->parseCurrentBlock();
50
51 $this->setStyleId($this->layout_object->getStyleId());
52
53 }
54
58 function executeCommand()
59 {
60 global $ilCtrl;
61
62 $next_class = $this->ctrl->getNextClass($this);
63 $cmd = $this->ctrl->getCmd();
64
65 switch($next_class)
66 {
67 case 'ilmdeditorgui':
68 return parent::executeCommand();
69 break;
70
71 case "ilpageobjectgui":
72die("ilPageLayoutGUI forward to ilpageobjectgui error.");
73 return;
74
75 default:
76 $html = parent::executeCommand();
77 return $html;
78 }
79 }
80
81 function create(){
82 $this->properties("insert");
83 }
84
90 function properties($a_mode="save", $a_form = null)
91 {
92 global $ilTabs;
93
94 $ilTabs->setTabActive('properties');
95
96 if(!$a_form)
97 {
98 $a_form = $this->initForm($a_mode);
99 }
100
101 $this->tpl->setContent($a_form->getHTML());
102 }
103
104 function initForm($a_mode)
105 {
106 global $ilCtrl, $lng, $ilSetting;
107
108 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
109 $form_gui = new ilPropertyFormGUI();
110 $form_gui->setFormAction($ilCtrl->getFormAction($this));
111 $form_gui->setTitle($lng->txt("cont_ed_pglprop"));
112
113 // title
114 $title_input = new ilTextInputGUI($lng->txt("title"),"pgl_title");
115 $title_input->setSize(50);
116 $title_input->setMaxLength(128);
117 $title_input->setValue($this->layout_object->title);
118 $title_input->setTitle($lng->txt("title"));
119 $title_input->setRequired(true);
120
121 // description
122 $desc_input = new ilTextAreaInputGUI($lng->txt("description"),"pgl_desc");
123 $desc_input->setValue($this->layout_object->description);
124 $desc_input->setRows(3);
125 $desc_input->setCols(37);
126 $desc_input->setTitle($lng->txt("description"));
127 $desc_input->setRequired(false);
128
129 // modules
130 $mods = new ilCheckboxGroupInputGUI($this->lng->txt("modules"), "module");
131 // $mods->setRequired(true);
132 $mods->setValue($this->layout_object->getModules());
133 foreach(ilPageLayout::getAvailableModules() as $mod_id => $mod_caption)
134 {
135 $mod = new ilCheckboxOption($mod_caption, $mod_id);
136 $mods->addOption($mod);
137 }
138
139 $form_gui->addItem($title_input);
140 $form_gui->addItem($desc_input);
141 $form_gui->addItem($mods);
142
143 // style
144 $fixed_style = $ilSetting->get("fixed_content_style_id");
145 $style_id = $this->layout_object->getStyleId();
146
147 if ($fixed_style > 0)
148 {
149 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
150 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
151 $this->lng->txt("global_fixed").")");
152 $form_gui->addItem($st);
153 }
154 else
155 {
156 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
157 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false);
158 $st_styles[0] = $this->lng->txt("default");
159 ksort($st_styles);
160 $style_sel = new ilSelectInputGUI($lng->txt("obj_sty"), "style_id");
161 $style_sel->setOptions($st_styles);
162 $style_sel->setValue($style_id);
163 $form_gui->addItem($style_sel);
164 }
165
166 $form_gui->addCommandButton("updateProperties", $lng->txt($a_mode));
167
168 return $form_gui;
169 }
170
175 {
176 global $lng;
177
178 $form = $this->initForm("save");
179 if(!$form->checkInput())
180 {
181 $form->setValuesByPost();
182 return $this->properties("save", $form);
183 }
184
185 $this->layout_object->setTitle($form->getInput('pgl_title'));
186 $this->layout_object->setDescription($form->getInput('pgl_desc'));
187 $this->layout_object->setStyleId($form->getInput('style_id'));
188 $this->layout_object->setModules($form->getInput('module'));
189 $this->layout_object->update();
190
191 ilUtil::sendInfo($lng->txt("saved_successfully"));
192 $this->properties();
193 }
194
198 function setTabs($a_tabs = "")
199 {
200 global $ilTabs, $ilCtrl, $tpl, $lng;
201
202 $ilCtrl->setParameterByClass("ilpagelayoutgui", "obj_id", $this->obj->id);
203 $ilTabs->addTarget("properties",
204 $ilCtrl->getLinkTarget($this, "properties"), array("properties","", ""), "", "");
205 $tpl->setTitleIcon(ilUtil::getImagePath("icon_pg.svg"));
206 $tpl->setTitle($this->layout_object->getTitle());
207 $tpl->setDescription("");
208 // $tpl->setTitle(
209 // $lng->txt("sahs_page").": ".$this->node_object->getTitle());
210 }
211
212
213}
214?>
An exception for terminatinating execution or to throw for unit testing.
This class represents a property in a property form.
This class represents an option in a checkbox group.
This class represents a non editable value in a property form.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id)
get content style path
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
static _getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static _lookupTitle($a_id)
lookup object title
Class ilPageLayoutGUI GUI class.
executeCommand()
execute command
__construct($a_parent_type, $a_id=0, $a_old_nr=0, $a_prevent_get_id=false, $a_lang="")
Constructor.
properties($a_mode="save", $a_form=null)
Edit page layout properties.
setTabs($a_tabs="")
output tabs
updateProperties()
Update properties.
Class ilPageLayout.
static getAvailableModules()
Class ilPageObjectGUI.
setStyleId($a_styleid)
Set Style Id.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
$cmd
Definition: sahs_server.php:35