ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPageLayout Class Reference

Class ilPageLayout. More...

+ Collaboration diagram for ilPageLayout:

Public Member Functions

 ilPageLayout ($a_id=null)
 
 getActive ()
 
 getDescription ()
 
 setDescription ($a_description)
 
 getTitle ()
 
 setTitle ($a_title)
 
 getId ()
 
 setStyleId ($a_val)
 Set style id. More...
 
 getStyleId ()
 Get style id. More...
 
 setSpecialPage ($a_val)
 Set special page. More...
 
 getSpecialPage ()
 Get special page. More...
 
 setModules (array $a_values=null)
 Set modules. More...
 
 getModules ()
 Get modules. More...
 
 activate ($a_setting=true)
 (De-)Activate layout More...
 
 delete ()
 Delete page layout. More...
 
 update ()
 Update page layout. More...
 
 readObject ()
 Read page layout. More...
 
 getXMLContent ()
 Get xml content. More...
 
 getPreview ()
 Get preview. More...
 

Static Public Member Functions

static getLayoutsAsArray ($a_active=0)
 Static access functions. More...
 
static getLayouts ($a_active=false, $a_special_page=false, $a_module=null)
 Get layouts. More...
 
static activeLayouts ($a_special_page=false, $a_module=null)
 Get active layouts. More...
 
static import ($a_filename, $a_filepath)
 Import page layout. More...
 
static getAvailableModules ()
 

Data Fields

const SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/editor/page_layouts_temp/thumbnails'
 
const MODULE_SCORM = 1
 
const MODULE_PORTFOLIO = 2
 
 $layout_id = null
 
 $title = null
 
 $description = null
 
 $active = null
 
 $modules = array()
 

Private Member Functions

 getXSLPath ()
 
 generatePreview ()
 

Detailed Description

Class ilPageLayout.

Class for Page Layouts

Author
Hendrik Holtmann holtm.nosp@m.ann@.nosp@m.me.co.nosp@m.m
Version
$Id$

Definition at line 14 of file class.ilPageLayout.php.

Member Function Documentation

◆ activate()

ilPageLayout::activate (   $a_setting = true)

(De-)Activate layout

Parameters
boolean$a_settingtrue/false

Definition at line 139 of file class.ilPageLayout.php.

140 {
141 global $ilias, $ilDB;
142
143 $query = "UPDATE page_layout SET active=".$ilDB->quote($a_setting, "integer").
144 " WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
145 $result = $ilDB->manipulate($query);
146 }
$result
global $ilDB

References $ilDB, $query, and $result.

◆ activeLayouts()

static ilPageLayout::activeLayouts (   $a_special_page = false,
  $a_module = null 
)
static

Get active layouts.

Definition at line 327 of file class.ilPageLayout.php.

328 {
329 return self::getLayouts(true, $a_special_page, $a_module);
330 }
static getLayouts($a_active=false, $a_special_page=false, $a_module=null)
Get layouts.

References getLayouts().

Referenced by ilSCORM2004OrganizationHFormGUI\getMenuItems(), ilObjPortfolioGUI\initCreateForm(), ilObjPortfolioBaseGUI\initPageForm(), and ilObjSCORM2004LearningModuleGUI\insertTemplateGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilPageLayout::delete ( )

Delete page layout.

Definition at line 151 of file class.ilPageLayout.php.

152 {
153 global $ilias, $ilDB;
154
155 $query = "DELETE FROM page_layout WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
156 $result = $ilDB->manipulate($query);
157 }

References $ilDB, $query, and $result.

◆ generatePreview()

ilPageLayout::generatePreview ( )
private

Definition at line 241 of file class.ilPageLayout.php.

241 {
242
243 $xml = $this->getXMLContent();
244
245 $dom = @domxml_open_mem($xml, DOMXML_LOAD_PARSING, $error);
246 $xpc = xpath_new_context($dom);
247 $path = "////PlaceHolder";
248 $res =& xpath_eval($xpc, $path);
249
250 foreach ($res->nodeset as $item){
251 $height = $item->get_attribute("Height");
252
253 $height = eregi_replace("px","",$height);
254 $height=$height/10;
255 $item->set_attribute("Height",$height."px");
256 }
257 $xsl = file_get_contents($this->getXSLPath());
258
259 $xml = $dom->dump_mem(0, "UTF-8");
260
261 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
262
263 $xh = xslt_create();
264 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
265 xslt_error($xh);
266 xslt_free($xh);
267 return $output;
268 }
getXMLContent()
Get xml content.
const DOMXML_LOAD_PARSING
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=NULL)
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
$path
Definition: index.php:22

References $path, $res, DOMXML_LOAD_PARSING, domxml_open_mem(), getXMLContent(), getXSLPath(), xpath_eval(), xpath_new_context(), xslt_create(), xslt_error(), and xslt_free().

Referenced by getPreview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActive()

ilPageLayout::getActive ( )

Definition at line 54 of file class.ilPageLayout.php.

54 {
55 return $this->active;
56 }

References $active.

◆ getAvailableModules()

static ilPageLayout::getAvailableModules ( )
static

Definition at line 348 of file class.ilPageLayout.php.

349 {
350 global $lng;
351
352 return array(
353 self::MODULE_SCORM => $lng->txt("style_page_layout_module_scorm"),
354 self::MODULE_PORTFOLIO => $lng->txt("style_page_layout_module_portfolio")
355 );
356 }
global $lng
Definition: privfeed.php:40

References $lng.

Referenced by ilPageLayoutTableGUI\getPageLayouts(), ilObjStyleSettingsGUI\initAddPageLayoutForm(), ilPageLayoutGUI\initForm(), and setModules().

+ Here is the caller graph for this function:

◆ getDescription()

ilPageLayout::getDescription ( )

Definition at line 58 of file class.ilPageLayout.php.

58 {
59 return $this->description;
60 }

References $description.

◆ getId()

ilPageLayout::getId ( )

Definition at line 74 of file class.ilPageLayout.php.

74 {
75 return $this->layout_id;
76 }

References $layout_id.

◆ getLayouts()

static ilPageLayout::getLayouts (   $a_active = false,
  $a_special_page = false,
  $a_module = null 
)
static

Get layouts.

Definition at line 295 of file class.ilPageLayout.php.

296 {
297 global $ilDB;
298 $arr_layouts = array();
299 $add = "WHERE special_page = ".$ilDB->quote($a_special_page, "integer");
300 if ($a_active)
301 {
302 $add.= " AND (active = 1)";
303 }
304 switch($a_module)
305 {
307 $add .= " AND mod_scorm = 1";
308 break;
309
311 $add .= " AND mod_portfolio = 1";
312 break;
313 }
314 $query = "SELECT layout_id FROM page_layout $add ORDER BY title ";
315 $result = $ilDB->query($query);
316 while($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
317 {
318 array_push($arr_layouts,new ilPageLayout($row['layout_id']));
319 }
320
321 return $arr_layouts;
322 }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
ilPageLayout($a_id=null)

References $ilDB, $query, $result, $row, DB_FETCHMODE_ASSOC, ilPageLayout(), MODULE_PORTFOLIO, and MODULE_SCORM.

Referenced by activeLayouts(), and ilObjStyleSettingsGUI\initAddPageLayoutForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLayoutsAsArray()

static ilPageLayout::getLayoutsAsArray (   $a_active = 0)
static

Static access functions.

Definition at line 275 of file class.ilPageLayout.php.

275 {
276
277 global $ilDB;
278 $arr_layouts = array();
279 if ($active!=0) {
280 $add ="WHERE (active=1)";
281 }
282 $query = "SELECT * FROM page_layout $add ORDER BY title ";
283 $result = $ilDB->query($query);
284 while($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
285 {
286 array_push($arr_layouts,$row);
287 }
288 return $arr_layouts;
289
290 }

References $active, $ilDB, $query, $result, $row, and DB_FETCHMODE_ASSOC.

Referenced by ilPageLayoutTableGUI\getPageLayouts().

+ Here is the caller graph for this function:

◆ getModules()

ilPageLayout::getModules ( )

Get modules.

Definition at line 129 of file class.ilPageLayout.php.

130 {
131 return $this->modules;
132 }

References $modules.

◆ getPreview()

ilPageLayout::getPreview ( )

Get preview.

Definition at line 231 of file class.ilPageLayout.php.

232 {
233 return $this->generatePreview();
234 }

References generatePreview().

+ Here is the call graph for this function:

◆ getSpecialPage()

ilPageLayout::getSpecialPage ( )

Get special page.

Definition at line 105 of file class.ilPageLayout.php.

106 {
107 return $this->special_page;
108 }

Referenced by update().

+ Here is the caller graph for this function:

◆ getStyleId()

ilPageLayout::getStyleId ( )

Get style id.

Definition at line 89 of file class.ilPageLayout.php.

90 {
91 return $this->style_id;
92 }

Referenced by update().

+ Here is the caller graph for this function:

◆ getTitle()

ilPageLayout::getTitle ( )

Definition at line 66 of file class.ilPageLayout.php.

66 {
67 return $this->title;
68 }

References $title.

◆ getXMLContent()

ilPageLayout::getXMLContent ( )

Get xml content.

Returns
string content xml

Definition at line 220 of file class.ilPageLayout.php.

221 {
222 include_once "Services/Style/classes/class.ilPageLayoutPage.php";
223 $layout_page = new ilPageLayoutPage($this->layout_id);
224 return $layout_page->getXMLContent();
225 }
Page layout page object.

Referenced by generatePreview().

+ Here is the caller graph for this function:

◆ getXSLPath()

ilPageLayout::getXSLPath ( )
private

Definition at line 237 of file class.ilPageLayout.php.

237 {
238 return "./Services/Style/xml/layout2html.xsl";
239 }

Referenced by generatePreview().

+ Here is the caller graph for this function:

◆ ilPageLayout()

ilPageLayout::ilPageLayout (   $a_id = null)

Definition at line 28 of file class.ilPageLayout.php.

29 {
30 global $ilias, $ilDB;
31 //create new instance
32 if ($a_id == null) {
33 $this->layout_id = $ilDB->nextId("page_layout");
34 $ilDB->insert("page_layout", array(
35 "layout_id" => array("integer", $this->layout_id),
36 "active" => array("integer", 0),
37 "title" => array("text", ""),
38 "content" => array("clob", ""),
39 "description" => array("text", "")
40 ));
41 //$query = "INSERT INTO page_layout(active) values (0);";
42 //$result = $ilDB->query($query);
43 //$query = "SELECT LAST_INSERT_ID() as id";
44 //$res = $ilDB->query($query);
45 //$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
46 //$this->layout_id = $row->id;
47 $this->active = false;
48 }
49 else {
50 $this->layout_id = $a_id;
51 }
52 }

References $ilDB.

Referenced by getLayouts().

+ Here is the caller graph for this function:

◆ import()

static ilPageLayout::import (   $a_filename,
  $a_filepath 
)
static

Import page layout.

Parameters
string$a_filenamefile name
string$a_fiepathcomplete path (incl. name) to file
Returns
object new object

Definition at line 340 of file class.ilPageLayout.php.

341 {
342 include_once("./Services/Export/classes/class.ilImport.php");
343 $imp = new ilImport();
344 $imp->importEntity($a_filepath, $a_filename,
345 "pgtp", "Services/COPage");
346 }
Import class.

Referenced by ilObjStyleSettingsGUI\importPageLayoutObject().

+ Here is the caller graph for this function:

◆ readObject()

ilPageLayout::readObject ( )

Read page layout.

Definition at line 191 of file class.ilPageLayout.php.

192 {
193 global $ilias, $ilDB;
194 $query = "SELECT * FROM page_layout WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
195 $result = $ilDB->query($query);
196 $row = $ilDB->fetchAssoc($result);
197 $this->title = $row['title'];
198 $this->setStyleId($row['style_id']);
199 $this->setSpecialPage($row['special_page']);
200 $this->description=$row['description'];
201 $this->active=$row['active'];
202
203 $mods = array();
204 if($row["mod_scorm"])
205 {
206 $mods[] = self::MODULE_SCORM;
207 }
208 if($row["mod_portfolio"])
209 {
210 $mods[] = self::MODULE_PORTFOLIO;
211 }
212 $this->setModules($mods);
213 }
setSpecialPage($a_val)
Set special page.
setModules(array $a_values=null)
Set modules.
setStyleId($a_val)
Set style id.

References $ilDB, $query, $result, $row, MODULE_PORTFOLIO, MODULE_SCORM, setModules(), setSpecialPage(), and setStyleId().

+ Here is the call graph for this function:

◆ setDescription()

ilPageLayout::setDescription (   $a_description)

Definition at line 62 of file class.ilPageLayout.php.

62 {
63 $this->description = $a_description;
64 }

◆ setModules()

ilPageLayout::setModules ( array  $a_values = null)

Set modules.

Definition at line 113 of file class.ilPageLayout.php.

114 {
115 if($a_values)
116 {
117 $valid = array_keys($this->getAvailableModules());
118 $this->modules = array_intersect($a_values, $valid);
119 }
120 else
121 {
122 $this->modules = array();
123 }
124 }
static getAvailableModules()
$valid

References $valid, and getAvailableModules().

Referenced by readObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSpecialPage()

ilPageLayout::setSpecialPage (   $a_val)

Set special page.

Definition at line 97 of file class.ilPageLayout.php.

98 {
99 $this->special_page = $a_val;
100 }

Referenced by readObject().

+ Here is the caller graph for this function:

◆ setStyleId()

ilPageLayout::setStyleId (   $a_val)

Set style id.

Definition at line 81 of file class.ilPageLayout.php.

82 {
83 $this->style_id = $a_val;
84 }

Referenced by readObject().

+ Here is the caller graph for this function:

◆ setTitle()

ilPageLayout::setTitle (   $a_title)

Definition at line 70 of file class.ilPageLayout.php.

70 {
71 $this->title = $a_title;
72 }

◆ update()

ilPageLayout::update ( )

Update page layout.

Definition at line 162 of file class.ilPageLayout.php.

163 {
164 global $ilias, $ilDB;
165
166 $mod_scorm = $mod_portfolio = 0;
167 if(in_array(self::MODULE_SCORM, $this->modules))
168 {
169 $mod_scorm = 1;
170 }
171 if(in_array(self::MODULE_PORTFOLIO, $this->modules))
172 {
173 $mod_portfolio = 1;
174 }
175
176 $query = "UPDATE page_layout SET title=".$ilDB->quote($this->title, "text").
177 ",description =".$ilDB->quote($this->description, "text").
178 ",active =".$ilDB->quote($this->active, "integer").
179 ",style_id =".$ilDB->quote($this->getStyleId(), "integer").
180 ",special_page =".$ilDB->quote((int) $this->getSpecialPage(), "integer").
181 ",mod_scorm =".$ilDB->quote($mod_scorm, "integer").
182 ",mod_portfolio =".$ilDB->quote($mod_portfolio, "integer").
183 " WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
184
185 $result = $ilDB->manipulate($query);
186 }
getStyleId()
Get style id.
getSpecialPage()
Get special page.

References $ilDB, $query, $result, getSpecialPage(), and getStyleId().

+ Here is the call graph for this function:

Field Documentation

◆ $active

ilPageLayout::$active = null

Definition at line 25 of file class.ilPageLayout.php.

Referenced by getActive(), and getLayoutsAsArray().

◆ $description

ilPageLayout::$description = null

Definition at line 24 of file class.ilPageLayout.php.

Referenced by getDescription().

◆ $layout_id

ilPageLayout::$layout_id = null

Definition at line 22 of file class.ilPageLayout.php.

Referenced by getId().

◆ $modules

ilPageLayout::$modules = array()

Definition at line 26 of file class.ilPageLayout.php.

Referenced by getModules().

◆ $title

ilPageLayout::$title = null

Definition at line 23 of file class.ilPageLayout.php.

Referenced by getTitle().

◆ MODULE_PORTFOLIO

const ilPageLayout::MODULE_PORTFOLIO = 2

◆ MODULE_SCORM

const ilPageLayout::MODULE_SCORM = 1

◆ SEQ_TEMPLATE_DIR

const ilPageLayout::SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/editor/page_layouts_temp/thumbnails'

Definition at line 17 of file class.ilPageLayout.php.


The documentation for this class was generated from the following file: