ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
5require_once "Services/Object/classes/class.ilObject2.php";
6
16{
17 function initType()
18 {
19 $this->type = "wsrt";
20 }
21
28 function getTranslations()
29 {
30 global $ilDB;
31
32 $q = "SELECT * FROM object_translation WHERE obj_id = ".
33 $ilDB->quote($this->getId(),'integer')." ORDER BY lang_default DESC";
34 $r = $ilDB->query($q);
35
36 $num = 0;
37
38 $data["Fobject"] = array();
39 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
40 {
41 $data["Fobject"][$num]= array("title" => $row->title,
42 "desc" => $row->description,
43 "lang" => $row->lang_code
44 );
45 $num++;
46 }
47
48 // first entry is always the default language
49 $data["default_language"] = 0;
50
51 return $data ? $data : array();
52 }
53
54 // remove all Translations of current category
56 {
57 global $ilDB;
58
59 $query = "DELETE FROM object_translation WHERE obj_id= ".
60 $ilDB->quote($this->getId(),'integer');
61 $res = $ilDB->manipulate($query);
62 }
63
64 // add a new translation to current category
65 function addTranslation($a_title,$a_desc,$a_lang,$a_lang_default)
66 {
67 global $ilDB;
68
69 if (empty($a_title))
70 {
71 $a_title = "NO TITLE";
72 }
73
74 $query = "INSERT INTO object_translation ".
75 "(obj_id,title,description,lang_code,lang_default) ".
76 "VALUES ".
77 "(".$ilDB->quote($this->getId(),'integer').",".
78 $ilDB->quote($a_title,'text').",".
79 $ilDB->quote($a_desc,'text').",".
80 $ilDB->quote($a_lang,'text').",".
81 $ilDB->quote($a_lang_default,'integer').")";
82 $res = $ilDB->manipulate($query);
83 return true;
84 }
85
86} // END class.ObjRootFolder
87?>
An exception for terminatinating execution or to throw for unit testing.
Class ilObjWorkspaceRootFolder.
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
getTranslations()
get all translations from this category
Class ilObject2 This is an intermediate progress of ilObject class.
getId()
get object id @access public
$r
Definition: example_031.php:79
global $ilDB