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.

@access public

Parameters
intentry id

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

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

References $DIC, $GLOBALS, 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 138 of file class.ilMDCopyrightSelectionEntry.php.

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 }

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

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 }
global $ilDB

References $ilDB, $query, $res, $row, and ilDBConstants\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 114 of file class.ilMDCopyrightSelectionEntry.php.

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 }

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

Referenced by ilMDUtils\_parseCopyright().

+ Here is the caller graph for this function:

◆ add()

ilMDCopyrightSelectionEntry::add ( )

Add entry.

@access public

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

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

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

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 }

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

+ Here is the call graph for this function:

◆ getCopyright()

ilMDCopyrightSelectionEntry::getCopyright ( )

get copyright

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

@access public

Parameters

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

306 {
307 // Fixed
308 return true;
309 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getCosts()

ilMDCopyrightSelectionEntry::getCosts ( )

get costs

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

@access public

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

216 {
217 return $this->description;
218 }

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

171 {
172 return $this->entry_id;
173 }

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

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

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

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 }

References $entry_id, $ilDB, $query, $res, $row, and ilDBConstants\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 397 of file class.ilMDCopyrightSelectionEntry.php.

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

References $ilDB, $query, $res, $row, ilDBConstants\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 227 of file class.ilMDCopyrightSelectionEntry.php.

228 {
229 $this->copyright = $a_copyright;
230 }

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

294 {
295 $this->copyright_and_other_restrictions = $a_status;
296 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts()

ilMDCopyrightSelectionEntry::setCosts (   $a_costs)

set costs

@access public

Parameters

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

250 {
251 $this->costs = $a_costs;
252 }

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

206 {
207 $this->description = $a_desc;
208 }

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

272 {
273 $this->language = $a_lang_key;
274 }

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

183 {
184 $this->title = $a_title;
185 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMDCopyrightSelectionEntry::update ( )

update

@access public

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

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 }

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

382 {
383 if(!strlen($this->getTitle()))
384 {
385 return false;
386 }
387 return true;
388 }

References getTitle().

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