ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 getStyleId ()
 Get style id.
 setSpecialPage ($a_val)
 Set special page.
 getSpecialPage ()
 Get special page.
 setModules (array $a_values=null)
 Set modules.
 getModules ()
 Get modules.
 activate ($a_setting=true)
 (De-)Activate layout
 delete ()
 Delete page layout.
 update ()
 Update page layout.
 readObject ()
 Read page layout.
 getXMLContent ()
 Get xml content.
 getPreview ()
 Get preview.

Static Public Member Functions

static getLayoutsAsArray ($a_active=0)
 Static access functions.
static getLayouts ($a_active=false, $a_special_page=false, $a_module=null)
 Get layouts.
static activeLayouts ($a_special_page=false, $a_module=null)
 Get active layouts.
static import ($a_filename, $a_filepath)
 Import page layout.
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

ilPageLayout::activate (   $a_setting = true)

(De-)Activate layout

Parameters
boolean$a_settingtrue/false

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

References $ilDB, $query, and $result.

{
global $ilias, $ilDB;
$query = "UPDATE page_layout SET active=".$ilDB->quote($a_setting, "integer").
" WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
$result = $ilDB->manipulate($query);
}
static ilPageLayout::activeLayouts (   $a_special_page = false,
  $a_module = null 
)
static

Get active layouts.

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

References getLayouts().

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

{
return self::getLayouts(true, $a_special_page, $a_module);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageLayout::delete ( )

Delete page layout.

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

References $ilDB, $query, and $result.

{
global $ilias, $ilDB;
$query = "DELETE FROM page_layout WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
$result = $ilDB->manipulate($query);
}
ilPageLayout::generatePreview ( )
private

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

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().

{
$xml = $this->getXMLContent();
$dom = @domxml_open_mem($xml, DOMXML_LOAD_PARSING, $error);
$xpc = xpath_new_context($dom);
$path = "////PlaceHolder";
$res =& xpath_eval($xpc, $path);
foreach ($res->nodeset as $item){
$height = $item->get_attribute("Height");
$height = eregi_replace("px","",$height);
$height=$height/10;
$item->set_attribute("Height",$height."px");
}
$xsl = file_get_contents($this->getXSLPath());
$xml = $dom->dump_mem(0, "UTF-8");
$args = array( '/_xml' => $xml, '/_xsl' => $xsl );
$xh = xslt_create();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
xslt_error($xh);
xslt_free($xh);
return $output;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageLayout::getActive ( )

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

References $active.

{
return $this->active;
}
static ilPageLayout::getAvailableModules ( )
static

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

References $lng.

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

{
global $lng;
return array(
self::MODULE_SCORM => $lng->txt("style_page_layout_module_scorm"),
self::MODULE_PORTFOLIO => $lng->txt("style_page_layout_module_portfolio")
);
}

+ Here is the caller graph for this function:

ilPageLayout::getDescription ( )

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

References $description.

{
}
ilPageLayout::getId ( )

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

References $layout_id.

{
}
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.

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

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

{
global $ilDB;
$arr_layouts = array();
$add = "WHERE special_page = ".$ilDB->quote($a_special_page, "integer");
if ($a_active)
{
$add.= " AND (active = 1)";
}
switch($a_module)
{
case self::MODULE_SCORM:
$add .= " AND mod_scorm = 1";
break;
case self::MODULE_PORTFOLIO:
$add .= " AND mod_portfolio = 1";
break;
}
$query = "SELECT layout_id FROM page_layout $add ORDER BY title ";
$result = $ilDB->query($query);
while($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($arr_layouts,new ilPageLayout($row['layout_id']));
}
return $arr_layouts;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Static access functions.

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

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

Referenced by ilPageLayoutTableGUI\getPageLayouts().

{
global $ilDB;
$arr_layouts = array();
if ($active!=0) {
$add ="WHERE (active=1)";
}
$query = "SELECT * FROM page_layout $add ORDER BY title ";
$result = $ilDB->query($query);
while($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($arr_layouts,$row);
}
return $arr_layouts;
}

+ Here is the caller graph for this function:

ilPageLayout::getModules ( )

Get modules.

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

References $modules.

{
}
ilPageLayout::getPreview ( )

Get preview.

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

References generatePreview().

{
return $this->generatePreview();
}

+ Here is the call graph for this function:

ilPageLayout::getSpecialPage ( )

Get special page.

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

Referenced by update().

{
return $this->special_page;
}

+ Here is the caller graph for this function:

ilPageLayout::getStyleId ( )

Get style id.

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

Referenced by update().

{
return $this->style_id;
}

+ Here is the caller graph for this function:

ilPageLayout::getTitle ( )

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

References $title.

{
return $this->title;
}
ilPageLayout::getXMLContent ( )

Get xml content.

Returns
string content xml

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

Referenced by generatePreview().

{
include_once "Services/Style/classes/class.ilPageLayoutPage.php";
$layout_page = new ilPageLayoutPage($this->layout_id);
return $layout_page->getXMLContent();
}

+ Here is the caller graph for this function:

ilPageLayout::getXSLPath ( )
private

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

Referenced by generatePreview().

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

+ Here is the caller graph for this function:

ilPageLayout::ilPageLayout (   $a_id = null)

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

References $ilDB.

Referenced by getLayouts().

{
global $ilias, $ilDB;
//create new instance
if ($a_id == null) {
$this->layout_id = $ilDB->nextId("page_layout");
$ilDB->insert("page_layout", array(
"layout_id" => array("integer", $this->layout_id),
"active" => array("integer", 0),
"title" => array("text", ""),
"content" => array("clob", ""),
"description" => array("text", "")
));
//$query = "INSERT INTO page_layout(active) values (0);";
//$result = $ilDB->query($query);
//$query = "SELECT LAST_INSERT_ID() as id";
//$res = $ilDB->query($query);
//$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
//$this->layout_id = $row->id;
$this->active = false;
}
else {
$this->layout_id = $a_id;
}
}

+ Here is the caller graph for this function:

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.

Referenced by ilObjStyleSettingsGUI\importPageLayoutObject().

{
include_once("./Services/Export/classes/class.ilImport.php");
$imp = new ilImport();
$imp->importEntity($a_filepath, $a_filename,
"pgtp", "Services/COPage");
}

+ Here is the caller graph for this function:

ilPageLayout::readObject ( )

Read page layout.

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

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

{
global $ilias, $ilDB;
$query = "SELECT * FROM page_layout WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
$result = $ilDB->query($query);
$row = $ilDB->fetchAssoc($result);
$this->title = $row['title'];
$this->setStyleId($row['style_id']);
$this->setSpecialPage($row['special_page']);
$this->description=$row['description'];
$this->active=$row['active'];
$mods = array();
if($row["mod_scorm"])
{
$mods[] = self::MODULE_SCORM;
}
if($row["mod_portfolio"])
{
}
$this->setModules($mods);
}

+ Here is the call graph for this function:

ilPageLayout::setDescription (   $a_description)

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

{
$this->description = $a_description;
}
ilPageLayout::setModules ( array  $a_values = null)

Set modules.

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

References $valid, and getAvailableModules().

Referenced by readObject().

{
if($a_values)
{
$valid = array_keys($this->getAvailableModules());
$this->modules = array_intersect($a_values, $valid);
}
else
{
$this->modules = array();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageLayout::setSpecialPage (   $a_val)

Set special page.

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

Referenced by readObject().

{
$this->special_page = $a_val;
}

+ Here is the caller graph for this function:

ilPageLayout::setStyleId (   $a_val)

Set style id.

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

Referenced by readObject().

{
$this->style_id = $a_val;
}

+ Here is the caller graph for this function:

ilPageLayout::setTitle (   $a_title)

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

{
$this->title = $a_title;
}
ilPageLayout::update ( )

Update page layout.

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

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

{
global $ilias, $ilDB;
$mod_scorm = $mod_portfolio = 0;
if(in_array(self::MODULE_SCORM, $this->modules))
{
$mod_scorm = 1;
}
if(in_array(self::MODULE_PORTFOLIO, $this->modules))
{
$mod_portfolio = 1;
}
$query = "UPDATE page_layout SET title=".$ilDB->quote($this->title, "text").
",description =".$ilDB->quote($this->description, "text").
",active =".$ilDB->quote($this->active, "integer").
",style_id =".$ilDB->quote($this->getStyleId(), "integer").
",special_page =".$ilDB->quote((int) $this->getSpecialPage(), "integer").
",mod_scorm =".$ilDB->quote($mod_scorm, "integer").
",mod_portfolio =".$ilDB->quote($mod_portfolio, "integer").
" WHERE layout_id =".$ilDB->quote($this->layout_id, "integer");
$result = $ilDB->manipulate($query);
}

+ Here is the call graph for this function:

Field Documentation

ilPageLayout::$active = null

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

Referenced by getActive(), and getLayoutsAsArray().

ilPageLayout::$description = null

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

Referenced by getDescription().

ilPageLayout::$layout_id = null

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

Referenced by getId().

ilPageLayout::$modules = array()

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

Referenced by getModules().

ilPageLayout::$title = null

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

Referenced by getTitle().

const ilPageLayout::MODULE_PORTFOLIO = 2
const ilPageLayout::MODULE_SCORM = 1
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: