00001 <?php 00002 00003 require_once("content/classes/AICC/class.ilAICCObject.php"); 00004 00005 class ilAICCCourse extends ilAICCObject 00006 { 00007 00018 var $course_creator; 00019 var $course_id; 00020 var $course_system; 00021 var $course_title; 00022 var $level; 00023 var $max_fields_cst; 00024 var $max_fields_ort; 00025 var $total_aus; 00026 var $total_blocks; 00027 var $total_complex_obj; 00028 var $total_objectives; 00029 var $version; 00030 var $max_normal; 00031 var $description; 00032 00039 function ilAICCCourse($a_id = 0) 00040 { 00041 parent::ilAICCObject($a_id); 00042 $this->setType("shd"); 00043 } 00044 00045 function getCourseCreator() 00046 { 00047 return $this->course_creator; 00048 } 00049 00050 function setCourseCreator($a_course_creator) 00051 { 00052 $this->course_creator = $a_course_creator; 00053 } 00054 00055 function getCourseId() 00056 { 00057 return $this->course_id; 00058 } 00059 00060 function setCourseId($a_course_id) 00061 { 00062 $this->course_id = $a_course_id; 00063 } 00064 00065 function getCourseSystem() 00066 { 00067 return $this->course_system; 00068 } 00069 00070 function setCourseSystem($a_course_system) 00071 { 00072 $this->course_system = $a_course_system; 00073 } 00074 00075 function getCourseTitle() 00076 { 00077 return $this->course_title; 00078 } 00079 00080 function setCourseTitle($a_course_title) 00081 { 00082 $this->course_title = $a_course_title; 00083 } 00084 00085 function getLevel() 00086 { 00087 return $this->level; 00088 } 00089 00090 function setLevel($a_level) 00091 { 00092 $this->level = $a_level; 00093 } 00094 00095 function getMaxFieldsCst() 00096 { 00097 return $this->max_fields_cst; 00098 } 00099 00100 function setMaxFieldsCst($a_max_fields_cst) 00101 { 00102 $this->max_fields_cst = $a_max_fields_cst; 00103 } 00104 00105 function getMaxFieldsOrt() 00106 { 00107 return $this->max_fields_ort; 00108 } 00109 00110 function setMaxFieldsOrt($a_max_fields_ort) 00111 { 00112 $this->max_fields_ort = $a_max_fields_ort; 00113 } 00114 00115 function getTotalAUs() 00116 { 00117 return $this->total_aus; 00118 } 00119 00120 function setTotalAUs($a_total_aus) 00121 { 00122 $this->total_aus = $a_total_aus; 00123 } 00124 00125 function getTotalBlocks() 00126 { 00127 return $this->total_blocks; 00128 } 00129 00130 function setTotalBlocks($a_total_blocks) 00131 { 00132 $this->total_blocks = $a_total_blocks; 00133 } 00134 00135 function getTotalComplexObj() 00136 { 00137 return $this->total_complex_obj; 00138 } 00139 00140 function setTotalComplexObj($a_total_complex_obj) 00141 { 00142 $this->total_complex_obj = $a_total_complex_obj; 00143 } 00144 00145 function getTotalObjectives() 00146 { 00147 return $this->total_objectives; 00148 } 00149 00150 function setTotalObjectives($a_total_objectives) 00151 { 00152 $this->total_objectives = $a_total_objectives; 00153 } 00154 00155 function getVersion() 00156 { 00157 return $this->version; 00158 } 00159 00160 function setVersion($a_version) 00161 { 00162 $this->version = $a_version; 00163 } 00164 00165 function getMaxNormal() 00166 { 00167 return $this->max_normal; 00168 } 00169 00170 function setMaxNormal($a_max_normal) 00171 { 00172 $this->max_normal = $a_max_normal; 00173 } 00174 00175 function getDescription() 00176 { 00177 return $this->description; 00178 } 00179 00180 function setDescription($a_description) 00181 { 00182 $this->description = $a_description; 00183 } 00184 00185 function read() 00186 { 00187 parent::read(); 00188 00189 $q = "SELECT * FROM aicc_course WHERE obj_id = '".$this->getId()."'"; 00190 00191 $obj_set = $this->ilias->db->query($q); 00192 $obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC); 00193 $this->setCourseCreator($obj_rec["course_creator"]); 00194 $this->setCourseId($obj_rec["course_id"]); 00195 $this->setCourseSystem($obj_rec["course_system"]); 00196 $this->setCourseTitle($obj_rec["course_title"]); 00197 $this->setLevel($obj_rec["level"]); 00198 $this->setMaxFieldsCst($obj_rec["max_fields_cst"]); 00199 $this->setMaxFieldsOrt($obj_rec["max_fields_ort"]); 00200 $this->setTotalAUs($obj_rec["total_aus"]); 00201 $this->setTotalBlocks($obj_rec["total_blocks"]); 00202 $this->setTotalComplexObj($obj_rec["total_complex_obj"]); 00203 $this->setTotalObjectives($obj_rec["total_objectives"]); 00204 $this->setVersion($obj_rec["_version"]); 00205 $this->setMaxNormal($obj_rec["max_normal"]); 00206 $this->setDescription($obj_rec["description"]); 00207 } 00208 00209 function create() 00210 { 00211 parent::create(); 00212 00213 $q = "INSERT INTO aicc_course (obj_id, course_creator, course_id, course_system, course_title, 00214 level, max_fields_cst, max_fields_ort, total_aus, total_blocks, 00215 total_complex_obj, total_objectives, version, max_normal, 00216 description) VALUES ("; 00217 $q.="'".$this->getId()."', "; 00218 $q.="'".$this->prepForStore($this->getCourseCreator())."', "; 00219 $q.="'".$this->prepForStore($this->getCourseId())."', "; 00220 $q.="'".$this->prepForStore($this->getCourseSystem())."', "; 00221 $q.="'".$this->prepForStore($this->getCourseTitle())."', "; 00222 $q.="'".$this->prepForStore($this->getLevel())."', "; 00223 $q.="'".$this->prepForStore($this->getMaxFieldsCst())."', "; 00224 $q.="'".$this->prepForStore($this->getMaxFieldsOrt())."', "; 00225 $q.="'".$this->prepForStore($this->getTotalAUs())."', "; 00226 $q.="'".$this->prepForStore($this->getTotalBlocks())."', "; 00227 $q.="'".$this->prepForStore($this->getTotalComplexObj())."', "; 00228 $q.="'".$this->prepForStore($this->getTotalObjectives())."', "; 00229 $q.="'".$this->prepForStore($this->getVersion())."', "; 00230 $q.="'".$this->prepForStore($this->getMaxNormal())."', "; 00231 $q.="'".$this->prepForStore($this->getDescription())."')"; 00232 $this->ilias->db->query($q); 00233 } 00234 00235 function update() 00236 { 00237 parent::update(); 00238 00239 $q = "UPDATE aicc_course SET "; 00240 $q.="course_creator='".$this->prepForStore($this->getCourseCreator())."', "; 00241 $q.="course_id='".$this->prepForStore($this->getCourseId())."', "; 00242 $q.="course_system='".$this->prepForStore($this->getCourseSystem())."', "; 00243 $q.="course_title='".$this->prepForStore($this->getCourseTitle())."', "; 00244 $q.="level='".$this->prepForStore($this->getLevel())."', "; 00245 $q.="max_fields_cst='".$this->prepForStore($this->getMaxFieldsCst())."', "; 00246 $q.="max_fields_ort='".$this->prepForStore($this->getMaxFieldsOrt())."', "; 00247 $q.="total_aus='".$this->prepForStore($this->getTotalAUs())."', "; 00248 $q.="total_blocks='".$this->prepForStore($this->getTotalBlocks())."', "; 00249 $q.="total_complex_obj='".$this->prepForStore($this->getTotalComplexObj())."', "; 00250 $q.="total_objectives='".$this->prepForStore($this->getTotalObjectives())."', "; 00251 $q.="version='".$this->prepForStore($this->getVersion())."', "; 00252 $q.="max_normal='".$this->prepForStore($this->getMaxNormal())."', "; 00253 $q.="description='".$this->prepForStore($this->getDescription())."' "; 00254 $q.="WHERE obj_id = '".$this->getId()."'"; 00255 $this->ilias->db->query($q); 00256 } 00257 00258 function delete() 00259 { 00260 global $ilDB; 00261 00262 parent::delete(); 00263 00264 $q = "DELETE FROM aicc_course WHERE obj_id =".$ilDB->quote($this->getId()); 00265 $ilDB->query($q); 00266 00267 $q = "DELETE FROM scorm_tracking WHERE ". 00268 "sco_id = ".$ilDB->quote($this->getId()); 00269 $ilDB->query($q); 00270 00271 } 00272 00278 function getTrackingDataOfUser($a_user_id = 0) 00279 { 00280 global $ilDB, $ilUser; 00281 00282 if ($a_user_id == 0) 00283 { 00284 $a_user_id = $ilUser->getId(); 00285 } 00286 00287 $q = "SELECT * FROM scorm_tracking WHERE ". 00288 "sco_id = '".$this->getId()."' AND ". 00289 "user_id = '".$a_user_id."'"; 00290 00291 $track_set = $ilDB->query($q); 00292 $trdata = array(); 00293 while ($track_rec = $track_set->fetchRow(DB_FETCHMODE_ASSOC)) 00294 { 00295 $trdata[$track_rec["lvalue"]] = $track_rec["rvalue"]; 00296 } 00297 00298 return $trdata; 00299 } 00300 00301 function insertTrackData($a_lval, $a_rval, $a_obj_id) 00302 { 00303 require_once("content/classes/SCORM/class.ilObjSCORMTracking.php"); 00304 ilObjSCORMTracking::_insertTrackData($this->getId(), $a_lval, $a_rval, $a_obj_id); 00305 } 00306 00307 } 00308 ?>