[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Extension/ -> When.php (source)

   1  <?php
   2  
   3  /**
   4   * Zend Framework
   5   *
   6   * LICENSE
   7   *
   8   * This source file is subject to the new BSD license that is bundled
   9   * with this package in the file LICENSE.txt.
  10   * It is also available through the world-wide-web at this URL:
  11   * http://framework.zend.com/license/new-bsd
  12   * If you did not receive a copy of the license and are unable to
  13   * obtain it through the world-wide-web, please send an email
  14   * to [email protected] so we can send you a copy immediately.
  15   *
  16   * @category   Zend
  17   * @package    Zend_Gdata
  18   * @subpackage Gdata
  19   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  20   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  21   * @version    $Id$
  22   */
  23  
  24  /**
  25   * @see Zend_Gdata_Extension
  26   */
  27  require_once 'Zend/Gdata/Extension.php';
  28  
  29  /**
  30   * @see Zend_Gdata_Extension_Reminder
  31   */
  32  require_once 'Zend/Gdata/Extension/Reminder.php';
  33  
  34  /**
  35   * Represents the gd:when element
  36   *
  37   * @category   Zend
  38   * @package    Zend_Gdata
  39   * @subpackage Gdata
  40   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  41   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  42   */
  43  class Zend_Gdata_Extension_When extends Zend_Gdata_Extension
  44  {
  45  
  46      protected $_rootElement = 'when';
  47      protected $_reminders = array();
  48      protected $_startTime = null;
  49      protected $_valueString = null;
  50      protected $_endTime = null;
  51  
  52      public function __construct($startTime = null, $endTime = null,
  53              $valueString = null, $reminders = null)
  54      {
  55          parent::__construct();
  56          $this->_startTime = $startTime;
  57          $this->_endTime = $endTime;
  58          $this->_valueString = $valueString;
  59          $this->_reminders = $reminders;
  60      }
  61  
  62      public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  63      {
  64          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  65          if ($this->_startTime !== null) {
  66              $element->setAttribute('startTime', $this->_startTime);
  67          }
  68          if ($this->_endTime !== null) {
  69              $element->setAttribute('endTime', $this->_endTime);
  70          }
  71          if ($this->_valueString !== null) {
  72              $element->setAttribute('valueString', $this->_valueString);
  73          }
  74          if ($this->_reminders !== null) {
  75              foreach ($this->_reminders as $reminder) {
  76                  $element->appendChild(
  77                          $reminder->getDOM($element->ownerDocument));
  78              }
  79          }
  80          return $element;
  81      }
  82  
  83      protected function takeChildFromDOM($child)
  84      {
  85          $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
  86          switch ($absoluteNodeName) {
  87              case $this->lookupNamespace('gd') . ':' . 'reminder';
  88                  $reminder = new Zend_Gdata_Extension_Reminder();
  89                  $reminder->transferFromDOM($child);
  90                  $this->_reminders[] = $reminder;
  91                  break;
  92          default:
  93              parent::takeChildFromDOM($child);
  94              break;
  95          }
  96      }
  97  
  98      protected function takeAttributeFromDOM($attribute)
  99      {
 100          switch ($attribute->localName) {
 101              case 'startTime':
 102                  $this->_startTime = $attribute->nodeValue;
 103                  break;
 104              case 'endTime':
 105                  $this->_endTime = $attribute->nodeValue;
 106                  break;
 107              case 'valueString':
 108                  $this->_valueString = $attribute->nodeValue;
 109                  break;
 110              default:
 111                  parent::takeAttributeFromDOM($attribute);
 112          }
 113      }
 114  
 115      public function __toString()
 116      {
 117          if ($this->_valueString)
 118              return $this->_valueString;
 119          else {
 120              return 'Starts: ' . $this->getStartTime() . ' ' .
 121                     'Ends: ' .  $this->getEndTime();
 122          }
 123      }
 124  
 125      public function getStartTime()
 126      {
 127          return $this->_startTime;
 128      }
 129  
 130      public function setStartTime($value)
 131      {
 132          $this->_startTime = $value;
 133          return $this;
 134      }
 135  
 136      public function getEndTime()
 137      {
 138          return $this->_endTime;
 139      }
 140  
 141      public function setEndTime($value)
 142      {
 143          $this->_endTime = $value;
 144          return $this;
 145      }
 146  
 147      public function getValueString()
 148      {
 149          return $this->_valueString;
 150      }
 151  
 152      public function setValueString($value)
 153      {
 154          $this->_valueString = $value;
 155          return $this;
 156      }
 157  
 158      public function getReminders()
 159      {
 160          return $this->_reminders;
 161      }
 162  
 163      public function setReminders($value)
 164      {
 165          $this->_reminders = $value;
 166          return $this;
 167      }
 168  
 169  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1