Changeset 1436 for trunk/wifidog-auth/wifidog/classes/Network.php
- Timestamp:
- 12/17/09 17:02:31 (3 years ago)
- Files:
-
- 1 modified
-
trunk/wifidog-auth/wifidog/classes/Network.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/wifidog/classes/Network.php
r1435 r1436 47 47 * Load required classes 48 48 */ 49 require_once('classes/GenericDataObject.php');50 49 require_once('classes/Content.php'); 51 50 require_once('classes/User.php'); 52 51 require_once('classes/Node.php'); 52 require_once('classes/NodeGroup.php'); 53 53 require_once('classes/GisPoint.php'); 54 54 require_once('classes/Cache.php'); … … 68 68 * @copyright 2006 Max Horváth, Horvath Web Consulting 69 69 */ 70 class Network extends GenericDataObject70 class Network extends HotspotGraphElement 71 71 { 72 72 /** Object cache for the object factory (getObject())*/ 73 private static $instanceArray = array();74 protected $_hotspotGraphElement;75 73 76 74 /** … … 88 86 public static function &getObject($id) 89 87 { 90 if(!isset(self::$instanceArray[$id])) 91 { 92 self::$instanceArray[$id] = new self($id); 93 } 94 return self::$instanceArray[$id]; 88 return HotspotGraphElement::getObject($id, 'Network'); 95 89 } 96 90 … … 101 95 public static function freeObject($id) 102 96 { 103 if(isset(self::$instanceArray[$id])) 104 { 105 unset(self::$instanceArray[$id]); 106 } 97 HotspotGraphElement::freeObject($id, 'Network'); 107 98 } 108 99 … … 192 183 public static function createNewObject($network_id = null) 193 184 { 185 194 186 $db = AbstractDb::getObject(); 195 187 if (empty ($network_id)) { … … 380 372 * @access private 381 373 */ 382 pr ivatefunction __construct($p_network_id)374 protected function __construct($p_network_id) 383 375 { 384 376 $db = AbstractDb::getObject(); … … 395 387 $this->_row = $row; 396 388 $this->_id = $p_network_id; 397 $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->_id,'Network');389 parent::__construct($this->_id, 'Network'); 398 390 } 399 391 … … 1706 1698 $data = Content::getLinkedContentUI($name, "network_has_content", "network_id", $this->_id, $display_page = "portal"); 1707 1699 $html .= InterfaceElements::generateAdminSectionContainer("network_content", $title, $data);*/ 1708 if (!is_null($this->_hotspotGraphElement))1709 $html .= $this->_hotspotGraphElement->getContentAdminUI();1700 1701 $html .= parent::getContentAdminUI(); 1710 1702 1711 1703 /* … … 1937 1929 1938 1930 // objects hierarchy 1939 if (!is_null($this->_hotspotGraphElement)) 1940 $html .= $this->_hotspotGraphElement->getGraphAdminUI($this); 1931 $html .= parent::getGraphAdminUI($this); 1941 1932 1942 1933 $html .= "</ul>\n"; … … 1958 1949 1959 1950 // Content management 1960 if (!is_null($this->_hotspotGraphElement)) 1961 $this->_hotspotGraphElement->processContentAdminUI(); 1951 parent::processContentAdminUI(); 1962 1952 /* $name = "network_".$this->_id."_content"; 1963 1953 Content :: processLinkedContentUI($name, 'network_has_content', 'network_id', $this->_id);*/ … … 2079 2069 ProfileTemplate :: processLinkedProfileTemplateUI($name, 'network_has_profile_templates', 'network_id', $this->_id); 2080 2070 2081 if (!is_null($this->_hotspotGraphElement)) 2082 $this->_hotspotGraphElement->processGraphAdminUI($errMsg, $this); 2071 parent::processGraphAdminUI($errMsg, $this); 2083 2072 if(!empty($errMsg)) { 2084 2073 echo $errMsg; … … 2103 2092 * @access public 2104 2093 */ 2105 public function addContent(Content $content)2094 /* public function addContent(Content $content) 2106 2095 { 2107 2096 $db = AbstractDb::getObject(); … … 2110 2099 $sql = "INSERT INTO network_has_content (network_id, content_id) VALUES ('$this->_id','$content_id')"; 2111 2100 $db->execSqlUpdate($sql, false); 2112 } 2101 }*/ 2113 2102 2114 2103 /** … … 2121 2110 * @access public 2122 2111 */ 2123 public function removeContent(Content $content)2112 /* public function removeContent(Content $content) 2124 2113 { 2125 2114 $db = AbstractDb::getObject(); … … 2128 2117 $sql = "DELETE FROM network_has_content WHERE network_id='$this->_id' AND content_id='$content_id'"; 2129 2118 $db->execSqlUpdate($sql, false); 2130 } 2119 }*/ 2131 2120 2132 2121 … … 2205 2194 $errmsg = _('Could not delete network!'); 2206 2195 } else { 2196 parent::_delete($errmsg); 2207 2197 $retval = true; 2208 2198 } … … 2274 2264 $smarty->assign('networkNumNonMonitoredNodes', $net ? $net->getNumOnlineNodes(true) : 0); 2275 2265 } 2266 2267 /** 2268 * Get the type of graph element (read-only for now) 2269 * 2270 * @return string 2271 */ 2272 protected function getType() { 2273 return 'Network'; 2274 } 2275 2276 /** 2277 * Return whether this element is a root or has parent (Network is root) 2278 * @return boolean 2279 */ 2280 public function isRoot(){ 2281 return true; 2282 } 2283 2284 /** 2285 * Return whether this element is a leaf or has children (Node is leaf) 2286 * @return boolean 2287 */ 2288 public function isLeaf() { 2289 return false; 2290 } 2276 2291 } 2277 2292
