CHips L MINI SHELL

CHips L pro

Current Path : /opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/SitebuilderDao/
Upload File :
Current File : //opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/SitebuilderDao/CharsetDao.php

<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// WebSite:  http://www.rvglobalsoft.com
// Unauthorized copying is strictly forbidden and may result in severe legal action.
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
// 
// =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
// This Agreement is a legal contract, which specifies the terms of the license
// and warranty limitation between you and RV Global Soft Co.,Ltd. and RV Site Builder.
// You should carefully read the following terms and conditions before
// installing or using this software.  Unless you have a different license
// agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
// indicates your acceptance of the license and warranty limitation terms
// contained in this Agreement. If you do not agree to the terms of this
// Agreement, promptly delete and destroy all copies of the Software.
//
// =====  Grant of License =======
// The Software may only be installed and used on a single host machine.
//
// =====  Disclaimer of Warranty =======
// THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
// WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
// WARRANTIES WHETHER EXPRESSED OR IMPLIED.   BECAUSE OF THE VARIOUS HARDWARE
// AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
// FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.  THE USER MUST ASSUME THE
// ENTIRE RISK OF USING THIS PROGRAM.  ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
// LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
// IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
// CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
// OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
// BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
// NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
// RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
// RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
// BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
// +---------------------------------------------------------------------------+
// $Id$
// +---------------------------------------------------------------------------+

/**
 *  Data access methods for the charset of RVSiteBuilder  
 *
 * @package sitebuilder
 * @author  Pairote Manunphol <pairote@rvglobalsoft.com>
 * @author  Parinya <parinya@rvglobalsoft.com>
 * @version $Revision$
 * @since   PHP 5.1
 */

class CharsetDao extends DbWrapper implements SitebuilderInf
{	
	function CharsetDao()
	{
        parent::DbWrapper();
	}
	
	/**
	 * Returns a singleton CharsetDao instance.
	 *
	 * @param bool $autoload
	 * @return obj
	 */
	public static function singleton($autoload=false)
    {
        static $instance;
        // If the instance is not there, create one
        if (!isset($instance) || $autoload) {
            $class = __CLASS__;
            $instance = new $class();
        }
        return $instance;
    }
    
    /**
     * Find charset data by charset id
     * @author Parinya Chaipetch
     * 
     * @param string $charsetId
     * @param string $fetchMode
     * @access public
     * @return array
     */
    public function findCharsetDataByCharsetId($charsetId=null, $fetchMode='getassoc')
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        DB_DataObject::debugLevel(0);
    	$oCharset = DB_DataObject::factory($this->aConf['table']['rvs_charset']);
    	
    	if (!is_null($charsetId)) {
    	    $oCharset->charset_id = $charsetId;
    	}
    	$oCharset->find();
    	$aCloneData = array();
        while ($oCharset->fetch()) {
            $aCloneData[] = clone($oCharset);
        }
        DB_DataObject::debugLevel();
        return DbWrapper::fetchDatas($oCharset->_resultFields, $aCloneData, $fetchMode);
    }
    
    /**
     * Find charset data by charset name
     * @author Parinya Chaipetch
     * 
     * @param string $charsetName
     * @param string $fetchMode
     * @access public
     * @return array
     */
    public function findCharDataByCharsetName($charsetName=null, $fetchMode='getassoc')
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        DB_DataObject::debugLevel();
        $oCharset = DB_DataObject::factory($this->aConf['table']['rvs_charset']);

        if (!is_null($charsetName)) {
            $oCharset->charset_name = $charsetName;
            $oCharset->find();
        }
        $aCloneData = array();
        while ($oCharset->fetch()) {
            $aCloneData[] = clone($oCharset);
        }
        DB_DataObject::debugLevel();
        return DbWrapper::fetchDatas($oCharset->_resultFields, $aCloneData, $fetchMode);
    }
 /**
     * Find charset lang data by project id
     * @author Parinya Chaipetch
     * 
     * @param string $projectId
     * @param string $fetchMode
     * @access public
     * @return array
     */ 
    public function findCharsetLangByUserId($userId=null, $fetchMode='getassoc')
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        DB_DataObject::debugLevel(0);
        $oCharset = DB_DataObject::factory($this->aConf['table']['rvs_usr']);
        if (!is_null($userId)) {
             $query = sprintf('
                        SELECT
                            charset_id
                        FROM 
                            %s
                        WHERE 
                            rvs_usr_id = %s
                        '
                        , $this->aConf['table']['rvs_usr']
                        , RvsLibs_String::quoteSmart($userId)
                        );
        $oCharset->query($query);
        }
        $aCloneData = array();
        while ($oCharset->fetch()) {
            $aCloneData[] = clone($oCharset);
        }
        return DbWrapper::fetchDatas($oCharset->_resultFields, $aCloneData, $fetchMode);
    }
    /**
     * Find charset lang data by project id
     * @author Parinya Chaipetch
     * 
     * @param string $projectId
     * @param string $fetchMode
     * @access public
     * @return array
     */ 
    public function findCharsetLangByProjectId($projectId=null, $fetchMode='getassoc')
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        DB_DataObject::debugLevel(0);
        $oCharset = DB_DataObject::factory($this->aConf['table']['rvs_charset']);
        $oProject = DB_DataObject::factory($this->aConf['table']['rvs_project']);
        $oProjectInfo = DB_DataObject::factory($this->aConf['table']['rvs_project_info']);
        $oCharset->selectAdd();
        $oCharset->selectAdd('charset_value, xml_lang');
        if (!is_null($projectId)) {
            $oProject->get('project_id', $projectId);
            $oProjectInfo->get('project_info_id', $oProject->project_info_id);
            if (isset($oProjectInfo->charset_id) && !empty($oProjectInfo->charset_id)) {
            	$oCharset->charset_id = $oProjectInfo->charset_id;
            	$oCharset->find();
            }

        }
        $aCloneData = array();
        while ($oCharset->fetch()) {
            $aCloneData[] = clone($oCharset);
        }
        DB_DataObject::debugLevel(0);
        return DbWrapper::fetchDatas($oCharset->_resultFields, $aCloneData, $fetchMode);
    }
    
    /**
     * Find all charset data
     *
     * Resulting SQL
     *      SELECT
     *           charset_id, charset_name ; (Option: $aResultFields)
     *      FROM
     *           rvs_charset
     *       ORDER BY 
     *           charset_name 
     * 
     * @param string $fetchMode
     * @param array $aResultFields ; Option for SELECT field , Default is charset_id and charset_name, if you want select all fields please usage array() 
     * @author Parinya Chaipetch
     * @access public
     * @return array
     */
    public function findCharsetData($fetchMode='getassoc', $aResultFields = array('charset_id', 'charset_name'))
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        DB_DataObject::debugLevel();
        $oCharset = DB_DataObject::factory($this->aConf['table']['rvs_charset']);
        $oCharset->orderBy('charset_name');
        $oCharset->find();
        $aCloneData = array();
        while ($oCharset->fetch()) {
            $aCloneData[] = clone($oCharset);
        }
        $aResultFields = DbWrapper::buildResultFields($oCharset, $aResultFields);
        DB_DataObject::debugLevel();
        return DbWrapper::fetchDatas($aResultFields, $aCloneData, $fetchMode);
    }

    public function backupsql($projectId, $usrId)
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        $aSQLData = array();
        /// Get Project info id By project_id
        $oProjectInfoId = DaoFactory::Project()->findProjectInfoDataByProjectId($projectId, 'getDataObject');
        foreach ($oProjectInfoId as $key => $val) {
            /// Backup table rvs_charset
            if (!empty($val->charset_id)) {
	            $oCharset = $this->findCharsetDataByCharsetId($val->charset_id, 'getDataObject');
	            foreach ($oCharset as $k => $v) {
	                $aSQLData[] = DbWrapper::buildSQLFormat($v);
	            }
            }
        }
        return $aSQLData;
    }
     
    public function deleteProjectOfUserId($projectId, $usrId, $aProjectPageId = array()) {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
    }
}
?>

Copyright 2K16 - 2K18 Indonesian Hacker Rulez