ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

@access public

Parameters
intentry id

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

53 {
54 global $ilDB;
55
56 $this->db = $ilDB;
57 $this->entry_id = $a_entry_id;
58 $this->read();
59 }
global $ilDB

References $ilDB, 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

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

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 }

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

+ Here is the caller graph for this function:

◆ _getEntries()

static ilMDCopyrightSelectionEntry::_getEntries ( )
static

get entries

@access public

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

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

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

Referenced by ilMDCopyrightSelectionGUI\fillTemplate(), ilCopyrightInputGUI\insert(), 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 111 of file class.ilMDCopyrightSelectionEntry.php.

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 }

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

Referenced by ilMDUtils\_parseCopyright().

+ Here is the caller graph for this function:

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

@access public

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

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

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

+ Here is the call graph for this function:

◆ delete()

ilMDCopyrightSelectionEntry::delete ( )

delete

@access public

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

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 }

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

+ Here is the call graph for this function:

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

@access 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

@access public

Parameters

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

303 {
304 // Fixed
305 return true;
306 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

@access 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

@access public

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

213 {
214 return $this->description;
215 }

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

168 {
169 return $this->entry_id;
170 }

References $entry_id.

Referenced by delete(), and update().

+ Here is the caller graph for this function:

◆ getLanguage()

ilMDCopyrightSelectionEntry::getLanguage ( )

get language

@access 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

@access 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

@access 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.

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 }

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

Referenced by ilMDRights\toXML().

+ Here is the caller graph for this function:

◆ read()

ilMDCopyrightSelectionEntry::read ( )
private

Read entry.

@access private

Parameters

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

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, setCopyright(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setLanguage(), 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 224 of file class.ilMDCopyrightSelectionEntry.php.

225 {
226 $this->copyright = $a_copyright;
227 }

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

291 {
292 $this->copyright_and_other_restrictions = $a_status;
293 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

@access public

Parameters

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

247 {
248 $this->costs = $a_costs;
249 }

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

203 {
204 $this->description = $a_desc;
205 }

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

269 {
270 $this->language = $a_lang_key;
271 }

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

180 {
181 $this->title = $a_title;
182 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

@access public

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

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 }

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

+ Here is the call graph for this function:

◆ validate()

ilMDCopyrightSelectionEntry::validate ( )

validate

@access public

Parameters

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

379 {
380 if(!strlen($this->getTitle()))
381 {
382 return false;
383 }
384 return true;
385 }

References getTitle().

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