ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPageLayout Class Reference

Class ilPageLayout. More...

+ Collaboration diagram for ilPageLayout:

Public Member Functions

 __construct ($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()
 

Protected Attributes

 $db
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilPageLayout::__construct (   $a_id = null)

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

34 {
35 global $DIC;
36
37 $this->db = $DIC->database();
38 $ilDB = $DIC->database();
39 //create new instance
40 if ($a_id == null) {
41 $this->layout_id = $ilDB->nextId("page_layout");
42 $ilDB->insert("page_layout", array(
43 "layout_id" => array("integer", $this->layout_id),
44 "active" => array("integer", 0),
45 "title" => array("text", ""),
46 "content" => array("clob", ""),
47 "description" => array("text", "")
48 ));
49 //$query = "INSERT INTO page_layout(active) values (0);";
50 //$result = $ilDB->query($query);
51 //$query = "SELECT LAST_INSERT_ID() as id";
52 //$res = $ilDB->query($query);
53 //$row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
54 //$this->layout_id = $row->id;
55 $this->active = false;
56 } else {
57 $this->layout_id = $a_id;
58 }
59 }
global $DIC
Definition: saml.php:7
global $ilDB

References $DIC, and $ilDB.

Member Function Documentation

◆ activate()

ilPageLayout::activate (   $a_setting = true)

(De-)Activate layout

Parameters
boolean$a_settingtrue/false

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

150 {
152
153 $query = "UPDATE page_layout SET active=" . $ilDB->quote($a_setting, "integer") .
154 " WHERE layout_id =" . $ilDB->quote($this->layout_id, "integer");
155 $result = $ilDB->manipulate($query);
156 }
$result
$query

References $db, $ilDB, $query, and $result.

◆ activeLayouts()

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

Get active layouts.

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

334 {
335 return self::getLayouts(true, $a_special_page, $a_module);
336 }
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 161 of file class.ilPageLayout.php.

162 {
164
165 $query = "DELETE FROM page_layout WHERE layout_id =" . $ilDB->quote($this->layout_id, "integer");
166 $result = $ilDB->manipulate($query);
167 }

References $db, $ilDB, $query, and $result.

◆ generatePreview()

ilPageLayout::generatePreview ( )
private

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

249 {
250 $xml = $this->getXMLContent();
251
253 $xpc = xpath_new_context($dom);
254 $path = "////PlaceHolder";
255 $res = xpath_eval($xpc, $path);
256
257 foreach ($res->nodeset as $item) {
258 $height = $item->get_attribute("Height");
259
260 $height = str_ireplace("px", "", $height);
261 $height=$height/10;
262 $item->set_attribute("Height", $height . "px");
263 }
264 $xsl = file_get_contents($this->getXSLPath());
265
266 $xml = $dom->dump_mem(0, "UTF-8");
267
268 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
269
270 $xh = xslt_create();
271 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, null);
272 xslt_error($xh);
273 xslt_free($xh);
274 return $output;
275 }
getXMLContent()
Get xml content.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=null)
xpath_new_context($dom_document)
const DOMXML_LOAD_PARSING
$error
Definition: Error.php:17
$xml
Definition: metadata.php:240
foreach($_POST as $key=> $value) $res

References $error, $output, $path, $res, $xml, 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 61 of file class.ilPageLayout.php.

62 {
63 return $this->active;
64 }

References $active.

◆ getAvailableModules()

static ilPageLayout::getAvailableModules ( )
static

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

359 {
360 global $DIC;
361
362 $lng = $DIC->language();
363
364 return array(
365 self::MODULE_SCORM => $lng->txt("style_page_layout_module_scorm"),
366 self::MODULE_PORTFOLIO => $lng->txt("style_page_layout_module_portfolio")
367 );
368 }
global $lng
Definition: privfeed.php:17

References $DIC, and $lng.

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

+ Here is the caller graph for this function:

◆ getDescription()

ilPageLayout::getDescription ( )

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

67 {
68 return $this->description;
69 }

References $description.

◆ getId()

ilPageLayout::getId ( )

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

87 {
88 return $this->layout_id;
89 }

References $layout_id.

◆ getLayouts()

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

Get layouts.

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

303 {
304 global $DIC;
305
306 $ilDB = $DIC->database();
307 $arr_layouts = array();
308 $add = "WHERE special_page = " . $ilDB->quote($a_special_page, "integer");
309 if ($a_active) {
310 $add.= " AND (active = 1)";
311 }
312 switch ($a_module) {
314 $add .= " AND mod_scorm = 1";
315 break;
316
318 $add .= " AND mod_portfolio = 1";
319 break;
320 }
321 $query = "SELECT layout_id FROM page_layout $add ORDER BY title ";
322 $result = $ilDB->query($query);
323 while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
324 array_push($arr_layouts, new ilPageLayout($row['layout_id']));
325 }
326
327 return $arr_layouts;
328 }
Class ilPageLayout.

References $DIC, $ilDB, $query, $result, $row, ilDBConstants\FETCHMODE_ASSOC, MODULE_PORTFOLIO, and MODULE_SCORM.

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

+ Here is the caller graph for this function:

◆ getLayoutsAsArray()

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

Static access functions.

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

283 {
284 global $DIC;
285
286 $ilDB = $DIC->database();
287 $arr_layouts = array();
288 if ($active!=0) {
289 $add ="WHERE (active=1)";
290 }
291 $query = "SELECT * FROM page_layout $add ORDER BY title ";
292 $result = $ilDB->query($query);
293 while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
294 array_push($arr_layouts, $row);
295 }
296 return $arr_layouts;
297 }

References $active, $DIC, $ilDB, $query, $result, $row, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilPageLayoutTableGUI\getPageLayouts().

+ Here is the caller graph for this function:

◆ getModules()

ilPageLayout::getModules ( )

Get modules.

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

140 {
141 return $this->modules;
142 }

References $modules.

◆ getPreview()

ilPageLayout::getPreview ( )

Get preview.

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

238 {
239 return $this->generatePreview();
240 }

References generatePreview().

+ Here is the call graph for this function:

◆ getSpecialPage()

ilPageLayout::getSpecialPage ( )

Get special page.

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

119 {
120 return $this->special_page;
121 }

Referenced by update().

+ Here is the caller graph for this function:

◆ getStyleId()

ilPageLayout::getStyleId ( )

Get style id.

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

103 {
104 return $this->style_id;
105 }

Referenced by update().

+ Here is the caller graph for this function:

◆ getTitle()

ilPageLayout::getTitle ( )

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

77 {
78 return $this->title;
79 }

References $title.

◆ getXMLContent()

ilPageLayout::getXMLContent ( )

Get xml content.

Returns
string content xml

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

227 {
228 include_once "Services/COPage/Layout/classes/class.ilPageLayoutPage.php";
229 $layout_page = new ilPageLayoutPage($this->layout_id);
230 return $layout_page->getXMLContent();
231 }
Page layout page object.

Referenced by generatePreview().

+ Here is the caller graph for this function:

◆ getXSLPath()

ilPageLayout::getXSLPath ( )
private

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

244 {
245 return "./Services/COPage/Layout/xml/layout2html.xsl";
246 }

Referenced by generatePreview().

+ 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 346 of file class.ilPageLayout.php.

347 {
348 include_once("./Services/Export/classes/class.ilImport.php");
349 $imp = new ilImport();
350 $imp->importEntity(
351 $a_filepath,
352 $a_filename,
353 "pgtp",
354 "Services/COPage"
355 );
356 }
Import class.

Referenced by ilPageLayoutAdministrationGUI\importPageLayout().

+ Here is the caller graph for this function:

◆ readObject()

ilPageLayout::readObject ( )

Read page layout.

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

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

References $db, $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 71 of file class.ilPageLayout.php.

72 {
73 $this->description = $a_description;
74 }

◆ setModules()

ilPageLayout::setModules ( array  $a_values = null)

Set modules.

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

127 {
128 if ($a_values) {
129 $valid = array_keys($this->getAvailableModules());
130 $this->modules = array_intersect($a_values, $valid);
131 } else {
132 $this->modules = array();
133 }
134 }
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 110 of file class.ilPageLayout.php.

111 {
112 $this->special_page = $a_val;
113 }

Referenced by readObject().

+ Here is the caller graph for this function:

◆ setStyleId()

ilPageLayout::setStyleId (   $a_val)

Set style id.

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

95 {
96 $this->style_id = $a_val;
97 }

Referenced by readObject().

+ Here is the caller graph for this function:

◆ setTitle()

ilPageLayout::setTitle (   $a_title)

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

82 {
83 $this->title = $a_title;
84 }

◆ update()

ilPageLayout::update ( )

Update page layout.

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

173 {
175
176 $mod_scorm = $mod_portfolio = 0;
177 if (in_array(self::MODULE_SCORM, $this->modules)) {
178 $mod_scorm = 1;
179 }
180 if (in_array(self::MODULE_PORTFOLIO, $this->modules)) {
181 $mod_portfolio = 1;
182 }
183
184 $query = "UPDATE page_layout SET title=" . $ilDB->quote($this->title, "text") .
185 ",description =" . $ilDB->quote($this->description, "text") .
186 ",active =" . $ilDB->quote($this->active, "integer") .
187 ",style_id =" . $ilDB->quote($this->getStyleId(), "integer") .
188 ",special_page =" . $ilDB->quote((int) $this->getSpecialPage(), "integer") .
189 ",mod_scorm =" . $ilDB->quote($mod_scorm, "integer") .
190 ",mod_portfolio =" . $ilDB->quote($mod_portfolio, "integer") .
191 " WHERE layout_id =" . $ilDB->quote($this->layout_id, "integer");
192
193 $result = $ilDB->manipulate($query);
194 }
getStyleId()
Get style id.
getSpecialPage()
Get special page.

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

+ Here is the call graph for this function:

Field Documentation

◆ $active

ilPageLayout::$active = null

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

Referenced by getActive(), and getLayoutsAsArray().

◆ $db

ilPageLayout::$db
protected

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

Referenced by activate(), delete(), readObject(), and update().

◆ $description

ilPageLayout::$description = null

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

Referenced by getDescription().

◆ $layout_id

ilPageLayout::$layout_id = null

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

Referenced by getId().

◆ $modules

ilPageLayout::$modules = array()

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

Referenced by getModules().

◆ $title

ilPageLayout::$title = null

Definition at line 28 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 22 of file class.ilPageLayout.php.


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