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

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

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  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
Create styles array
The data for the language used.
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 142 of file class.ilMDRights.php.

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

Referenced by save().

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  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
Create styles array
The data for the language used.
+ 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 196 of file class.ilMDRights.php.

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

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  }
global $ilDB

◆ _getId() [2/2]

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

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

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

Referenced by ilMD\getRights().

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
+ Here is the caller graph for this function:

◆ _lookupDescription()

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

Lookup description (copyright)

public

Parameters
intrbac_id
intobj_id

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

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

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

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  }
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDRights::delete ( )

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

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

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  }
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDRights::delete ( )

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

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

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  }
global $ilDB
+ 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  }

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

Referenced by __getFields(), and toXML().

67  {
68  return $this->caor;
69  }
+ Here is the caller graph for this function:

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

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

Referenced by __getFields(), and toXML().

50  {
51  return $this->costs;
52  }
+ 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  }

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

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

Referenced by __getFields(), and toXML().

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

◆ 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.

Referenced by __getFields(), and toXML().

90  {
91  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
92  }
+ 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 152 of file class.ilMDRights.php.

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

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  }
setObjType($a_type)
setCosts($a_costs)
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
global $ilDB
setDescription($a_description)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDRights::read ( )

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

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

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  }
setObjType($a_type)
setCosts($a_costs)
setDescriptionLanguage(&$lng_obj)
setCopyrightAndOtherRestrictions($a_caor)
setObjId($a_id)
setRBACId($a_id)
global $ilDB
setDescription($a_description)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDRights::save ( )

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

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

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  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDRights::save ( )

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

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

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)
Create styles array
The data for the language used.
global $ilDB
+ 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  }

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

Referenced by read().

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  }
+ Here is the caller graph for this function:

◆ setCosts() [1/2]

ilMDRights::setCosts (   $a_costs)

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

Referenced by read().

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  }
+ 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  }

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

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

Referenced by read().

71  {
72  $this->description = $a_description;
73  }
+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [1/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

Referenced by read().

79  {
80  if(is_object($lng_obj))
81  {
82  $this->description_language = $lng_obj;
83  }
84  }
+ 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)

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

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

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  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDRights::toXML ( $writer)

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

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

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()
199  ? $this->getDescriptionLanguageCode()
200  : 'en'),
202  );
203  $writer->xmlEndTag('Rights');
204  }
getDescriptionLanguageCode()
getCopyrightAndOtherRestrictions()
Create styles array
The data for the language used.
static lookupCopyyrightTitle($a_cp_string)
Lookup copyright title.
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDRights::update ( )

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

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

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  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDRights::update ( )

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

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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