• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/class.ilObjAICCLearningModule.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once "classes/class.ilObject.php";
00025 //require_once "classes/class.ilMetaData.php";
00026 require_once "content/classes/class.ilObjSCORMLearningModule.php";
00027 
00037 class ilObjAICCLearningModule extends ilObjSCORMLearningModule
00038 {
00039         //var $meta_data;
00040 
00047         function ilObjAICCLearningModule($a_id = 0, $a_call_by_reference = true)
00048         {
00049                 $this->type = "sahs";
00050                 parent::ilObject($a_id,$a_call_by_reference);
00051 /*
00052                 if ($a_id == 0)
00053                 {
00054                         $new_meta =& new ilMetaData();
00055                         $this->assignMetaData($new_meta);
00056                 }
00057 */
00058         }
00059 
00063         function readObject()
00064         {
00065                 require_once("content/classes/class.ilObjAICCCourseInterchangeFiles.php");
00066                 $cifModule = new ilObjAICCCourseInterchangeFiles();
00067                 $cifModule->findFiles($this->getDataDirectory());
00068 
00069                 $cifModule->readFiles();
00070                 if (!empty($cifModule->errorText))
00071                 {
00072                         $this->ilias->raiseError("<b>Error reading LM-File(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
00073                 }
00074 
00075                 if ($_POST["validate"] == "y")
00076                 {
00077 
00078                         $cifModule->validate();
00079                         if (!empty($cifModule->errorText))
00080                         {
00081                                 $this->ilias->raiseError("<b>Validation Error(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
00082                         }
00083                 }
00084 
00085                 $cifModule->writeToDatabase($this->getId());
00086         }
00087 
00088 
00100         function delete()
00101         {
00102                 global $ilDB;
00103 
00104                 // always call parent delete function first!!
00105                 if (!parent::delete())
00106                 {
00107                         return false;
00108                 }
00109 
00110                 // delete meta data of scorm content object
00111 /*
00112                 $nested = new ilNestedSetXML();
00113                 $nested->init($this->getId(), $this->getType());
00114                 $nested->deleteAllDBData();
00115 */
00116                 $this->deleteMetaData();
00117 
00118                 // delete data directory
00119                 ilUtil::delDir($this->getDataDirectory());
00120 
00121                 // delete scorm learning module record
00122                 $q = "DELETE FROM sahs_lm WHERE id = ".$ilDB->quote($this->getId());
00123                 $this->ilias->db->query($q);
00124 
00125                 // delete aicc data
00126                 // this is highly dependent on the database
00127                 $q = "DELETE FROM aicc_units USING aicc_object, aicc_units WHERE aicc_object.obj_id=aicc_units.obj_id and aicc_object.slm_id=".$ilDB->quote($this->getId());
00128                 $this->ilias->db->query($q);
00129 
00130                 $q = "DELETE FROM aicc_course USING aicc_object, aicc_course WHERE aicc_object.obj_id=aicc_course.obj_id and aicc_object.slm_id=".$ilDB->quote($this->getId());
00131                 $this->ilias->db->query($q);
00132 
00133                 $q = "DELETE FROM scorm_tree WHERE slm_id = ".$ilDB->quote($this->getId());
00134                 $this->ilias->db->query($q);
00135 
00136                 $q = "DELETE FROM aicc_object WHERE slm_id = ".$ilDB->quote($this->getId());
00137                 $this->ilias->db->query($q);
00138 
00139 
00140                 // always call parent delete function at the end!!
00141                 return true;
00142         }
00143 
00144 
00148         function getTrackingItems()
00149         {
00150                 return ilObjAICCLearningModule::_getTrackingItems($this->getId());
00151         }
00152 
00153 
00157         function _getTrackingItems($a_obj_id)
00158         {
00159                 global $ilDB;
00160 
00161                 include_once("content/classes/AICC/class.ilAICCUnit.php");
00162 
00163                 $query = "SELECT obj_id,title FROM aicc_object ".
00164                         "WHERE slm_id = '".$a_obj_id."' ".
00165                         "AND type = 'sau'";
00166 
00167                 $res = $ilDB->query($query);
00168                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00169                 {
00170                         $items[$row->obj_id]['obj_id'] = $row->obj_id;
00171                         $items[$row->obj_id]['title'] = $row->title;
00172 
00173                 }
00174                 return $items ? $items : array();
00175 
00176                 /*
00177                 include_once("content/classes/SCORM/class.ilSCORMTree.php");
00178                 $tree = new ilSCORMTree($a_obj_id);
00179                 $root_id = $tree->readRootId();
00180 
00181                 $items = array();
00182                 $childs = $tree->getSubTree($tree->getNodeData($root_id));
00183                 foreach($childs as $child)
00184                 {
00185                         if($child["type"] == "sau")
00186                         {
00187                                 include_once("content/classes/AICC/class.ilAICCUnit.php");
00188                                 $ac_item =& new ilAICCUnit($child["obj_id"]);
00189                                 $items[count($items)] =& $ac_item;
00190                         }
00191                 }
00192 
00193                 return $items;
00194                 */
00195         }
00196 
00200         function getTrackedItems()
00201         {
00202                 global $ilUser, $ilDB, $ilUser;
00203 
00204                 $query = "SELECT DISTINCT sco_id FROM scorm_tracking WHERE".
00205                         " obj_id = ".$ilDB->quote($this->getId());
00206 
00207                 $sco_set = $ilDB->query($query);
00208 
00209                 $items = array();
00210                 while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
00211                 {
00212                         include_once("content/classes/AICC/class.ilAICCUnit.php");      
00213                         $ac_item =& new ilAICCUnit($sco_rec["sco_id"]);
00214                         $items[count($items)] =& $ac_item;
00215 
00216                 }
00217 
00218                 return $items;
00219         }
00220 
00221         function getTrackingData($a_sco_id)
00222         {
00223                 global $ilDB;
00224 
00225                 $query = "SELECT * FROM scorm_tracking WHERE".
00226                         " obj_id = ".$ilDB->quote($this->getId()).
00227                         " AND sco_id = ".$ilDB->quote($a_sco_id).
00228                         " ORDER BY user_id, lvalue";
00229                 $data_set = $ilDB->query($query);
00230 
00231                 $data = array();
00232                 while($data_rec = $data_set->fetchRow(DB_FETCHMODE_ASSOC))
00233                 {
00234                         $data[] = $data_rec;
00235                 }
00236 
00237                 return $data;
00238         }
00239 
00240 } // END class.ilObjAICCLearningModule
00241 
00242 ?>

Generated on Fri Dec 13 2013 13:52:09 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1