ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMDCopyrightSelectionEntry Class Reference
+ Collaboration diagram for ilMDCopyrightSelectionEntry:

Public Member Functions

 __construct ($a_entry_id)
 Constructor. More...
 
 getUsage ()
 get usage More...
 
 getEntryId ()
 get entry id More...
 
 getIsDefault ()
 Get if the entry is default No setter for this. More...
 
 setOutdated ($a_value)
 Set copyright element as outdated and not usable anymore. More...
 
 getOutdated ()
 
 setTitle ($a_title)
 set title More...
 
 getTitle ()
 get title More...
 
 setDescription ($a_desc)
 set description More...
 
 getDescription ()
 get description More...
 
 setCopyright ($a_copyright)
 set copyright More...
 
 getCopyright ()
 get copyright More...
 
 setCosts ($a_costs)
 set costs More...
 
 getCosts ()
 get costs More...
 
 setLanguage ($a_lang_key)
 set language More...
 
 getLanguage ()
 get language More...
 
 setCopyrightAndOtherRestrictions ($a_status)
 set copyright and other restrictions More...
 
 getCopyrightAndOtherRestrictions ()
 get copyright and other restrictions More...
 
 setOrderPosition ($a_position)
 Set the order position in the table of copyrights. More...
 
 getOrderPosition ()
 Get the order position in the table of copyrights. More...
 
 add ()
 Add entry. More...
 
 update ()
 update More...
 
 delete ()
 delete More...
 
 validate ()
 validate More...
 

Static Public Member Functions

static _getEntries ()
 get entries More...
 
static lookupCopyyrightTitle ($a_cp_string)
 Lookup copyright title. More...
 
static _lookupCopyright ($a_cp_string)
 lookup copyright by entry id More...
 
static lookupCopyrightByText ($copyright_text)
 
static _extractEntryId ($a_cp_string)
 extract entry id More...
 
static getDefault ()
 Get default. More...
 
static createIdentifier ($a_entry_id)
 Create identifier for entry id. More...
 

Protected Member Functions

 getNextOrderPosition ()
 

Protected Attributes

 $logger = null
 
 $db
 
 $outdated
 
 $order_position
 

Private Member Functions

 read ()
 Read entry. More...
 

Private Attributes

 $entry_id
 
 $title
 
 $decription
 
 $copyright
 
 $costs
 
 $language
 
 $copyright_and_other_restrictions
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 32 of file class.ilMDCopyrightSelectionEntry.php.

Constructor & Destructor Documentation

◆ __construct()

ilMDCopyrightSelectionEntry::__construct (   $a_entry_id)

Constructor.

public

Parameters
intentry id

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

References $DIC, $GLOBALS, and read().

65  {
66  global $DIC;
67 
68 
69  $this->logger = $GLOBALS['DIC']->logger()->meta();
70  $this->db = $GLOBALS['DIC']->database();
71  $this->entry_id = $a_entry_id;
72  $this->read();
73  }
global $DIC
Definition: saml.php:7
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:

Member Function Documentation

◆ _extractEntryId()

static ilMDCopyrightSelectionEntry::_extractEntryId (   $a_cp_string)
static

extract entry id

public

Parameters

Definition at line 176 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by ilMDCopyrightSelectionGUI\fillTemplate(), ilCopyrightInputGUI\insert(), and ilMDEditorGUI\listQuickEditCopyright().

177  {
178  if (!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/', $a_cp_string, $matches)) {
179  return 0;
180  }
181  if ($matches[1] != IL_INST_ID) {
182  return 0;
183  }
184  return $matches[2] ? $matches[2] : 0;
185  }
+ Here is the caller graph for this function:

◆ _getEntries()

static ilMDCopyrightSelectionEntry::_getEntries ( )
static

get entries

Returns
ilMDCopyrightSelectionEntry[] public

Definition at line 83 of file class.ilMDCopyrightSelectionEntry.php.

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

Referenced by ilCronOerHarvester\addCustomSettingsToForm(), ilMDCopyrightSelectionGUI\fillTemplate(), ilCopyrightInputGUI\insert(), ilMDEditorGUI\listQuickEditCopyright(), and ilMDCopyrightTableGUI\parseSelections().

84  {
85  global $DIC;
86 
87  $ilDB = $DIC['ilDB'];
88 
89  $query = "SELECT entry_id FROM il_md_cpr_selections ORDER BY is_default DESC, position ASC";
90  $res = $ilDB->query($query);
91 
92  $entries = [];
93  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
94  $entries[] = new ilMDCopyrightSelectionEntry($row->entry_id);
95  }
96  return $entries;
97  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupCopyright()

static ilMDCopyrightSelectionEntry::_lookupCopyright (   $a_cp_string)
static

lookup copyright by entry id

public

Parameters
stringcopyright string il_copyright_entry__IL_INST_ID__ENTRY_ID

Definition at line 130 of file class.ilMDCopyrightSelectionEntry.php.

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

Referenced by ilMDUtils\_parseCopyright(), and ilMDRights\toXML().

131  {
132  global $DIC;
133 
134  $ilDB = $DIC['ilDB'];
135 
136  if (!$entry_id = self::_extractEntryId($a_cp_string)) {
137  return $a_cp_string;
138  }
139 
140  $query = "SELECT copyright FROM il_md_cpr_selections " .
141  "WHERE entry_id = " . $ilDB->quote($entry_id) . " ";
142  $res = $ilDB->query($query);
144  return $row->copyright ? $row->copyright : '';
145  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

public

Definition at line 429 of file class.ilMDCopyrightSelectionEntry.php.

References $DIC, $ilDB, getCopyright(), getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getLanguage(), getNextOrderPosition(), and getTitle().

430  {
431  global $DIC;
432 
433  $ilDB = $DIC['ilDB'];
434 
435  $next_id = $ilDB->nextId('il_md_cpr_selections');
436 
437  $ilDB->insert('il_md_cpr_selections', array(
438  'entry_id' => array('integer',$next_id),
439  'title' => array('text',$this->getTitle()),
440  'description' => array('clob',$this->getDescription()),
441  'copyright' => array('clob',$this->getCopyright()),
442  'language' => array('text',$this->getLanguage()),
443  'costs' => array('integer',$this->getCosts()),
444  'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions()),
445  'position' => array('integer', $this->getNextOrderPosition())
446  ));
447  $this->entry_id = $next_id;
448  return true;
449  }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

◆ createIdentifier()

static ilMDCopyrightSelectionEntry::createIdentifier (   $a_entry_id)
static

Create identifier for entry id.

Parameters
$a_entry_id
Returns
string

Definition at line 553 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by ilMDRights\parseDescriptionFromImport().

554  {
555  return 'il_copyright_entry__' . IL_INST_ID . '__' . $a_entry_id;
556  }
+ Here is the caller graph for this function:

◆ delete()

ilMDCopyrightSelectionEntry::delete ( )

delete

public

Definition at line 484 of file class.ilMDCopyrightSelectionEntry.php.

References $DIC, $ilDB, $query, $res, and getEntryId().

485  {
486  global $DIC;
487 
488  $ilDB = $DIC['ilDB'];
489 
490  $query = "DELETE FROM il_md_cpr_selections " .
491  "WHERE entry_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
492  $res = $ilDB->manipulate($query);
493  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

publi

Definition at line 323 of file class.ilMDCopyrightSelectionEntry.php.

References $copyright.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getCopyrightAndOtherRestrictions()

ilMDCopyrightSelectionEntry::getCopyrightAndOtherRestrictions ( )

get copyright and other restrictions

public

Parameters

Definition at line 391 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by add(), and update().

392  {
393  // Fixed
394  return true;
395  }
+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

public

Definition at line 345 of file class.ilMDCopyrightSelectionEntry.php.

References $costs.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getDefault()

static ilMDCopyrightSelectionEntry::getDefault ( )
static

Get default.

Definition at line 246 of file class.ilMDCopyrightSelectionEntry.php.

References $db, $DIC, $query, $res, $row, and ilDBConstants\FETCHMODE_DEFAULT.

Referenced by ilMDEditorGUI\listQuickEditCopyright().

247  {
248  global $DIC;
249 
250  $db = $DIC->database();
251 
252  $query = "SELECT entry_id FROM il_md_cpr_selections " .
253  "WHERE is_default = " . $db->quote(1, 'integer');
254 
255  $res = $db->query($query);
257 
258  return $row['entry_id'];
259  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ getDescription()

ilMDCopyrightSelectionEntry::getDescription ( )

get description

public

Definition at line 301 of file class.ilMDCopyrightSelectionEntry.php.

References $description.

Referenced by add(), and update().

302  {
303  return $this->description;
304  }
+ Here is the caller graph for this function:

◆ getEntryId()

ilMDCopyrightSelectionEntry::getEntryId ( )

get entry id

public

Parameters

Definition at line 206 of file class.ilMDCopyrightSelectionEntry.php.

References $entry_id.

Referenced by delete(), read(), and update().

+ Here is the caller graph for this function:

◆ getIsDefault()

ilMDCopyrightSelectionEntry::getIsDefault ( )

Get if the entry is default No setter for this.

Definition at line 215 of file class.ilMDCopyrightSelectionEntry.php.

References $query, $res, $row, and ilDBConstants\FETCHMODE_DEFAULT.

216  {
217  $query = "SELECT is_default FROM il_md_cpr_selections " .
218  "WHERE entry_id = " . $this->db->quote($this->entry_id, 'integer');
219 
220  $res = $this->db->query($query);
222 
223  return $row['is_default'];
224  }
foreach($_POST as $key=> $value) $res
$query
$row

◆ getLanguage()

ilMDCopyrightSelectionEntry::getLanguage ( )

get language

public

Definition at line 368 of file class.ilMDCopyrightSelectionEntry.php.

References $language.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getNextOrderPosition()

ilMDCopyrightSelectionEntry::getNextOrderPosition ( )
protected

Definition at line 415 of file class.ilMDCopyrightSelectionEntry.php.

References $query, $res, $row, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by add().

416  {
417  $query = "SELECT count(entry_id) total FROM il_md_cpr_selections";
418  $res = $this->db->query($query);
420 
421  return $row['total'] + 1;
422  }
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ getOrderPosition()

ilMDCopyrightSelectionEntry::getOrderPosition ( )

Get the order position in the table of copyrights.

Returns
int

Definition at line 410 of file class.ilMDCopyrightSelectionEntry.php.

References $order_position.

Referenced by update().

+ Here is the caller graph for this function:

◆ getOutdated()

ilMDCopyrightSelectionEntry::getOutdated ( )
Returns
int

Definition at line 238 of file class.ilMDCopyrightSelectionEntry.php.

References $outdated.

Referenced by update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMDCopyrightSelectionEntry::getTitle ( )

get title

public

Definition at line 279 of file class.ilMDCopyrightSelectionEntry.php.

References $title.

Referenced by add(), update(), and validate().

+ Here is the caller graph for this function:

◆ getUsage()

ilMDCopyrightSelectionEntry::getUsage ( )

get usage

public

Parameters

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

195  {
196  return $this->usage;
197  }

◆ lookupCopyrightByText()

static ilMDCopyrightSelectionEntry::lookupCopyrightByText (   $copyright_text)
static
Parameters
$copyright_text
Returns
int
Exceptions
ilDatabaseException

Definition at line 152 of file class.ilMDCopyrightSelectionEntry.php.

References $db, $DIC, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDRights\parseDescriptionFromImport().

153  {
154  global $DIC;
155 
156  $db = $DIC->database();
157 
158  $query = 'SELECT entry_id FROM il_md_cpr_selections ' .
159  'WHERE copyright = ' . $db->quote($copyright_text, 'text');
160  $res = $db->query($query);
161  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
162  return $row->entry_id;
163  }
164  return 0;
165  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ lookupCopyyrightTitle()

static ilMDCopyrightSelectionEntry::lookupCopyyrightTitle (   $a_cp_string)
static

Lookup copyright title.

Currently used for export of meta data

Parameters
type$a_cp_string

Definition at line 104 of file class.ilMDCopyrightSelectionEntry.php.

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

Referenced by ilMDRights\toXML().

105  {
106  global $DIC;
107 
108  $ilDB = $DIC['ilDB'];
109 
110  if (!$entry_id = self::_extractEntryId($a_cp_string)) {
111  return $a_cp_string;
112  }
113 
114  $query = "SELECT title FROM il_md_cpr_selections " .
115  "WHERE entry_id = " . $ilDB->quote($entry_id) . " ";
116  $res = $ilDB->query($query);
118  return $row->title ? $row->title : '';
119  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilMDCopyrightSelectionEntry::read ( )
private

Read entry.

private

Parameters

Definition at line 517 of file class.ilMDCopyrightSelectionEntry.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getEntryId(), setCopyright(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setLanguage(), setOrderPosition(), setOutdated(), and setTitle().

Referenced by __construct().

518  {
519  global $DIC;
520 
521  $ilDB = $DIC['ilDB'];
522 
523  $query = "SELECT * FROM il_md_cpr_selections " .
524  "WHERE entry_id = " . $this->db->quote($this->entry_id, 'integer') . " " .
525  "ORDER BY is_default DESC, position ASC ";
526 
527  $res = $this->db->query($query);
528  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
529  $this->setTitle($row->title);
530  $this->setDescription($row->description);
531  $this->setCopyright($row->copyright);
532  $this->setLanguage($row->language);
533  $this->setCosts($row->costs);
534  $this->setOutdated($row->outdated);
535  $this->setOrderPosition($row->position);
536  // Fixed
538  }
539 
540  $query = "SELECT count(meta_rights_id) used FROM il_meta_rights " .
541  "WHERE description = " . $ilDB->quote('il_copyright_entry__' . IL_INST_ID . '__' . $this->getEntryId(), 'text');
542 
543  $res = $this->db->query($query);
545  $this->usage = $row->used;
546  }
global $DIC
Definition: saml.php:7
setCopyrightAndOtherRestrictions($a_status)
set copyright and other restrictions
setOrderPosition($a_position)
Set the order position in the table of copyrights.
foreach($_POST as $key=> $value) $res
$query
$row
setOutdated($a_value)
Set copyright element as outdated and not usable anymore.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCopyright()

ilMDCopyrightSelectionEntry::setCopyright (   $a_copyright)

set copyright

public

Parameters
string$copyright

Definition at line 313 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

314  {
315  $this->copyright = $a_copyright;
316  }
+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions()

ilMDCopyrightSelectionEntry::setCopyrightAndOtherRestrictions (   $a_status)

set copyright and other restrictions

public

Parameters
boolcopyright and other restrictions

Definition at line 379 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

380  {
381  $this->copyright_and_other_restrictions = $a_status;
382  }
+ Here is the caller graph for this function:

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

public

Parameters

Definition at line 335 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

336  {
337  $this->costs = $a_costs;
338  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMDCopyrightSelectionEntry::setDescription (   $a_desc)

set description

public

Parameters
stringdescription

Definition at line 291 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

292  {
293  $this->description = $a_desc;
294  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilMDCopyrightSelectionEntry::setLanguage (   $a_lang_key)

set language

public

Parameters
stringlanguage key

Definition at line 357 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

358  {
359  $this->language = $a_lang_key;
360  }
+ Here is the caller graph for this function:

◆ setOrderPosition()

ilMDCopyrightSelectionEntry::setOrderPosition (   $a_position)

Set the order position in the table of copyrights.

Parameters
$a_positioninteger

Definition at line 401 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

402  {
403  $this->order_position = (int) $a_position;
404  }
+ Here is the caller graph for this function:

◆ setOutdated()

ilMDCopyrightSelectionEntry::setOutdated (   $a_value)

Set copyright element as outdated and not usable anymore.

Parameters
$a_value

Definition at line 230 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

231  {
232  $this->outdated = (int) $a_value;
233  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMDCopyrightSelectionEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

Definition at line 268 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

269  {
270  $this->title = $a_title;
271  }
+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

public

Definition at line 457 of file class.ilMDCopyrightSelectionEntry.php.

References $DIC, $ilDB, getCopyright(), getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getEntryId(), getLanguage(), getOrderPosition(), getOutdated(), and getTitle().

458  {
459  global $DIC;
460 
461  $ilDB = $DIC['ilDB'];
462 
463  $ilDB->update('il_md_cpr_selections', array(
464  'title' => array('text',$this->getTitle()),
465  'description' => array('clob',$this->getDescription()),
466  'copyright' => array('clob',$this->getCopyright()),
467  'language' => array('text',$this->getLanguage()),
468  'costs' => array('integer',$this->getCosts()),
469  'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions()),
470  'outdated' => array('integer',$this->getOutdated()),
471  'position' => array('integer',$this->getOrderPosition())
472  ), array(
473  'entry_id' => array('integer',$this->getEntryId())
474  ));
475  return true;
476  }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
global $DIC
Definition: saml.php:7
getOrderPosition()
Get the order position in the table of copyrights.
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilMDCopyrightSelectionEntry::validate ( )

validate

public

Parameters

Definition at line 502 of file class.ilMDCopyrightSelectionEntry.php.

References getTitle().

503  {
504  if (!strlen($this->getTitle())) {
505  return false;
506  }
507  return true;
508  }
+ Here is the call graph for this function:

Field Documentation

◆ $copyright

ilMDCopyrightSelectionEntry::$copyright
private

Definition at line 40 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by getCopyright().

◆ $copyright_and_other_restrictions

ilMDCopyrightSelectionEntry::$copyright_and_other_restrictions
private

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

◆ $costs

ilMDCopyrightSelectionEntry::$costs
private

Definition at line 41 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by getCosts().

◆ $db

ilMDCopyrightSelectionEntry::$db
protected

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

Referenced by getDefault(), and lookupCopyrightByText().

◆ $decription

ilMDCopyrightSelectionEntry::$decription
private

Definition at line 39 of file class.ilMDCopyrightSelectionEntry.php.

◆ $entry_id

ilMDCopyrightSelectionEntry::$entry_id
private

◆ $language

ilMDCopyrightSelectionEntry::$language
private

Definition at line 42 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by getLanguage().

◆ $logger

ilMDCopyrightSelectionEntry::$logger = null
protected

Definition at line 34 of file class.ilMDCopyrightSelectionEntry.php.

◆ $order_position

ilMDCopyrightSelectionEntry::$order_position
protected

Definition at line 54 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by getOrderPosition().

◆ $outdated

ilMDCopyrightSelectionEntry::$outdated
protected

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

Referenced by getOutdated().

◆ $title

ilMDCopyrightSelectionEntry::$title
private

Definition at line 38 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by getTitle().


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