• Main Page
  • Related Pages
  • Modules
  • 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 
00034 require_once "class.ilObject.php";
00035 
00036 class ilObjSystemFolder extends ilObject
00037 {
00044         function ilObjSystemFolder($a_id,$a_call_by_reference = true)
00045         {
00046                 $this->type = "adm";
00047                 $this->ilObject($a_id,$a_call_by_reference);
00048         }
00049 
00050 
00057         function delete()
00058         {
00059                 // DISABLED
00060                 return false;
00061 
00062                 // always call parent delete function first!!
00063                 if (!parent::delete())
00064                 {
00065                         return false;
00066                 }
00067 
00068                 // put here systemfolder specific stuff
00069 
00070                 // always call parent delete function at the end!!
00071                 return true;
00072         }
00073 
00080         function getHeaderTitleTranslations()
00081         {
00082                 global $ilDB;
00083                 
00084                 $q = "SELECT * FROM object_translation WHERE obj_id = ".
00085                         $ilDB->quote($this->getId())." ORDER BY lang_default DESC";
00086                 $r = $this->ilias->db->query($q);
00087 
00088                 $num = 0;
00089 
00090                 while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
00091                 {
00092                         $data["Fobject"][$num]= array("title"   => $row->title,
00093                                                                                   "desc"        => ilUtil::shortenText($row->description,MAXLENGTH_OBJ_DESC,true),
00094                                                                                   "lang"        => $row->lang_code
00095                                                                                   );
00096                 $num++;
00097                 }
00098 
00099                 // first entry is always the default language
00100                 $data["default_language"] = 0;
00101 
00102                 return $data ? $data : array();
00103         }
00104 
00105         // remove all Translations of current category
00106         function removeHeaderTitleTranslations()
00107         {
00108                 global $ilDB;
00109                 
00110                 $q = "DELETE FROM object_translation WHERE obj_id= ".
00111                         $ilDB->quote($this->getId());
00112                 $this->ilias->db->query($q);
00113         }
00114 
00115         // add a new translation to current category
00116         function addHeaderTitleTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
00117         {
00118                 global $ilDB;
00119                 
00120                 $q = "INSERT INTO object_translation ".
00121                          "(obj_id,title,description,lang_code,lang_default) ".
00122                          "VALUES ".
00123                          "(".$ilDB->quote($this->getId()).",".
00124                          $ilDB->quote($a_title).",".
00125                          $ilDB->quote($a_desc).",".
00126                          $ilDB->quote($a_lang).",".
00127                          $ilDB->quote($a_lang_default).")";
00128                 $this->ilias->db->query($q);
00129 
00130                 return true;
00131         }
00132 
00133         function _getId()
00134         {
00135                 $q = "SELECT obj_id FROM object_data ".
00136                         "WHERE type = 'adm'";
00137                 $r = $this->ilias->db->query($q);
00138                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00139 
00140                 return $row->obj_id;
00141         }
00142 
00143         function _getHeaderTitle()
00144         {
00145                 global $ilDB;
00146                 
00147                 $id = ilObjSystemFolder::_getId();
00148 
00149                 $q = "SELECT title,description FROM object_translation ".
00150                         "WHERE obj_id = ".$ilDB->quote($id)." ".
00151                         "AND lang_default = 1";
00152                 $r = $this->ilias->db->query($q);
00153                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00154                 $title = $row->title;
00155 
00156                 $q = "SELECT title,description FROM object_translation ".
00157                         "WHERE obj_id = ".$ilDB->quote($id)." ".
00158                         "AND lang_code = ".
00159                         $ilDB->quote($this->ilias->account->getPref("language"))." ".
00160                         "AND NOT lang_default = 1";
00161                 $r = $this->ilias->db->query($q);
00162                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00163 
00164                 if ($row)
00165                 {
00166                         $title = $row->title;
00167                 }
00168 
00169                 return $title;
00170         }
00171 
00172         function _getHeaderTitleDescription()
00173         {
00174                 global $ilDB;
00175                 
00176                 $id = ilObjSystemFolder::_getId();
00177 
00178                 $q = "SELECT title,description FROM object_translation ".
00179                         "WHERE obj_id = ".$ilDB->quote($id)." ".
00180                         "AND lang_default = 1";
00181                 $r = $this->ilias->db->query($q);
00182                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00183                 $description = $row->description;
00184 
00185                 $q = "SELECT title,description FROM object_translation ".
00186                         "WHERE obj_id = ".$ilDB->quote($id)." ".
00187                         "AND lang_code = ".
00188                         $ilDB->quote($this->ilias->account->getPref("language"))." ".
00189                         "AND NOT lang_default = 1";
00190                 $r = $this->ilias->db->query($q);
00191                 $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
00192 
00193                 if ($row)
00194                 {
00195                         $description = ilUtil::shortenText($row->description,MAXLENGTH_OBJ_DESC,true);
00196                 }
00197 
00198                 return $description;
00199         }
00200 
00201 } // END class.ilObjSystemFolder
00202 ?>

Generated on Fri Dec 13 2013 17:56:48 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1