ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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...
 
 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 _extractEntryId ($a_cp_string)
 extract entry id More...
 

Protected Attributes

 $logger = null
 
 $db
 

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

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

54  {
55  global $DIC;
56 
57 
58  $this->logger = $GLOBALS['DIC']->logger()->meta();
59  $this->db = $GLOBALS['DIC']->database();
60  $this->entry_id = $a_entry_id;
61  $this->read();
62  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $DIC
+ 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 138 of file class.ilMDCopyrightSelectionEntry.php.

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

139  {
140  if(!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/',$a_cp_string,$matches))
141  {
142  return 0;
143  }
144  if($matches[1] != IL_INST_ID)
145  {
146  return 0;
147  }
148  return $matches[2] ? $matches[2] : 0;
149  }
+ Here is the caller graph for this function:

◆ _getEntries()

static ilMDCopyrightSelectionEntry::_getEntries ( )
static

get entries

public

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

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

Referenced by ilMDCopyrightSelectionGUI\fillTemplate(), ilCopyrightInputGUI\insert(), and ilMDCopyrightTableGUI\parseSelections().

72  {
73  global $ilDB;
74 
75  $query = "SELECT entry_id FROM il_md_cpr_selections ";
76  $res = $ilDB->query($query);
77  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
78  {
79  $entries[] = new ilMDCopyrightSelectionEntry($row->entry_id);
80  }
81  return $entries ? $entries : array();
82  }
Create styles array
The data for the language used.
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 114 of file class.ilMDCopyrightSelectionEntry.php.

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

Referenced by ilMDUtils\_parseCopyright().

115  {
116  global $ilDB;
117 
118  if(!$entry_id = self::_extractEntryId($a_cp_string))
119  {
120  return $a_cp_string;
121  }
122 
123  $query = "SELECT copyright FROM il_md_cpr_selections ".
124  "WHERE entry_id = ".$ilDB->quote($entry_id)." ";
125  $res = $ilDB->query($query);
127  return $row->copyright ? $row->copyright : '';
128  }
global $ilDB
+ Here is the caller graph for this function:

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

public

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

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

317  {
318  global $ilDB;
319 
320  $next_id = $ilDB->nextId('il_md_cpr_selections');
321 
322  $ilDB->insert('il_md_cpr_selections',array(
323  'entry_id' => array('integer',$next_id),
324  'title' => array('text',$this->getTitle()),
325  'description' => array('clob',$this->getDescription()),
326  'copyright' => array('clob',$this->getCopyright()),
327  'language' => array('text',$this->getLanguage()),
328  'costs' => array('integer',$this->getCosts()),
329  'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions())
330  ));
331  $this->entry_id = $next_id;
332  return true;
333  }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilMDCopyrightSelectionEntry::delete ( )

delete

public

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

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

365  {
366  global $ilDB;
367 
368  $query = "DELETE FROM il_md_cpr_selections ".
369  "WHERE entry_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
370  $res = $ilDB->manipulate($query);
371 
372  }
global $ilDB
+ Here is the call graph for this function:

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

publi

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

Referenced by add(), and update().

306  {
307  // Fixed
308  return true;
309  }
+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

public

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

References $costs.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getDescription()

ilMDCopyrightSelectionEntry::getDescription ( )

get description

public

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

Referenced by add(), and update().

216  {
217  return $this->description;
218  }
+ Here is the caller graph for this function:

◆ getEntryId()

ilMDCopyrightSelectionEntry::getEntryId ( )

get entry id

public

Parameters

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

References $entry_id.

Referenced by delete(), and update().

+ Here is the caller graph for this function:

◆ getLanguage()

ilMDCopyrightSelectionEntry::getLanguage ( )

get language

public

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

References $language.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMDCopyrightSelectionEntry::getTitle ( )

get title

public

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

159  {
160  return $this->usage;
161  }

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

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

Referenced by ilMDRights\toXML().

90  {
91  global $ilDB;
92 
93  if(!$entry_id = self::_extractEntryId($a_cp_string))
94  {
95  return $a_cp_string;
96  }
97 
98  $query = "SELECT title FROM il_md_cpr_selections ".
99  "WHERE entry_id = ".$ilDB->quote($entry_id)." ";
100  $res = $ilDB->query($query);
102  return $row->title ? $row->title : '';
103  }
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilMDCopyrightSelectionEntry::read ( )
private

Read entry.

private

Parameters

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

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

Referenced by __construct().

398  {
399  global $ilDB;
400 
401  $query = "SELECT * FROM il_md_cpr_selections ".
402  "WHERE entry_id = ".$this->db->quote($this->entry_id ,'integer')." ";
403  $res = $this->db->query($query);
404  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
405  {
406  $this->setTitle($row->title);
407  $this->setDescription($row->description);
408  $this->setCopyright($row->copyright);
409  $this->setLanguage($row->language);
410  $this->setCosts($row->costs);
411  // Fixed
413  }
414 
415  $query = "SELECT count(meta_rights_id) used FROM il_meta_rights ".
416  "WHERE description = ".$ilDB->quote('il_copyright_entry__'.IL_INST_ID.'__'.$this->getEntryId(),'text');
417 
418  $this->logger->debug($query);
419 
420  $res = $this->db->query($query);
422  $this->usage = $row->used;
423  }
setCopyrightAndOtherRestrictions($a_status)
set copyright and other restrictions
global $ilDB
Peak memory usage
+ 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 227 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

228  {
229  $this->copyright = $a_copyright;
230  }
+ 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 293 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

294  {
295  $this->copyright_and_other_restrictions = $a_status;
296  }
+ Here is the caller graph for this function:

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

public

Parameters

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

Referenced by read().

250  {
251  $this->costs = $a_costs;
252  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMDCopyrightSelectionEntry::setDescription (   $a_desc)

set description

public

Parameters
stringdescription

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

Referenced by read().

206  {
207  $this->description = $a_desc;
208  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilMDCopyrightSelectionEntry::setLanguage (   $a_lang_key)

set language

public

Parameters
stringlanguage key

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

Referenced by read().

272  {
273  $this->language = $a_lang_key;
274  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMDCopyrightSelectionEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

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

Referenced by read().

183  {
184  $this->title = $a_title;
185  }
+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

public

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

References $ilDB, array, getCopyright(), getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getEntryId(), getLanguage(), and getTitle().

342  {
343  global $ilDB;
344 
345  $ilDB->update('il_md_cpr_selections',array(
346  'title' => array('text',$this->getTitle()),
347  'description' => array('clob',$this->getDescription()),
348  'copyright' => array('clob',$this->getCopyright()),
349  'language' => array('text',$this->getLanguage()),
350  'costs' => array('integer',$this->getCosts()),
351  'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions())
352  ),array(
353  'entry_id' => array('integer',$this->getEntryId())
354  ));
355  return true;
356  }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilMDCopyrightSelectionEntry::validate ( )

validate

public

Parameters

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

References getTitle().

382  {
383  if(!strlen($this->getTitle()))
384  {
385  return false;
386  }
387  return true;
388  }
+ 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.

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

◆ $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: