ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
37 
38  const SEQ_TEMPLATE_DIR = './Modules/Scorm2004/templates/editor/page_layouts_temp/thumbnails';
39 
40  var $layout_id = null;
41 
42  function ilSCORM2004PageLayout($a_id) {
43  $this->layout_id = $a_id;
44  }
45 
46 
47  public function getXMLContent() {
48  global $ilias, $ilDB;
49  $r = $ilias->db->query("SELECT content FROM page_layout WHERE layout_id=".
50  $ilDB->quote($this->layout_id));
51  $row = $r->fetchRow(DB_FETCHMODE_ASSOC);
52  return $row['content'];
53  }
54 
55 
56  public function getPreview() {
57  //just returns manually created previews at the moment
58  return self::SEQ_TEMPLATE_DIR."/".$this->layout_id.".png";
59  }
60 
61 
62  public function getTitle() {
63  global $ilias, $ilDB;
64 
65  $r = $ilDB->queryF('SELECT title FROM page_layout WHERE layout_id = %s',
66  array('integer'),array($this->layout_id));
67  $row->$ilDB->fetchAssoc($r);
68 
69  return $row['title'];
70  }
71 
72  public function getId() {
73  return $this->layout_id;
74  }
75 
76 
77  private function generatePreview() {
78 
79  //toimplement...generate Preview from XML
80 
81  }
82 
83 
84  public static function activeLayouts()
85  {
86  global $ilDB;
87  $arr_layouts = array();
88  $query = "SELECT * FROM page_layout WHERE (active=1) ORDER BY title ";
89  $result = $ilDB->query($query);
90  while($row = $ilDB->fetchAssoc($result))
91  {
92  array_push($arr_layouts,new ilSCORM2004PageLayout($row['layout_id']));
93  }
94  return $arr_layouts;
95  }
96 
97 }