Location: PHPKode > projects > Entier Studio > entierstudio/framework/viewobject.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 
 * @version	   $Id: viewobject.php 81 2008-01-17 23:08:21Z yannromefort $
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefViewObject")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefViewObject", "1");
    //-------------------------------------------------------------------------
    // View mode enumeration
    define("NULLVIEW", 0);
    define("FORMVIEW", 1);
    define("ITEMVIEW", 2);
    define("LISTVIEW", 3);
    define("TREEVIEW", 4);
    define("GRIDVIEW", 5);
    define("FRAMEVIEW", 6);
    define("ROOTVIEW", 10);
    define("MENUVIEW", 11);
    define("PROCVIEW", 12);
    define("CODEVIEW", 13);
    define("FAILVIEW", 99);
    //
    // Error type enumeration
    define("VIEW_OBJECT_ERROR", 1);
    define("HTML_OBJECT_ERROR", 2);
    define("VIEW_RENDER_ERROR", 3);
    define("VIEW_LAYOUT_ERROR", 4);
    define("VIEW_SYSTEM_ERROR", 5);
    //-------------------------------------------------------------------------
    //	Class
    class ViewObject {
        //---------------------------------------------------------------------
        //	Attributes
        
        /**
         *
         * @var	object
         * @see
         */
        var $m_database = NULL;
        /**
         *
         * @var	object
         * @see
         */
        var $m_Template = NULL;
        /**
         *
         * @var	array
         * @see
         */
        var $m_fieldSet = array();
        /**
         *
         * @var	array
         * @see
         */
        var $m_blockSet = array();
        /**
         *
         * @var	array
         * @see
         */
        var $m_errorSet = array();
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         * @param	object	Instance of ViewTemplate
         * @param	object	Instance of DataSource
         */
        function ViewObject($template, $database) {
            //
            if (is_object($template) && is_subclass_of($template, "ViewTemplateParser")) $this->m_Template = $template;
            //
            if (is_object($database) && is_subclass_of($database, "DataSource")) {
                $this->m_database = $database;
            }
        }
        //---------------------------------------------------------------------
        //	Properties
        /*
        *	_Database property
        */
        //
        /*
        * @return	object reference
        */
        function &Database() {
            return ($this->m_database);
        }
        /*
        *	_Template property
        */
        //
        /*
        * @return	object reference
        */
        function &Template() {
            return ($this->m_Template);
        }
        /*
        *	_FieldSet property
        */
        //
        /*
        * @return	array
        */
        function fieldSet() {
            return ($this->m_fieldSet);
        }
        //
        //	_FieldSet.field_count
        /*
        * @return	integer
        */
        function get_field_count() {
            if (is_array($this->m_fieldSet)) return (count($this->m_fieldSet));
            return (0);
        }
        //
        //	_FieldSet.field_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_field_value($field, $value) {
            $this->m_fieldSet["$field"] = $value;
            return (true);
        }
        //
        /*
        * @param	string
        * @return	variant
        */
        function get_field_value($field) {
            if (isset($this->m_fieldSet["$field"])) return ($this->m_fieldSet["$field"]);
            return (false);
        }
        /*
        *	_BlockSet property
        */
        //
        /*
        * @return	array
        */
        function BlockSet() {
            return ($this->m_blockSet);
        }
        //
        //	_BlockSet.field_count
        /*
        * @return	integer
        */
        function get_block_count() {
            if (is_array($this->m_blockSet)) return (count($this->m_blockSet));
            return (0);
        }
        //
        //	_BlockSet.block_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_block_value($block, $string) {
            $this->m_blockSet[$block] = $string;
            return (true);
        }
        //
        /*
        * @param	string
        * @return	variant
        */
        function get_block_value($block) {
            if (isset($this->m_blockSet[$block])) return ($this->m_blockSet[$block]);
            return (false);
        }
        /*
        *	_ErrorSet property
        */
        //
        /*
        * @return	array
        */
        function errorSet() {
            return ($this->m_errorSet);
        }
        //
        //	_ErrorSet.field_count
        /*
        * @return	integer
        */
        function get_error_count() {
            if (is_array($this->m_errorSet)) return (count($this->m_errorSet));
            return (0);
        }
        //
        //	_ErrorSet.error_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_error_value($field, $value) {
            $this->m_errorSet[$field] = $value;
            return (true);
        }
        //
        /*
        * @param	string
        * @return	variant
        */
        function get_error_value($field) {
            if (isset($this->m_errorSet[$field])) return ($this->m_errorSet[$field]);
            return (false);
        }
        //---------------------------------------------------------------------
        //	Abstract Methods
        /*
        *
        * @access	public
        *
        * @return	object
        */
        function getObject() {
            //
            return (NULL);
        }
        /**
         *
         * @access	public
         *
         * @param	string	layout name is a template file name or a layer name in a template file
         * @param	array	block names in layout
         * @param	integer	view selector	{ ITEMVIEW, LISTVIEW, TREEVIEW }
         * @param	integer	outputmode
         * @return	boolean
         */
        function renderView($layout, $block, $view = NULL, $mode = OUTPUT) {
            //
            return (false);
        }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio