Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/datas/data.RepositoryModelResourceIndexer.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: data.RepositoryModelResourceIndexer.php 95 2008-02-03 23:40:15Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefRepositoryModelResourceIndexer")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefRepositoryModelResourceIndexer", "1");
    //
    define(EXTFLAGKEY, 20);
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . DATAROWOBJECT);
    //-------------------------------------------------------------------------
    //	Class
    class RepositoryModelResourceIndexer extends DataRow {
        //---------------------------------------------------------------------
        //	Constructor
        /*
        */
        //
        function RepositoryModelResourceIndexer() {
            //
            $this->m_tableSet[PRIMARYKEY] = "tbl_repository_model_resource";
            //
            $this->m_indexSet[PRIMARYKEY] = "REPMRESPKID";
            $this->m_indexSet[FOREIGNKEY] = "REPCELEPKID";
            $this->m_indexSet[NATURALKEY] = "REPMRESNAME";
        }
        //---------------------------------------------------------------------
        //	Methods
        /*
        *
        * @access	protected
        *
        * @param	integer	index type
        */
        function getSelectQuery($indexType = PRIMARYKEY) {
            //
            $table = $this->m_tableSet[PRIMARYKEY];
            //
            switch ($indexType) {
                case FOREIGNKEY:
                    /*
                    *	SELECT
                    *			tbl_repository_model_resource
                    *		<-> tbl_repository_core_element
                    *		<-> tbl_repository_model_resource_type
                    *	ON
                    *		DIRRESOPKID && REPMRESFLAG
                    */
                    //
                    $index1 = $this->m_fieldSet["DIRRESOPKID"];
                    $index2 = $this->m_fieldSet["REPMRESFLAG"];
                    if ( ($index1 != 0) && ($index2 != "") )
                        return ("SELECT 
								t1.*, 
								t2.REPOSITPKID, 
								t2.REPCELTPKID,
								t2.REPCELENAME, 
								t3.REPMELTPKID, 
								t3.REPMRETNAME,
								t3.REPMRETCODE,
								t4.OBJETYPPKID
							FROM 
								tbl_repository_model_resource as t1, 
								tbl_repository_core_element as t2, 
								tbl_repository_model_resource_type as t3,
								tbl_repository_model_element_type as t4 
							WHERE
								t1.DIRRESOPKID=$index1
							AND
								t1.REPMRESFLAG='$index2'
							AND 
								t1.REPMRESSTAT<>0 
							AND 
								t1.REPCELEPKID=t2.REPCELEPKID 
							AND 
								t2.REPCELESTAT<>0 
							AND 
								t1.REPMRETPKID=t3.REPMRETPKID
							AND
								t3.REPMELTPKID=t4.REPMELTPKID");
                    break;
                case REFLECTKEY:
                    /*
                    *	SELECT
                    *			tbl_repository_model_resource
                    *		<-> tbl_repository_core_element
                    *		<-> tbl_repository_model_resource_type
                    *	ON
                    *		REPMRESLINK && REPMRESFLAG
                    */
                    //
                    $index1 = $this->m_fieldSet["REPMRESLINK"];
                    $index2 = $this->m_fieldSet["REPMRESFLAG"];
                    if ( ($index1 != 0) && ($index2 != "") ) 
                        return ("SELECT 
								t1.*, 
								t2.REPOSITPKID, 
								t2.REPCELTPKID,
								t2.REPCELENAME, 
								t3.REPMELTPKID, 
								t3.REPMRETNAME,
								t3.REPMRETCODE,
								t4.OBJETYPPKID
							FROM 
								tbl_repository_model_resource as t1, 
								tbl_repository_core_element as t2, 
								tbl_repository_model_resource_type as t3,
								tbl_repository_model_element_type as t4 
							WHERE
								t1.REPMRESLINK=$index1
							AND
								t1.REPMRESFLAG='$index2' 
							AND 
								t1.REPMRESSTAT<>0 
							AND 
								t1.REPCELEPKID=t2.REPCELEPKID 
							AND 
								t2.REPCELESTAT<>0 
							AND 
								t1.REPMRETPKID=t3.REPMRETPKID
							AND
								t3.REPMELTPKID=t4.REPMELTPKID");
                    break;
                }
            //
            return ("");
        }
    };
    //	Class
    //-------------------------------------------------------------------------
}
//	namespace
//-----------------------------------------------------------------------------    
?>
Return current item: Entier Studio