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

classes/class.ilObjSystemFolder.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 
00035 require_once "class.ilObject.php";
00036 
00037 class ilObjSystemFolder extends ilObject
00038 {
00045         function ilObjSystemFolder($a_id,$a_call_by_reference = true)
00046         {
00047                 $this->type = "adm";
00048                 $this->ilObject($a_id,$a_call_by_reference);
00049         }
00050 
00057         function ilClone($a_parent_ref)
00058         {               
00059                 // DISABLED
00060                 return false;
00061 
00062                 global $rbacadmin;
00063 
00064                 // always call parent ilClone function first!!
00065                 $new_ref_id = parent::ilClone($a_parent_ref);
00066                 
00067                 // put here cat specific stuff
00068 
00069                 // ... and finally always return new reference ID!!
00070                 return $new_ref_id;
00071         }
00072 
00079         function delete()
00080         {
00081                 // DISABLED
00082                 return false;
00083 
00084                 // always call parent delete function first!!
00085                 if (!parent::delete())
00086                 {
00087                         return false;
00088                 }
00089 
00090                 // put here systemfolder specific stuff
00091 
00092                 // always call parent delete function at the end!!
00093                 return true;
00094         }
00095 
00102         function getHeaderTitleTranslations()
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                 // first entry is always the default language
00119                 $data["default_language"] = 0;
00120 
00121                 return $data ? $data : array();
00122         }
00123 
00124         // remove all Translations of current category
00125         function removeHeaderTitleTranslations()
00126         {
00127                 $q = "DELETE FROM object_translation WHERE obj_id= ".$this->getId();
00128                 $this->ilias->db->query($q);
00129         }
00130 
00131         // add a new translation to current category
00132         function addHeaderTitleTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
00133         {
00134                 $q = "INSERT INTO object_translation ".
00135                          "(obj_id,title,description,lang_code,lang_default) ".
00136                          "VALUES ".
00137                          "(".$this->getId().",'".ilUtil::prepareDBString($a_title)."','".ilUtil::prepareDBString($a_desc)."','".$a_lang."',".$a_lang_default.")";
00138                 $this->ilias->db->query($q);
00139 
00140                 return true;
00141         }
00142 
00143         function _getId()
00144         {
00145                 $q = "SELECT obj_id FROM object_data ".
00146                         "WHERE type = 'adm'";
00147                 $r = $this->ilias->db->query($q);
00148                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00149 
00150                 return $row->obj_id;
00151         }
00152 
00153         function _getHeaderTitle()
00154         {
00155                 $id = ilObjSystemFolder::_getId();
00156 
00157                 $q = "SELECT title,description FROM object_translation ".
00158                         "WHERE obj_id = ".$id." ".
00159                         "AND lang_default = 1";
00160                 $r = $this->ilias->db->query($q);
00161                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00162                 $title = $row->title;
00163 
00164                 $q = "SELECT title,description FROM object_translation ".
00165                         "WHERE obj_id = ".$id." ".
00166                         "AND lang_code = '".$this->ilias->account->getPref("language")."' ".
00167                         "AND NOT lang_default = 1";
00168                 $r = $this->ilias->db->query($q);
00169                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00170 
00171                 if ($row)
00172                 {
00173                         $title = $row->title;
00174                 }
00175 
00176                 return $title;
00177         }
00178 
00179         function _getHeaderTitleDescription()
00180         {
00181                 $id = ilObjSystemFolder::_getId();
00182 
00183                 $q = "SELECT title,description FROM object_translation ".
00184                         "WHERE obj_id = ".$id." ".
00185                         "AND lang_default = 1";
00186                 $r = $this->ilias->db->query($q);
00187                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00188                 $description = $row->description;
00189 
00190                 $q = "SELECT title,description FROM object_translation ".
00191                         "WHERE obj_id = ".$id." ".
00192                         "AND lang_code = '".$this->ilias->account->getPref("language")."' ".
00193                         "AND NOT lang_default = 1";
00194                 $r = $this->ilias->db->query($q);
00195                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00196 
00197                 if ($row)
00198                 {
00199                         $description = $row->description;
00200                 }
00201 
00202                 return $description;
00203         }
00204 
00205 } // END class.ilObjSystemFolder
00206 ?>

Generated on Fri Dec 13 2013 09:06:34 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1