Location: PHPKode > projects > Entier Studio > entierstudio/office/classes/views/view.DirectoryProjectUserExplorer.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.office
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 * @version	   $Id: view.DirectoryProjectUserExplorer.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefDirectoryProjectUserExplorer")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefDirectoryProjectUserExplorer", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . VIEWHELPER);
    //-------------------------------------------------------------------------
    //	Class
    class DirectoryProjectUserExplorer extends ViewObject {
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         * @param	object	Instance of ViewTemplate
         * @param	object	Instance of DataSource
         */
        function DirectoryProjectUserExplorer($template, $database) {
            //
            parent::ViewObject($template, $database);
        }
        //---------------------------------------------------------------------
        //	Methods
        
        /**
         *
         * @access	public
         *
         * @return	object
         */
        function getObject() {
            //
            @include_once (COMPONENTS_DATA . "data.DirectoryProjectUser.php");
            //
            return (new DirectoryProjectUser);
        }
        /**
         *
         * @access	public
         *
         * @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
         * @return	boolean
         */
        function renderView($layout, $block = NULL, $view = NULL, $mode = OUTPUT) {
            //
            if (!is_object($this->Template())) return (false);
            //
            if (isset($layout) && ($this->m_Template->define($layout) == false)) return (false);
            //
            switch ($view) {
                case FORMVIEW:
                    /*
                    * @see handler ctrl.DirectoryProjectUser-form.php
                    */
                    //
                    /*
                    * 1- DirectoryUser
                    * 2- DirectoryProjectSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DirectoryUser.php");
                    //
                    $user = new DirectoryUser($this->m_fieldSet["LOGUSERPKID"]);
                    if ($user->selectRow($this->Database()) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $this->m_Template->assign($user->fieldSet());
                    $this->m_Template->assign($this->m_fieldSet);
                    //
                    /*
                    * 2- DirectoryUserSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DirectoryProjectUserSet.php");
                    //
                    $userSet = new DirectoryProjectUserSet($this->m_fieldSet["DIRPROJPKID"]);
                    if ($userSet->selectSet($this->Database() , DEFAULTKEY, $this->m_fieldSet["LISTVIEWSRT"], $this->m_fieldSet["LISTVIEWORD"]) == true) {
                        //
                        for ($i = 0;$i < $userSet->rowCount();$i++) {
                            //	select row
                            if ($userSet->fetchCursorRow($this->Database()) == false) return (false);
                            //
                            $this->m_Template->select($block);
                            $this->m_Template->assign($userSet->fieldSet());
                            $this->m_Template->render($block);
                        }
                    }
                    //
                    break;
                case LISTVIEW:
                    /*
                    * @see handler ctrl.DirectoryProjectUser-list.php
                    */
                    //
                    /*
                    * 1- DirectoryUser
                    * 2- DirectoryProjectSet
                    */
                    //
                    /*
                    * 1- DirectoryUser
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DirectoryUser.php");
                    //
                    $user = new DirectoryUser($this->m_fieldSet["LOGUSERPKID"]);
                    if ($user->selectRow($this->Database()) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $this->m_Template->assign($user->fieldSet());
                    $this->m_Template->assign($this->m_fieldSet);
                    $this->m_Template->assign($this->m_blockSet);
                    //
                    /*
                    * 2- DirectoryProjectUserSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DirectoryProjectUserSet.php");
                    //
                    $userSet = new DirectoryProjectUserSet($this->m_fieldSet["DIRPROJPKID"]);
                    if ($userSet->selectSet($this->Database() , FOREIGNKEY, $this->m_fieldSet["LISTVIEWSRT"], $this->m_fieldSet["LISTVIEWORD"]) == true) {
                        //
                        for ($i = 0;$i < $userSet->rowCount();$i++) {
                            //	select row
                            if ($userSet->fetchCursorRow($this->Database()) == false) return (false);
                            //
                            $this->m_Template->select($block);
                            $this->m_Template->assign($userSet->fieldSet());
                            $this->m_Template->render($block);
                        }
                    }
                    //
                    break;
                case GRIDVIEW:
                    /*
                    * @see handler ctrl.DirectoryProjectUser-grid.php
                    */
                    /*
                    * 1- DirectoryUser
                    * 2- DirectoryProjectSet
                    */
                    //
                    /*
                    * 1- DirectoryUser
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DirectoryUser.php");
                    //
                    $user = new DirectoryUser($this->m_fieldSet["LOGUSERPKID"]);
                    if ($user->selectRow($this->Database()) == false) {
                        //
                        $this->m_errorSet[VIEW_OBJECT_ERROR] = true;
                        //
                        return (false);
                    }
                    //
                    $this->m_Template->assign($user->fieldSet());
                    $this->m_Template->assign($this->m_fieldSet);
                    $this->m_Template->assign($this->m_blockSet);
                    //
                    /*
                    * 2- DirectoryProjectUserSet
                    */
                    //
                    @include_once (COMPONENTS_DATA . "data.DirectoryProjectUserSet.php");
                    //
                    $userSet = new DirectoryProjectUserSet(NOTSET_KEY, $this->m_fieldSet["DIRUSERPKID"]);
                    if ($userSet->selectSet($this->Database() , FOREIGNKEY, $this->m_fieldSet["LISTVIEWSRT"], $this->m_fieldSet["LISTVIEWORD"]) == true) {
                        //
                        for ($i = 0;$i < $userSet->rowCount();$i++) {
                            //	select row
                            if ($userSet->fetchCursorRow($this->Database()) == false) return (false);
                            //
                            $this->m_Template->select($block);
                            $this->m_Template->assign($userSet->fieldSet());
                            $this->m_Template->render($block);
                        }
                    }
                    //
                    break;
                }
                //
                $this->m_Template->output($mode);
                //
                return (true);
            }
        };
        //	Class
        //-------------------------------------------------------------------------
        
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio