Index: trunk/wifidog-auth/wifidog/classes/Network.php
===================================================================
--- trunk/wifidog-auth/wifidog/classes/Network.php	(revision 1435)
+++ trunk/wifidog-auth/wifidog/classes/Network.php	(revision 1436)
@@ -47,8 +47,8 @@
  * Load required classes
  */
-require_once('classes/GenericDataObject.php');
 require_once('classes/Content.php');
 require_once('classes/User.php');
 require_once('classes/Node.php');
+require_once('classes/NodeGroup.php');
 require_once('classes/GisPoint.php');
 require_once('classes/Cache.php');
@@ -68,9 +68,7 @@
  * @copyright  2006 Max Horváth, Horvath Web Consulting
  */
-class Network extends GenericDataObject
+class Network extends HotspotGraphElement
 {
     /** Object cache for the object factory (getObject())*/
-    private static $instanceArray = array();
-    protected $_hotspotGraphElement;
 
     /**
@@ -88,9 +86,5 @@
     public static function &getObject($id)
     {
-        if(!isset(self::$instanceArray[$id]))
-        {
-            self::$instanceArray[$id] = new self($id);
-        }
-        return self::$instanceArray[$id];
+        return HotspotGraphElement::getObject($id, 'Network');
     }
 
@@ -101,8 +95,5 @@
     public static function freeObject($id)
     {
-        if(isset(self::$instanceArray[$id]))
-        {
-            unset(self::$instanceArray[$id]);
-        }
+        HotspotGraphElement::freeObject($id, 'Network');
     }
 
@@ -192,4 +183,5 @@
     public static function createNewObject($network_id = null)
     {
+        
         $db = AbstractDb::getObject();
         if (empty ($network_id)) {
@@ -380,5 +372,5 @@
      * @access private
      */
-    private function __construct($p_network_id)
+    protected function __construct($p_network_id)
     {
         $db = AbstractDb::getObject();
@@ -395,5 +387,5 @@
         $this->_row = $row;
         $this->_id = $p_network_id;
-        $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->_id,'Network');
+        parent::__construct($this->_id, 'Network');
     }
 
@@ -1706,6 +1698,6 @@
         $data = Content::getLinkedContentUI($name, "network_has_content", "network_id", $this->_id, $display_page = "portal");
         $html .= InterfaceElements::generateAdminSectionContainer("network_content", $title, $data);*/
-        if (!is_null($this->_hotspotGraphElement))
-            $html .= $this->_hotspotGraphElement->getContentAdminUI();
+        
+        $html .= parent::getContentAdminUI();
 
         /*
@@ -1937,6 +1929,5 @@
         
         // objects hierarchy
-        if (!is_null($this->_hotspotGraphElement))
-            $html .= $this->_hotspotGraphElement->getGraphAdminUI($this);
+        $html .= parent::getGraphAdminUI($this);
 
         $html .= "</ul>\n";
@@ -1958,6 +1949,5 @@
 
         // Content management
-        if (!is_null($this->_hotspotGraphElement))
-            $this->_hotspotGraphElement->processContentAdminUI();
+        parent::processContentAdminUI();
         /* $name = "network_".$this->_id."_content";
         Content :: processLinkedContentUI($name, 'network_has_content', 'network_id', $this->_id);*/
@@ -2079,6 +2069,5 @@
         ProfileTemplate :: processLinkedProfileTemplateUI($name, 'network_has_profile_templates', 'network_id', $this->_id);
         
-        if (!is_null($this->_hotspotGraphElement))
-            $this->_hotspotGraphElement->processGraphAdminUI($errMsg, $this);
+        parent::processGraphAdminUI($errMsg, $this);
         if(!empty($errMsg)) {
             echo $errMsg;
@@ -2103,5 +2092,5 @@
      * @access public
      */
-    public function addContent(Content $content)
+ /*   public function addContent(Content $content)
     {
         $db = AbstractDb::getObject();
@@ -2110,5 +2099,5 @@
         $sql = "INSERT INTO network_has_content (network_id, content_id) VALUES ('$this->_id','$content_id')";
         $db->execSqlUpdate($sql, false);
-    }
+    }*/
 
     /**
@@ -2121,5 +2110,5 @@
      * @access public
      */
-    public function removeContent(Content $content)
+ /*   public function removeContent(Content $content)
     {
         $db = AbstractDb::getObject();
@@ -2128,5 +2117,5 @@
         $sql = "DELETE FROM network_has_content WHERE network_id='$this->_id' AND content_id='$content_id'";
         $db->execSqlUpdate($sql, false);
-    }
+    }*/
 
 
@@ -2205,4 +2194,5 @@
                 $errmsg = _('Could not delete network!');
             } else {
+                parent::_delete($errmsg);
                 $retval = true;
             }
@@ -2274,4 +2264,29 @@
         $smarty->assign('networkNumNonMonitoredNodes', $net ? $net->getNumOnlineNodes(true) : 0);
     }
+    
+/**
+     * Get the type of graph element (read-only for now)
+     * 
+     * @return string
+     */
+    protected function getType() {
+        return 'Network';
+    }
+  
+    /**
+     * Return whether this element is a root or has parent (Network is root)
+     * @return boolean
+     */
+    public function isRoot(){
+        return true;
+    }
+    
+		/**
+     * Return whether this element is a leaf or has children (Node is leaf)
+     * @return boolean
+     */
+    public function isLeaf() {
+        return false;
+    }
 }
 
