ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilQTIMaterial.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
33 {
34  var $label;
35  var $flow;
36  var $comment;
37  var $mattext;
39  var $matimage;
40  var $mataudio;
41  var $matvideo;
44  var $matref;
45  var $matbreak;
49 
50  function ilQTIMaterial()
51  {
52  $this->flow = 0;
53  $this->altmaterial = array();
54  $this->materials = array();
55  }
56 
57  function addMattext($a_mattext)
58  {
59  array_push($this->materials, array("material" => $a_mattext, "type" => "mattext"));
60  }
61 
62  function addMatimage($a_matimage)
63  {
64  array_push($this->materials, array("material" => $a_matimage, "type" => "matimage"));
65  }
66 
67  function addMatemtext($a_matemtext)
68  {
69  array_push($this->materials, array("material" => $a_matemtext, "type" => "matemtext"));
70  }
71 
72  function addMataudio($a_mataudio)
73  {
74  array_push($this->materials, array("material" => $a_mataudio, "type" => "mataudio"));
75  }
76 
77  function addMatvideo($a_matvideo)
78  {
79  array_push($this->materials, array("material" => $a_matvideo, "type" => "matvideo"));
80  }
81 
82  function addMatapplet($a_matapplet)
83  {
84  array_push($this->materials, array("material" => $a_matapplet, "type" => "matapplet"));
85  }
86 
87  function addMatapplication($a_matapplication)
88  {
89  array_push($this->materials, array("material" => $a_matapplication, "type" => "matapplication"));
90  }
91 
92  function addMatref($a_matref)
93  {
94  array_push($this->materials, array("material" => $a_matref, "type" => "matref"));
95  }
96 
97  function addMatbreak($a_matbreak)
98  {
99  array_push($this->materials, array("material" => $a_matbreak, "type" => "matbreak"));
100  }
101 
102  function addMat_extension($a_mat_extension)
103  {
104  array_push($this->materials, array("material" => $a_mat_extension, "type" => "mat_extension"));
105  }
106 
107  function addAltmaterial($a_altmaterial)
108  {
109  array_push($this->materials, array("material" => $a_altmaterial, "type" => "altmaterial"));
110  }
111 
112  function getMaterialCount()
113  {
114  return count($this->materials);
115  }
116 
117  function getMaterial($a_index)
118  {
119  if (array_key_exists($a_index, $this->materials))
120  {
121  return $this->materials[$a_index];
122  }
123  else
124  {
125  return FALSE;
126  }
127  }
128 
129  function setFlow($a_flow)
130  {
131  $this->flow = $a_flow;
132  }
133 
134  function getFlow()
135  {
136  return $this->flow;
137  }
138 
139  function setLabel($a_label)
140  {
141  $this->label = $a_label;
142  }
143 
144  function getLabel()
145  {
146  return $this->label;
147  }
148 
149  function extractText()
150  {
151  $text = "";
152  if ($this->getMaterialCount())
153  {
154  foreach ($this->materials as $mat)
155  {
156  if (strcmp($mat["type"], "mattext") == 0)
157  {
158  $text .= $mat["material"];
159  }
160  }
161  }
162  return $text;
163  }
164 }
165 ?>