[ 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_Link 33 { 34 /** 35 * Private access type 36 * 37 * @var string 38 */ 39 const ACCESSTYPE_PRIVATE = '0'; 40 41 /** 42 * Public access type 43 * 44 * @var string 45 */ 46 const ACCESSTYPE_PUBLIC = '1'; 47 48 /** 49 * Access type assigned to the link 50 * 51 * @var string 52 */ 53 protected $_accessType; 54 55 /** 56 * URL of the link 57 * 58 * @var string 59 */ 60 protected $_url; 61 62 /** 63 * Date of the last modification made to the link 64 * 65 * @var string 66 */ 67 protected $_modDate; 68 69 /** 70 * Date the link was added 71 * 72 * @var string 73 */ 74 protected $_addDate; 75 76 /** 77 * Title assigned to the link 78 * 79 * @var string 80 */ 81 protected $_title; 82 83 /** 84 * Nickname assigned to the link 85 * 86 * @var string 87 */ 88 protected $_nickname; 89 90 /** 91 * Tags assigned to the link 92 * 93 * @var array 94 */ 95 protected $_tags; 96 97 /** 98 * Note assigned to the link 99 * 100 * @var string 101 */ 102 protected $_note; 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->_url = $xpath->evaluate('/link/url')->item(0)->nodeValue; 120 $this->_modDate = $xpath->evaluate('/link/modDate')->item(0)->nodeValue; 121 $this->_addDate = $xpath->evaluate('/link/addDate')->item(0)->nodeValue; 122 $this->_title = $xpath->evaluate('/link/title')->item(0)->nodeValue; 123 $this->_nickname = $xpath->evaluate('/link/nickname')->item(0)->nodeValue; 124 $this->_note = $xpath->evaluate('/link/note')->item(0)->nodeValue; 125 126 $list = $xpath->query('/link/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 link 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 URL of the link 148 * 149 * @return string 150 */ 151 public function getUrl() 152 { 153 return $this->_url; 154 } 155 156 /** 157 * Returns the date of the last modification made to the link 158 * 159 * @return string 160 */ 161 public function getModDate() 162 { 163 return $this->_modDate; 164 } 165 166 /** 167 * Returns the date the link was added 168 * 169 * @return string 170 */ 171 public function getAddDate() 172 { 173 return $this->_addDate; 174 } 175 176 /** 177 * Returns the title assigned to the link 178 * 179 * @return string 180 */ 181 public function getTitle() 182 { 183 return $this->_title; 184 } 185 186 /** 187 * Returns the nickname assigned to the link 188 * 189 * @return string 190 */ 191 public function getNickname() 192 { 193 return $this->_nickname; 194 } 195 196 /** 197 * Returns the tags assigned to the link 198 * 199 * @return array 200 */ 201 public function getTags() 202 { 203 return $this->_tags; 204 } 205 206 /** 207 * Returns the note assigned to the link 208 * 209 * @return string 210 */ 211 public function getNote() 212 { 213 return $this->_note; 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 |