[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Gdata/Gapps/ -> UserEntry.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 Gapps
  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_Entry
  26   */
  27  require_once 'Zend/Gdata/Entry.php';
  28  
  29  /**
  30   * @see Zend_Gdata_Extension_FeedLink
  31   */
  32  require_once 'Zend/Gdata/Extension/FeedLink.php';
  33  
  34  /**
  35   * @see Zend_Gdata_Gapps_Extension_Login
  36   */
  37  require_once 'Zend/Gdata/Gapps/Extension/Login.php';
  38  
  39  /**
  40   * @see Zend_Gdata_Gapps_Extension_Name
  41   */
  42  require_once 'Zend/Gdata/Gapps/Extension/Name.php';
  43  
  44  /**
  45   * @see Zend_Gdata_Gapps_Extension_Quota
  46   */
  47  require_once 'Zend/Gdata/Gapps/Extension/Quota.php';
  48  
  49  /**
  50   * Data model class for a Google Apps User Entry.
  51   *
  52   * Each user entry describes a single user within a Google Apps hosted
  53   * domain.
  54   *
  55   * To transfer user entries to and from the Google Apps servers, including
  56   * creating new entries, refer to the Google Apps service class,
  57   * Zend_Gdata_Gapps.
  58   *
  59   * This class represents <atom:entry> in the Google Data protocol.
  60   *
  61   * @category   Zend
  62   * @package    Zend_Gdata
  63   * @subpackage Gapps
  64   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  65   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  66   */
  67  class Zend_Gdata_Gapps_UserEntry extends Zend_Gdata_Entry
  68  {
  69  
  70      protected $_entryClassName = 'Zend_Gdata_Gapps_UserEntry';
  71  
  72      /**
  73       * <apps:login> element containing information about this user's
  74       * account, including their username and permissions.
  75       *
  76       * @var Zend_Gdata_Gapps_Extension_Login
  77       */
  78      protected $_login = null;
  79  
  80      /**
  81       * <apps:name> element containing the user's actual name.
  82       *
  83       * @var Zend_Gdata_Gapps_Extension_Name
  84       */
  85      protected $_name = null;
  86  
  87      /**
  88       * <apps:quotq> element describing any storage quotas in place for
  89       * this user.
  90       *
  91       * @var Zend_Gdata_Gapps_Extension_Quota
  92       */
  93      protected $_quota = null;
  94  
  95      /**
  96       * <gd:feedLink> element containing information about other feeds
  97       * relevant to this entry.
  98       *
  99       * @var Zend_Gdata_Extension_FeedLink
 100       */
 101      protected $_feedLink = array();
 102  
 103      /**
 104       * Create a new instance.
 105       *
 106       * @param DOMElement $element (optional) DOMElement from which this
 107       *          object should be constructed.
 108       */
 109      public function __construct($element = null)
 110      {
 111          $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
 112          parent::__construct($element);
 113      }
 114  
 115      /**
 116       * Retrieves a DOMElement which corresponds to this element and all
 117       * child properties.  This is used to build an entry back into a DOM
 118       * and eventually XML text for application storage/persistence.
 119       *
 120       * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 121       * @return DOMElement The DOMElement representing this element and all
 122       *          child properties.
 123       */
 124      public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 125      {
 126          $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 127          if ($this->_login !== null) {
 128              $element->appendChild($this->_login->getDOM($element->ownerDocument));
 129          }
 130          if ($this->_name !== null) {
 131              $element->appendChild($this->_name->getDOM($element->ownerDocument));
 132          }
 133          if ($this->_quota !== null) {
 134              $element->appendChild($this->_quota->getDOM($element->ownerDocument));
 135          }
 136          foreach ($this->_feedLink as $feedLink) {
 137              $element->appendChild($feedLink->getDOM($element->ownerDocument));
 138          }
 139          return $element;
 140      }
 141  
 142      /**
 143       * Creates individual Entry objects of the appropriate type and
 144       * stores them as members of this entry based upon DOM data.
 145       *
 146       * @param DOMNode $child The DOMNode to process
 147       */
 148      protected function takeChildFromDOM($child)
 149      {
 150          $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
 151  
 152          switch ($absoluteNodeName) {
 153              case $this->lookupNamespace('apps') . ':' . 'login';
 154                  $login = new Zend_Gdata_Gapps_Extension_Login();
 155                  $login->transferFromDOM($child);
 156                  $this->_login = $login;
 157                  break;
 158              case $this->lookupNamespace('apps') . ':' . 'name';
 159                  $name = new Zend_Gdata_Gapps_Extension_Name();
 160                  $name->transferFromDOM($child);
 161                  $this->_name = $name;
 162                  break;
 163              case $this->lookupNamespace('apps') . ':' . 'quota';
 164                  $quota = new Zend_Gdata_Gapps_Extension_Quota();
 165                  $quota->transferFromDOM($child);
 166                  $this->_quota = $quota;
 167                  break;
 168              case $this->lookupNamespace('gd') . ':' . 'feedLink';
 169                  $feedLink = new Zend_Gdata_Extension_FeedLink();
 170                  $feedLink->transferFromDOM($child);
 171                  $this->_feedLink[] = $feedLink;
 172                  break;
 173              default:
 174                  parent::takeChildFromDOM($child);
 175                  break;
 176          }
 177      }
 178  
 179      /**
 180       * Get the value of the login property for this object.
 181       *
 182       * @see setLogin
 183       * @return Zend_Gdata_Gapps_Extension_Login The requested object.
 184       */
 185      public function getLogin()
 186      {
 187          return $this->_login;
 188      }
 189  
 190      /**
 191       * Set the value of the login property for this object. This property
 192       * is used to store the username address of the current user.
 193       *
 194       * @param Zend_Gdata_Gapps_Extension_Login $value The desired value for
 195       *          this instance's login property.
 196       * @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface.
 197       */
 198      public function setLogin($value)
 199      {
 200          $this->_login = $value;
 201          return $this;
 202      }
 203  
 204      /**
 205       * Get the value of the name property for this object.
 206       *
 207       * @see setName
 208       * @return Zend_Gdata_Gapps_Extension_Name The requested object.
 209       */
 210      public function getName()
 211      {
 212          return $this->_name;
 213      }
 214  
 215      /**
 216       * Set the value of the name property for this object. This property
 217       * is used to store the full name of the current user.
 218       *
 219       * @param Zend_Gdata_Gapps_Extension_Name $value The desired value for
 220       *          this instance's name property.
 221       * @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface.
 222       */
 223      public function setName($value)
 224      {
 225          $this->_name = $value;
 226          return $this;
 227      }
 228  
 229      /**
 230       * Get the value of the quota property for this object.
 231       *
 232       * @see setQuota
 233       * @return Zend_Gdata_Gapps_Extension_Quota The requested object.
 234       */
 235      public function getQuota()
 236      {
 237          return $this->_quota;
 238      }
 239  
 240      /**
 241       * Set the value of the quota property for this object. This property
 242       * is used to store the amount of storage available for the current
 243       * user. Quotas may not be modifiable depending on the domain used.
 244       *
 245       * @param Zend_Gdata_Gapps_Extension_Quota $value The desired value for
 246       *          this instance's quota property.
 247       * @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface.
 248       */
 249      public function setQuota($value)
 250      {
 251          $this->_quota = $value;
 252          return $this;
 253      }
 254  
 255      /**
 256       * Returns all feed links for this entry, or if a rel value is
 257       * specified, the feed link associated with that value is returned.
 258       *
 259       * @param string $rel The rel value of the link to be found. If null,
 260       *          the array of links is returned instead.
 261       * @return mixed Either an array of Zend_Gdata_Extension_FeedLink
 262       *          objects if $rel is null, a single
 263       *          Zend_Gdata_Extension_FeedLink object if $rel is specified
 264       *          and a matching feed link is found, or null if $rel is
 265       *          specified and no matching feed link is found.
 266       */
 267      public function getFeedLink($rel = null)
 268      {
 269          if ($rel == null) {
 270              return $this->_feedLink;
 271          } else {
 272              foreach ($this->_feedLink as $feedLink) {
 273                  if ($feedLink->rel == $rel) {
 274                      return $feedLink;
 275                  }
 276              }
 277              return null;
 278          }
 279      }
 280  
 281      /**
 282       * Set the value of the feed link property for this object. This property
 283       * is used to provide links to alternative feeds relevant to this entry.
 284       *
 285       * @param array $value A collection of
 286       *          Zend_Gdata_Gapps_Extension_FeedLink objects.
 287       * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface.
 288       */
 289      public function setFeedLink($value)
 290      {
 291          $this->_feedLink = $value;
 292          return $this;
 293      }
 294  
 295  }


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