Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/views/view.DictionaryExplorer.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.studio
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 * @version	   $Id: view.DictionaryExplorer.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefDictionaryExplorer")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefDictionaryExplorer", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . VIEWHELPER);
    //-------------------------------------------------------------------------
    //	Class
    class DictionaryExplorer extends ViewObject {
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         * @param	integer	 Repository	pkid //	foreign key
         *
         */
        function DictionaryExplorer($DIRECTOPKID = 0) {
            //
            $this->m_fieldSet["DIRECTOPKID"] = $DIRECTOPKID;
        }
        //---------------------------------------------------------------------
        //	Methods
        
        /**
         *
         * @access	public
         *
         * @param	object	DataSource object
         * @param	object	ViewTemplate object
         * @param	string	layout name is a template file name or a layer name in a template file
         * @param	string	block name in layout
         * @param	integer	view type	{ FORMVIEW, ITEMVIEW, LISTVIEW, TREEVIEW... }
         * @param	integer	outputmode
         * @return	boolean
         */
        function renderView(&$datasource, &$template, $layout, $block, $view = NULL, $mode = OUTPUT) {
            //
            if (!is_object($template)) {
                //
                $this->m_errorSet[VIEW_SYSTEM_ERROR] = true;
                //
                return (false);
            }
            //
            if (!empty($layout) && ($template->define($layout) == false)) {
                //
                $this->m_errorSet[VIEW_LAYOUT_ERROR] = $layout;
                //
                return (false);
            }
            //
            switch ($view) {
                case ITEMVIEW:
                    //
                    /*
                    * 1- RepositorySet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.RepositorySet.php");
                    //
                    $repositorySet = new RepositorySet($this->m_fieldSet["DIRECTOPKID"]);
                    if ($repositorySet->selectSet($datasource, FOREIGNKEY) == false)
                        return (false);
                    //
                    /*
                    * 2- DictionaryPropertyType
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DictionaryPropertyTypeSet.php");
                    //
                    for ($i = 0;$i < $repositorySet->rowCount();$i++) {
                        //	select next item
                        if ($repositorySet->fetchCursorRow($datasource) == false)
                           return (false);
                        //
                        $REPTYPEPKID = $repositorySet->get_field_value("REPTYPEPKID");
                        //
                        $propertyTypeSet = new DictionaryPropertyTypeSet($REPTYPEPKID);
						if ($propertyTypeSet->selectSet($datasource, FOREIGNKEY, NATURALKEY) == false)
                            return (false);
                        //
                        for ($j = 0;$j < $propertyTypeSet->rowCount();$j++) {
                            //	select next item
                            if ($propertyTypeSet->fetchCursorRow($datasource) == false)
                                return (false);
                            //	render item
                            $template->select($block);
							$template->assign($propertyTypeSet->fieldSet());
							$template->render($block);
                        }
                    }
                    //
                break;
                }
                //
                $template->output($mode);
                //
                return (true);
            }
        };
        //	Class
        //-------------------------------------------------------------------------
        
    }
    //	namespace
    //-----------------------------------------------------------------------------
    
?>
Return current item: Entier Studio