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