ILIAS  release_4-4 Revision
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 _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 read().

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

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

114  {
115  if(!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/',$a_cp_string,$matches))
116  {
117  return 0;
118  }
119  if($matches[1] != IL_INST_ID)
120  {
121  return 0;
122  }
123  return $matches[2] ? $matches[2] : 0;
124  }
+ 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 $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
+ 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 89 of file class.ilMDCopyrightSelectionEntry.php.

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

Referenced by ilMDUtils\_parseCopyright().

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 copyright FROM il_md_cpr_selections ".
99  "WHERE entry_id = ".$ilDB->quote($entry_id)." ";
100  $res = $ilDB->query($query);
101  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
102  return $row->copyright ? $row->copyright : '';
103  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

public

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

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

292  {
293  global $ilDB;
294 
295  $next_id = $ilDB->nextId('il_md_cpr_selections');
296 
297  $ilDB->insert('il_md_cpr_selections',array(
298  'entry_id' => array('integer',$next_id),
299  'title' => array('text',$this->getTitle()),
300  'description' => array('clob',$this->getDescription()),
301  'copyright' => array('clob',$this->getCopyright()),
302  'language' => array('text',$this->getLanguage()),
303  'costs' => array('integer',$this->getCosts()),
304  'cpr_restrictions' => array('integer',$this->getCopyrightAndOtherRestrictions())
305  ));
306  $this->entry_id = $next_id;
307  return true;
308  }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
+ Here is the call graph for this function:

◆ delete()

ilMDCopyrightSelectionEntry::delete ( )

delete

public

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

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

340  {
341  global $ilDB;
342 
343  $query = "DELETE FROM il_md_cpr_selections ".
344  "WHERE entry_id = ".$this->db->quote($this->getEntryId() ,'integer')." ";
345  $res = $ilDB->manipulate($query);
346 
347  }
+ Here is the call graph for this function:

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

publi

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

Referenced by add(), and update().

281  {
282  // Fixed
283  return true;
284  }
+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

public

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

Referenced by add(), and update().

191  {
192  return $this->description;
193  }
+ Here is the caller graph for this function:

◆ getEntryId()

ilMDCopyrightSelectionEntry::getEntryId ( )

get entry id

public

Parameters

Definition at line 145 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 257 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 168 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 133 of file class.ilMDCopyrightSelectionEntry.php.

134  {
135  return $this->usage;
136  }

◆ read()

ilMDCopyrightSelectionEntry::read ( )
private

Read entry.

private

Parameters

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

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

Referenced by __construct().

373  {
374  global $ilDB;
375 
376  $query = "SELECT * FROM il_md_cpr_selections ".
377  "WHERE entry_id = ".$this->db->quote($this->entry_id ,'integer')." ";
378  $res = $this->db->query($query);
379  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
380  {
381  $this->setTitle($row->title);
382  $this->setDescription($row->description);
383  $this->setCopyright($row->copyright);
384  $this->setLanguage($row->language);
385  $this->setCosts($row->costs);
386  // Fixed
388  }
389 
390  $desc = $ilDB->quote('il_copyright_entry__'.IL_INST_ID.'__'.$this->getEntryId(),'text');
391  $query = "SELECT count(meta_rights_id) used FROM il_meta_rights ".
392  "WHERE description = ".$ilDB->quote($desc ,'text');
393  $res = $this->db->query($query);
394  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
395  $this->usage = $row->used;
396  }
setCopyrightAndOtherRestrictions($a_status)
set copyright and other restrictions
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ 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 202 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

203  {
204  $this->copyright = $a_copyright;
205  }
+ 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 268 of file class.ilMDCopyrightSelectionEntry.php.

Referenced by read().

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

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

public

Parameters

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

Referenced by read().

225  {
226  $this->costs = $a_costs;
227  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMDCopyrightSelectionEntry::setDescription (   $a_desc)

set description

public

Parameters
stringdescription

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

Referenced by read().

181  {
182  $this->description = $a_desc;
183  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilMDCopyrightSelectionEntry::setLanguage (   $a_lang_key)

set language

public

Parameters
stringlanguage key

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

Referenced by read().

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

◆ setTitle()

ilMDCopyrightSelectionEntry::setTitle (   $a_title)

set title

public

Parameters
stringtitle

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

Referenced by read().

158  {
159  $this->title = $a_title;
160  }
+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

public

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

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

317  {
318  global $ilDB;
319 
320  $ilDB->update('il_md_cpr_selections',array(
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  ),array(
328  'entry_id' => array('integer',$this->getEntryId())
329  ));
330  return true;
331  }
getCopyrightAndOtherRestrictions()
get copyright and other restrictions
+ Here is the call graph for this function:

◆ validate()

ilMDCopyrightSelectionEntry::validate ( )

validate

public

Parameters

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

References getTitle().

357  {
358  if(!strlen($this->getTitle()))
359  {
360  return false;
361  }
362  return true;
363  }
+ 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

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

Referenced by _lookupCopyright(), and getEntryId().

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