Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/views/view.DictionaryPropertyValueManager.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.DictionaryPropertyValueManager.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefDictionaryPropertyValueManager")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefDictionaryPropertyValueManager", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . VIEWHELPER);
    //-------------------------------------------------------------------------
    //	Class
    class DictionaryPropertyValueManager extends ViewObject {
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         * @param
         *
         */
        function DictionaryPropertyValueManager() {
            //
            
        }
        //---------------------------------------------------------------------
        //	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
        *
        */
        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);
            }
            //
            /*
            * *- Error management
            */
            //
            if ($this->get_error_count() > 0) {
                //
                @include_once (FRAMEWORK_VIEW . "view.ErrorMessage.php");
                //
                $errorMessage = new ErrorMessage($this->errorSet());
                if ($errorMessage->renderView($template, $block, $view) == false) {
                    //
                    $this->m_errorSet[VIEW_RENDER_ERROR] = true;
                    //
                    return (false);
                }
            }
            //
            $template->assign($this->m_fieldSet);
            //
            switch ($view) {
                case ITEMVIEW:
                    /*
                    * @see handler DictionaryPropertyValue-view.php
                    */
                    //
                    /*
                    * 1- DictionaryPropertyValue
                    * 2- ApplicationCodifications status
                    * 3- DictionaryPropertyRuleScopeSet scope
                    * 4- DictionaryPropertyRuleTypeSet
                    */
                    //
                    /*
                    * 1- DictionaryPropertyValue
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DictionaryPropertyValue.php");
                    //
                    $value = new DictionaryPropertyValue($this->m_fieldSet["DICPVALPKID"]);
                    if ($value->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($value->fieldSet());
                    //
                    /*
                    * 2- ApplicationCodifications Dropdownlist 4 status field
                    */
                    //
                    @include_once (COMPONENTS_HTML . "html.ApplicationCodificationDDL.php");
                    //
                    $codificationSet = NULL;
                    $codificationSetDDL = new ApplicationCodificationDDL("stat", "formInput", 1);
                    $this->m_blockSet["DICSTATLIST"] = $codificationSetDDL->renderObject($datasource, $codificationSet, $value->get_field_value("DICPVALSTAT"));
                    //
                    unset($codificationSetDDL);
                    unset($codificationSet);
                    //
                    /*
                    * 3- DictionaryPropertyRuleScopeSet Dropdownlist
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DictionaryPropertyRuleScopeSet.php");
                    //
                    $ruleScopeSet = new DictionaryPropertyRuleScopeSet($value->get_field_value("REPTYPEPKID"));
                    if ($ruleScopeSet->selectSet($datasource, FOREIGNKEY) == false) {
                        //
                        $this->m_errorSet[HTML_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $ruleScopeSetDLL = new HTMLDropdownList("mode", "listInput");
                    $this->m_blockSet["DICPRULMODE"] = $ruleScopeSetDLL->renderObject($datasource, $ruleScopeSet);
                    //
                    unset($ruleScopeSetDLL);
                    unset($ruleScopeSet);
                    //
                    /*
                    * 4- DictionaryPropertyRuleTypeSet Dropdownlist
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DictionaryPropertyRuleTypeSet.php");
                    //
                    $ruleTypeSet = new DictionaryPropertyRuleTypeSet($value->get_field_value("DICPTYPPKID"));
                    if ($ruleTypeSet->selectSet($datasource, FOREIGNKEY) == false) {
                        //
                        $this->m_errorSet[HTML_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    @include_once (COMPONENTS_HTML . "html.DictionaryPropertyRuleTypeSetDDL.php");
                    //
                    $ruleTypeSetDDL = new DictionaryPropertyRuleTypeSetDDL("type", "listInput");
                    $this->m_blockSet["DICPRULTYPE"] = $ruleTypeSetDDL->renderObject($datasource, $ruleTypeSet);
                    //
                    //
                    /*
                    * 5- DictionaryProperty Dropdownlist
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DictionaryPropertySet.php");
                    //
                    if ($ruleTypeSet->set_cursor_value($datasource, 0) == false) {
                        //
                        $this->m_errorSet[HTML_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    unset($ruleTypeSetDDL);
                    //
                    //
                    $propertySetDDL = new HTMLDropdownList("prop", "listInput");
                    //
                    for ($i = 0;$i < $ruleTypeSet->rowCount();$i++) {
                        //	select next row
                        if ($ruleTypeSet->fetchCursorRow($datasource) == false) return (false);
                        //
                        $template->select("list");
                        $template->assign($ruleTypeSet->fieldSet());
                        //
                        $propertySet = new DictionaryPropertySet($value->get_field_value("REPOSITPKID") , $ruleTypeSet->get_field_value("DICPTYPRKID"));
                        if ($propertySet->selectSet($datasource) == true) {
                            //
                            $template->assign("DICPROPLIST", $propertySetDDL->renderObject($datasource, $propertySet));
                        }
                        //
                        unset($propertySet);
                        //
                        $template->render("list");
                    }
                    //
                    $template->assign($this->m_blockSet);
                    //
                    break;
                case LISTVIEW:
                    /*
                    * * @see handler DictionaryPropertyValue-list.php
                    */
                    //
                    /*
                    * =- DictionaryPropertyValueSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DictionaryPropertyValueSet.php");
                    //
                    $valueSet = new DictionaryPropertyValueSet($this->m_fieldSet["DICPROPPKID"]);
                    if ($valueSet->selectSet($datasource, FOREIGNKEY) == true) {
                        //
                        for ($i = 0;$i < $valueSet->rowCount();$i++) {
                            //	select next ValueSet row
                            if ($valueSet->fetchCursorRow($datasource) == false) return (false);
                            //
                            $template->select("list");
                            $template->assign($valueSet->fieldSet());
                            $template->render("list");
                        }
                        //
                        $template->assign($valueSet->fieldSet());
                    }
                    //
                    break;
                }
                //
                $template->output($mode);
                //
                return (true);
            }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio