[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Copyright (C) 2005-2010 Alfresco Software Limited. 4 * 5 * This file is part of Alfresco 6 * 7 * Alfresco is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * Alfresco is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with Alfresco. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 22 /** 23 * Version class 24 * 25 * @author Roy Wetherall 26 */ 27 class Version extends BaseObject 28 { 29 private $_session; 30 private $_store; 31 private $_id; 32 private $_description; 33 private $_major; 34 private $_properties; 35 private $_type; 36 private $_aspects; 37 38 /** 39 * Constructor 40 * 41 * @param $session the session that the version is tied to 42 * @param @store the store that the forzen node is stored in 43 * @prarm @id the id of the frozen node 44 * @param @description the description of the version 45 * @param @major indicates whether this is a major or minor revision 46 */ 47 public function __construct($session, $store, $id, $description=null, $major=false) 48 { 49 $this->_session = $session; 50 $this->_store = $store; 51 $this->_id = $id; 52 $this->_description = $description; 53 $this->_major = $major; 54 $this->_properties = null; 55 $this->_aspects = null; 56 $this->_type = null; 57 } 58 59 /** 60 * __get override. 61 * 62 * If called with a valid property short name, the frozen value of that property is returned. 63 * 64 * @return String the appropriate property value, null if none found 65 */ 66 public function __get($name) 67 { 68 $fullName = $this->_session->namespaceMap->getFullName($name); 69 if ($fullName != $name) 70 { 71 $this->populateProperties(); 72 if (array_key_exists($fullName, $this->_properties) == true) 73 { 74 return $this->_properties[$fullName]; 75 } 76 else 77 { 78 return null; 79 } 80 } 81 else 82 { 83 return parent::__get($name); 84 } 85 } 86 87 /** 88 * Gets session 89 * 90 * @return Session the session 91 */ 92 public function getSession() 93 { 94 return $this->_session; 95 } 96 97 /** 98 * Get the frozen nodes store 99 * 100 * @return Store the store 101 */ 102 public function getStore() 103 { 104 return $this->_store; 105 } 106 107 public function getId() 108 { 109 return $this->_id; 110 } 111 112 public function getDescription() 113 { 114 return $this->_description; 115 } 116 117 public function getMajor() 118 { 119 return $this->_major; 120 } 121 122 public function getType() 123 { 124 return $this->_type; 125 } 126 127 public function getProperties() 128 { 129 return $this->_properties; 130 } 131 132 public function getAspects() 133 { 134 return $this->_aspects; 135 } 136 137 private function populateProperties() 138 { 139 if ($this->_properties == null) 140 { 141 $result = $this->_session->repositoryService->get(array ( 142 "where" => array ( 143 "nodes" => array( 144 "store" => $this->_store->__toArray(), 145 "uuid" => $this->_id)))); 146 147 $this->populateFromWebServiceNode($result->getReturn); 148 } 149 } 150 151 private function populateFromWebServiceNode($webServiceNode) 152 { 153 $this->_type = $webServiceNode->type; 154 155 // Get the aspects 156 $this->_aspects = array(); 157 $aspects = $webServiceNode->aspects; 158 if (is_array($aspects) == true) 159 { 160 foreach ($aspects as $aspect) 161 { 162 $this->_aspects[] = $aspect; 163 } 164 } 165 else 166 { 167 $this->_aspects[] = $aspects; 168 } 169 170 // Set the property values 171 $this->_properties = array(); 172 foreach ($webServiceNode->properties as $propertyDetails) 173 { 174 $name = $propertyDetails->name; 175 $isMultiValue = $propertyDetails->isMultiValue; 176 $value = null; 177 if ($isMultiValue == false) 178 { 179 $value = $propertyDetails->value; 180 if ($this->isContentData($value) == true) 181 { 182 $value = new ContentData($this, $name); 183 } 184 } 185 else 186 { 187 $value = $propertyDetails->values; 188 } 189 190 $this->_properties[$name] = $value; 191 } 192 } 193 } 194 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |