Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Gdata/Query.php
Go to the documentation of this file.
00001 <?php
00002 
00027 require_once 'Zend/Gdata/App/Util.php';
00028 
00040 class Zend_Gdata_Query
00041 {
00042 
00048     protected $_params = array();
00049 
00055     protected $_defaultFeedUri = null;
00056 
00063     protected $_url = null;
00064 
00070     protected $_category = null;
00071 
00075     public function __construct($url = null)
00076     {
00077         $this->_url = $url;
00078     }
00079 
00083     public function getQueryString()
00084     {
00085         $queryArray = array();
00086         foreach ($this->_params as $name => $value) {
00087             if (substr($name, 0, 1) == '_') {
00088                 continue;
00089             }
00090             $queryArray[] = urlencode($name) . '=' . urlencode($value);
00091         }
00092         if (count($queryArray) > 0) {
00093             return '?' . implode('&', $queryArray);
00094         } else {
00095             return '';
00096         }
00097     }
00098 
00102     public function resetParameters()
00103     {
00104         $this->_params = array();
00105     }
00106 
00110     public function getQueryUrl()
00111     {
00112         if ($this->_url == null) {
00113             $url = $this->_defaultFeedUri;
00114         } else {
00115             $url = $this->_url;
00116         }
00117         if ($this->getCategory() !== null) {
00118             $url .= '/-/' . $this->getCategory();
00119         }
00120         $url .= $this->getQueryString();
00121         return $url;
00122     }
00123 
00129     public function setParam($name, $value)
00130     {
00131         $this->_params[$name] = $value;
00132         return $this;
00133     }
00134 
00138     public function getParam($name)
00139     {
00140         return $this->_params[$name];
00141     }
00142 
00147     public function setAlt($value)
00148     {
00149         if ($value != null) {
00150             $this->_params['alt'] = $value;
00151         } else {
00152             unset($this->_params['alt']);
00153         }
00154         return $this;
00155     }
00156 
00161     public function setMaxResults($value)
00162     {
00163         if ($value != null) {
00164             $this->_params['max-results'] = $value;
00165         } else {
00166             unset($this->_params['max-results']);
00167         }
00168         return $this;
00169     }
00170 
00175     public function setQuery($value)
00176     {
00177         if ($value != null) {
00178             $this->_params['q'] = $value;
00179         } else {
00180             unset($this->_params['q']);
00181         }
00182         return $this;
00183     }
00184 
00189     public function setStartIndex($value)
00190     {
00191         if ($value != null) {
00192             $this->_params['start-index'] = $value;
00193         } else {
00194             unset($this->_params['start-index']);
00195         }
00196         return $this;
00197     }
00198 
00203     public function setUpdatedMax($value)
00204     {
00205         if ($value != null) {
00206             $this->_params['updated-max'] = Zend_Gdata_App_Util::formatTimestamp($value);
00207         } else {
00208             unset($this->_params['updated-max']);
00209         }
00210         return $this;
00211     }
00212 
00217     public function setUpdatedMin($value)
00218     {
00219         if ($value != null) {
00220             $this->_params['updated-min'] = Zend_Gdata_App_Util::formatTimestamp($value);
00221         } else {
00222             unset($this->_params['updated-min']);
00223         }
00224         return $this;
00225     }
00226 
00231     public function setPublishedMax($value)
00232     {
00233         if ($value !== null) {
00234             $this->_params['published-max'] = Zend_Gdata_App_Util::formatTimestamp($value);
00235         } else {
00236             unset($this->_params['published-max']);
00237         }
00238         return $this;
00239     }
00240 
00245     public function setPublishedMin($value)
00246     {
00247         if ($value != null) {
00248             $this->_params['published-min'] = Zend_Gdata_App_Util::formatTimestamp($value);
00249         } else {
00250             unset($this->_params['published-min']);
00251         }
00252         return $this;
00253     }
00254 
00259     public function setAuthor($value)
00260     {
00261         if ($value != null) {
00262             $this->_params['author'] = $value;
00263         } else {
00264             unset($this->_params['author']);
00265         }
00266         return $this;
00267     }
00268 
00272     public function getAlt()
00273     {
00274         if (array_key_exists('alt', $this->_params)) {
00275             return $this->_params['alt'];
00276         } else {
00277             return null;
00278         }
00279     }
00280 
00284     public function getMaxResults()
00285     {
00286         if (array_key_exists('max-results', $this->_params)) {
00287             return intval($this->_params['max-results']);
00288         } else {
00289             return null;
00290         }
00291     }
00292 
00296     public function getQuery()
00297     {
00298         if (array_key_exists('q', $this->_params)) {
00299             return $this->_params['q'];
00300         } else {
00301             return null;
00302         }
00303     }
00304 
00308     public function getStartIndex()
00309     {
00310         if (array_key_exists('start-index', $this->_params)) {
00311             return intval($this->_params['start-index']);
00312         } else {
00313             return null;
00314         }
00315     }
00316 
00320     public function getUpdatedMax()
00321     {
00322         if (array_key_exists('updated-max', $this->_params)) {
00323             return $this->_params['updated-max'];
00324         } else {
00325             return null;
00326         }
00327     }
00328 
00332     public function getUpdatedMin()
00333     {
00334         if (array_key_exists('updated-min', $this->_params)) {
00335             return $this->_params['updated-min'];
00336         } else {
00337             return null;
00338         }
00339     }
00340 
00344     public function getPublishedMax()
00345     {
00346         if (array_key_exists('published-max', $this->_params)) {
00347             return $this->_params['published-max'];
00348         } else {
00349             return null;
00350         }
00351     }
00352 
00356     public function getPublishedMin()
00357     {
00358         if (array_key_exists('published-min', $this->_params)) {
00359             return $this->_params['published-min'];
00360         } else {
00361             return null;
00362         }
00363     }
00364 
00368     public function getAuthor()
00369     {
00370         if (array_key_exists('author', $this->_params)) {
00371             return $this->_params['author'];
00372         } else {
00373             return null;
00374         }
00375     }
00376 
00381     public function setCategory($value)
00382     {
00383         $this->_category = $value;
00384         return $this;
00385     }
00386 
00387     /*
00388      * @return string id
00389      */
00390     public function getCategory()
00391     {
00392         return $this->_category;
00393     }
00394 
00395 
00396     public function __get($name)
00397     {
00398         $method = 'get'.ucfirst($name);
00399         if (method_exists($this, $method)) {
00400             return call_user_func(array(&$this, $method));
00401         } else {
00402             require_once 'Zend/Gdata/App/Exception.php';
00403             throw new Zend_Gdata_App_Exception('Property ' . $name . '  does not exist');
00404         }
00405     }
00406 
00407     public function __set($name, $val)
00408     {
00409         $method = 'set'.ucfirst($name);
00410         if (method_exists($this, $method)) {
00411             return call_user_func(array(&$this, $method), $val);
00412         } else {
00413             require_once 'Zend/Gdata/App/Exception.php';
00414             throw new Zend_Gdata_App_Exception('Property ' . $name . '  does not exist');
00415         }
00416     }
00417 
00418 }
 All Data Structures Namespaces Files Functions Variables Enumerations