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.

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

Referenced by save().

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

◆ __getFields() [2/2]

ilMDRights::__getFields ( )

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

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

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

◆ _getId() [1/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

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

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

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  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB

◆ _getId() [2/2]

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

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

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

Referenced by ilMD\getRights().

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  }
foreach($_POST as $key=> $value) $res
$query
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 207 of file class.ilMDRights.php.

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

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

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  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDRights::delete ( )

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

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

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

◆ delete() [2/2]

ilMDRights::delete ( )

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

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

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

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

Referenced by __getFields(), and toXML().

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

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

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

Referenced by __getFields(), and toXML().

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

References $description.

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

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

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

References $description.

Referenced by __getFields(), and toXML().

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

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

Referenced by __getFields(), and toXML().

87  {
88  return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
89  }
+ 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.

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

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

◆ read() [2/2]

ilMDRights::read ( )

Definition at line 149 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().

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  }
setObjType($a_type)
setCosts($a_costs)
setDescriptionLanguage(&$lng_obj)
foreach($_POST as $key=> $value) $res
setCopyrightAndOtherRestrictions($a_caor)
setObjId($a_id)
setRBACId($a_id)
$query
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:

◆ save() [1/2]

ilMDRights::save ( )

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

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

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

◆ save() [2/2]

ilMDRights::save ( )

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

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

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

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

Referenced by read().

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

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

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

Referenced by read().

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

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

◆ setDescriptionLanguage() [2/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

Referenced by read().

77  {
78  if (is_object($lng_obj)) {
79  $this->description_language = $lng_obj;
80  }
81  }
+ Here is the caller graph for this function:

◆ toXML() [1/2]

ilMDRights::toXML ( $writer)

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

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

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()
192  ? $this->getDescriptionLanguageCode()
193  : 'en'),
195  );
196  $writer->xmlEndTag('Rights');
197  }
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:

◆ toXML() [2/2]

ilMDRights::toXML ( $writer)

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

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

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

◆ update() [1/2]

ilMDRights::update ( )

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

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

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

◆ update() [2/2]

ilMDRights::update ( )

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

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

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