ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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

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

References $ilDB, and read().

53  {
54  global $ilDB;
55 
56  $this->db = $ilDB;
57  $this->entry_id = $a_entry_id;
58  $this->read();
59  }
global $ilDB
+ 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 135 of file class.ilMDCopyrightSelectionEntry.php.

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

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

◆ _getEntries()

static ilMDCopyrightSelectionEntry::_getEntries ( )
static

get entries

public

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

69  {
70  global $ilDB;
71 
72  $query = "SELECT entry_id FROM il_md_cpr_selections ";
73  $res = $ilDB->query($query);
74  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
75  {
76  $entries[] = new ilMDCopyrightSelectionEntry($row->entry_id);
77  }
78  return $entries ? $entries : array();
79  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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 111 of file class.ilMDCopyrightSelectionEntry.php.

References $entry_id, $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMDUtils\_parseCopyright().

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

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

public

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

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

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

◆ delete()

ilMDCopyrightSelectionEntry::delete ( )

delete

public

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

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

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

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

publi

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

Referenced by add(), and update().

303  {
304  // Fixed
305  return true;
306  }
+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

public

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

Referenced by add(), and update().

213  {
214  return $this->description;
215  }
+ Here is the caller graph for this function:

◆ getEntryId()

ilMDCopyrightSelectionEntry::getEntryId ( )

get entry id

public

Parameters

Definition at line 167 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 279 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 190 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 155 of file class.ilMDCopyrightSelectionEntry.php.

156  {
157  return $this->usage;
158  }

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

References $entry_id, $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMDRights\toXML().

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

◆ read()

ilMDCopyrightSelectionEntry::read ( )
private

Read entry.

private

Parameters

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, setCopyright(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setLanguage(), and setTitle().

Referenced by __construct().

395  {
396  global $ilDB;
397 
398  $query = "SELECT * FROM il_md_cpr_selections ".
399  "WHERE entry_id = ".$this->db->quote($this->entry_id ,'integer')." ";
400  $res = $this->db->query($query);
401  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
402  {
403  $this->setTitle($row->title);
404  $this->setDescription($row->description);
405  $this->setCopyright($row->copyright);
406  $this->setLanguage($row->language);
407  $this->setCosts($row->costs);
408  // Fixed
410  }
411 
412  $desc = $ilDB->quote('il_copyright_entry__'.IL_INST_ID.'__'.$this->getEntryId(),'text');
413  $query = "SELECT count(meta_rights_id) used FROM il_meta_rights ".
414  "WHERE description = ".$ilDB->quote($desc ,'text');
415  $res = $this->db->query($query);
416  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
417  $this->usage = $row->used;
418  }
setCopyrightAndOtherRestrictions($a_status)
set copyright and other restrictions
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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 224 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

225  {
226  $this->copyright = $a_copyright;
227  }
+ 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 290 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

291  {
292  $this->copyright_and_other_restrictions = $a_status;
293  }
+ Here is the caller graph for this function:

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

public

Parameters

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

Referenced by read().

247  {
248  $this->costs = $a_costs;
249  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMDCopyrightSelectionEntry::setDescription (   $a_desc)

set description

public

Parameters
stringdescription

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

Referenced by read().

203  {
204  $this->description = $a_desc;
205  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilMDCopyrightSelectionEntry::setLanguage (   $a_lang_key)

set language

public

Parameters
stringlanguage key

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

Referenced by read().

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

◆ setTitle()

ilMDCopyrightSelectionEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

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

Referenced by read().

180  {
181  $this->title = $a_title;
182  }
+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

public

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

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

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

◆ validate()

ilMDCopyrightSelectionEntry::validate ( )

validate

public

Parameters

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

References getTitle().

379  {
380  if(!strlen($this->getTitle()))
381  {
382  return false;
383  }
384  return true;
385  }
+ Here is the call graph for this function:

Field Documentation

◆ $copyright

ilMDCopyrightSelectionEntry::$copyright
private

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

Referenced by getCopyright().

◆ $copyright_and_other_restrictions

ilMDCopyrightSelectionEntry::$copyright_and_other_restrictions
private

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

◆ $costs

ilMDCopyrightSelectionEntry::$costs
private

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

Referenced by getCosts().

◆ $db

ilMDCopyrightSelectionEntry::$db
protected

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

◆ $decription

ilMDCopyrightSelectionEntry::$decription
private

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

◆ $entry_id

ilMDCopyrightSelectionEntry::$entry_id
private

◆ $language

ilMDCopyrightSelectionEntry::$language
private

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

Referenced by getLanguage().

◆ $title

ilMDCopyrightSelectionEntry::$title
private

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

Referenced by getTitle().


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