Public Member Functions | Data Fields

ilBibItem Class Reference
[Modules/IliasLearningModule]

Class ilBibItem. More...

Public Member Functions

 ilBibItem ($content_obj=0)
 Constructor public.
 setBibliographyAttributes ($a_data)
 setAbstract ($a_data)
 setBibItemData ($a_key, $a_value, $a_bib_item_nr)
 appendBibItemData ($a_key, $a_value, $a_bib_item_nr)
 getBibItemData ()
 getBibliographyAttributes ()
 getAbstract ()
 getTitle ()
 getXML ()
 readXML ()
 setXMLContent ($a_xml, $a_encoding="UTF-8")
 set xml content of BibItem, start with <BibItem...>, end with </BibItemt>, comply with ILIAS DTD, use utf-8!
 appendXMLContent ($a_xml)
 append xml content to BibItem setXMLContent must be called before and the same encoding must be used
 getXMLContent ()
 get xml content of BibItem
 __initNestedSet ()
 setBooktitle ($a_booktitle)
 getBooktitle ()
 setEdition ($a_edition)
 getEdition ()
 setPublisher ($a_publisher)
 getPublisher ()
 setYear ($a_year)
 getYear ()
 setMeta ($a_data)
 set (posted) meta data
 getMeta ()
 get meta data
 setID ($a_id)
 set id
 getID ()
 setType ($a_type)
 getType ()
 setElement ($a_name, $a_data)
 set identifier catalog value note: only one value implemented currently
 getElement ($a_name, $a_path="", $a_index=0)
 get identifier catalog value note: only one value implemented currently
 read ()
 create ()
 create bib data object in db
 delete ($a_name, $a_path, $a_index)
 delete bibitem data node
 add ($a_name, $a_path, $a_index=0)
 add meta data node
 getCountries ()
 setLanguage ($a_lang)
 getLanguage ()
 getLanguages ()
 get iso conform languages see http://www.oasis-open.org/cover/iso639a.html

Data Fields

 $nested_obj
 $content_obj
 $xml
 $bibliography_attr
 $abstract
 $id = 0
 $type = "bib"
 $meta
 $language

Detailed Description

Class ilBibItem.

Handles Bib-Items of ILIAS DigiLib-Books (see ILIAS DTD)

Author:
Databay AG <jc@databay.de>
Version:
Id:
class.ilBibItem.php 11711 2006-07-30 14:11:38Z akill

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


Member Function Documentation

ilBibItem::__initNestedSet (  ) 

Definition at line 232 of file class.ilBibItem.php.

References getID().

Referenced by add(), create(), delete(), getElement(), read(), and readXML().

        {
                include_once("classes/class.ilNestedSetXML.php");

                $this->nested_obj =& new ilNestedSetXML();
                $this->nested_obj->init($this->getID(), "bib");

                return $this->nested_obj->initDom();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilBibItem::add ( a_name,
a_path,
a_index = 0 
)

add meta data node

Definition at line 447 of file class.ilBibItem.php.

References $xml, __initNestedSet(), getID(), and getType().

        {
                if(!$this->__initNestedSet())
                {
                        return false;
                }

                $p = "//Bibliography";
                if ($a_path != "")
                {
                        $p .= "/" . $a_path;
                }
                $attributes = array();
#               echo "Index: " . $a_index . " | Path: " . $p . " | Name: " . $a_name . "<br>\n";
                switch ($a_name)
                {
                        case "BibItem"          :       $xml = '
                                                                                <BibItem Type="" Label="">
                                                                                        <Identifier Catalog="ILIAS" Entry="il__' . $this->getType() . '_' . $this->getID() . '"></Identifier>
                                                                                        <Language Language="' . $this->ilias->account->getLanguage() . '"></Language>
                                                                                        <Booktitle Language="' . $this->ilias->account->getLanguage() . '">NO TITLE</Booktitle>
                                                                                        <Edition>N/A</Edition>
                                                                                        <HowPublished Type=""></HowPublished>
                                                                                        <Publisher></Publisher>
                                                                                        <Year>N/A</Year>
                                                                                        <URL></URL>
                                                                                </BibItem>
                                                                        ';
                                                                        $this->nested_obj->addXMLNode($p, $xml, $a_index);
                                                                        break;
                        case "Identifier"       :       $value = "";
                                                                        $attributes[0] = array("name" => "Catalog", "value" => "");
                                                                        $attributes[1] = array("name" => "Entry", "value" => "");
                                                                        $this->nested_obj->addDomNode($p, $a_name, $value, $attributes, $a_index);
                                                                        break;
                        case "Keyword"          :       ;
                        case "Booktitle"        :       ;
                        case "Language"         :       $value = "";
                                                                        $attributes[0] = array("name" => "Language", value => $this->ilias->account->getLanguage());
                                                                        $this->nested_obj->addDomNode($p, $a_name, $value, $attributes, $a_index);
                                                                        break;
                        case "Author"           :       $xml = '
                                                                                <Author>
                                                                                        <Lastname></Lastname>
                                                                                </Author>
                                                                        ';
                                                                        $this->nested_obj->addXMLNode($p, $xml, $a_index);
                                                                        break;
                        case "HowPublished"     :       $value = "";
                                                                        $attributes[0] = array("name" => "Type", value => "");
                                                                        $this->nested_obj->addDomNode($p, $a_name, $value, $attributes, $a_index);
                                                                        break;
                        case "Series"           :       $xml = '
                                                                                <Series>
                                                                                        <SeriesTitle></SeriesTitle>
                                                                                </Series>
                                                                        ';
                                                                        $this->nested_obj->addXMLNode($p, $xml, $a_index);
                                                                        break;
                        default                         :       $value = "";
                                                                        $attributes = "";
                                                                        $this->nested_obj->addDomNode($p, $a_name, $value, $attributes, $a_index);
                                                                        break;
                }
                $this->nested_obj->updateFromDom();
        }

Here is the call graph for this function:

ilBibItem::appendBibItemData ( a_key,
a_value,
a_bib_item_nr 
)
Parameters:
@access public
Returns:

Definition at line 124 of file class.ilBibItem.php.

        {
                $this->bib_item_data[$a_bib_item_nr]["$a_key"] = array_merge($this->bib_item_data[$a_bib_item_nr]["$a_key"],array($a_value));
        }

ilBibItem::appendXMLContent ( a_xml  ) 

append xml content to BibItem setXMLContent must be called before and the same encoding must be used

Parameters:
string $a_xml xml content

Definition at line 216 of file class.ilBibItem.php.

        {
                $this->xml.= $a_xml;
        }

ilBibItem::create (  ) 

create bib data object in db

Definition at line 387 of file class.ilBibItem.php.

References $xml, __initNestedSet(), getID(), and getType().

Referenced by read().

        {
                $this->__initNestedSet();

/*              if (is_object($this->obj))
                {
                        $bibData["booktitle"] = $this->obj->getTitle();
                }
                else
                {*/
                        $bibData["booktitle"] = "NO TITLE";
/*              }*/
                $bibData["edition"] = "N/A";
                $bibData["publisher"] = "";
                $bibData["year"] = "N/A";

                $xml = '
                        <Bibliography>
                                <BibItem Type="" Label="">
                                        <Identifier Catalog="ILIAS" Entry="il__' . $this->getType() . '_' . $this->getID() . '"></Identifier>
                                        <Language Language="' . $this->ilias->account->getLanguage() . '"></Language>
                                        <Booktitle Language="' . $this->ilias->account->getLanguage() . '">'. $bibData["booktitle"] . '</Booktitle>
                                        <Edition>'. $bibData["edition"] . '</Edition>
                                        <HowPublished Type=""></HowPublished>
                                        <Publisher>'. $bibData["publisher"] . '</Publisher>
                                        <Year>'. $bibData["year"] . '</Year>
                                        <URL></URL>
                                </BibItem>
                        </Bibliography>
                ';
                $this->nested_obj->import($xml, $this->getID(), "bib");

                return $bibData;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilBibItem::delete ( a_name,
a_path,
a_index 
)

delete bibitem data node

Definition at line 425 of file class.ilBibItem.php.

References __initNestedSet().

        {
                if(!$this->__initNestedSet())
                {
                        return false;
                }

                if ($a_name != "")
                {
                        $p = "//Bibliography";
                        if ($a_path != "")
                        {
                                $p .= "/" . $a_path;
                        }
                        $this->nested_obj->deleteDomNode($p, $a_name, $a_index);
                        $this->nested_obj->updateFromDom();
                }
        }

Here is the call graph for this function:

ilBibItem::getAbstract (  ) 
Returns:
string
See also:
ilias_co.dtd Public

Definition at line 149 of file class.ilBibItem.php.

        {
                return $this->abstract;
        }

ilBibItem::getBibItemData (  ) 

Definition at line 130 of file class.ilBibItem.php.

        {
                return $this->bib_item_data;
        }

ilBibItem::getBibliographyAttributes (  ) 
Returns:
array e.g array("version" => 1,...)
See also:
ilias_co.dtd Public

Definition at line 140 of file class.ilBibItem.php.

        {
                return $this->bibliography_attr ? $this->bibliography_attr : array();
        }

ilBibItem::getBooktitle (  ) 

Definition at line 252 of file class.ilBibItem.php.

        {
                return $this->booktitle;
        }

ilBibItem::getCountries (  ) 

Definition at line 514 of file class.ilBibItem.php.

References $lng.

        {
                global $lng;

                $lng->loadLanguageModule("meta");

                $cntcodes = array ("DE","ES","FR","GB","AT","CH","AF","AL","DZ","AS","AD","AO",
                        "AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY",
                        "BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF",
                        "BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM",
                        "CG","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","TP","EC",
                        "EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","FX","GF","PF",
                        "TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GN",
                        "GW","GY","HT","HM","HN","HU","IS","IN","ID","IR","IQ","IE","IL","IT",
                        "JM","JP","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS",
                        "LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH",
                        "MQ","MR","MU","YT","MX","FM","MD","MC","MN","MS","MA","MZ","MM","NA",
                        "NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM",
                        "PK","PW","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO",
                        "RU","RW","KN","LC","VC","WS","SM","ST","SA","CH","SN","SC","SL","SG",
                        "SK","SI","SB","SO","ZA","GS","ES","LK","SH","PM","SD","SR","SJ","SZ",
                        "SE","SY","TW","TJ","TZ","TH","TG","TK","TO","TT","TN","TR","TM","TC",
                        "TV","UG","UA","AE","GB","UY","US","UM","UZ","VU","VA","VE","VN","VG",
                        "VI","WF","EH","YE","ZR","ZM","ZW");
                $cntrs = array();
                foreach($cntcodes as $cntcode)
                {
                        $cntrs[$cntcode] = $lng->txt("meta_c_".$cntcode);
                }
                asort($cntrs);
                return $cntrs;

        }

ilBibItem::getEdition (  ) 

Definition at line 262 of file class.ilBibItem.php.

        {
                return $this->edition;
        }

ilBibItem::getElement ( a_name,
a_path = "",
a_index = 0 
)

get identifier catalog value note: only one value implemented currently

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

References __initNestedSet(), and setElement().

        {
                if(!$this->__initNestedSet())
                {
                        return false;
                }

                $p = "//Bibliography";
                if ($a_path != "")
                {
                        $p .= "/" . $a_path;
                }
                $nodes = $this->nested_obj->getDomContent($p, $a_name, $a_index);
                $this->setElement($a_name, $nodes);
/*              if ($a_name == "Author" ||
                        $a_name == "FirstName" ||
                        $a_name == "MiddleName" ||
                        $a_name == "LastName")
                {
                        echo "Index: " . $a_index . " | Path: " . $p . " | Name: " . $a_name . "<br>\n";
                        vd($this->$a_name);
                }
*/
                return $this->$a_name;
        }

Here is the call graph for this function:

ilBibItem::getID (  ) 

Definition at line 310 of file class.ilBibItem.php.

Referenced by __initNestedSet(), add(), and create().

        {
                return $this->id;
        }

Here is the caller graph for this function:

ilBibItem::getLanguage (  ) 

Definition at line 554 of file class.ilBibItem.php.

        {
                return $this->language;
        }

ilBibItem::getLanguages (  ) 

get iso conform languages see http://www.oasis-open.org/cover/iso639a.html

Definition at line 563 of file class.ilBibItem.php.

References $lng.

        {
                global $lng;

                $lng->loadLanguageModule("meta");

                $lngcodes = array("aa","ab","af","am","ar","as","ay","az","ba","be","bg","bh",
                        "bi","bn","bo","br","ca","co","cs","cy","da","de","dz","el","en","eo",
                        "es","et","eu","fa","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu",
                        "ha","he","hi","hr","hu","hy","ia","ie","ik","id","is","it","iu","ja",
                        "jv","ka","kk","kl","km","kn","ko","ks","ku","ky","la","ln","ru","rw",
                        "sa","sd","sg","sh","si","sk","sl","sm","sn","so","sq","sr","ss","st",
                        "su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts",
                        "tt","tw","ug","uk","ur","uz","vi","vo","wo","xh","yi","yo","za","zh",
                        "zu");
                $langs = array();
                foreach($lngcodes as $lngcode)
                {
                        $langs[$lngcode] = $lng->txt("meta_l_".$lngcode);
                }
                asort($langs);
                return $langs;
        }

ilBibItem::getMeta (  ) 

get meta data

Definition at line 298 of file class.ilBibItem.php.

        {
                return $this->meta;
        }

ilBibItem::getPublisher (  ) 

Definition at line 272 of file class.ilBibItem.php.

        {
                return $this->publisher;
        }

ilBibItem::getTitle (  ) 
Parameters:
@access public
Returns:
string title

Definition at line 161 of file class.ilBibItem.php.

        {
                return $this->title;
        }

ilBibItem::getType (  ) 

Definition at line 320 of file class.ilBibItem.php.

Referenced by add(), and create().

        {
                return $this->type;
        }

Here is the caller graph for this function:

ilBibItem::getXML (  ) 
Parameters:
@access public
Returns:
string xml-structure

Definition at line 173 of file class.ilBibItem.php.

        {
                return $this->xml;
        }

ilBibItem::getXMLContent (  ) 

get xml content of BibItem

Definition at line 225 of file class.ilBibItem.php.

        {

        return $this->xml;
        }

ilBibItem::getYear (  ) 

Definition at line 282 of file class.ilBibItem.php.

        {
                return $this->year;
        }

ilBibItem::ilBibItem ( content_obj = 0  ) 

Constructor public.

Definition at line 56 of file class.ilBibItem.php.

References $content_obj, $ilias, readXML(), and setID().

        {
                global $ilias;

                $this->ilias =& $ilias;

                $this->import_id = array();
                $this->title = "";
                $this->language = array();
                $this->description = array();
                $this->keyword = array();
                $this->technicals = array();    // technical sections
                $this->coverage = "";
                $this->structure = "";

                $this->content_obj =& $content_obj;
                if(is_object($content_obj))
                {
                        $this->setID($this->content_obj->getId());
                        $this->readXML();
#                       $this->read();
                }
        }

Here is the call graph for this function:

ilBibItem::read (  ) 

Definition at line 364 of file class.ilBibItem.php.

References __initNestedSet(), create(), setBooktitle(), setEdition(), setPublisher(), and setYear().

        {
                if(!$this->__initNestedSet())
                {
                        $bibData = $this->create();
                }
                else
                {
                        $bibData["booktitle"] = $this->nested_obj->getFirstDomContent("//Bibliography/BibItem/Booktitle");
                        $bibData["edition"] = $this->nested_obj->getFirstDomContent("//Bibliography/BibItem/Edition");
                        $bibData["publisher"] = $this->nested_obj->getFirstDomContent("//Bibliography/BibItem/Publisher");
                        $bibData["year"] = $this->nested_obj->getFirstDomContent("//Bibliography/BibItem/Year");
                }

                $this->setBooktitle($bibData["booktitle"]);
                $this->setEdition($bibData["edition"]);
                $this->setPublisher($bibData["publisher"]);
                $this->setYear($bibData["year"]);
        }

Here is the call graph for this function:

ilBibItem::readXML (  ) 
Parameters:
@access public
Returns:

Definition at line 185 of file class.ilBibItem.php.

References __initNestedSet().

Referenced by ilBibItem().

        {
                if(!$this->__initNestedSet())
                {
                        return false;
                }
                $this->xml = $this->nested_obj->export($this->content_obj->getId(),"bib");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilBibItem::setAbstract ( a_data  ) 
Parameters:
@access public
Returns:

Definition at line 98 of file class.ilBibItem.php.

        {
                $this->abstract = $a_data;
        }

ilBibItem::setBibItemData ( a_key,
a_value,
a_bib_item_nr 
)
Parameters:
@access public
Returns:

Definition at line 110 of file class.ilBibItem.php.

        {
                $this->bib_item_data[$a_bib_item_nr]["$a_key"] = $a_value;
                
                return true;
        }

ilBibItem::setBibliographyAttributes ( a_data  ) 
Parameters:
array e.g array("version" => 1,...)
See also:
ilias_co.dtd Public

Definition at line 86 of file class.ilBibItem.php.

        {
                $this->bibliography_attr = $a_data;
        }

ilBibItem::setBooktitle ( a_booktitle  ) 

Definition at line 242 of file class.ilBibItem.php.

Referenced by read().

        {
                if ($a_booktitle == "")
                {
                        $a_booktitle = "NO TITLE";
                }

                $this->booktitle = $a_booktitle;
        }

Here is the caller graph for this function:

ilBibItem::setEdition ( a_edition  ) 

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

Referenced by read().

        {
                $this->edition = $a_edition;
        }

Here is the caller graph for this function:

ilBibItem::setElement ( a_name,
a_data 
)

set identifier catalog value note: only one value implemented currently

Definition at line 329 of file class.ilBibItem.php.

Referenced by getElement().

        {
                $this->$a_name = $a_data;
        }

Here is the caller graph for this function:

ilBibItem::setID ( a_id  ) 

set id

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

Referenced by ilBibItem().

        {
                $this->id = $a_id;
        }

Here is the caller graph for this function:

ilBibItem::setLanguage ( a_lang  ) 

Definition at line 549 of file class.ilBibItem.php.

        {
                $this->language = $a_lang;
        }

ilBibItem::setMeta ( a_data  ) 

set (posted) meta data

Definition at line 290 of file class.ilBibItem.php.

        {
                $this->meta = $a_data;
        }

ilBibItem::setPublisher ( a_publisher  ) 

Definition at line 267 of file class.ilBibItem.php.

Referenced by read().

        {
                $this->publisher = $a_publisher;
        }

Here is the caller graph for this function:

ilBibItem::setType ( a_type  ) 

Definition at line 315 of file class.ilBibItem.php.

        {
                $this->type = $a_type;
        }

ilBibItem::setXMLContent ( a_xml,
a_encoding = "UTF-8" 
)

set xml content of BibItem, start with <BibItem...>, end with </BibItemt>, comply with ILIAS DTD, use utf-8!

Parameters:
string $a_xml xml content
string $a_encoding encoding of the content (here is no conversion done! it must be already utf-8 encoded at the time)

Definition at line 203 of file class.ilBibItem.php.

        {
                $this->encoding = $a_encoding;
                $this->xml = $a_xml;
        }

ilBibItem::setYear ( a_year  ) 

Definition at line 277 of file class.ilBibItem.php.

Referenced by read().

        {
                $this->year = $a_year;
        }

Here is the caller graph for this function:


Field Documentation

ilBibItem::$abstract

Definition at line 43 of file class.ilBibItem.php.

ilBibItem::$bibliography_attr

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

ilBibItem::$content_obj

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

Referenced by ilBibItem().

ilBibItem::$id = 0

Definition at line 45 of file class.ilBibItem.php.

ilBibItem::$language

Definition at line 50 of file class.ilBibItem.php.

ilBibItem::$meta

Definition at line 48 of file class.ilBibItem.php.

ilBibItem::$nested_obj

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

ilBibItem::$type = "bib"

Definition at line 46 of file class.ilBibItem.php.

ilBibItem::$xml

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

Referenced by add(), and create().


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