ILIAS  release_7 Revision v7.30-3-g800a261c036
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
21 public function __construct($a_id = 0, $a_reference = true)
22 {
23 global $DIC;
24 parent::__construct($a_id, $a_reference);
25
26 $this->db = $DIC->database();
27 }
28
29 public function initType()
30 {
31 $this->type = "wsrt";
32 }
33
40 public function getTranslations()
41 {
43
44 $q = "SELECT * FROM object_translation WHERE obj_id = " .
45 $ilDB->quote($this->getId(), 'integer') . " ORDER BY lang_default DESC";
46 $r = $ilDB->query($q);
47
48 $num = 0;
49
50 $data["Fobject"] = array();
51 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
52 $data["Fobject"][$num] = array("title" => $row->title,
53 "desc" => $row->description,
54 "lang" => $row->lang_code
55 );
56 $num++;
57 }
58
59 // first entry is always the default language
60 $data["default_language"] = 0;
61
62 return $data ? $data : array();
63 }
64
65 // remove all Translations of current category
66 public function removeTranslations()
67 {
69
70 $query = "DELETE FROM object_translation WHERE obj_id= " .
71 $ilDB->quote($this->getId(), 'integer');
72 $res = $ilDB->manipulate($query);
73 }
74
75 // add a new translation to current category
76 public function addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
77 {
79
80 if (empty($a_title)) {
81 $a_title = "NO TITLE";
82 }
83
84 $query = "INSERT INTO object_translation " .
85 "(obj_id,title,description,lang_code,lang_default) " .
86 "VALUES " .
87 "(" . $ilDB->quote($this->getId(), 'integer') . "," .
88 $ilDB->quote($a_title, 'text') . "," .
89 $ilDB->quote($a_desc, 'text') . "," .
90 $ilDB->quote($a_lang, 'text') . "," .
91 $ilDB->quote($a_lang_default, 'integer') . ")";
92 $res = $ilDB->manipulate($query);
93 return true;
94 }
95} // END class.ObjRootFolder
An exception for terminatinating execution or to throw for unit testing.
Class ilObjWorkspaceFolder.
Class ilObjWorkspaceRootFolder.
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
__construct($a_id=0, $a_reference=true)
Constructor.
getTranslations()
get all translations from this category
getId()
get object id @access public
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$data
Definition: storeScorm.php:23