Current File : /home/k/a/r/karenpetzb/www/items/category/ListEntry.php.tar
home/karenpetzb/library/Zend/Gdata/Spreadsheets/ListEntry.php000060400000015540150714137250020333 0ustar00<?php

/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category     Zend
 * @package      Zend_Gdata
 * @subpackage   Spreadsheets
 * @copyright    Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * @see Zend_Gdata_Entry
 */
require_once 'Zend/Gdata/Entry.php';

/**
 * @see Zend_Gdata_Spreadsheets_Extension_Custom
 */
require_once 'Zend/Gdata/Spreadsheets/Extension/Custom.php';

/**
 * Concrete class for working with List entries.
 *
 * @category     Zend
 * @package      Zend_Gdata
 * @subpackage   Spreadsheets
 * @copyright    Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Gdata_Spreadsheets_ListEntry extends Zend_Gdata_Entry
{

    protected $_entryClassName = 'Zend_Gdata_Spreadsheets_ListEntry';

    /**
     * List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom),
     * indexed by order added to this entry.
     * @var array
     */
    protected $_custom = array();

    /**
     * List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom),
     * indexed by element name.
     * @var array
     */
    protected $_customByName = array();

    /**
     * Constructs a new Zend_Gdata_Spreadsheets_ListEntry object.
     * @param DOMElement $element An existing XML element on which to base this new object.
     */
    public function __construct($element = null)
    {
        $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
        parent::__construct($element);
    }

    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
    {
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
        if (!empty($this->_custom)) {
            foreach ($this->_custom as $custom) {
                $element->appendChild($custom->getDOM($element->ownerDocument));
            }
        }
        return $element;
    }

    protected function takeChildFromDOM($child)
    {
        switch ($child->namespaceURI) {
        case $this->lookupNamespace('gsx');
            $custom = new Zend_Gdata_Spreadsheets_Extension_Custom($child->localName);
            $custom->transferFromDOM($child);
            $this->addCustom($custom);
            break;
        default:
            parent::takeChildFromDOM($child);
            break;
        }
    }

    /**
     * Gets the row elements contained by this list entry.
     * @return array The custom row elements in this list entry
     */
    public function getCustom()
    {
        return $this->_custom;
    }

    /**
     * Gets a single row element contained by this list entry using its name.
     * @param string $name The name of a custom element to return. If null
     *          or not defined, an array containing all custom elements
     *          indexed by name will be returned.
     * @return mixed If a name is specified, the
     *          Zend_Gdata_Spreadsheets_Extension_Custom element requested,
     *          is returned or null if not found. Otherwise, an array of all
     *          Zend_Gdata_Spreadsheets_Extension_Custom elements is returned
     *          indexed by name.
     */
    public function getCustomByName($name = null)
    {
        if ($name === null) {
            return $this->_customByName;
        } else {
            if (array_key_exists($name, $this->customByName)) {
                return $this->_customByName[$name];
            } else {
                return null;
            }
        }
    }

    /**
     * Sets the row elements contained by this list entry. If any
     * custom row elements were previously stored, they will be overwritten.
     * @param array $custom The custom row elements to be contained in this
     *          list entry.
     * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
     */
    public function setCustom($custom)
    {
        $this->_custom = array();
        foreach ($custom as $c) {
            $this->addCustom($c);
        }
        return $this;
    }

    /**
     * Add an individual custom row element to this list entry.
     * @param Zend_Gdata_Spreadsheets_Extension_Custom $custom The custom
     *             element to be added.
     * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
     */
    public function addCustom($custom)
    {
        $this->_custom[] = $custom;
        $this->_customByName[$custom->getColumnName()] = $custom;
        return $this;
    }

    /**
     * Remove an individual row element from this list entry by index. This
     * will cause the array to be re-indexed.
     * @param int $index The index of the custom element to be deleted.
     * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
     * @throws Zend_Gdata_App_InvalidArgumentException
     */
    public function removeCustom($index)
    {
        if (array_key_exists($index, $this->_custom)) {
            $element = $this->_custom[$index];
            // Remove element
            unset($this->_custom[$index]);
            // Re-index the array
            $this->_custom = array_values($this->_custom);
            // Be sure to delete form both arrays!
            $key = array_search($element, $this->_customByName);
            unset($this->_customByName[$key]);
        } else {
            require_once 'Zend/Gdata/App/InvalidArgumentException.php';
            throw new Zend_Gdata_App_InvalidArgumentException(
                'Element does not exist.');
        }
        return $this;
    }

    /**
     * Remove an individual row element from this list entry by name.
     * @param string $name The name of the custom element to be deleted.
     * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface.
     * @throws Zend_Gdata_App_InvalidArgumentException
     */
    public function removeCustomByName($name)
    {
        if (array_key_exists($name, $this->_customByName)) {
            $element = $this->_customByName[$name];
            // Remove element
            unset($this->_customByName[$name]);
            // Be sure to delete from both arrays!
            $key = array_search($element, $this->_custom);
            unset($this->_custom[$key]);
        } else {
            require_once 'Zend/Gdata/App/InvalidArgumentException.php';
            throw new Zend_Gdata_App_InvalidArgumentException(
                'Element does not exist.');
        }
        return $this;
    }

}
home/karenpetzb/library/Zend/Gdata/Calendar/ListEntry.php000060400000015550150714320000017376 0ustar00<?php

/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Gdata
 * @subpackage Calendar
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * @see Zend_Gdata_Entry
 */
require_once 'Zend/Gdata/Entry.php';

/**
 * @see Zend_Calendar_Extension_AccessLevel
 */
require_once 'Zend/Gdata/Calendar/Extension/AccessLevel.php';

/**
 * @see Zend_Calendar_Extension_Color
 */
require_once 'Zend/Gdata/Calendar/Extension/Color.php';

/**
 * @see Zend_Calendar_Extension_Hidden
 */
require_once 'Zend/Gdata/Calendar/Extension/Hidden.php';

/**
 * @see Zend_Calendar_Extension_Selected
 */
require_once 'Zend/Gdata/Calendar/Extension/Selected.php';

/**
 * @see Zend_Gdata_Extension_EventStatus
 */
require_once 'Zend/Gdata/Extension/EventStatus.php';

/**
 * @see Zend_Gdata_Extension_Visibility
 */
require_once 'Zend/Gdata/Extension/Visibility.php';


/**
 * @see Zend_Extension_Where
 */
require_once 'Zend/Gdata/Extension/Where.php';

/**
 * Represents a Calendar entry in the Calendar data API meta feed of a user's
 * calendars.
 *
 * @category   Zend
 * @package    Zend_Gdata
 * @subpackage Calendar
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry
{

    protected $_color = null;
    protected $_accessLevel = null;
    protected $_hidden = null;
    protected $_selected = null;
    protected $_timezone = null;
    protected $_where = array();

    public function __construct($element = null)
    {
        $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
        parent::__construct($element);
    }

    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
    {
        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
        if ($this->_accessLevel != null) {
            $element->appendChild($this->_accessLevel->getDOM($element->ownerDocument));
        }
        if ($this->_color != null) {
            $element->appendChild($this->_color->getDOM($element->ownerDocument));
        }
        if ($this->_hidden != null) {
            $element->appendChild($this->_hidden->getDOM($element->ownerDocument));
        }
        if ($this->_selected != null) {
            $element->appendChild($this->_selected->getDOM($element->ownerDocument));
        }
        if ($this->_timezone != null) {
            $element->appendChild($this->_timezone->getDOM($element->ownerDocument));
        }
        if ($this->_where != null) {
            foreach ($this->_where as $where) {
                $element->appendChild($where->getDOM($element->ownerDocument));
            }
        }
        return $element;
    }

    protected function takeChildFromDOM($child)
    {
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
        switch ($absoluteNodeName) {
        case $this->lookupNamespace('gCal') . ':' . 'accesslevel';
            $accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel();
            $accessLevel->transferFromDOM($child);
            $this->_accessLevel = $accessLevel;
            break;
        case $this->lookupNamespace('gCal') . ':' . 'color';
            $color = new Zend_Gdata_Calendar_Extension_Color();
            $color->transferFromDOM($child);
            $this->_color = $color;
            break;
        case $this->lookupNamespace('gCal') . ':' . 'hidden';
            $hidden = new Zend_Gdata_Calendar_Extension_Hidden();
            $hidden->transferFromDOM($child);
            $this->_hidden = $hidden;
            break;
        case $this->lookupNamespace('gCal') . ':' . 'selected';
            $selected = new Zend_Gdata_Calendar_Extension_Selected();
            $selected->transferFromDOM($child);
            $this->_selected = $selected;
            break;
        case $this->lookupNamespace('gCal') . ':' . 'timezone';
            $timezone = new Zend_Gdata_Calendar_Extension_Timezone();
            $timezone->transferFromDOM($child);
            $this->_timezone = $timezone;
            break;
        case $this->lookupNamespace('gd') . ':' . 'where';
            $where = new Zend_Gdata_Extension_Where();
            $where->transferFromDOM($child);
            $this->_where[] = $where;
            break;
        default:
            parent::takeChildFromDOM($child);
            break;
        }
    }

    public function getAccessLevel()
    {
        return $this->_accessLevel;
    }

    /**
     * @param Zend_Gdata_Calendar_Extension_AccessLevel $value
     * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
     */
    public function setAccessLevel($value)
    {
        $this->_accessLevel = $value;
        return $this;
    }
    public function getColor()
    {
        return $this->_color;
    }

    /**
     * @param Zend_Gdata_Calendar_Extension_Color $value
     * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
     */
    public function setColor($value)
    {
        $this->_color = $value;
        return $this;
    }

    public function getHidden()
    {
        return $this->_hidden;
    }

    /**
     * @param Zend_Gdata_Calendar_Extension_Hidden $value
     * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
     */
    public function setHidden($value)
    {
        $this->_hidden = $value;
        return $this;
    }

    public function getSelected()
    {
        return $this->_selected;
    }

    /**
     * @param Zend_Gdata_Calendar_Extension_Selected $value
     * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
     */
    public function setSelected($value)
    {
        $this->_selected = $value;
        return $this;
    }

    public function getTimezone()
    {
        return $this->_timezone;
    }

    /**
     * @param Zend_Gdata_Calendar_Extension_Timezone $value
     * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
     */
    public function setTimezone($value)
    {
        $this->_timezone = $value;
        return $this;
    }

    public function getWhere()
    {
        return $this->_where;
    }

    /**
     * @param Zend_Gdata_Extension_Where $value
     * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
     */
    public function setWhere($value)
    {
        $this->_where = $value;
        return $this;
    }

}