ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAdvancedMDFieldTranslation Class Reference

Class ilAdvancedMDFieldTranslation. More...

+ Collaboration diagram for ilAdvancedMDFieldTranslation:

Public Member Functions

 __construct (int $field_id, string $title, string $description, string $lang_key)
 ilAdvancedMDFieldTranslation constructor. More...
 
 setTitle (string $title)
 
 setDescription (string $description)
 
 getFieldId ()
 
 getTitle ()
 
 getDescription ()
 
 getLangKey ()
 
 update ()
 update or insert entry More...
 
 delete ()
 
 insert ()
 

Data Fields

const TABLE_NAME = 'adv_md_field_int'
 

Private Attributes

 $field_id
 
 $title
 
 $description
 
 $lang_key
 
 $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDFieldTranslation::__construct ( int  $field_id,
string  $title,
string  $description,
string  $lang_key 
)

ilAdvancedMDFieldTranslation constructor.

Definition at line 42 of file class.ilAdvancedMDFieldTranslation.php.

43 {
44 global $DIC;
45
46 $this->db = $DIC->database();
47
48 $this->field_id = $field_id;
49 $this->title = $title;
50 $this->description = $description;
51 $this->lang_key = $lang_key;
52 }
global $DIC
Definition: goto.php:24

References $description, $DIC, $field_id, $lang_key, and $title.

Member Function Documentation

◆ delete()

ilAdvancedMDFieldTranslation::delete ( )

Definition at line 125 of file class.ilAdvancedMDFieldTranslation.php.

126 {
127 $query = 'delete from ' . self::TABLE_NAME . ' ' .
128 'where field_id = ' . $this->db->quote($this->getFieldId(), ilDBConstants::T_INTEGER) . ' and ' .
129 'lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT);
130 $this->db->manipulate($query);
131 }
$query

References $query, getFieldId(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

+ Here is the call graph for this function:

◆ getDescription()

ilAdvancedMDFieldTranslation::getDescription ( )
Returns
string

Definition at line 90 of file class.ilAdvancedMDFieldTranslation.php.

90 : string
91 {
92 return $this->description;
93 }

References $description.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getFieldId()

ilAdvancedMDFieldTranslation::getFieldId ( )
Returns
int

Definition at line 74 of file class.ilAdvancedMDFieldTranslation.php.

74 : int
75 {
76 return $this->field_id;
77 }

References $field_id.

Referenced by delete(), insert(), and update().

+ Here is the caller graph for this function:

◆ getLangKey()

ilAdvancedMDFieldTranslation::getLangKey ( )
Returns
string

Definition at line 98 of file class.ilAdvancedMDFieldTranslation.php.

98 : string
99 {
100 return $this->lang_key;
101 }

References $lang_key.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilAdvancedMDFieldTranslation::getTitle ( )
Returns
string

Definition at line 82 of file class.ilAdvancedMDFieldTranslation.php.

82 : string
83 {
84 return $this->title;
85 }

References $title.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ insert()

ilAdvancedMDFieldTranslation::insert ( )

Definition at line 133 of file class.ilAdvancedMDFieldTranslation.php.

134 {
135 $query = 'insert into ' . self::TABLE_NAME . ' (field_id, title, lang_code, description) ' .
136 'values ( ' .
137 $this->db->quote($this->getFieldId(), ilDBConstants::T_INTEGER) . ', ' .
138 $this->db->quote($this->getTitle() , ilDBConstants::T_TEXT) . ', ' .
139 $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT) . ', ' .
140 $this->db->quote($this->getDescription(), ilDBConstants::T_TEXT) . ' ' .
141 ')';
142 $this->db->manipulate($query);
143 }

References $query, getDescription(), getFieldId(), getLangKey(), getTitle(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDescription()

ilAdvancedMDFieldTranslation::setDescription ( string  $description)
Parameters
string$description

Definition at line 65 of file class.ilAdvancedMDFieldTranslation.php.

65 : void
66 {
67 $this->description = $description;
68 }

References $description.

◆ setTitle()

ilAdvancedMDFieldTranslation::setTitle ( string  $title)
Parameters
string$title

Definition at line 57 of file class.ilAdvancedMDFieldTranslation.php.

57 : void
58 {
59 $this->title = $title;
60 }

References $title.

◆ update()

ilAdvancedMDFieldTranslation::update ( )

update or insert entry

Definition at line 106 of file class.ilAdvancedMDFieldTranslation.php.

107 {
108 $query = 'select * from ' . self::TABLE_NAME . ' ' .
109 'where field_id = ' . $this->db->quote($this->getFieldId(), ilDBConstants::T_INTEGER) . ' ' .
110 'and lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT) . ' ';
111 $res = $this->db->query($query);
112 if (!$res->numRows()) {
113 return $this->insert();
114 }
115
116 $query = 'update ' . self::TABLE_NAME . ' ' .
117 'set title = ' . $this->db->quote($this->getTitle(), ilDBConstants::T_TEXT) . ', ' .
118 'description = ' . $this->db->quote($this->getDescription(), ilDBConstants::T_TEXT) . ' ' .
119 'where field_id = ' . $this->db->quote($this->getFieldId(), ilDBConstants::T_INTEGER) . ' ' .
120 'and lang_code = ' . $this->db->quote($this->getLangKey(), ilDBConstants::T_TEXT);
121
122 $this->db->manipulate($query);
123 }
foreach($_POST as $key=> $value) $res

References $query, $res, getDescription(), getFieldId(), getLangKey(), getTitle(), insert(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilAdvancedMDFieldTranslation::$db
private

Definition at line 37 of file class.ilAdvancedMDFieldTranslation.php.

◆ $description

ilAdvancedMDFieldTranslation::$description
private

◆ $field_id

ilAdvancedMDFieldTranslation::$field_id
private

Definition at line 16 of file class.ilAdvancedMDFieldTranslation.php.

Referenced by __construct(), and getFieldId().

◆ $lang_key

ilAdvancedMDFieldTranslation::$lang_key
private

Definition at line 31 of file class.ilAdvancedMDFieldTranslation.php.

Referenced by __construct(), and getLangKey().

◆ $title

ilAdvancedMDFieldTranslation::$title
private

Definition at line 21 of file class.ilAdvancedMDFieldTranslation.php.

Referenced by __construct(), getTitle(), and setTitle().

◆ TABLE_NAME

const ilAdvancedMDFieldTranslation::TABLE_NAME = 'adv_md_field_int'

Definition at line 11 of file class.ilAdvancedMDFieldTranslation.php.


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