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
00035 require_once "class.ilContainer.php";
00036
00037 class ilObjCategory extends ilContainer
00038 {
00045 function ilObjCategory($a_id = 0,$a_call_by_reference = true)
00046 {
00047 global $ilBench;
00048
00049 $ilBench->start("Core", "ilObjCategory_Constructor");
00050
00051 $this->type = "cat";
00052 $this->ilContainer($a_id,$a_call_by_reference);
00053
00054 $ilBench->stop("Core", "ilObjCategory_Constructor");
00055 }
00056
00063 function ilClone($a_parent_ref)
00064 {
00065 global $rbacadmin;
00066
00067
00068 $new_ref_id = parent::ilClone($a_parent_ref);
00069
00070
00071
00072
00073 return $new_ref_id;
00074 }
00075
00082 function delete()
00083 {
00084
00085 if (!parent::delete())
00086 {
00087 return false;
00088 }
00089
00090 $query = "DELETE FROM object_translation WHERE obj_id=".$this->getId();
00091 $this->ilias->db->query($query);
00092
00093 return true;
00094 }
00095
00102 function getTranslations()
00103 {
00104 $q = "SELECT * FROM object_translation WHERE obj_id = ".$this->getId()." ORDER BY lang_default DESC";
00105 $r = $this->ilias->db->query($q);
00106
00107 $num = 0;
00108
00109 while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
00110 {
00111 $data["Fobject"][$num]= array("title" => $row->title,
00112 "desc" => $row->description,
00113 "lang" => $row->lang_code
00114 );
00115 $num++;
00116 }
00117
00118
00119 $data["default_language"] = 0;
00120
00121 return $data ? $data : array();
00122 }
00123
00124
00125 function removeTranslations()
00126 {
00127 $q = "DELETE FROM object_translation WHERE obj_id= ".$this->getId();
00128 $this->ilias->db->query($q);
00129 }
00130
00131
00132 function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
00133 {
00134 if (empty($a_title))
00135 {
00136 $a_title = "NO TITLE";
00137 }
00138
00139 $q = "INSERT INTO object_translation ".
00140 "(obj_id,title,description,lang_code,lang_default) ".
00141 "VALUES ".
00142 "(".$this->getId().",'".ilUtil::prepareDBString($a_title)."','".ilUtil::prepareDBString($a_desc)."','".$a_lang."',".$a_lang_default.")";
00143 $this->ilias->db->query($q);
00144
00145 return true;
00146 }
00147
00148
00149 }
00150 ?>