ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
ILIAS\Administration\HeaderTitleRepo Class Reference
+ Collaboration diagram for ILIAS\Administration\HeaderTitleRepo:

Public Member Functions

 __construct ()
 
 getHeaderTitle ()
 
 getHeaderTitleTranslations ()
 
 removeHeaderTitleTranslations ()
 
 addHeaderTitleTranslation (string $a_title, string $a_lang, bool $a_lang_default)
 

Private Attributes

ilDBInterface $db
 
ilObjUser $user
 
int $obj_id
 

Detailed Description

Definition at line 28 of file HeaderTitleRepo.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Administration\HeaderTitleRepo::__construct ( )

Definition at line 34 of file HeaderTitleRepo.php.

35 {
36 global $DIC;
37 $this->db = $DIC->database();
38 $this->user = $DIC->user();
39 $this->obj_id = SYSTEM_FOLDER_ID;
40 }
const SYSTEM_FOLDER_ID
Definition: constants.php:35
global $DIC
Definition: shib_login.php:26

References $DIC, SYSTEM_FOLDER_ID, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addHeaderTitleTranslation()

ILIAS\Administration\HeaderTitleRepo::addHeaderTitleTranslation ( string  $a_title,
string  $a_lang,
bool  $a_lang_default 
)

Definition at line 102 of file HeaderTitleRepo.php.

102 : void
103 {
104 $query = "INSERT INTO object_translation " .
105 "(obj_id,title,description,lang_code,lang_default) " .
106 "VALUES " .
107 "(" . $this->db->quote($this->obj_id, 'integer') . "," .
108 $this->db->quote($a_title, 'text') . "," .
109 $this->db->quote('', 'text') . "," .
110 $this->db->quote($a_lang, 'text') . "," .
111 $this->db->quote($a_lang_default, 'integer') . ")";
112 $res = $this->db->manipulate($query);
113 }
$res
Definition: ltiservices.php:69

References $res.

◆ getHeaderTitle()

ILIAS\Administration\HeaderTitleRepo::getHeaderTitle ( )

Definition at line 42 of file HeaderTitleRepo.php.

42 : string
43 {
44 $title = '';
45
46 $q = "SELECT title FROM object_translation " .
47 "WHERE obj_id = " . $this->db->quote($this->obj_id, 'integer') . " " .
48 "AND lang_default = 1";
49 $r = $this->db->query($q);
50 $row = $this->db->fetchObject($r);
51 if ($row !== null) {
52 $title = (string) $row->title;
53 }
54
55 $q = "SELECT title FROM object_translation " .
56 "WHERE obj_id = " . $this->db->quote($this->obj_id, 'integer') . " " .
57 "AND lang_code = " .
58 $this->db->quote($this->user->getCurrentLanguage(), 'text') . " " .
59 "AND NOT lang_default = 1";
60 $r = $this->db->query($q);
61 $row = $this->db->fetchObject($r);
62
63 if ($row !== null) {
64 $title = (string) $row->title;
65 }
66
67 return $title;
68 }
$q
Definition: shib_logout.php:23

References $q, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getHeaderTitleTranslations()

ILIAS\Administration\HeaderTitleRepo::getHeaderTitleTranslations ( )

Definition at line 70 of file HeaderTitleRepo.php.

70 : array
71 {
72 $q = "SELECT * FROM object_translation WHERE obj_id = " .
73 $this->db->quote($this->obj_id, 'integer') . " ORDER BY lang_default DESC";
74 $r = $this->db->query($q);
75
76 $num = 0;
77 while ($row = $this->db->fetchObject($r)) {
78 $data["Fobject"][$num] = array("title" => $row->title,
80 (string) $row->description,
82 true
83 ),
84 "lang" => $row->lang_code
85 );
86 $num++;
87 }
88
89 // first entry is always the default language
90 $data["default_language"] = 0;
91
92 return $data ?? [];
93 }
const DESC_LENGTH
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)

References $data, $q, ilObject\DESC_LENGTH, and ilStr\shortenTextExtended().

+ Here is the call graph for this function:

◆ removeHeaderTitleTranslations()

ILIAS\Administration\HeaderTitleRepo::removeHeaderTitleTranslations ( )

Definition at line 95 of file HeaderTitleRepo.php.

95 : void
96 {
97 $query = "DELETE FROM object_translation WHERE obj_id= " .
98 $this->db->quote($this->obj_id, 'integer');
99 $this->db->manipulate($query);
100 }

Field Documentation

◆ $db

ilDBInterface ILIAS\Administration\HeaderTitleRepo::$db
private

Definition at line 30 of file HeaderTitleRepo.php.

◆ $obj_id

int ILIAS\Administration\HeaderTitleRepo::$obj_id
private

Definition at line 32 of file HeaderTitleRepo.php.

◆ $user

ilObjUser ILIAS\Administration\HeaderTitleRepo::$user
private

Definition at line 31 of file HeaderTitleRepo.php.


The documentation for this class was generated from the following file: