<?

class CAT_Book extends CAT_Item {
    var $title;
    var $author;
    var $year;
    var $publisher;
    var $notes;
    var $amazonLink;

    function CAT_Book() {
    }

    function getBanner() {
        return 'My books';
    }

    function getEmptyMessage() {
        return "No items for the moment";
    }
       
    function getClass() {
        return 'CAT_Book';
    }

    function isRateable() {
        return true;
    }

    function getData() {
        $a = array();
        
        $a['title'] = $this->title;
        $a['author'] = $this->author;
        $a['year'] = $this->year;
        $a['publisher'] = $this->publisher;
        $a['notes'] = $this->notes;
        $a['amazonLink'] = $this->amazonLink;

        return serialize($a);
    }

    function setData($s) {
        $a = unserialize($s);
        
        $this->title = $a['title'];
        $this->author = $a['author'];
        $this->year = $a['year'];
        $this->publisher = $a['publisher'];
        $this->notes = $a['notes'];
        $this->amazonLink = $a['amazonLink'];

        // do NOT set the permalink here!!
        // NO: ---> $this->permalink = $a['permalink']; !!!
    }

    function fromForm($a) {
        $this->title = $a['title'];
        $this->author = $a['author'];
        $this->year = $a['year'];
        $this->publisher = $a['publisher'];
        $this->notes = $a['notes'];
        $this->amazonLink = $a['amazonLink'];

        // must be here, if you want a permalink.
        // inherited from superclass
        $this->permalink = $a['permalink'];
    }
}

?>