ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjWorkspaceRootFolder.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "Services/Object/classes/class.ilObject2.php";
6 
16 {
17  function initType()
18  {
19  $this->type = "wsrt";
20  }
21 
32  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
33  {
34  global $tree;
35 
36  switch ($a_event)
37  {
38  case "link":
39 
40  //var_dump("<pre>",$a_params,"</pre>");
41  //echo "RootFolder ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
42  //exit;
43  break;
44 
45  case "cut":
46 
47  //echo "RootFolder ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
48  //exit;
49  break;
50 
51  case "copy":
52 
53  //var_dump("<pre>",$a_params,"</pre>");
54  //echo "RootFolder ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
55  //exit;
56  break;
57 
58  case "paste":
59 
60  //echo "RootFolder ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
61  //exit;
62  break;
63 
64  case "new":
65 
66  //echo "RootFolder ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
67  //exit;
68  break;
69  }
70 
71 
72  return true;
73  }
74 
81  function getTranslations()
82  {
83  global $ilDB;
84 
85  $q = "SELECT * FROM object_translation WHERE obj_id = ".
86  $ilDB->quote($this->getId(),'integer')." ORDER BY lang_default DESC";
87  $r = $this->ilias->db->query($q);
88 
89  $num = 0;
90 
91  $data["Fobject"] = array();
92  while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
93  {
94  $data["Fobject"][$num]= array("title" => $row->title,
95  "desc" => $row->description,
96  "lang" => $row->lang_code
97  );
98  $num++;
99  }
100 
101  // first entry is always the default language
102  $data["default_language"] = 0;
103 
104  return $data ? $data : array();
105  }
106 
107  // remove all Translations of current category
109  {
110  global $ilDB;
111 
112  $query = "DELETE FROM object_translation WHERE obj_id= ".
113  $ilDB->quote($this->getId(),'integer');
114  $res = $ilDB->manipulate($query);
115  }
116 
117  // add a new translation to current category
118  function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
119  {
120  global $ilDB;
121 
122  if (empty($a_title))
123  {
124  $a_title = "NO TITLE";
125  }
126 
127  $query = "INSERT INTO object_translation ".
128  "(obj_id,title,description,lang_code,lang_default) ".
129  "VALUES ".
130  "(".$ilDB->quote($this->getId(),'integer').",".
131  $ilDB->quote($a_title,'text').",".
132  $ilDB->quote($a_desc,'text').",".
133  $ilDB->quote($a_lang,'text').",".
134  $ilDB->quote($a_lang_default,'integer').")";
135  $res = $ilDB->manipulate($query);
136  return true;
137  }
138 
139 } // END class.ObjRootFolder
140 ?>