ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMDRights Class Reference
+ Inheritance diagram for ilMDRights:
+ Collaboration diagram for ilMDRights:

Public Member Functions

 setCosts ($a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions ($a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 setCosts ($a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions ($a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getId ($a_rbac_id, $a_obj_id)
 
- Public Member Functions inherited from ilMDBase
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Static Public Member Functions

static _lookupDescription ($a_rbac_id, $a_obj_id)
 Lookup description (copyright) More...
 
static _getId ($a_rbac_id, $a_obj_id)
 

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMDBase
 $log
 

Detailed Description

Definition at line 33 of file class.ilMDRights.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDRights::__getFields ( )

Definition at line 137 of file class.ilMDRights.php.

138 {
139 return array('rbac_id' => array('integer',$this->getRBACId()),
140 'obj_id' => array('integer',$this->getObjId()),
141 'obj_type' => array('text',$this->getObjType()),
142 'costs' => array('text',$this->getCosts()),
143 'cpr_and_or' => array('text',$this->getCopyrightAndOtherRestrictions()),
144 'description' => array('text',$this->getDescription()),
145 'description_language' => array('text',$this->getDescriptionLanguageCode()));
146 }
getCopyrightAndOtherRestrictions()
getDescriptionLanguageCode()

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), and ilMDBase\getRBACId().

Referenced by save().

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

◆ __getFields() [2/2]

ilMDRights::__getFields ( )

Definition at line 138 of file class.ilMDRights.php.

139 {
140 return array('rbac_id' => $this->getRBACId(),
141 'obj_id' => $this->getObjId(),
142 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
143 'costs' => ilUtil::prepareDBString($this->getCosts()),
144 'copyright_and_other_restrictions' => ilUtil::prepareDBString($this->getCopyrightAndOtherRestrictions()),
145 'description' => ilUtil::prepareDBString($this->getDescription()),
146 'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
147 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), and ilUtil\prepareDBString().

+ Here is the call graph for this function:

◆ _getId() [1/2]

static ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)
static

Definition at line 220 of file class.ilMDRights.php.

221 {
222 global $ilDB;
223
224 $query = "SELECT meta_rights_id FROM il_meta_rights " .
225 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
226 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
227
228 $res = $ilDB->query($query);
229 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
230 return $row->meta_rights_id;
231 }
232 return false;
233 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMD\getRights().

+ Here is the caller graph for this function:

◆ _getId() [2/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

Definition at line 190 of file class.ilMDRights.php.

191 {
192 global $ilDB;
193
194 $query = "SELECT meta_rights_id FROM il_meta_rights " .
195 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
196 "AND obj_id = " . $ilDB->quote($a_obj_id);
197
198 $res = $ilDB->query($query);
199 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
200 return $row->meta_rights_id;
201 }
202 return false;
203 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

◆ _lookupDescription()

static ilMDRights::_lookupDescription (   $a_rbac_id,
  $a_obj_id 
)
static

Lookup description (copyright)

@access public

Parameters
intrbac_id
intobj_id

Definition at line 207 of file class.ilMDRights.php.

208 {
209 global $ilDB;
210
211 $query = "SELECT description FROM il_meta_rights " .
212 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
213 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
214 $res = $ilDB->query($query);
216 return $row->description ? $row->description : '';
217 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDCopyrightSelectionGUI\fillTemplate(), and ilMDEditorGUI\initQuickEditForm().

+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDRights::delete ( )

Reimplemented from ilMDBase.

Definition at line 121 of file class.ilMDRights.php.

122 {
123 global $ilDB;
124
125 if ($this->getMetaId()) {
126 $query = "DELETE FROM il_meta_rights " .
127 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId(), 'integer');
128
129 $this->db->query($query);
130
131 return true;
132 }
133 return false;
134 }

References $ilDB, $query, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDRights::delete ( )

Reimplemented from ilMDBase.

Definition at line 122 of file class.ilMDRights.php.

123 {
124 global $ilDB;
125
126 if ($this->getMetaId()) {
127 $query = "DELETE FROM il_meta_rights " .
128 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId());
129
130 $this->db->query($query);
131
132 return true;
133 }
134 return false;
135 }

References $ilDB, $query, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ getCopyrightAndOtherRestrictions() [1/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

Definition at line 64 of file class.ilMDRights.php.

65 {
66 return $this->caor;
67 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

Definition at line 64 of file class.ilMDRights.php.

65 {
66 return $this->caor;
67 }

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

Definition at line 48 of file class.ilMDRights.php.

49 {
50 return $this->costs;
51 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCosts() [2/2]

ilMDRights::getCosts ( )

Definition at line 48 of file class.ilMDRights.php.

49 {
50 return $this->costs;
51 }

◆ getDescription() [1/2]

ilMDRights::getDescription ( )

Definition at line 72 of file class.ilMDRights.php.

73 {
74 return $this->description;
75 }

References $description.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

Definition at line 72 of file class.ilMDRights.php.

73 {
74 return $this->description;
75 }

References $description.

◆ getDescriptionLanguage() [1/2]

& ilMDRights::getDescriptionLanguage ( )

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

83 {
84 return is_object($this->description_language) ? $this->description_language : false;
85 }

◆ getDescriptionLanguage() [2/2]

& ilMDRights::getDescriptionLanguage ( )

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

83 {
84 return is_object($this->description_language) ? $this->description_language : false;
85 }

◆ getDescriptionLanguageCode() [1/2]

ilMDRights::getDescriptionLanguageCode ( )

Definition at line 86 of file class.ilMDRights.php.

87 {
88 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
89 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDRights::getDescriptionLanguageCode ( )

Definition at line 86 of file class.ilMDRights.php.

87 {
88 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
89 }

◆ read() [1/2]

ilMDRights::read ( )

Definition at line 148 of file class.ilMDRights.php.

149 {
150 global $ilDB;
151
152 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
153
154
155 if ($this->getMetaId()) {
156 $query = "SELECT * FROM il_meta_rights " .
157 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId(), 'integer');
158
159
160 $res = $this->db->query($query);
161 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
162 $this->setRBACId($row->rbac_id);
163 $this->setObjId($row->obj_id);
164 $this->setObjType($row->obj_type);
165 $this->setDescription($row->description);
166 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
167 $this->setCosts($row->costs);
168 $this->setCopyrightAndOtherRestrictions($row->cpr_and_or);
169 }
170 return true;
171 }
172 return false;
173 }
setObjId($a_id)
setObjType($a_type)
setRBACId($a_id)
setCosts($a_costs)
setDescription($a_description)
setDescriptionLanguage(&$lng_obj)
setCopyrightAndOtherRestrictions($a_caor)

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), and ilMDBase\setRBACId().

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDRights::read ( )

Definition at line 149 of file class.ilMDRights.php.

150 {
151 global $ilDB;
152
153 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
154
155
156 if ($this->getMetaId()) {
157 $query = "SELECT * FROM il_meta_rights " .
158 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId());
159
160
161 $res = $this->db->query($query);
162 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163 $this->setRBACId($row->rbac_id);
164 $this->setObjId($row->obj_id);
165 $this->setObjType($row->obj_type);
166 $this->setDescription(ilUtil::stripSlashes($row->description));
167 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
168 $this->setCosts(ilUtil::stripSlashes($row->costs));
169 $this->setCopyrightAndOtherRestrictions(ilUtil::stripSlashes($row->copyright_and_other_restrictions));
170 }
171 return true;
172 }
173 return false;
174 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilMDBase\getMetaId(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setRBACId(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDRights::save ( )

Reimplemented from ilMDBase.

Definition at line 91 of file class.ilMDRights.php.

92 {
93 global $ilDB;
94
95 $fields = $this->__getFields();
96 $fields['meta_rights_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_rights'));
97
98 if ($this->db->insert('il_meta_rights', $fields)) {
99 $this->setMetaId($next_id);
100 return $this->getMetaId();
101 }
102 return false;
103 }
setMetaId($a_meta_id, $a_read_data=true)

References $ilDB, __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDRights::save ( )

Reimplemented from ilMDBase.

Definition at line 91 of file class.ilMDRights.php.

92 {
93 if ($this->db->autoExecute(
94 'il_meta_rights',
95 $this->__getFields(),
97 )) {
98 $this->setMetaId($this->db->getLastInsertId());
99
100 return $this->getMetaId();
101 }
102 return false;
103 }

References ilMDBase\getMetaId(), ilDBConstants\MDB2_AUTOQUERY_INSERT, and ilMDBase\setMetaId().

+ Here is the call graph for this function:

◆ setCopyrightAndOtherRestrictions() [1/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

Definition at line 52 of file class.ilMDRights.php.

53 {
54 switch ($a_caor) {
55 case 'Yes':
56 case 'No':
57 $this->caor = $a_caor;
58 return true;
59
60 default:
61 return false;
62 }
63 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

Definition at line 52 of file class.ilMDRights.php.

53 {
54 switch ($a_caor) {
55 case 'Yes':
56 case 'No':
57 $this->caor = $a_caor;
58 return true;
59
60 default:
61 return false;
62 }
63 }

◆ setCosts() [1/2]

ilMDRights::setCosts (   $a_costs)

Definition at line 36 of file class.ilMDRights.php.

37 {
38 switch ($a_costs) {
39 case 'Yes':
40 case 'No':
41 $this->costs = $a_costs;
42 return true;
43
44 default:
45 return false;
46 }
47 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts() [2/2]

ilMDRights::setCosts (   $a_costs)

Definition at line 36 of file class.ilMDRights.php.

37 {
38 switch ($a_costs) {
39 case 'Yes':
40 case 'No':
41 $this->costs = $a_costs;
42 return true;
43
44 default:
45 return false;
46 }
47 }

◆ setDescription() [1/2]

ilMDRights::setDescription (   $a_description)

Definition at line 68 of file class.ilMDRights.php.

69 {
70 $this->description = $a_description;
71 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

Definition at line 68 of file class.ilMDRights.php.

69 {
70 $this->description = $a_description;
71 }

◆ setDescriptionLanguage() [1/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

Definition at line 76 of file class.ilMDRights.php.

77 {
78 if (is_object($lng_obj)) {
79 $this->description_language = $lng_obj;
80 }
81 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [2/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

Definition at line 76 of file class.ilMDRights.php.

77 {
78 if (is_object($lng_obj)) {
79 $this->description_language = $lng_obj;
80 }
81 }

◆ toXML() [1/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 180 of file class.ilMDRights.php.

181 {
182 $writer->xmlStartTag('Rights', array('Cost' => $this->getCosts()
183 ? $this->getCosts()
184 : 'No',
185 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()
187 : 'No'));
188 include_once './Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
189 $writer->xmlElement(
190 'Description',
191 array('Language' => $this->getDescriptionLanguageCode()
193 : 'en'),
195 );
196 $writer->xmlEndTag('Rights');
197 }
static lookupCopyyrightTitle($a_cp_string)
Lookup copyright title.

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), and ilMDCopyrightSelectionEntry\lookupCopyyrightTitle().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 181 of file class.ilMDRights.php.

182 {
183 $writer->xmlStartTag('Rights', array('Costs' => $this->getCosts(),
184 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()));
185 $writer->xmlElement('Description', array('Language' => $this->getDescriptionLanguageCode()), $this->getDescription());
186 $writer->xmlEndTag('Rights');
187 }

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), and getDescriptionLanguageCode().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDRights::update ( )

Reimplemented from ilMDBase.

Definition at line 105 of file class.ilMDRights.php.

106 {
107 global $ilDB;
108
109 if ($this->getMetaId()) {
110 if ($this->db->update(
111 'il_meta_rights',
112 $this->__getFields(),
113 array("meta_rights_id" => array('integer',$this->getMetaId()))
114 )) {
115 return true;
116 }
117 }
118 return false;
119 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDRights::update ( )

Reimplemented from ilMDBase.

Definition at line 105 of file class.ilMDRights.php.

106 {
107 global $ilDB;
108
109 if ($this->getMetaId()) {
110 if ($this->db->autoExecute(
111 'il_meta_rights',
112 $this->__getFields(),
114 "meta_rights_id = " . $ilDB->quote($this->getMetaId())
115 )) {
116 return true;
117 }
118 }
119 return false;
120 }

References $ilDB, ilMDBase\getMetaId(), and ilDBConstants\MDB2_AUTOQUERY_UPDATE.

+ Here is the call graph for this function:

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