|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 /* 00003 * Copyright (C) 2005 Alfresco, Inc. 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 00019 * As a special exception to the terms and conditions of version 2.0 of 00020 * the GPL, you may redistribute this Program in connection with Free/Libre 00021 * and Open Source Software ("FLOSS") applications as described in Alfresco's 00022 * FLOSS exception. You should have recieved a copy of the text describing 00023 * the FLOSS exception, and it is also available here: 00024 * http://www.alfresco.com/legal/licensing" 00025 */ 00026 00027 require_once 'BaseObject.php'; 00028 require_once 'Node.php'; 00029 00030 class Store extends BaseObject 00031 { 00032 protected $_session; 00033 protected $_address; 00034 protected $_scheme; 00035 protected $_rootNode; 00036 00037 public function __construct($session, $address, $scheme = "workspace") 00038 { 00039 $this->_session = $session; 00040 $this->_address = $address; 00041 $this->_scheme = $scheme; 00042 } 00043 00044 public function __toString() 00045 { 00046 return $this->scheme . "://" . $this->address; 00047 } 00048 00049 public function __toArray() 00050 { 00051 return array( 00052 "scheme" => $this->_scheme, 00053 "address" => $this->_address); 00054 } 00055 00056 public function getAddress() 00057 { 00058 return $this->_address; 00059 } 00060 00061 public function getScheme() 00062 { 00063 return $this->_scheme; 00064 } 00065 00066 public function getRootNode() 00067 { 00068 if (isset ($this->_rootNode) == false) 00069 { 00070 $result = $this->_session->repositoryService->get( 00071 array( 00072 "where" => array( 00073 "store" => $this->__toArray()))); 00074 00075 $this->_rootNode = Node::createFromWebServiceData($this->_session, $result->getReturn); 00076 } 00077 00078 return $this->_rootNode; 00079 } 00080 } 00081 ?>