Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00032 class ilAICCObject
00033 {
00034 var $id;
00035 var $title;
00036 var $objType;
00037 var $alm_id;
00038 var $description;
00039 var $developer_id;
00040 var $system_id;
00041
00042
00049 function ilAICCObject($a_id = 0)
00050 {
00051 global $ilias;
00052
00053 $this->ilias =& $ilias;
00054 $this->id = $a_id;
00055 if ($a_id > 0)
00056 {
00057 $this->read();
00058 }
00059 }
00060
00061 function getId()
00062 {
00063 return $this->id;
00064 }
00065
00066 function setId($a_id)
00067 {
00068 $this->id = $a_id;
00069 }
00070
00071 function getType()
00072 {
00073 return $this->objType;
00074 }
00075
00076 function setType($a_objType)
00077 {
00078 $this->objType = $a_objType;
00079 }
00080
00081 function getTitle()
00082 {
00083 return $this->title;
00084 }
00085
00086 function setTitle($a_title)
00087 {
00088 $this->title = $a_title;
00089 }
00090
00091 function getDescription()
00092 {
00093 return $this->description;
00094 }
00095
00096 function setDescription($a_description)
00097 {
00098 $this->description = $a_description;
00099 }
00100
00101 function getDeveloperId()
00102 {
00103 return $this->developer_id;
00104 }
00105
00106 function setDeveloperId($a_developer_id)
00107 {
00108 $this->developer_id = $a_developer_id;
00109 }
00110
00111 function getSystemId()
00112 {
00113 return $this->system_id;
00114 }
00115
00116 function setSystemId($a_system_id)
00117 {
00118 $this->system_id = $a_system_id;
00119 }
00120
00121 function getALMId()
00122 {
00123 return $this->alm_id;
00124 }
00125
00126 function setALMId($a_alm_id)
00127 {
00128 $this->alm_id = $a_alm_id;
00129 }
00130
00131 function prepForStore($string) {
00132 if (!get_magic_quotes_runtime()) {
00133 $string = addslashes($string);
00134 }
00135 return $string;
00136 }
00137
00138 function read()
00139 {
00140 global $ilDB;
00141
00142 $q = "SELECT * FROM aicc_object WHERE obj_id = ".$ilDB->quote($this->getId());
00143
00144 $obj_set = $this->ilias->db->query($q);
00145 $obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC);
00146 $this->setTitle($obj_rec["title"]);
00147 $this->setType($obj_rec["type"]);
00148 $this->setALMId($obj_rec["alm_id"]);
00149 $this->setDescription($obj_rec["description"]);
00150 $this->setDeveloperId($obj_rec["developer_id"]);
00151 $this->setSystemId($obj_rec["system_id"]);
00152 }
00153
00154 function create()
00155 {
00156 global $ilDB;
00157
00158 $q = "INSERT INTO aicc_object (title, type, slm_id, description, developer_id, system_id) VALUES (";
00159 $q.=$ilDB->quote($this->getTitle()).", ";
00160 $q.=$ilDB->quote($this->getType()).", ";
00161 $q.=$ilDB->quote($this->getALMId()).", ";
00162 $q.=$ilDB->quote($this->getDescription()).", ";
00163 $q.=$ilDB->quote($this->getDeveloperId()).", ";
00164 $q.=$ilDB->quote($this->getSystemId()).") ";
00165 $this->ilias->db->query($q);
00166 $this->setId($this->ilias->db->getLastInsertId());
00167 }
00168
00169 function update()
00170 {
00171 global $ilDB;
00172
00173 $q = "UPDATE aicc_object SET ";
00174 $q.="title = ".$ilDB->quote($this->getTitle()).", ";
00175 $q.="type = ".$ilDB->quote($this->getType()).", ";
00176 $q.="slm_id = ".$ilDB->quote($this->getALMId()).", ";
00177 $q.="description = ".$ilDB->quote($this->getDescription()).", ";
00178 $q.="developer_id = ".$ilDB->quote($this->getDeveloperId()).", ";
00179 $q.="system_id = ".$ilDB->quote($this->getSystemId())." ";
00180 $q.="WHERE obj_id = ".$ilDB->quote($this->getId());
00181
00182 $this->ilias->db->query($q);
00183 }
00184
00185 function delete()
00186 {
00187 global $ilDB;
00188
00189 $q = "DELETE FROM aicc_object WHERE obj_id =".$ilDB->quote($this->getId());
00190 $ilDB->query($q);
00191 }
00192
00198 function &_getInstance($a_id, $a_slm_id)
00199 {
00200 global $ilDB;
00201
00202 $sc_set = $ilDB->query("SELECT type FROM aicc_object WHERE obj_id =".$ilDB->quote($a_id).
00203 " AND slm_id = ".$ilDB->quote($a_slm_id));
00204 $sc_rec = $sc_set->fetchRow(DB_FETCHMODE_ASSOC);
00205
00206 switch($sc_rec["type"])
00207 {
00208 case "sbl":
00209 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCBlock.php");
00210 $block =& new ilAICCBlock($a_id);
00211 return $block;
00212 break;
00213
00214 case "sau":
00215 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
00216 $sau =& new ilAICCUnit($a_id);
00217 return $sau;
00218 break;
00219
00220 case "shd":
00221 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCCourse.php");
00222 $shd =& new ilAICCCourse($a_id);
00223 return $shd;
00224 break;
00225 }
00226
00227 }
00228
00229 }
00230 ?>