ILIAS  release_4-4 Revision
ilMDRights Class Reference
+ Inheritance diagram for ilMDRights:
+ Collaboration diagram for ilMDRights:

Public Member Functions

 ilMDRights ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setCosts ($a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions ($a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _lookupDescription ($a_rbac_id, $a_obj_id)
 Lookup description (copyright) More...
 
 _getId ($a_rbac_id, $a_obj_id)
 
 ilMDRights ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 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
 ilMDBase ($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)
 
 ilMDBase ($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)
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDRights::__getFields ( )

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

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

149  {
150  return array('rbac_id' => $this->getRBACId(),
151  'obj_id' => $this->getObjId(),
152  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
153  'costs' => ilUtil::prepareDBString($this->getCosts()),
154  'copyright_and_other_restrictions' => ilUtil::prepareDBString($this->getCopyrightAndOtherRestrictions()),
155  'description' => ilUtil::prepareDBString($this->getDescription()),
156  'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
157  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ __getFields() [2/2]

ilMDRights::__getFields ( )

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

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

Referenced by save().

150  {
151  return array('rbac_id' => array('integer',$this->getRBACId()),
152  'obj_id' => array('integer',$this->getObjId()),
153  'obj_type' => array('text',$this->getObjType()),
154  'costs' => array('text',$this->getCosts()),
155  'cpr_and_or' => array('text',$this->getCopyrightAndOtherRestrictions()),
156  'description' => array('text',$this->getDescription()),
157  'description_language' => array('text',$this->getDescriptionLanguageCode()));
158  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getId() [1/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

204  {
205  global $ilDB;
206 
207  $query = "SELECT meta_rights_id FROM il_meta_rights ".
208  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
209  "AND obj_id = ".$ilDB->quote($a_obj_id);
210 
211  $res = $ilDB->query($query);
212  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
213  {
214  return $row->meta_rights_id;
215  }
216  return false;
217  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ _getId() [2/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMD\getRights().

232  {
233  global $ilDB;
234 
235  $query = "SELECT meta_rights_id FROM il_meta_rights ".
236  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
237  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
238 
239  $res = $ilDB->query($query);
240  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
241  {
242  return $row->meta_rights_id;
243  }
244  return false;
245  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _lookupDescription()

ilMDRights::_lookupDescription (   $a_rbac_id,
  $a_obj_id 
)

Lookup description (copyright)

public

Parameters
intrbac_id
intobj_id

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

219  {
220  global $ilDB;
221 
222  $query = "SELECT description FROM il_meta_rights ".
223  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
224  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
225  $res = $ilDB->query($query);
226  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
227  return $row->description ? $row->description : '';
228  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDRights::delete ( )

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

References $query, and ilMDBase\getMetaId().

132  {
133  global $ilDB;
134 
135  if($this->getMetaId())
136  {
137  $query = "DELETE FROM il_meta_rights ".
138  "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId());
139 
140  $this->db->query($query);
141 
142  return true;
143  }
144  return false;
145  }
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDRights::delete ( )

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

References $query, and ilMDBase\getMetaId().

133  {
134  global $ilDB;
135 
136  if($this->getMetaId())
137  {
138  $query = "DELETE FROM il_meta_rights ".
139  "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId() ,'integer');
140 
141  $this->db->query($query);
142 
143  return true;
144  }
145  return false;
146  }
+ Here is the call graph for this function:

◆ getCopyrightAndOtherRestrictions() [1/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

74  {
75  return $this->caor;
76  }

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

Referenced by __getFields(), and toXML().

74  {
75  return $this->caor;
76  }
+ Here is the caller graph for this function:

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

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

Referenced by __getFields(), and toXML().

57  {
58  return $this->costs;
59  }
+ Here is the caller graph for this function:

◆ getCosts() [2/2]

ilMDRights::getCosts ( )

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

57  {
58  return $this->costs;
59  }

◆ getDescription() [1/2]

ilMDRights::getDescription ( )

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

Referenced by __getFields(), and toXML().

82  {
83  return $this->description;
84  }
+ Here is the caller graph for this function:

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

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

82  {
83  return $this->description;
84  }

◆ getDescriptionLanguage() [1/2]

& ilMDRights::getDescriptionLanguage ( )

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

93  {
94  return is_object($this->description_language) ? $this->description_language : false;
95  }

◆ getDescriptionLanguage() [2/2]

& ilMDRights::getDescriptionLanguage ( )

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

93  {
94  return is_object($this->description_language) ? $this->description_language : false;
95  }

◆ getDescriptionLanguageCode() [1/2]

ilMDRights::getDescriptionLanguageCode ( )

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

Referenced by __getFields(), and toXML().

97  {
98  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
99  }
+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDRights::getDescriptionLanguageCode ( )

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

97  {
98  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
99  }

◆ ilMDRights() [1/2]

ilMDRights::ilMDRights (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

36  {
37  parent::ilMDBase($a_rbac_id,
38  $a_obj_id,
39  $a_obj_type);
40  }

◆ ilMDRights() [2/2]

ilMDRights::ilMDRights (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

36  {
37  parent::ilMDBase($a_rbac_id,
38  $a_obj_id,
39  $a_obj_type);
40  }

◆ read() [1/2]

ilMDRights::read ( )

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

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

160  {
161  global $ilDB;
162 
163  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
164 
165 
166  if($this->getMetaId())
167  {
168 
169  $query = "SELECT * FROM il_meta_rights ".
170  "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId());
171 
172 
173  $res = $this->db->query($query);
174  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
175  {
176  $this->setRBACId($row->rbac_id);
177  $this->setObjId($row->obj_id);
178  $this->setObjType($row->obj_type);
179  $this->setDescription(ilUtil::stripSlashes($row->description));
180  $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
181  $this->setCosts(ilUtil::stripSlashes($row->costs));
182  $this->setCopyrightAndOtherRestrictions(ilUtil::stripSlashes($row->copyright_and_other_restrictions));
183  }
184  return true;
185  }
186  return false;
187  }
setObjType($a_type)
setCosts($a_costs)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setDescriptionLanguage(&$lng_obj)
setCopyrightAndOtherRestrictions($a_caor)
setObjId($a_id)
setRBACId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setDescription($a_description)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDRights::read ( )

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

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

161  {
162  global $ilDB;
163 
164  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
165 
166 
167  if($this->getMetaId())
168  {
169 
170  $query = "SELECT * FROM il_meta_rights ".
171  "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId() ,'integer');
172 
173 
174  $res = $this->db->query($query);
175  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
176  {
177  $this->setRBACId($row->rbac_id);
178  $this->setObjId($row->obj_id);
179  $this->setObjType($row->obj_type);
180  $this->setDescription($row->description);
181  $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
182  $this->setCosts($row->costs);
183  $this->setCopyrightAndOtherRestrictions($row->cpr_and_or);
184  }
185  return true;
186  }
187  return false;
188  }
setObjType($a_type)
setCosts($a_costs)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setDescriptionLanguage(&$lng_obj)
setCopyrightAndOtherRestrictions($a_caor)
setObjId($a_id)
setRBACId($a_id)
setDescription($a_description)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDRights::save ( )

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

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

102  {
103  if($this->db->autoExecute('il_meta_rights',
104  $this->__getFields(),
105  DB_AUTOQUERY_INSERT))
106  {
107  $this->setMetaId($this->db->getLastInsertId());
108 
109  return $this->getMetaId();
110  }
111  return false;
112  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDRights::save ( )

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

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

102  {
103  global $ilDB;
104 
105  $fields = $this->__getFields();
106  $fields['meta_rights_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_rights'));
107 
108  if($this->db->insert('il_meta_rights',$fields))
109  {
110  $this->setMetaId($next_id);
111  return $this->getMetaId();
112  }
113  return false;
114  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setCopyrightAndOtherRestrictions() [1/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

Referenced by read().

61  {
62  switch($a_caor)
63  {
64  case 'Yes':
65  case 'No':
66  $this->caor = $a_caor;
67  return true;
68 
69  default:
70  return false;
71  }
72  }
+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

61  {
62  switch($a_caor)
63  {
64  case 'Yes':
65  case 'No':
66  $this->caor = $a_caor;
67  return true;
68 
69  default:
70  return false;
71  }
72  }

◆ setCosts() [1/2]

ilMDRights::setCosts (   $a_costs)

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

Referenced by read().

44  {
45  switch($a_costs)
46  {
47  case 'Yes':
48  case 'No':
49  $this->costs = $a_costs;
50  return true;
51 
52  default:
53  return false;
54  }
55  }
+ Here is the caller graph for this function:

◆ setCosts() [2/2]

ilMDRights::setCosts (   $a_costs)

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

44  {
45  switch($a_costs)
46  {
47  case 'Yes':
48  case 'No':
49  $this->costs = $a_costs;
50  return true;
51 
52  default:
53  return false;
54  }
55  }

◆ setDescription() [1/2]

ilMDRights::setDescription (   $a_description)

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

Referenced by read().

78  {
79  $this->description = $a_description;
80  }
+ Here is the caller graph for this function:

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

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

78  {
79  $this->description = $a_description;
80  }

◆ setDescriptionLanguage() [1/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

Referenced by read().

86  {
87  if(is_object($lng_obj))
88  {
89  $this->description_language = $lng_obj;
90  }
91  }
+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [2/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

86  {
87  if(is_object($lng_obj))
88  {
89  $this->description_language = $lng_obj;
90  }
91  }

◆ toXML() [1/2]

ilMDRights::toXML ( $writer)

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

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

195  {
196  $writer->xmlStartTag('Rights',array('Costs' => $this->getCosts(),
197  'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()));
198  $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()),$this->getDescription());
199  $writer->xmlEndTag('Rights');
200  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDRights::toXML ( $writer)

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

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

196  {
197  $writer->xmlStartTag('Rights',array('Cost' => $this->getCosts()
198  ? $this->getCosts()
199  : 'No',
200  'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()
202  : 'No'));
203  $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()
204  ? $this->getDescriptionLanguageCode()
205  : 'en'),
206  $this->getDescription());
207  $writer->xmlEndTag('Rights');
208  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDRights::update ( )

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

References ilMDBase\getMetaId().

115  {
116  global $ilDB;
117 
118  if($this->getMetaId())
119  {
120  if($this->db->autoExecute('il_meta_rights',
121  $this->__getFields(),
122  DB_AUTOQUERY_UPDATE,
123  "meta_rights_id = ".$ilDB->quote($this->getMetaId())))
124  {
125  return true;
126  }
127  }
128  return false;
129  }
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDRights::update ( )

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

References ilMDBase\getMetaId().

117  {
118  global $ilDB;
119 
120  if($this->getMetaId())
121  {
122  if($this->db->update('il_meta_rights',
123  $this->__getFields(),
124  array("meta_rights_id" => array('integer',$this->getMetaId()))))
125  {
126  return true;
127  }
128  }
129  return false;
130  }
+ Here is the call graph for this function:

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