ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 142 of file class.ilMDRights.php.

143 {
144 return array('rbac_id' => array('integer',$this->getRBACId()),
145 'obj_id' => array('integer',$this->getObjId()),
146 'obj_type' => array('text',$this->getObjType()),
147 'costs' => array('text',$this->getCosts()),
148 'cpr_and_or' => array('text',$this->getCopyrightAndOtherRestrictions()),
149 'description' => array('text',$this->getDescription()),
150 'description_language' => array('text',$this->getDescriptionLanguageCode()));
151 }
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 141 of file class.ilMDRights.php.

142 {
143 return array('rbac_id' => $this->getRBACId(),
144 'obj_id' => $this->getObjId(),
145 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
146 'costs' => ilUtil::prepareDBString($this->getCosts()),
147 'copyright_and_other_restrictions' => ilUtil::prepareDBString($this->getCopyrightAndOtherRestrictions()),
148 'description' => ilUtil::prepareDBString($this->getDescription()),
149 'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
150 }
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 227 of file class.ilMDRights.php.

228 {
229 global $ilDB;
230
231 $query = "SELECT meta_rights_id FROM il_meta_rights ".
232 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
233 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
234
235 $res = $ilDB->query($query);
236 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
237 {
238 return $row->meta_rights_id;
239 }
240 return false;
241 }
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 196 of file class.ilMDRights.php.

197 {
198 global $ilDB;
199
200 $query = "SELECT meta_rights_id FROM il_meta_rights ".
201 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
202 "AND obj_id = ".$ilDB->quote($a_obj_id);
203
204 $res = $ilDB->query($query);
205 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
206 {
207 return $row->meta_rights_id;
208 }
209 return false;
210 }

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 214 of file class.ilMDRights.php.

215 {
216 global $ilDB;
217
218 $query = "SELECT description FROM il_meta_rights ".
219 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
220 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
221 $res = $ilDB->query($query);
223 return $row->description ? $row->description : '';
224 }

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 125 of file class.ilMDRights.php.

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

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 124 of file class.ilMDRights.php.

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

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

+ Here is the call graph for this function:

◆ getCopyrightAndOtherRestrictions() [1/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

67 {
68 return $this->caor;
69 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

67 {
68 return $this->caor;
69 }

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCosts() [2/2]

ilMDRights::getCosts ( )

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

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

◆ getDescription() [1/2]

ilMDRights::getDescription ( )

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

75 {
76 return $this->description;
77 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

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

75 {
76 return $this->description;
77 }

◆ getDescriptionLanguage() [1/2]

& ilMDRights::getDescriptionLanguage ( )

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

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

◆ getDescriptionLanguage() [2/2]

& ilMDRights::getDescriptionLanguage ( )

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

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

◆ getDescriptionLanguageCode() [1/2]

ilMDRights::getDescriptionLanguageCode ( )

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

90 {
91 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
92 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDRights::getDescriptionLanguageCode ( )

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

90 {
91 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
92 }

◆ read() [1/2]

ilMDRights::read ( )

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

154 {
155 global $ilDB;
156
157 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
158
159
160 if($this->getMetaId())
161 {
162
163 $query = "SELECT * FROM il_meta_rights ".
164 "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId() ,'integer');
165
166
167 $res = $this->db->query($query);
168 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
169 {
170 $this->setRBACId($row->rbac_id);
171 $this->setObjId($row->obj_id);
172 $this->setObjType($row->obj_type);
173 $this->setDescription($row->description);
174 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
175 $this->setCosts($row->costs);
176 $this->setCopyrightAndOtherRestrictions($row->cpr_and_or);
177 }
178 return true;
179 }
180 return false;
181 }
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 152 of file class.ilMDRights.php.

153 {
154 global $ilDB;
155
156 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
157
158
159 if($this->getMetaId())
160 {
161
162 $query = "SELECT * FROM il_meta_rights ".
163 "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId());
164
165
166 $res = $this->db->query($query);
167 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
168 {
169 $this->setRBACId($row->rbac_id);
170 $this->setObjId($row->obj_id);
171 $this->setObjType($row->obj_type);
172 $this->setDescription(ilUtil::stripSlashes($row->description));
173 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
174 $this->setCosts(ilUtil::stripSlashes($row->costs));
175 $this->setCopyrightAndOtherRestrictions(ilUtil::stripSlashes($row->copyright_and_other_restrictions));
176 }
177 return true;
178 }
179 return false;
180 }
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 94 of file class.ilMDRights.php.

95 {
96 global $ilDB;
97
98 $fields = $this->__getFields();
99 $fields['meta_rights_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_rights'));
100
101 if($this->db->insert('il_meta_rights',$fields))
102 {
103 $this->setMetaId($next_id);
104 return $this->getMetaId();
105 }
106 return false;
107 }
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 94 of file class.ilMDRights.php.

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

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 53 of file class.ilMDRights.php.

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

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

◆ setCosts() [1/2]

ilMDRights::setCosts (   $a_costs)

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

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

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 {
40 case 'Yes':
41 case 'No':
42 $this->costs = $a_costs;
43 return true;
44
45 default:
46 return false;
47 }
48 }

◆ setDescription() [1/2]

ilMDRights::setDescription (   $a_description)

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

71 {
72 $this->description = $a_description;
73 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

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

71 {
72 $this->description = $a_description;
73 }

◆ setDescriptionLanguage() [1/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

79 {
80 if(is_object($lng_obj))
81 {
82 $this->description_language = $lng_obj;
83 }
84 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [2/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

79 {
80 if(is_object($lng_obj))
81 {
82 $this->description_language = $lng_obj;
83 }
84 }

◆ toXML() [1/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

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

189 {
190 $writer->xmlStartTag('Rights',array('Cost' => $this->getCosts()
191 ? $this->getCosts()
192 : 'No',
193 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()
195 : 'No'));
196 include_once './Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
197 $writer->xmlElement(
198 'Description',array('Language' => $this->getDescriptionLanguageCode()
200 : 'en'),
202 );
203 $writer->xmlEndTag('Rights');
204 }
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 187 of file class.ilMDRights.php.

188 {
189 $writer->xmlStartTag('Rights',array('Costs' => $this->getCosts(),
190 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()));
191 $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()),$this->getDescription());
192 $writer->xmlEndTag('Rights');
193 }

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 109 of file class.ilMDRights.php.

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

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDRights::update ( )

Reimplemented from ilMDBase.

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

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

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: