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

content/classes/AICC/class.ilAICCObject.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 
00034 class ilAICCObject
00035 {
00036         var $id;
00037         var $title;
00038         var $objType;
00039         var $alm_id;
00040         var $description;
00041         var $developer_id;
00042         var $system_id;
00043 
00044 
00051         function ilAICCObject($a_id = 0)
00052         {
00053                 global $ilias;
00054 
00055                 $this->ilias =& $ilias;
00056                 $this->id = $a_id;
00057                 if ($a_id > 0)
00058                 {
00059                         $this->read();
00060                 }
00061         }
00062 
00063         function getId()
00064         {
00065                 return $this->id;
00066         }
00067 
00068         function setId($a_id)
00069         {
00070                 $this->id = $a_id;
00071         }
00072 
00073         function getType()
00074         {
00075                 return $this->objType;
00076         }
00077 
00078         function setType($a_objType)
00079         {
00080                 $this->objType = $a_objType;
00081         }
00082 
00083         function getTitle()
00084         {
00085                 return $this->title;
00086         }
00087 
00088         function setTitle($a_title)
00089         {
00090                 $this->title = $a_title;
00091         }
00092         
00093         function getDescription()
00094         {
00095                 return $this->description;
00096         }
00097 
00098         function setDescription($a_description)
00099         {
00100                 $this->description = $a_description;
00101         }
00102         
00103         function getDeveloperId()
00104         {
00105                 return $this->developer_id;
00106         }
00107 
00108         function setDeveloperId($a_developer_id)
00109         {
00110                 $this->developer_id = $a_developer_id;
00111         }       
00112         
00113         function getSystemId()
00114         {
00115                 return $this->system_id;
00116         }
00117 
00118         function setSystemId($a_system_id)
00119         {
00120                 $this->system_id = $a_system_id;
00121         }               
00122 
00123         function getALMId()
00124         {
00125                 return $this->alm_id;
00126         }
00127 
00128         function setALMId($a_alm_id)
00129         {
00130                 $this->alm_id = $a_alm_id;
00131         }
00132         
00133         function prepForStore($string) {
00134                 if (!get_magic_quotes_runtime()) {
00135         $string = addslashes($string);
00136     }
00137     return $string;
00138         }
00139 
00140         function read()
00141         {
00142                 $q = "SELECT * FROM aicc_object WHERE obj_id = '".$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                 $q = "INSERT INTO aicc_object (title, type, slm_id, description, developer_id, system_id) VALUES (";
00157                 $q.="'".$this->prepForStore($this->getTitle())."', ";
00158                 $q.="'".$this->prepForStore($this->getType())."', ";
00159                 $q.="'".$this->getALMId()."', ";
00160                 $q.="'".$this->prepForStore($this->getDescription())."', ";
00161                 $q.="'".$this->getDeveloperId()."', ";
00162                 $q.="'".$this->getSystemId()."') ";
00163                 $this->ilias->db->query($q);
00164                 $this->setId($this->ilias->db->getLastInsertId());
00165         }
00166 
00167         function update()
00168         {
00169                 $q = "UPDATE aicc_object SET ";
00170                 $q.="title = '".$this->prepForStore($this->getTitle())."', ";
00171                 $q.="type = '".$this->prepForStore($this->getType())."', ";
00172                 $q.="slm_id = '".$this->getALMId()."', ";
00173                 $q.="description = '".$this->prepForStore($this->getDescription())."', ";
00174                 $q.="developer_id = '".$this->getDeveloperId()."', ";
00175                 $q.="system_id = '".$this->getSystemId()."' ";
00176                 $q.="WHERE obj_id = '".$this->getId()."'";
00177                 $this->ilias->db->query($q);
00178         }
00179 
00180         function delete()
00181         {
00182                 global $ilDB;
00183 
00184                 $q = "DELETE FROM aicc_object WHERE obj_id =".$ilDB->quote($this->getId());
00185                 $ilDB->query($q);
00186         }
00187 
00193         function &_getInstance($a_id)
00194         {
00195                 global $ilDB;
00196 
00197                 $sc_set = $ilDB->query("SELECT type FROM aicc_object WHERE obj_id =".$ilDB->quote($a_id));
00198                 $sc_rec = $sc_set->fetchRow(DB_FETCHMODE_ASSOC);
00199 
00200                 switch($sc_rec["type"])
00201                 {
00202                         case "sbl":                                     // Block
00203                                 include_once("content/classes/AICC/class.ilAICCBlock.php");
00204                                 $block =& new ilAICCBlock($a_id);
00205                                 return $block;
00206                                 break;
00207 
00208                         case "sau":                                     // assignable unit
00209                                 include_once("content/classes/AICC/class.ilAICCUnit.php");
00210                                 $sau =& new ilAICCUnit($a_id);
00211                                 return $sau;
00212                                 break;
00213                                 
00214                         case "shd":                                     // course
00215                                 include_once("content/classes/AICC/class.ilAICCCourse.php");
00216                                 $shd =& new ilAICCCourse($a_id);
00217                                 return $shd;
00218                                 break;
00219                 }
00220                 
00221         }
00222 
00223 }
00224 ?>

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