Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/views/view.RepositoryModelElementExporter.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.RepositoryModelElementExporter.php 97 2008-02-05 21:08:53Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefRepositoryModelElementExporter")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefRepositoryModelElementExporter", "1");
    define(PANEVIEW, 20);
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . VIEWHELPER);
    //-------------------------------------------------------------------------
    //	Class
    class RepositoryModelElementExporter extends ViewObject {
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         */
        function RepositoryModelElementExporter() {
            //
            
        }
        //---------------------------------------------------------------------
        //	Methods
        /*
        *
        * @access	private
        *
        * @param	object	DataSource object
        * @param	object	ViewTemplate object
        * @param	string	block name in layout
        * @param	integer	key value
        *
        */
        function RenderTemporaryTree(&$datasource, &$template, $block, $value) {
            //
            $elementSet = new TemporaryElementSet($this->m_fieldSet["OBJELEMPKID"], $value);
            if ($elementSet->selectSet($datasource, REFLECTKEY, REFLECTKEY) == true) {
                //
                for ($i = 0;$i < $elementSet->rowCount();$i++) {
                    //	select next row
                    if ($elementSet->fetchCursorRow($datasource) == false) return (false);
                    //
                    $template->select($block);
                    $template->assign($elementSet->fieldSet());
                    $template->render($block);
                    //	select dependent rows
                    if ($this->RenderTemporaryTree($datasource, $template, $block, $elementSet->get_field_value("TMPELEMPKID")) == false) return (false);
                }
            }
            //
            return (true);
        }
        /*
        *
        * @access	private
        *
        * @param	object	DataSource object
        * @param	object	ViewTemplate object
        * @param	string	block name in layout
        * @param	integer	key value
        *
        */
        function RenderRepositoryBaseList(&$datasource, &$template, $block, $handle, $value) {
            //
            @include_once (COMPONENTS_DATA . "data.TemporaryModelElementSet.php");
            //
            $elementSet = new TemporaryModelElementSet($value);
            if ($elementSet->selectSet($datasource, REFLECTKEY) == true) {
                //
                for ($i = 0;$i < $elementSet->rowCount();$i++) {
                    //	select next row
                    if ($elementSet->fetchCursorRow($datasource) == false) return (false);
                    //
                    $template->select($block[3], $handle);
                    $template->assign($elementSet->fieldSet() , NULL, $handle);
                    $template->render($block[3], $handle);
                }
            }
            //
            return (true);
        }
        /*
        *
        * @access	private
        *
        * @param	object	DataSource object
        * @param	object	ViewTemplate object
        * @param	string	block name in layout
        * @param	integer	handler in template
        * @param	integer	key value
        *
        */
        function RenderRepositoryBaseTree(&$datasource, &$template, $block, $parent, $value) {
            //
            @include_once (COMPONENTS_DATA . "data.TemporaryModelElementSet.php");
            //
            $elementSet = new TemporaryModelElementSet($value);
            if ($elementSet->selectSet($datasource, REFLECTKEY) == true) {
                //
                $handle = $template->import("RepositoryElementExport-base.html");
                if ($handle == -1) return (false);
                //
                for ($i = 0;$i < $elementSet->rowCount();$i++) {
                    //	select next row
                    if ($elementSet->fetchCursorRow($datasource) == false) return (false);
                    //
                    $template->select($block[2] . "-" . $block[1], $handle);
                    $template->assign($elementSet->fieldSet() , NULL, $handle);
                    //	select base element
                    if ($this->RenderRepositoryBase($datasource, $template, $block, $handle, $elementSet->fieldSet()) == false) return (false);
                    //	select dependent rows
                    if ($this->RenderRepositoryBaseList($datasource, $template, $block, $handle, $elementSet->get_field_value("REPMELEPKID")) == false) return (false);
                    //
                    $template->render($block[2] . "-" . $block[1], $handle);
                }
                //
                $template->render(".", $handle);
                $template->insert("REPBASETREE", $handle, $parent);
            } else {
                // template quirk!!!
                $template->assign("REPBASETREE", "//emply list", $parent);
            }
            //
            return (true);
        }
        /*
        *
        * @access	private
        *
        * @param	object	DataSource object
        * @param	object	ViewTemplate object
        * @param	string	block name in layout
        * @param	integer	handler in template
        * @param	array	element fields set
        *
        */
        function RenderRepositoryBase(&$datasource, &$template, $block, $handle, $model) {
            //
            $elementType = new RepositoryModelElementType($model["REPMELTPKID"]);
            $elementType->selectRow($datasource);
            if ($elementType->get_field_value("REPMELTTYPE") == MODEL_ENABLED) {
                //
                $element = new RepositoryModelElement();
                $element->set_field_value("REPCELEPKID", $model["REPCELEPKID"]);
                if ($element->selectRow($datasource, FOREIGNKEY) == true) {
                    //
                    $element->set_field_value("REPMELEROOT", $model["REPMELEPKID"]);
                    //
                    $template->select($block[2], $handle);
                    $template->assign($element->fieldSet() , NULL, $handle);
                    //	select dependent rows
                    if ($this->RenderRepositoryBaseTree($datasource, $template, $block, $handle, $element->get_field_value("REPMELEPKID")) == false) return (false);
                    //
                    $template->render($block[2], $handle);
                }
            }
            //
            return (true);
        }
        /*
        *
        * @access	private
        *
        * @param	object	DataSource object
        * @param	object	ViewTemplate object
        * @param	string	block name in layout
        * @param	integer	handler in template
        * @param	integer	key value
        *
        */
        function RenderRepositoryTree(&$datasource, &$template, $block, $handle, $value) {
            //
            @include_once (COMPONENTS_DATA . "data.TemporaryModelElementSet.php");
            //
            $elementSet = new TemporaryModelElementSet($value);
            if ($elementSet->selectSet($datasource, REFLECTKEY) == true) {
                //
                for ($i = 0;$i < $elementSet->rowCount();$i++) {
                    //	select next row
                    if ($elementSet->fetchCursorRow($datasource) == false) return (false);
                    //
                    $template->select($block[1], $handle);
                    $template->assign($elementSet->fieldSet() , NULL, $handle);
                    //	select base element
                    if ($this->RenderRepositoryBase($datasource, $template, $block, $handle, $elementSet->fieldSet()) == false) return (false);
                    $template->render($block[1], $handle);
                    //	select dependent rows
                    if ($this->RenderRepositoryTree($datasource, $template, $block, $handle, $elementSet->get_field_value("REPMELEPKID")) == false) return (false);
                }
            }
            //
            return (true);
        }
        /*
        *
        * @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	{ ITEMVIEW, LISTVIEW, TREEVIEW }
        * @param	integer	outputmode
        *
        */
        function renderView(&$datasource, &$template, $layout, $block = NULL, $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 FORMVIEW:
                    /*
                    * @see handler ctrl.RepositoryElementExport-form
                    */
                    //
                    /*
                    * 1- TemporaryElement
                    * 2- ObjectoryElement
                    * 3- RepositoryModelElement
                    * 4- ObjectoryElementType
                    * 5- TemporaryElement assigments
                    * 6- RepositoryCoreElementPropertyList
                    * 7- RepositoryModelElementPropertyList
                    * 8- TemporaryElementAttributeValueSet
                    * 9- TemporaryElementConstraintValueSet
                    */
                    //
                    /*
                    * 1- TemporaryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.TemporaryElement.php");
                    //
                    $tmpElement = new TemporaryElement();
                    $TYPEOFKEY = NULL;
                    //
                    switch ($this->m_fieldSet["TMPPROCSTEP"]) {
                        case 1:
                            // Drag and drop of members in a class case
                            $tmpElement->set_field_value("REPMELEPKID", $this->m_fieldSet["REPMELEPKID"]);
                            $tmpElement->set_field_value("OBJELEMPKID", $this->m_fieldSet["OBJELEMPKID"]);
                            //
                            $TYPEOFKEY = FOREIGNKEY;
                            //
                            
                        break;
                        case 2:
                            // a model is in grid
                            $tmpElement->set_field_value("TMPELEMPKID", $this->m_fieldSet["TMPELEMPKID"]);
                            //
                            $TYPEOFKEY = PRIMARYKEY;
                            //
                            
                        break;
                    }
                    //
                    if ($tmpElement->selectRow($datasource, $TYPEOFKEY) == false) {
                        /*
                        * TemporaryElement does not exist with key ( drag and drop case )
                        *
                        * 2- ObjectoryElement
                        * 3- RepositoryModelElement
                        * 4- ObjectoryElementType
                        * 5- Transient TemporaryElement
                        * 6- RepositoryCoreElementPropertyList
                        * 7- RepositoryModelElementPropertyList
                        */
                        //
                        /*
                        * 2- ObjectoryElement
                        */
                        //
                        @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                        //
                        $objElement = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                        if ($objElement->selectRow($datasource) == false) {
                            //
                            $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                            //
                            return (false);
                        }
                        //
                        /*
                        * 3- RepositoryModelElement
                        */
                        //
                        @include_once (COMPONENTS_DATA . "data.RepositoryModelElement.php");
                        //
                        $repElement = new RepositoryModelElement($this->m_fieldSet["REPMELEPKID"]);
                        if ($repElement->selectRow($datasource) == false) {
                            //
                            $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                            //
                            return (false);
                        }
                        //
                        /*
                        * 4- ObjectoryElementType
                        */
                        //
                        @include_once (COMPONENTS_DATA . "data.ObjectoryElementType.php");
                        //
                        $elementTyp = new ObjectoryElementType($repElement->get_field_value("REPCELTPKID") , $repElement->get_field_value("REPMELTPKID"));
                        if ($elementTyp->selectRow($datasource, FOREIGNKEY) == false) {
                            //
                            $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                            //
                            return (false);
                        }
                        //
                        /*
                        * 5- TemporaryElement assigments
                        */
                        //
                        $tmpElement->set_field_value("OBJETYPPKID", $elementTyp->get_field_value("OBJETYPPKID"));
                        //
                        $tmpElement->set_field_value("OBJECTOPKID", $objElement->get_field_value("OBJECTOPKID"));
                        //
                        $tmpElement->set_field_value("REPMELEPKID", $repElement->get_field_value("REPMELEPKID"));
                        $tmpElement->set_field_value("REPCELEPKID", $repElement->get_field_value("REPCELEPKID"));
                        $tmpElement->set_field_value("TMPELEMNAME", $repElement->get_field_value("REPMELENAME"));
                        $tmpElement->set_field_value("TMPELEMCODE", $repElement->get_field_value("REPMELECODE"));
                        $tmpElement->set_field_value("TMPELEMINAM", $repElement->get_field_value("REPMELEINAM"));
                        $tmpElement->set_field_value("TMPELEMINAM", $repElement->get_field_value("REPMELEINAM"));
                        $tmpElement->set_field_value("TMPELEMRANK", $repElement->get_field_value("REPMELERANK"));
                        $tmpElement->set_field_value("TMPELEMTEXT", $repElement->get_field_value("REPMELETEXT"));
                        //
                        $template->assign($this->m_fieldSet);
                        $template->assign($tmpElement->fieldSet());
                        //
                        /*
                        * 6- RepositoryCoreElementPropertyList
                        */
                        //
                        switch ($tmpElement->get_field_value("OBJETYPPKID")) {
                            case MODEL_TYPE:
                            case PACKAGE_TYPE:
                            case CLASS_TYPE:
                            case INTERFACE_TYPE:
                            case ATTRIBUTE_TYPE:
                            case OPERATION_TYPE:
                            case ASSOCIATION_TYPE:
                                //
                                @include_once (COMPONENTS_VIEW . "view.RepositoryCoreElementPropertyList.php");
                                //
                                $propertyList = new RepositoryCoreElementPropertyList();
                                $propertyList->set_field_value("REPOSITPKID", $repElement->get_field_value("REPOSITPKID"));
                                $propertyList->set_field_value("REPCELTPKID", $repElement->get_field_value("REPCELTPKID"));
                                $propertyList->set_field_value("REPCELEPKID", $repElement->get_field_value("REPCELEPKID"));
                                if ($propertyList->renderView($datasource, $template, "prop1", "prop1", LISTVIEW, RENDER) == false) {
                                    //
                                    $this->m_errorSet[VIEW_RENDER_ERROR] = true;
                                    //
                                    return (false);
                                }
                                //
                                unset($propertyList);
                                //
                                
                            break;
                        }
                        //
                        /*
                        * 7- RepositoryModelElementPropertyList
                        */
                        //
                        switch ($tmpElement->get_field_value("OBJETYPPKID")) {
                            case PACKAGE_TYPE:
                            case CLASS_TYPE:
                            case INTERFACE_TYPE:
                            case ATTRIBUTE_TYPE:
                            case OPERATION_TYPE:
                            case PARAMETER_TYPE:
                            case ASSOCIATION_TYPE:
                            case ASSOCIATIONEND_TYPE:
                                //
                                @include_once (COMPONENTS_VIEW . "view.RepositoryModelElementPropertyList.php");
                                //
                                $propertyList = new RepositoryModelElementPropertyList();
                                $propertyList->set_field_value("REPMELTPKID", $repElement->get_field_value("REPMELTPKID"));
                                $propertyList->set_field_value("REPMELEPKID", $repElement->get_field_value("REPMELEPKID"));
                                if ($propertyList->renderView($datasource, $template, "prop2", "prop2", LISTVIEW, RENDER) == false) {
                                    //
                                    $this->m_errorSet[VIEW_RENDER_ERROR] = true;
                                    //
                                    return (false);
                                }
                                //
                                unset($propertyList);
                                //
                                
                            break;
                        }
                        //
                        $template->select("step1");
                        $template->render("step1");
                    } else {
                        /*
                        * TemporaryElement does exist with <REPMELEPKID,OBJELEMPKID> ( grid case )
                        *
                        * 8- TemporaryElementReference
                        * 9- TemporaryElementAttributeValueSet
                        *10- TemporaryElementConstraintValueSet
                        */
                        //
                        $template->assign($this->m_fieldSet);
                        $template->assign($tmpElement->fieldSet());
                        //
                        /*
                        * 8- References
                        */
                        //
                        switch ($tmpElement->get_field_value("OBJETYPPKID")) {
                            case PARAMETER_TYPE: //  Parameter attribute
                                
                            case ASSOCIATIONEND_TYPE: //	Association end
                                //
                                /*
                                * 8.1 - ObjectoryReferenceType
                                */
                                //
                                @include_once (COMPONENTS_DATA . "data.ObjectoryElementReferenceType.php");
                                //
                                $referenceType = new ObjectoryElementReferenceType($tmpElement->get_field_value("OBJETYPPKID"));
                                if ($referenceType->selectRow($datasource, FOREIGNKEY) == false) {
                                    //
                                    $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                                    //
                                    return (false);
                                }
                                //
                                /*
                                * 8.2 - Parent element
                                */
                                // as parent.parent is the top container
                                //		end.association.[package]->list of classes
                                //		parameter.method.[class]->list of attributes
                                //
                                $parentElement = new TemporaryElement($tmpElement->get_field_value("TMPELEMLINK"));
                                if ($parentElement->selectRow($datasource) == false) {
                                    //
                                    $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                                    //
                                    return (false);
                                }
                                //
                                /*
                                * 8.3 - TemporaryContainedElementSet dropdownlist : end1 reference
                                *
                                * @todo TemporaryContainedElementSet filtering by REPCELEPKID
                                */
                                //
                                @include_once (COMPONENTS_DATA . "data.TemporaryContainedElementSet.php");
                                //
                                $referenceSet = new TemporaryContainedElementSet($parentElement->get_field_value("TMPELEMLINK") , // Temporary Link
                                $tmpElement->get_field_value("OBJELEMPKID") , // Objectory Link
                                $tmpElement->get_field_value("REPCELEPKID") // Target Element
                                );
                                if ($referenceSet->selectSet($datasource, FOREIGNKEY, FOREIGNKEY) == true) {
                                    //
                                    /*
                                    * 8.4 - TemporaryElementReference
                                    */
                                    //
                                    @include_once (COMPONENTS_DATA . "data.TemporaryElementReference.php");
                                    //
                                    $reference = new TemporaryElementReference(0, $tmpElement->get_field_value("TMPELEMPKID"));
                                    $reference->selectRow($datasource, FOREIGNKEY);
                                    //
                                    @include_once (COMPONENTS_HTML . "html.TemporaryElementReferenceSetDDL.php");
                                    //
                                    $referenceSetDDL = new TemporaryElementReferenceSetDDL("end1", "formInput", $parentElement->get_field_value("TMPELEMLINK") , // Temporary Link
                                    $tmpElement->get_field_value("OBJELEMPKID") , // Objectory Link
                                    $tmpElement->get_field_value("REPCELEPKID") , // Target Element
                                    $referenceType->get_field_value("OBJETYPLINK") // Target Container
                                    );
                                    $this->m_blockSet["TMPEREFLIST"] = $referenceSetDDL->renderObject($datasource, $referenceSet, $reference->get_field_value("TMPELEMRFID"));
                                    $template->select("reference");
                                    $template->assign($this->m_blockSet);
                                    $template->render("reference");
                                }
                                //
                                
                            break;
                        }
                        //
                        /*
                        * 9- TemporaryElementAttributeValueList
                        */
                        //
                        switch ($tmpElement->get_field_value("OBJETYPPKID")) {
                            case MODEL_TYPE:
                            case PACKAGE_TYPE:
                            case CLASS_TYPE:
                            case INTERFACE_TYPE:
                            case ATTRIBUTE_TYPE:
                            case OPERATION_TYPE:
                            case ASSOCIATION_TYPE:
                                //
                                @include_once (COMPONENTS_VIEW . "view.TemporaryElementAttributeValueList.php");
                                //
                                $attributeList = new TemporaryElementAttributeValueList();
                                $attributeList->set_field_value("REPCELTPKID", $tmpElement->get_field_value("REPCELTPKID"));
                                $attributeList->set_field_value("TMPELEMPKID", $tmpElement->get_field_value("TMPELEMPKID"));
                                if ($attributeList->renderView($datasource, $template, "prop1", "prop1", LISTVIEW, RENDER) == false) {
                                    //
                                    $this->m_errorSet[VIEW_RENDER_ERROR] = true;
                                    //
                                    return (false);
                                }
                                //
                                unset($attributeList);
                                //
                                
                            break;
                        }
                        //
                        /*
                        *10- TemporaryElementConstraintValueSet
                        */
                        //
                        switch ($tmpElement->get_field_value("OBJETYPPKID")) {
                            case PACKAGE_TYPE:
                            case CLASS_TYPE:
                            case INTERFACE_TYPE:
                            case ATTRIBUTE_TYPE:
                            case OPERATION_TYPE:
                            case PARAMETER_TYPE:
                            case ASSOCIATION_TYPE:
                            case ASSOCIATIONEND_TYPE:
                                //
                                @include_once (COMPONENTS_VIEW . "view.TemporaryElementConstraintValueList.php");
                                //
                                $constraintList = new TemporaryElementConstraintValueList();
                                $constraintList->set_field_value("REPMELTPKID", $tmpElement->get_field_value("REPMELTPKID"));
                                $constraintList->set_field_value("TMPELEMPKID", $tmpElement->get_field_value("TMPELEMPKID"));
                                if ($constraintList->renderView($datasource, $template, "prop2", "prop2", LISTVIEW, RENDER) == false) {
                                    //
                                    $this->m_errorSet[VIEW_RENDER_ERROR] = true;
                                    //
                                    return (false);
                                }
                                //
                                unset($constraintList);
                                //
                                
                            break;
                        }
                        //
                        $template->select("step2");
                        $template->render("step2");
                    }
                    //
                    
                break;
                case ITEMVIEW:
                    /*
                    * @see handler ctrl.RepositoryElementExport-view
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    * 2- RepositoryElement
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $element = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($element->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($element->fieldSet());
                    //
                    /*
                    * 2- RepositoryElement
                    */
                    //
                    if (!empty($this->m_fieldSet["REPMELEPKID"])) {
                        //
                        @include_once (COMPONENTS_DATA . "data.RepositoryModelElement.php");
                        //
                        $model = new RepositoryModelElement($this->m_fieldSet["REPMELEPKID"]);
                        if ($model->selectRow($datasource) == false) {
                            //
                            $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                            //
                            return (false);
                        }
                        //
                        $template->assign($model->fieldSet());
                    }
                    //
                    
                break;
                case LISTVIEW:
                    /*
                    * @see handler ctrl.RepositoryElementExport-grid
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    * 2- TemporaryElementSet
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $element = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($element->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($element->fieldSet());
                    /*
                    * 2- TemporaryElementSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.TemporaryElementSet.php");
                    //
                    $elementSet = new TemporaryElementSet($element->get_field_value("OBJELEMPKID"));
                    if ($elementSet->selectSet($datasource, FOREIGNKEY, FOREIGNKEY) == true) {
                        //
                        for ($i = 0;$i < $elementSet->rowCount();$i++) {
                            //	select next row
                            if ($elementSet->fetchCursorRow($datasource) == false) return (false);
                            //
                            $template->select($block[0]);
                            $template->assign($elementSet->fieldSet());
                            //	select dependent rows
                            if ($this->RenderTemporaryTree($datasource, $template, $block[1], $elementSet->get_field_value("TMPELEMPKID")) == false) return (false);
                            //
                            $template->render($block[0]);
                        }
                    }
                    //
                    break;
                case TREEVIEW:
                    /*
                    * @see handler ctrl.RepositoryElementExport-tree
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    * 1- ObjectoryCoreElementSet
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $element = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($element->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $this->m_fieldSet["OBJLINKPKID"] = $element->get_field_value("OBJELEMPKID");
                    $this->m_fieldSet["OBJLINKTYPE"] = $element->get_field_value("OBJETYPPKID");
                    //
                    $template->assign($this->m_fieldSet);
                    //
                    /*
                    * 2- ObjectoryCoreElementSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryCoreElementSet.php");
                    //
                    $elementSet = new ObjectoryCoreElementSet($this->m_fieldSet["OBJELEMPKID"], $this->m_fieldSet["REPOSITPKID"]);
                    if ($elementSet->selectSet($datasource) == false) return (false);
                    //
                    $template->assign($this->fieldSet());
                    //
                    @include_once (COMPONENTS_DATA . "data.RepositoryModelElement.php");
                    @include_once (COMPONENTS_DATA . "data.RepositoryModelElementType.php");
                    //
                    for ($i = 0;$i < $elementSet->rowCount();$i++) {
                        //	select next row
                        if ($elementSet->fetchCursorRow($datasource) == false) return (false);
                        //
                        $template->select($block[0]);
                        $template->assign($elementSet->fieldSet());
                        //	select dependent rows
                        if ($this->RenderRepositoryTree($datasource, $template, $block, 0, $elementSet->get_field_value("REPMELEPKID")) == false) return (false);
                        //
                        $template->render($block[0]);
                    }
                    //
                    break;
                case FRAMEVIEW:
                    /*
                    * * @see handler ctrl.RepositoryElementExport-frame
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    * 2- Objectory
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $element = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($element->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($element->fieldSet());
                    //
                    /*
                    * 2- Objectory
                    */
                    //
                    //
                    @include_once (COMPONENTS_DATA . "data.Objectory.php");
                    //
                    $objectory = new Objectory($element->get_field_value("OBJECTOPKID"));
                    if ($objectory->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($objectory->fieldSet());
                    //
                    break;
                case MENUVIEW:
                    /*
                    * * @see handler ctrl.RepositoryElementExport-menu
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    * 2- TemporaryElementSet
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $element = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($element->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($element->fieldSet());
                    //
                    /*
                    * 2- TemporaryElementSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.TemporaryElementSet.php");
                    //
                    $elementSet = new TemporaryElementSet($element->get_field_value("OBJELEMPKID"));
                    if ($elementSet->selectSet($datasource) == true) $template->toggle("proc", true);
                    //
                    break;
                case PANEVIEW:
                    /*
                    * * @see handler ctrl.RepositoryElementExport-pane
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    * 2- TemporaryElementSet
                    * 3- RepositoryModelElement
                    * 4- ElementRepositoryToTemporaryImport
                    */
                    //
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $objElement = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($objElement->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($objElement->fieldSet());
                    //
                    /*
                    * 2- Procedure step
                    */
                    switch ($this->m_fieldSet["TMPPROCSTEP"]) {
                        case 0: // delete all temporary tables
                            /*
                            * 2.0.1- TemporaryElementSet
                            */
                            //
                            @include_once (COMPONENTS_DATA . "data.TemporaryElementSet.php");
                            // Multi-tables DELETE Query in TemporaryElementSet
                            $elementSet = new TemporaryElementSet($objElement->get_field_value("OBJELEMPKID"));
                            $elementSet->deleteSet($datasource);
                            //
                            
                        break;
                        case 1: // insert a model in temporary tables
                            /*
                            * 3- RepositoryModelElement
                            */
                            //
                            @include_once (COMPONENTS_DATA . "data.RepositoryModelElement.php");
                            //
                            $repElement = new RepositoryModelElement($this->m_fieldSet["REPMELEPKID"]);
                            if ($repElement->selectRow($datasource) == false) {
                                //
                                $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                                //
                                return (false);
                            } else {
                                /*
                                *
                                */
                                //
                                @include_once (COMPONENTS_PROC . "proc.ElementRepositoryToTemporaryImport.php");
                                //
                                $importator = new ElementRepositoryToTemporaryImport();
                                $importator->set_option_value("USEPREFNAME", $this->m_fieldSet["USEPREFNAME"]);
                                $importator->set_option_value("USEPREFCODE", $this->m_fieldSet["USEPREFCODE"]);
                                $importator->set_option_value("USEPREFINAM", $this->m_fieldSet["USEPREFINAM"]);
                                //
                                $objElement->set_field_value("OBJELEMNAME", $this->m_fieldSet["TMPPREFNAME"]);
                                $objElement->set_field_value("OBJELEMCODE", $this->m_fieldSet["TMPPREFCODE"]);
                                $objElement->set_field_value("OBJELEMINAM", $this->m_fieldSet["TMPPREFINAM"]);
                                //
                                if ($importator->import($datasource, $repElement->fieldSet() , $objElement->fieldSet()) == false) {
                                    //
                                    $this->m_errorSet[PROC_OBJECT_ERROR] = true;
                                    //
                                    return (false);
                                }
                            }
                            //
                            
                        break;
                    }
                    //
                    break;
                case PROCVIEW:
                    /*
                    * * @see handler ctrl.RepositoryElementExport-proc
                    */
                    /*
                    * 1- ObjectoryElement
                    * 2- ElementTemporaryToObjectoryImport
                    */
                    /*
                    * 1- ObjectoryElement
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.ObjectoryElement.php");
                    //
                    $element = new ObjectoryElement($this->m_fieldSet["OBJELEMPKID"]);
                    if ($element->selectRow($datasource) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $template->assign($element->fieldSet());
                    //
                    @include_once (INTERCHANGE_PROC. "proc.InterchangeElementNamespace.php");
                    //
                    $this->m_blockSet["OBJELEMNASP"] = InterchangeElementNamespace::getNamespacePath($datasource, $element->get_field_value("OBJELEMPKID") , ".");
                    //
                    /*
                    * 2- ElementTemporaryToObjectoryImport
                    */
                    //
                    @include_once (COMPONENTS_PROC . "proc.ElementTemporaryToObjectoryImport.php");
                    //
                    $importator = new ElementTemporaryToObjectoryImport();
                    if ($importator->import($datasource, $element->fieldSet()) == false) {
                        //
                        $discardedObject = $importator->DiscardedObject();
                        $this->m_fieldSet["GARBAGEOB"] = $discardedObject["TMPELEMNAME"];
                    } else {
                        //
                        $this->m_fieldSet["RELEASENB"] = $importator->releasedCount();
                    }
                    //
                    $template->assign($this->m_fieldSet);
                    $template->assign($this->m_blockSet);
                    //
                    break;
                }
                //
                $template->output($mode);
                //
                return (true);
            }
        };
        //	Class
        //-------------------------------------------------------------------------
        
    }
    //	namespace
    //-----------------------------------------------------------------------------
    
?>
Return current item: Entier Studio