Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

ilMDCopyrightSelectionEntry Class Reference

Public Member Functions

 __construct ($a_entry_id)
 Constructor.
 getUsage ()
 get usage
 getEntryId ()
 get entry id
 setTitle ($a_title)
 set title
 getTitle ()
 get title
 setDescription ($a_desc)
 set description
 getDescription ()
 get description
 setCopyright ($a_copyright)
 set copyright
 getCopyright ()
 get copyright
 setCosts ($a_costs)
 set costs
 getCosts ()
 get costs
 setLanguage ($a_lang_key)
 set language
 getLanguage ()
 get language
 setCopyrightAndOtherRestrictions ($a_status)
 set copyright and other restrictions
 getCopyrightAndOtherRestrictions ()
 get copyright and other restrictions
 add ()
 Add entry.
 update ()
 update
 delete ()
 delete
 validate ()
 validate

Static Public Member Functions

static _getEntries ()
 get entries
static _lookupCopyright ($a_cp_string)
 lookup copyright by entry id
static _extractEntryId ($a_cp_string)
 extract entry id

Protected Attributes

 $db

Private Member Functions

 read ()
 Read entry.

Private Attributes

 $entry_id
 $title
 $decription
 $copyright
 $costs
 $language
 $copyright_and_other_restrictions

Detailed Description

Author:
Stefan Meyer <smeyer@databay.de>
Version:
$Id$

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


Constructor & Destructor Documentation

ilMDCopyrightSelectionEntry::__construct ( a_entry_id  ) 

Constructor.

public

Parameters:
int entry id

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

References read().

        {
                global $ilDB;
                
                $this->db = $ilDB;
                $this->entry_id = $a_entry_id;
                $this->read();
        }

Here is the call graph for this function:


Member Function Documentation

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().

        {
                if(!preg_match('/il_copyright_entry__([0-9]+)__([0-9]+)/',$a_cp_string,$matches))
                {
                        return 0;
                }
                if($matches[1] != IL_INST_ID)
                {
                        return 0;
                }
                return $matches[2] ? $matches[2] : 0;
        }

Here is the caller graph for this function:

static ilMDCopyrightSelectionEntry::_getEntries (  )  [static]

get entries

public

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

References $res.

Referenced by ilMDCopyrightSelectionGUI::fillTemplate(), and ilMDCopyrightTableGUI::parseSelections().

        {
                global $ilDB;
                
                $query = "SELECT entry_id FROM il_md_copyright_selections ";
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $entries[] = new ilMDCopyrightSelectionEntry($row->entry_id);
                }
                return $entries ? $entries : array();
        }

Here is the caller graph for this function:

static ilMDCopyrightSelectionEntry::_lookupCopyright ( a_cp_string  )  [static]

lookup copyright by entry id

public

Parameters:
string copyright string il_copyright_entry__IL_INST_ID__ENTRY_ID

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

References $entry_id, and $res.

Referenced by ilMDUtils::_parseCopyright().

        {
                global $ilDB;
                
                if(!$entry_id = self::_extractEntryId($a_cp_string))
                {
                        return $a_cp_string;
                }
                                
                $query = "SELECT copyright FROM il_md_copyright_selections ".
                        "WHERE entry_id = ".$ilDB->quote($entry_id)." ";
                $res = $ilDB->query($query);
                $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
                return $row->copyright ? $row->copyright : '';
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::add (  ) 

Add entry.

public

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

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

        {
                $query = "INSERT INTO il_md_copyright_selections ".
                        "SET title = ".$this->db->quote($this->getTitle()).", ".
                        "description = ".$this->db->quote($this->getDescription()).", ".
                        "copyright = ".$this->db->quote($this->getCopyright()).", ".
                        "language = ".$this->db->quote($this->getLanguage()).", ".
                        "costs = ".$this->db->quote($this->getCosts()).", ".
                        "copyright_and_other_restrictions = ".$this->db->quote($this->getCopyrightAndOtherRestrictions())." ";
                $this->db->query($query);
                $this->entry_id = $this->db->getLastInsertId();
                
                return true;
        }

Here is the call graph for this function:

ilMDCopyrightSelectionEntry::delete (  ) 

delete

public

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

References getEntryId().

        {
                $query = "DELETE FROM il_md_copyright_selections ".
                        "WHERE entry_id = ".$this->db->quote($this->getEntryId())." ";
                $this->db->query($query);
                        
        }       

Here is the call graph for this function:

ilMDCopyrightSelectionEntry::getCopyright (  ) 

get copyright

publi

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

Referenced by add(), and update().

        {
                return $this->copyright;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getCopyrightAndOtherRestrictions (  ) 

get copyright and other restrictions

public

Parameters:
 

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

Referenced by add(), and update().

        {
                // Fixed
                return true;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getCosts (  ) 

get costs

public

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

Referenced by add(), and update().

        {
                return $this->costs;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getDescription (  ) 

get description

public

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

Referenced by add(), and update().

        {
                return $this->description;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getEntryId (  ) 

get entry id

public

Parameters:
 

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

Referenced by delete(), read(), and update().

        {
                return $this->entry_id;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getLanguage (  ) 

get language

public

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

Referenced by add(), and update().

        {
                return $this->language;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getTitle (  ) 

get title

public

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

Referenced by add(), update(), and validate().

        {
                return $this->title;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::getUsage (  ) 

get usage

public

Parameters:
 

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

        {
                return $this->usage;
        }

ilMDCopyrightSelectionEntry::read (  )  [private]

Read entry.

private

Parameters:
 

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

References $res, getEntryId(), setCopyright(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setLanguage(), and setTitle().

Referenced by __construct().

        {
                $query = "SELECT * FROM il_md_copyright_selections ".
                        "WHERE entry_id = ".$this->db->quote($this->entry_id)." ";
                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->setTitle($row->title);
                        $this->setDescription($row->description);
                        $this->setCopyright($row->copyright);
                        $this->setLanguage($row->language);
                        $this->setCosts($row->costs);
                        // Fixed
                        $this->setCopyrightAndOtherRestrictions(true);
                }
                
                $query = "SELECT count(meta_rights_id) as used FROM il_meta_rights ".
                        "WHERE description = 'il_copyright_entry__".IL_INST_ID.'__'.$this->getEntryId()."'";
                $res = $this->db->query($query);
                $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
                $this->usage = $row->used;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::setCopyright ( a_copyright  ) 

set copyright

public

Parameters:
string $copyright

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

Referenced by read().

        {
                $this->copyright = $a_copyright;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::setCopyrightAndOtherRestrictions ( a_status  ) 

set copyright and other restrictions

public

Parameters:
bool copyright and other restrictions

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

Referenced by read().

        {
                $this->copyright_and_other_restrictions = $a_status;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::setCosts ( a_costs  ) 

set costs

public

Parameters:
 

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

Referenced by read().

        {
                $this->costs = $a_costs;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::setDescription ( a_desc  ) 

set description

public

Parameters:
string description

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

Referenced by read().

        {
                $this->description = $a_desc;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::setLanguage ( a_lang_key  ) 

set language

public

Parameters:
string language key

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

Referenced by read().

        {
                $this->language = $a_lang_key;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::setTitle ( a_title  ) 

set title

public

Parameters:
string title

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

Referenced by read().

        {
                $this->title = $a_title;
        }

Here is the caller graph for this function:

ilMDCopyrightSelectionEntry::update (  ) 

update

public

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

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

        {
                $query = "UPDATE il_md_copyright_selections ".
                        "SET title = ".$this->db->quote($this->getTitle()).", ".
                        "description = ".$this->db->quote($this->getDescription()).", ".
                        "copyright = ".$this->db->quote($this->getCopyright()).", ".
                        "language = ".$this->db->quote($this->getLanguage()).", ".
                        "costs = ".$this->db->quote($this->getCosts()).", ".
                        "copyright_and_other_restrictions = ".$this->db->quote($this->getCopyrightAndOtherRestrictions())." ".
                        "WHERE entry_id = ".$this->db->quote($this->getEntryId())." ";
                
                $this->db->query($query);
        }

Here is the call graph for this function:

ilMDCopyrightSelectionEntry::validate (  ) 

validate

public

Parameters:
 

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

References getTitle().

        {
                if(!strlen($this->getTitle()))
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:


Field Documentation

ilMDCopyrightSelectionEntry::$copyright [private]

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

ilMDCopyrightSelectionEntry::$copyright_and_other_restrictions [private]

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

ilMDCopyrightSelectionEntry::$costs [private]

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

ilMDCopyrightSelectionEntry::$db [protected]

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

ilMDCopyrightSelectionEntry::$decription [private]

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

ilMDCopyrightSelectionEntry::$entry_id [private]

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

Referenced by _lookupCopyright().

ilMDCopyrightSelectionEntry::$language [private]

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

ilMDCopyrightSelectionEntry::$title [private]

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


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