ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPageLayoutGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("./Services/COPage/classes/class.ilPageObjectGUI.php");
25 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
26 
38 {
43  var $layout_object = null;
44 
45 
46  function __construct($a_parent_type, $a_id = 0, $a_old_nr = 0, $a_slm_id = 0)
47  {
48  global $tpl,$ilCtrl;
49 
50  parent::__construct($a_parent_type, $a_id, $a_old_nr);
51 
52  // content style
53  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
54  $tpl->setCurrentBlock("ContentStyle");
55  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
57  $tpl->parseCurrentBlock();
58 
59  $tpl->setCurrentBlock("SyntaxStyle");
60  $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
62  $tpl->setVariable("LOCATION_ADDITIONAL_STYLESHEET",
64  $tpl->parseCurrentBlock();
65 
66  $this->setEnabledMaps(false);
67  $this->setPreventHTMLUnmasking(false);
68  $this->setEnabledInternalLinks(false);
69  $this->setEnabledSelfAssessment(false);
70 
71  //set For GUI and associated object
72  $this->setLayoutMode(true);
73  $this->obj->setLayoutMode(true);
74 
75  //associated object
76  include_once("./Services/Style/classes/class.ilPageLayout.php");
77 
78  $this->layout_object = new ilPageLayout($a_id);
79  $this->layout_object->readObject();
80  $this->slm_id = $a_slm_id;
81 
82  }
83 
84 
85 
86 
90  function &executeCommand()
91  {
92  global $ilCtrl;
93 
94  $next_class = $this->ctrl->getNextClass($this);
95  $cmd = $this->ctrl->getCmd();
96 
97  switch($next_class)
98  {
99  case 'ilmdeditorgui':
100  return parent::executeCommand();
101  break;
102 
103  case "ilpageobjectgui":
104  $page_gui = new ilPageObjectGUI("sahs",
105  $this->getPageObject()->getId(), $this->getPageObject()->old_nr);
106  $html = $ilCtrl->forwardCommand($page_gui);
107  return $html;
108 
109  default:
110  $html = parent::executeCommand();
111  return $html;
112  }
113  }
114 
115  function create(){
116  $this->properties("insert");
117  }
118 
119  function properties($a_mode="save")
120  {
121  global $ilCtrl, $lng, $ilTabs;
122 
123  $ilTabs->setTabActive('properties');
124 
125  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
126  $this->form_gui = new ilPropertyFormGUI();
127  $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
128  $this->form_gui->setTitle($lng->txt("cont_ed_pglprop"));
129 
130  include_once("Services/Form/classes/class.ilRadioMatrixInputGUI.php");
131 
132 
133  $title_input = new ilTextInputGUI($lng->txt("title"),"pgl_title");
134  $title_input->setSize(50);
135  $title_input->setMaxLength(128);
136  $title_input->setValue($this->layout_object->title);
137  $title_input->setTitle($lng->txt("title"));
138  $title_input->setRequired(true);
139 
140  $desc_input = new ilTextAreaInputGUI($lng->txt("description"),"pgl_desc");
141  $desc_input->setValue($this->layout_object->description);
142  $desc_input->setRows(3);
143  $desc_input->setCols(37);
144 
145  $desc_input->setTitle($lng->txt("description"));
146  $desc_input->setRequired(false);
147 
148  $this->form_gui->addItem($title_input);
149  $this->form_gui->addItem($desc_input);
150 
151  $this->form_gui->addCommandButton("updateProperties", $lng->txt($a_mode));
152  $this->tpl->setContent($this->form_gui->getHTML());
153  }
154 
155  function updateProperties()
156  {
157  global $lng;
158  if($_POST["pgl_title"] == "")
159  {
160  $this->ilias->raiseError($this->lng->txt("no_title"),$this->ilias->error_obj->MESSAGE);
161  $this->properties();
162  exit;
163  }
164  $this->layout_object->setTitle($_POST['pgl_title']);
165  $this->layout_object->setDescription($_POST['pgl_desc']);
166  $this->layout_object->update();
167  ilUtil::sendInfo($lng->txt("saved_successfully"),false);
168  $this->properties();
169  }
170 
174  function setTabs()
175  {
176  global $ilTabs, $ilCtrl, $tpl, $lng;
177  $ilCtrl->setParameterByClass("ilpagelayoutgui", "obj_id", $this->obj->id);
178  $ilTabs->addTarget("properties",
179  $ilCtrl->getLinkTarget($this, "properties"), array("properties","", ""), "", "");
180  $tpl->setTitleIcon(ilUtil::getImagePath("icon_pg_b.gif"));
181  $tpl->setTitle($this->layout_object->getTitle());
182  $tpl->setDescription("");
183  // $tpl->setTitle(
184  // $lng->txt("sahs_page").": ".$this->node_object->getTitle());
185  }
186 
187 
188 }
189 ?>