69 $this->logger =
$GLOBALS[
'DIC']->logger()->meta();
70 $this->db =
$GLOBALS[
'DIC']->database();
71 $this->entry_id = $a_entry_id;
89 $query =
"SELECT entry_id FROM il_md_cpr_selections ORDER BY is_default DESC, position ASC";
108 $ilDB = $DIC[
'ilDB'];
110 if (!
$entry_id = self::_extractEntryId($a_cp_string)) {
114 $query =
"SELECT title FROM il_md_cpr_selections " .
118 return $row->title ? $row->title :
'';
134 $ilDB = $DIC[
'ilDB'];
136 if (!
$entry_id = self::_extractEntryId($a_cp_string)) {
140 $query =
"SELECT copyright FROM il_md_cpr_selections " .
144 return $row->copyright ? $row->copyright :
'';
156 $db = $DIC->database();
158 $query =
'SELECT entry_id FROM il_md_cpr_selections ' .
159 'WHERE copyright = ' .
$db->quote($copyright_text,
'text');
162 return $row->entry_id;
178 if (!preg_match(
'/il_copyright_entry__([0-9]+)__([0-9]+)/', $a_cp_string, $matches)) {
184 return $matches[2] ? $matches[2] : 0;
187 public static function isEntry($a_cp_string) : bool
189 if (!preg_match(
'/il_copyright_entry__([0-9]+)__([0-9]+)/', $a_cp_string)) {
225 $query =
"SELECT is_default FROM il_md_cpr_selections " .
226 "WHERE entry_id = " . $this->db->quote($this->entry_id,
'integer');
231 return $row[
'is_default'];
240 $this->outdated = (int) $a_value;
258 $db = $DIC->database();
260 $query =
"SELECT entry_id FROM il_md_cpr_selections " .
261 "WHERE is_default = " .
$db->quote(1,
'integer');
266 return $row[
'entry_id'];
278 $this->title = $a_title;
301 $this->description = $a_desc;
311 return $this->description;
323 $this->copyright = $a_copyright;
345 $this->costs = $a_costs;
389 $this->copyright_and_other_restrictions = $a_status;
411 $this->order_position = (int) $a_position;
425 $query =
"SELECT count(entry_id) total FROM il_md_cpr_selections";
429 return $row[
'total'] + 1;
441 $ilDB = $DIC[
'ilDB'];
443 $next_id =
$ilDB->nextId(
'il_md_cpr_selections');
445 $ilDB->insert(
'il_md_cpr_selections', array(
446 'entry_id' => array(
'integer',$next_id),
447 'title' => array(
'text',$this->
getTitle()),
451 'costs' => array(
'integer',$this->
getCosts()),
455 $this->entry_id = $next_id;
469 $ilDB = $DIC[
'ilDB'];
471 $ilDB->update(
'il_md_cpr_selections', array(
472 'title' => array(
'text',$this->
getTitle()),
476 'costs' => array(
'integer',$this->
getCosts()),
478 'outdated' => array(
'integer',$this->
getOutdated()),
481 'entry_id' => array(
'integer',$this->
getEntryId())
492 public function delete()
496 $ilDB = $DIC[
'ilDB'];
498 $query =
"DELETE FROM il_md_cpr_selections " .
499 "WHERE entry_id = " . $this->db->quote($this->
getEntryId(),
'integer') .
" ";
529 $ilDB = $DIC[
'ilDB'];
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 ";
548 $query =
"SELECT count(meta_rights_id) used FROM il_meta_rights " .
553 $this->usage = $row->used;
563 return 'il_copyright_entry__' .
IL_INST_ID .
'__' . $a_entry_id;
getLanguage()
get language
static _getEntries()
get entries
setLanguage($a_lang_key)
set language
setCosts($a_costs)
set costs
setDescription($a_desc)
set description
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
getCopyright()
get copyright
setCopyrightAndOtherRestrictions($a_status)
set copyright and other restrictions
setOrderPosition($a_position)
Set the order position in the table of copyrights.
static lookupCopyrightByText($copyright_text)
static isEntry($a_cp_string)
foreach($_POST as $key=> $value) $res
getOrderPosition()
Get the order position in the table of copyrights.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static _extractEntryId($a_cp_string)
extract entry id
__construct($a_entry_id)
Constructor.
static getDefault()
Get default.
static _lookupCopyright($a_cp_string)
lookup copyright by entry id
getDescription()
get description
static createIdentifier($a_entry_id)
Create identifier for entry id.
setTitle($a_title)
set title
setOutdated($a_value)
Set copyright element as outdated and not usable anymore.
static lookupCopyyrightTitle($a_cp_string)
Lookup copyright title.
getIsDefault()
Get if the entry is default No setter for this.
$copyright_and_other_restrictions
setCopyright($a_copyright)
set copyright