Show
Ignore:
Timestamp:
12/17/09 17:02:31 (3 years ago)
Author:
gbastien
Message:
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r1435 r1436  
    4747 * Load required classes 
    4848 */ 
    49 require_once('classes/GenericDataObject.php'); 
    5049require_once('classes/Content.php'); 
    5150require_once('classes/User.php'); 
    5251require_once('classes/Node.php'); 
     52require_once('classes/NodeGroup.php'); 
    5353require_once('classes/GisPoint.php'); 
    5454require_once('classes/Cache.php'); 
     
    6868 * @copyright  2006 Max Horváth, Horvath Web Consulting 
    6969 */ 
    70 class Network extends GenericDataObject 
     70class Network extends HotspotGraphElement 
    7171{ 
    7272    /** Object cache for the object factory (getObject())*/ 
    73     private static $instanceArray = array(); 
    74     protected $_hotspotGraphElement; 
    7573 
    7674    /** 
     
    8886    public static function &getObject($id) 
    8987    { 
    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'); 
    9589    } 
    9690 
     
    10195    public static function freeObject($id) 
    10296    { 
    103         if(isset(self::$instanceArray[$id])) 
    104         { 
    105             unset(self::$instanceArray[$id]); 
    106         } 
     97        HotspotGraphElement::freeObject($id, 'Network'); 
    10798    } 
    10899 
     
    192183    public static function createNewObject($network_id = null) 
    193184    { 
     185         
    194186        $db = AbstractDb::getObject(); 
    195187        if (empty ($network_id)) { 
     
    380372     * @access private 
    381373     */ 
    382     private function __construct($p_network_id) 
     374    protected function __construct($p_network_id) 
    383375    { 
    384376        $db = AbstractDb::getObject(); 
     
    395387        $this->_row = $row; 
    396388        $this->_id = $p_network_id; 
    397         $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->_id,'Network'); 
     389        parent::__construct($this->_id, 'Network'); 
    398390    } 
    399391 
     
    17061698        $data = Content::getLinkedContentUI($name, "network_has_content", "network_id", $this->_id, $display_page = "portal"); 
    17071699        $html .= InterfaceElements::generateAdminSectionContainer("network_content", $title, $data);*/ 
    1708         if (!is_null($this->_hotspotGraphElement)) 
    1709             $html .= $this->_hotspotGraphElement->getContentAdminUI(); 
     1700         
     1701        $html .= parent::getContentAdminUI(); 
    17101702 
    17111703        /* 
     
    19371929         
    19381930        // objects hierarchy 
    1939         if (!is_null($this->_hotspotGraphElement)) 
    1940             $html .= $this->_hotspotGraphElement->getGraphAdminUI($this); 
     1931        $html .= parent::getGraphAdminUI($this); 
    19411932 
    19421933        $html .= "</ul>\n"; 
     
    19581949 
    19591950        // Content management 
    1960         if (!is_null($this->_hotspotGraphElement)) 
    1961             $this->_hotspotGraphElement->processContentAdminUI(); 
     1951        parent::processContentAdminUI(); 
    19621952        /* $name = "network_".$this->_id."_content"; 
    19631953        Content :: processLinkedContentUI($name, 'network_has_content', 'network_id', $this->_id);*/ 
     
    20792069        ProfileTemplate :: processLinkedProfileTemplateUI($name, 'network_has_profile_templates', 'network_id', $this->_id); 
    20802070         
    2081         if (!is_null($this->_hotspotGraphElement)) 
    2082             $this->_hotspotGraphElement->processGraphAdminUI($errMsg, $this); 
     2071        parent::processGraphAdminUI($errMsg, $this); 
    20832072        if(!empty($errMsg)) { 
    20842073            echo $errMsg; 
     
    21032092     * @access public 
    21042093     */ 
    2105     public function addContent(Content $content) 
     2094 /*   public function addContent(Content $content) 
    21062095    { 
    21072096        $db = AbstractDb::getObject(); 
     
    21102099        $sql = "INSERT INTO network_has_content (network_id, content_id) VALUES ('$this->_id','$content_id')"; 
    21112100        $db->execSqlUpdate($sql, false); 
    2112     } 
     2101    }*/ 
    21132102 
    21142103    /** 
     
    21212110     * @access public 
    21222111     */ 
    2123     public function removeContent(Content $content) 
     2112 /*   public function removeContent(Content $content) 
    21242113    { 
    21252114        $db = AbstractDb::getObject(); 
     
    21282117        $sql = "DELETE FROM network_has_content WHERE network_id='$this->_id' AND content_id='$content_id'"; 
    21292118        $db->execSqlUpdate($sql, false); 
    2130     } 
     2119    }*/ 
    21312120 
    21322121 
     
    22052194                $errmsg = _('Could not delete network!'); 
    22062195            } else { 
     2196                parent::_delete($errmsg); 
    22072197                $retval = true; 
    22082198            } 
     
    22742264        $smarty->assign('networkNumNonMonitoredNodes', $net ? $net->getNumOnlineNodes(true) : 0); 
    22752265    } 
     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    } 
    22762291} 
    22772292