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

classes/class.ilObjRootFolder.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 require_once "class.ilContainer.php";
00036 
00037 class ilObjRootFolder extends ilContainer
00038 {
00045         function ilObjRootFolder($a_id,$a_call_by_reference = true)
00046         {
00047                 $this->type = "root";
00048                 $this->ilObject($a_id,$a_call_by_reference);
00049         }
00050 
00051 
00052 
00059         function delete()
00060         {
00061                 // delete is disabled
00062 
00063                 $message = get_class($this)."::delete(): Can't delete root folder!";
00064                 $this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
00065                 return false;
00066 
00067                 // always call parent delete function first!!
00068                 if (!parent::delete())
00069                 {
00070                         return false;
00071                 }
00072 
00073                 // put here rootfolder specific stuff
00074 
00075                 return true;;
00076         }
00077 
00088         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00089         {
00090                 global $tree;
00091 
00092                 switch ($a_event)
00093                 {
00094                         case "link":
00095 
00096                                 //var_dump("<pre>",$a_params,"</pre>");
00097                                 //echo "RootFolder ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00098                                 //exit;
00099                                 break;
00100 
00101                         case "cut":
00102 
00103                                 //echo "RootFolder ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00104                                 //exit;
00105                                 break;
00106 
00107                         case "copy":
00108 
00109                                 //var_dump("<pre>",$a_params,"</pre>");
00110                                 //echo "RootFolder ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00111                                 //exit;
00112                                 break;
00113 
00114                         case "paste":
00115 
00116                                 //echo "RootFolder ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00117                                 //exit;
00118                                 break;
00119 
00120                         case "new":
00121 
00122                                 //echo "RootFolder ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00123                                 //exit;
00124                                 break;
00125                 }
00126 
00127 
00128                 return true;
00129         }
00130 
00137         function getTranslations()
00138         {
00139                 global $ilDB;
00140 
00141                 $q = "SELECT * FROM object_translation WHERE obj_id = ".
00142                         $ilDB->quote($this->getId())." ORDER BY lang_default DESC";
00143                 $r = $this->ilias->db->query($q);
00144 
00145                 $num = 0;
00146 
00147                 $data["Fobject"] = array();
00148                 while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
00149                 {
00150                         $data["Fobject"][$num]= array("title"   => $row->title,
00151                                                                                   "desc"        => $row->description,
00152                                                                                   "lang"        => $row->lang_code
00153                                                                                   );
00154                         $num++;
00155                 }
00156 
00157                 // first entry is always the default language
00158                 $data["default_language"] = 0;
00159 
00160                 return $data ? $data : array();
00161         }
00162 
00163         // remove all Translations of current category
00164         function removeTranslations()
00165         {
00166                 global $ilDB;
00167 
00168                 $q = "DELETE FROM object_translation WHERE obj_id= ".
00169                         $ilDB->quote($this->getId());
00170                 $this->ilias->db->query($q);
00171         }
00172 
00173         // add a new translation to current category
00174         function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
00175         {
00176                 global $ilDB;
00177 
00178                 if (empty($a_title))
00179                 {
00180                         $a_title = "NO TITLE";
00181                 }
00182 
00183                 $q = "INSERT INTO object_translation ".
00184                          "(obj_id,title,description,lang_code,lang_default) ".
00185                          "VALUES ".
00186                          "(".$ilDB->quote($this->getId()).",".
00187                          $ilDB->quote($a_title).",".
00188                          $ilDB->quote($a_desc).",".
00189                          $ilDB->quote($a_lang).",".
00190                          $ilDB->quote($a_lang_default).")";
00191                 $this->ilias->db->query($q);
00192 
00193                 return true;
00194         }
00195 
00196 } // END class.ObjRootFolder
00197 ?>

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