Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Service/Nirvanix.php
Go to the documentation of this file.
00001 <?php
00026 require_once 'Zend/Http/Client.php';
00027 
00039 class Zend_Service_Nirvanix
00040 {
00045     protected $_options;
00046 
00056     public function __construct($authParams, $options = array())
00057     {
00058         // merge options with default options
00059         $defaultOptions = array('defaults'   => array(),
00060                                 'httpClient' => new Zend_Http_Client(),
00061                                 'host'       => 'http://services.nirvanix.com');
00062         $this->_options = array_merge($defaultOptions, $options);
00063 
00064         // login and save sessionToken to default POST params
00065         $resp = $this->getService('Authentication')->login($authParams);
00066         $this->_options['defaults']['sessionToken'] = (string)$resp->SessionToken;
00067     }
00068 
00077     public function getService($namespace, $options = array())
00078     {
00079         switch ($namespace) {
00080             case 'IMFS':
00081                 $class = 'Zend_Service_Nirvanix_Namespace_Imfs';
00082                 break;
00083             default:
00084                 $class = 'Zend_Service_Nirvanix_Namespace_Base';
00085         }
00086 
00087         $options['namespace'] = ucfirst($namespace);
00088         $options = array_merge($this->_options, $options);
00089 
00090         if (!class_exists($class)) {
00091             require_once 'Zend/Loader.php';
00092             Zend_Loader::loadClass($class);
00093         }
00094         return new $class($options);
00095     }
00096 
00102     public function getOptions()
00103     {
00104         return $this->_options;
00105     }
00106 
00107 }
 All Data Structures Namespaces Files Functions Variables Enumerations