[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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_Service 18 * @subpackage Simpy 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 /** 26 * @category Zend 27 * @package Zend_Service 28 * @subpackage Simpy 29 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 30 * @license http://framework.zend.com/license/new-bsd New BSD License 31 */ 32 class Zend_Service_Simpy_Note 33 { 34 /** 35 * Private access type 36 * 37 * @var string 38 */ 39 const ACCESSTYPE_PRIVATE = 'private'; 40 41 /** 42 * Public access type 43 * 44 * @var string 45 */ 46 const ACCESSTYPE_PUBLIC = 'public'; 47 48 /** 49 * Access type assigned to the note 50 * 51 * @var string 52 */ 53 protected $_accessType; 54 55 /** 56 * ID of the note 57 * 58 * @var int 59 */ 60 protected $_id; 61 62 /** 63 * URI of the note 64 * 65 * @var string 66 */ 67 protected $_uri; 68 69 /** 70 * Date of the last modification made to the note 71 * 72 * @var string 73 */ 74 protected $_modDate; 75 76 /** 77 * Date the note was added 78 * 79 * @var string 80 */ 81 protected $_addDate; 82 83 /** 84 * Title of to the note 85 * 86 * @var string 87 */ 88 protected $_title; 89 90 /** 91 * Tags assigned to the note 92 * 93 * @var array 94 */ 95 protected $_tags; 96 97 /** 98 * Description of the note 99 * 100 * @var string 101 */ 102 protected $_description; 103 104 /** 105 * Constructor to initialize the object with data 106 * 107 * @param DOMNode $node Individual <link> node from a parsed response from 108 * a GetLinks operation 109 * @return void 110 */ 111 public function __construct($node) 112 { 113 $this->_accessType = $node->attributes->getNamedItem('accessType')->nodeValue; 114 115 $doc = new DOMDocument(); 116 $doc->appendChild($doc->importNode($node, true)); 117 $xpath = new DOMXPath($doc); 118 119 $this->_uri = $xpath->evaluate('/note/uri')->item(0)->nodeValue; 120 $this->_id = substr($this->_uri, strrpos($this->_uri, '=') + 1); 121 $this->_modDate = trim($xpath->evaluate('/note/modDate')->item(0)->nodeValue); 122 $this->_addDate = trim($xpath->evaluate('/note/addDate')->item(0)->nodeValue); 123 $this->_title = $xpath->evaluate('/note/title')->item(0)->nodeValue; 124 $this->_description = $xpath->evaluate('/note/description')->item(0)->nodeValue; 125 126 $list = $xpath->query('/note/tags/tag'); 127 $this->_tags = array(); 128 129 for ($x = 0; $x < $list->length; $x++) { 130 $this->_tags[$x] = $list->item($x)->nodeValue; 131 } 132 } 133 134 /** 135 * Returns the access type assigned to the note 136 * 137 * @see ACCESSTYPE_PRIVATE 138 * @see ACCESSTYPE_PUBLIC 139 * @return string 140 */ 141 public function getAccessType() 142 { 143 return $this->_accessType; 144 } 145 146 /** 147 * Returns the ID of the note 148 * 149 * @return int 150 */ 151 public function getId() 152 { 153 return $this->_id; 154 } 155 156 /** 157 * Returns the URI of the note 158 * 159 * @return string 160 */ 161 public function getUri() 162 { 163 return $this->_uri; 164 } 165 166 /** 167 * Returns the date of the last modification made to the note 168 * 169 * @return string 170 */ 171 public function getModDate() 172 { 173 return $this->_modDate; 174 } 175 176 /** 177 * Returns the date the note was added 178 * 179 * @return string 180 */ 181 public function getAddDate() 182 { 183 return $this->_addDate; 184 } 185 186 /** 187 * Returns the title assigned to the note 188 * 189 * @return string 190 */ 191 public function getTitle() 192 { 193 return $this->_title; 194 } 195 196 /** 197 * Returns the tags assigned to the note 198 * 199 * @return array 200 */ 201 public function getTags() 202 { 203 return $this->_tags; 204 } 205 206 /** 207 * Returns the description assigned to the note 208 * 209 * @return string 210 */ 211 public function getDescription() 212 { 213 return $this->_description; 214 } 215 }
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 |