ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSCORM2004PageLayout.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
36{
40 protected $db;
41
42
43 const SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/editor/page_layouts_temp/thumbnails';
44
45 public $layout_id = null;
46
47 public function __construct($a_id)
48 {
49 global $DIC;
50
51 $this->db = $DIC->database();
52 $this->layout_id = $a_id;
53 }
54
55
56 public function getXMLContent()
57 {
59 $r = $ilDB->query("SELECT content FROM page_layout WHERE layout_id=" .
60 $ilDB->quote($this->layout_id));
61 $row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
62 return $row['content'];
63 }
64
65
66 public function getPreview()
67 {
68 //just returns manually created previews at the moment
69 return self::SEQ_TEMPLATE_DIR . "/" . $this->layout_id . ".png";
70 }
71
72
73 public function getTitle()
74 {
76
77 $r = $ilDB->queryF(
78 'SELECT title FROM page_layout WHERE layout_id = %s',
79 array('integer'),
80 array($this->layout_id)
81 );
82 $row = $ilDB->fetchAssoc($r);
83
84 return $row['title'];
85 }
86
87 public function getId()
88 {
89 return $this->layout_id;
90 }
91
92
93 private function generatePreview()
94 {
95
96 //toimplement...generate Preview from XML
97 }
98
99
100 public static function activeLayouts()
101 {
102 global $DIC;
103
104 $ilDB = $DIC->database();
105 $arr_layouts = array();
106 $query = "SELECT * FROM page_layout WHERE (active=1) ORDER BY title ";
107 $result = $ilDB->query($query);
108 while ($row = $ilDB->fetchAssoc($result)) {
109 array_push($arr_layouts, new ilSCORM2004PageLayout($row['layout_id']));
110 }
111 return $arr_layouts;
112 }
113}
$result
An exception for terminatinating execution or to throw for unit testing.
Class ilSCORM2004PageLayout.
$query
global $ilDB
$DIC
Definition: xapitoken.php:46