Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/datas/data.TemporaryElementPropertyValueSet.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.TemporaryElementPropertyValueSet.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefTemporaryElementPropertyValueSet")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefTemporaryElementPropertyValueSet", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . DATASETOBJECT);
    //-------------------------------------------------------------------------
    //	Class
    /*
    *	TemporaryElementPropertyValueSet DAO
    *
    */
    class TemporaryElementPropertyValueSet extends DataSet {
        //---------------------------------------------------------------------
        //	Constructor
        /*
        *
        * @param	integer	TemporaryElement id		$TMPELEMPKID
        */
        function TemporaryElementPropertyValueSet($TMPELEMPKID = 0) {
            //
            $this->m_tableSet[PRIMARYKEY] = "tbl_temporary_element_property_value";
            $this->m_indexSet[PRIMARYKEY] = "TMPEPROPKID";
            $this->m_indexSet[FOREIGNKEY] = "TMPELEMPKID";
            $this->m_indexSet[NATURALKEY] = "DICPROPNAME";
            //
            $this->m_querySet["TMPELEMPKID"] = $TMPELEMPKID;
        }
        //---------------------------------------------------------------------
        //	Methods
        
        /**
         *
         * @access	protected
         *
         * @param	integer	Index Type
         * @return	string	SQL query
         *
         */
        function getDeleteQuery($indexType = FOREIGNKEY) {
            //
            $table = $this->m_tableSet[PRIMARYKEY];
            //
            switch ($indexType) {
                case FOREIGNKEY:
                    /*
                    *
                    *	DELETE ON TMPELEMPKID FOREIGNKEY
                    *
                    */
                    //
                    $field = $this->m_indexSet[FOREIGNKEY];
                    $index = $this->m_querySet[$field];
                    if ($index != 0) return ("DELETE FROM $table WHERE $field=$index");
                    //
                    break;
                }
                //
                return ("");
        }
        /*
        *
        * @access	protected
        *
        * @param	integer	index type
        * @param	integer	order type
        * @param	string	order mode
        *
        */
        function getSelectQuery($indexType = FOREIGNKEY, $orderType = NATURALKEY, $orderMode = "") {
            //
            switch ($indexType) {
                case FOREIGNKEY:
                    /*
                    *
                    *	SELECT
                    *				tbl_temporary_element_property_value	as t1
                    *			<->	tbl_dictionary_property					as t2
                    *	ON
                    *			TMPELEMPKID
                    *
                    */
                    //
                    $index = $this->m_querySet["TMPELEMPKID"];
                    if ($index != 0) {
                        //
                        $selectSQL = "SELECT 
										t1.TMPEPROPKID, 
										t1.DICPVALPKID, 
										t1.DICPROPPKID, 
										t1.TMPEPRODATA 
									FROM 
										tbl_temporary_element_property_value as t1, 
										tbl_dictionary_property as t2 
									WHERE 
										t1.TMPELEMPKID=$index 
									AND 
										t1.TMPEPROSTAT>0 
									AND 
										t1.DICPROPPKID=t2.DICPROPPKID 
									AND 
										t2.DICPROPSTAT>0";
                        //
                        switch ($orderType) {
                            case PRIMARYKEY:
                                return ($selectSQL . " ORDER BY t1.TMPEPROPKID $orderMode");
                            case NATURALKEY:
                                return ($selectSQL . " ORDER BY t2.DICPROPNAME $orderMode");
                            default:
                                return ($selectSQL . " ORDER BY t2.DICPROPNAME");
                        }
                    }
                    //
                    
                break;
            }
            //
            return ("");
        }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio