Location: PHPKode > projects > Entier Studio > entierstudio/framework/datasource.explorer.php
<?php
/**
 * Entier Studio
 *
 * LICENSE
 *
 *	Copyright 2006 Entier Studio team.
 *
 *	Licensed under the Apache License, Version 2.0 (the "License");
 *	you may not use this file except in compliance with the License.
 *	You may obtain a copy of the License at
 *
 *		http://www.apache.org/licenses/LICENSE-2.0
 *
 *	Unless required by applicable law or agreed to in writing, software
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License.
 *
 * @package    entier.framework
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 * @version	   $Id: datasource.explorer.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefDataSourceExplorer")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefDataSourceExplorer", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . "datasource.php");
    @require_once (FRAMEWORK_DIR . "model.element.php");
    //-------------------------------------------------------------------------
    //	Class
    class DataSourceExplorer extends DataSource {
        //---------------------------------------------------------------------
        //	Attributes
        
        /**
         * Data Source
         * @var	object
         */
        var $m_Source = NULL;
        /**
         * Model Element
         * @var	object
         */
        var $m_Element = NULL;
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         * Data source constructor
         *
         */
        function DataSourceExplorer() {
        }
        //---------------------------------------------------------------------
        //	Methods
        
        /**
         * @access	public
         * @return	boolean
         */
        function openSource() {
            //
            if (($this->m_Source->isConnectionOpen() == false) && ($this->m_Source->openConnection() == false)) return (false);
            //
            return (true);
        }
        /**
         * @access	public
         * @return	boolean
         */
        function closeSource() {
            //
            return ($this->m_Source->closeConnection());
        }
        /**
         * Parse a data source scheme
         *
         * @param	string	Target element path ( format parent/chield )
         * @param	string	Target element type
         * @return	boolean	Return flag
         */
        function parseObject($path = "", $type = "") {
            //
            return (false);
        }
        /**
         * Fetch a data source element
         * @param	string	Target element path
         * @param	string	Target element type
         * @return	variant
         */
        function fetchObject($path = "", $type = "") {
            //
            return ($this->m_Element->fetchElements($path, $type));
        }
        /**
         * get the root element
         * @param	string	Target element path
         * @param	string	Target element type
         * @return	object
         */
        function getObject($path = "", $type = "") {
            //
            if (isset($this->m_Element)) {
                //
                if ($this->m_Element->equals($path, $type) == true) return ($this->m_Element);
            }
            //
            return (NULL);
        }
        /**
         *
         * @return
         */
        function resetObject() {
            //
            unset($this->m_Element);
            $this->m_Element = NULL;
        }
        /**
         *
         * @return	integer	Count
         */
        function sizeOfElements() {
            //
            if (isset($this->m_Element)) return ($this->m_Element->sizeOfElements());
            //
            return (0);
        }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio