ILIAS  release_7 Revision v7.30-3-g800a261c036
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 isEntry ($a_cp_string)
 
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.

@access public

Parameters
intentry id

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

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 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _extractEntryId()

static ilMDCopyrightSelectionEntry::_extractEntryId (   $a_cp_string)
static

extract entry id

@access public

Parameters

return integer

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

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 }
const IL_INST_ID
Definition: constants.php:38

References IL_INST_ID.

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

+ Here is the caller graph for this function:

◆ _getEntries()

static ilMDCopyrightSelectionEntry::_getEntries ( )
static

get entries

Returns
ilMDCopyrightSelectionEntry[] @access public

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

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

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

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

+ Here is the caller graph for this function:

◆ _lookupCopyright()

static ilMDCopyrightSelectionEntry::_lookupCopyright (   $a_cp_string)
static

lookup copyright by entry id

@access public

Parameters
stringcopyright string il_copyright_entry__IL_INST_ID__ENTRY_ID

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

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);
143 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
144 return $row->copyright ? $row->copyright : '';
145 }

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

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

+ Here is the caller graph for this function:

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

@access public

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

438 {
439 global $DIC;
440
441 $ilDB = $DIC['ilDB'];
442
443 $next_id = $ilDB->nextId('il_md_cpr_selections');
444
445 $ilDB->insert('il_md_cpr_selections', array(
446 'entry_id' => array('integer',$next_id),
447 'title' => array('text',$this->getTitle()),
448 'description' => array('clob',$this->getDescription()),
449 'copyright' => array('clob',$this->getCopyright()),
450 'language' => array('text',$this->getLanguage()),
451 'costs' => array('integer',$this->getCosts()),
452 'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions()),
453 'position' => array('integer', $this->getNextOrderPosition())
454 ));
455 $this->entry_id = $next_id;
456 return true;
457 }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions

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

+ 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 561 of file class.ilMDCopyrightSelectionEntry.php.

562 {
563 return 'il_copyright_entry__' . IL_INST_ID . '__' . $a_entry_id;
564 }

References IL_INST_ID.

Referenced by ilMDUtils\_getDefaultCopyright(), and ilMDRights\parseDescriptionFromImport().

+ Here is the caller graph for this function:

◆ delete()

ilMDCopyrightSelectionEntry::delete ( )

delete

@access public

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

493 {
494 global $DIC;
495
496 $ilDB = $DIC['ilDB'];
497
498 $query = "DELETE FROM il_md_cpr_selections " .
499 "WHERE entry_id = " . $this->db->quote($this->getEntryId(), 'integer') . " ";
500 $res = $ilDB->manipulate($query);
501 }

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

+ Here is the call graph for this function:

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

@access publi

Definition at line 331 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

@access public

Parameters

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

400 {
401 // Fixed
402 return true;
403 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

@access public

Definition at line 353 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 254 of file class.ilMDCopyrightSelectionEntry.php.

255 {
256 global $DIC;
257
258 $db = $DIC->database();
259
260 $query = "SELECT entry_id FROM il_md_cpr_selections " .
261 "WHERE is_default = " . $db->quote(1, 'integer');
262
263 $res = $db->query($query);
264 $row = $res->fetchRow(ilDBConstants::FETCHMODE_DEFAULT);
265
266 return $row['entry_id'];
267 }

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

Referenced by ilMDUtils\_getDefaultCopyright(), and ilMDEditorGUI\listQuickEditCopyright().

+ Here is the caller graph for this function:

◆ getDescription()

ilMDCopyrightSelectionEntry::getDescription ( )

get description

@access public

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

310 {
311 return $this->description;
312 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getEntryId()

ilMDCopyrightSelectionEntry::getEntryId ( )

get entry id

@access public

Parameters

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

215 {
216 return $this->entry_id;
217 }

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 223 of file class.ilMDCopyrightSelectionEntry.php.

224 {
225 $query = "SELECT is_default FROM il_md_cpr_selections " .
226 "WHERE entry_id = " . $this->db->quote($this->entry_id, 'integer');
227
228 $res = $this->db->query($query);
229 $row = $res->fetchRow(ilDBConstants::FETCHMODE_DEFAULT);
230
231 return $row['is_default'];
232 }

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

◆ getLanguage()

ilMDCopyrightSelectionEntry::getLanguage ( )

get language

@access public

Definition at line 376 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 423 of file class.ilMDCopyrightSelectionEntry.php.

424 {
425 $query = "SELECT count(entry_id) total FROM il_md_cpr_selections";
426 $res = $this->db->query($query);
427 $row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
428
429 return $row['total'] + 1;
430 }

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

Referenced by add().

+ 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 418 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 246 of file class.ilMDCopyrightSelectionEntry.php.

References $outdated.

Referenced by update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMDCopyrightSelectionEntry::getTitle ( )

get title

@access public

Definition at line 287 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

@access public

Parameters

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

203 {
204 return $this->usage;
205 }

◆ isEntry()

static ilMDCopyrightSelectionEntry::isEntry (   $a_cp_string)
static

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

187 : bool
188 {
189 if (!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/', $a_cp_string)) {
190 return false;
191 }
192 return true;
193 }

Referenced by ilMDUtils\_parseCopyright().

+ Here is the caller graph for this function:

◆ lookupCopyrightByText()

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

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

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 }

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

Referenced by ilMDRights\parseDescriptionFromImport().

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

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);
117 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
118 return $row->title ? $row->title : '';
119 }

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

◆ read()

ilMDCopyrightSelectionEntry::read ( )
private

Read entry.

@access private

Parameters

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

526 {
527 global $DIC;
528
529 $ilDB = $DIC['ilDB'];
530
531 $query = "SELECT * FROM il_md_cpr_selections " .
532 "WHERE entry_id = " . $this->db->quote($this->entry_id, 'integer') . " " .
533 "ORDER BY is_default DESC, position ASC ";
534
535 $res = $this->db->query($query);
536 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
537 $this->setTitle($row->title);
538 $this->setDescription($row->description);
539 $this->setCopyright($row->copyright);
540 $this->setLanguage($row->language);
541 $this->setCosts($row->costs);
542 $this->setOutdated($row->outdated);
543 $this->setOrderPosition($row->position);
544 // Fixed
546 }
547
548 $query = "SELECT count(meta_rights_id) used FROM il_meta_rights " .
549 "WHERE description = " . $ilDB->quote('il_copyright_entry__' . IL_INST_ID . '__' . $this->getEntryId(), 'text');
550
551 $res = $this->db->query($query);
552 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
553 $this->usage = $row->used;
554 }
setOrderPosition($a_position)
Set the order position in the table of copyrights.
setCopyrightAndOtherRestrictions($a_status)
set copyright and other restrictions
setOutdated($a_value)
Set copyright element as outdated and not usable anymore.

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCopyright()

ilMDCopyrightSelectionEntry::setCopyright (   $a_copyright)

set copyright

@access public

Parameters
string$copyright

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

322 {
323 $this->copyright = $a_copyright;
324 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions()

ilMDCopyrightSelectionEntry::setCopyrightAndOtherRestrictions (   $a_status)

set copyright and other restrictions

@access public

Parameters
boolcopyright and other restrictions

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

388 {
389 $this->copyright_and_other_restrictions = $a_status;
390 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

@access public

Parameters

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

344 {
345 $this->costs = $a_costs;
346 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilMDCopyrightSelectionEntry::setDescription (   $a_desc)

set description

@access public

Parameters
stringdescription

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

300 {
301 $this->description = $a_desc;
302 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLanguage()

ilMDCopyrightSelectionEntry::setLanguage (   $a_lang_key)

set language

@access public

Parameters
stringlanguage key

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

366 {
367 $this->language = $a_lang_key;
368 }
language()
Definition: language.php:2

References language().

Referenced by read().

+ Here is the call graph for this function:
+ 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 409 of file class.ilMDCopyrightSelectionEntry.php.

410 {
411 $this->order_position = (int) $a_position;
412 }

Referenced by read().

+ 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 238 of file class.ilMDCopyrightSelectionEntry.php.

239 {
240 $this->outdated = (int) $a_value;
241 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMDCopyrightSelectionEntry::setTitle (   $a_title)

set title

@access public

Parameters
stringtitle

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

277 {
278 $this->title = $a_title;
279 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

@access public

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

466 {
467 global $DIC;
468
469 $ilDB = $DIC['ilDB'];
470
471 $ilDB->update('il_md_cpr_selections', array(
472 'title' => array('text',$this->getTitle()),
473 'description' => array('clob',$this->getDescription()),
474 'copyright' => array('clob',$this->getCopyright()),
475 'language' => array('text',$this->getLanguage()),
476 'costs' => array('integer',$this->getCosts()),
477 'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions()),
478 'outdated' => array('integer',$this->getOutdated()),
479 'position' => array('integer',$this->getOrderPosition())
480 ), array(
481 'entry_id' => array('integer',$this->getEntryId())
482 ));
483 return true;
484 }
getOrderPosition()
Get the order position in the table of copyrights.

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

+ Here is the call graph for this function:

◆ validate()

ilMDCopyrightSelectionEntry::validate ( )

validate

@access public

Parameters

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

511 {
512 if (!strlen($this->getTitle())) {
513 return false;
514 }
515 return true;
516 }

References getTitle().

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