<?php
/*
 * shopping/category/Load.class.php
 * 
 * CopyRight(C) 2010 Shopformer Development Team. All Right Reserved
 * URL: http://sourceforge.jp/projects/shopformer/
 * 
 * 
 * Mail: m_nakashima@users.sourceforge.jp
 * Auther: Masanori Nakashima
 * Last Update: 2010-02-12
 * 
 */
require_once( dirname(dirname(dirname(__FILE__)))
.DIRECTORY_SEPARATOR.'system'
.DIRECTORY_SEPARATOR.'login'
.DIRECTORY_SEPARATOR.'ModuleBase.class.php');
require_once( dirname(dirname(__FILE__))
.DIRECTORY_SEPARATOR.'PackageConfig.class.php' );
require_once( dirname(dirname(__FILE__))
.DIRECTORY_SEPARATOR.'DaoShoppingCategory.class.php');
class shopping_category_Load extends system_login_ModuleBase {
	
	function shopping_category_Load(){
		array_push($this->require_module_array,'database2.Connect');
	}
	function execute( & $request ) {
		
		$dbo					= $request->getAttribute( 'dbo' );
		$shoppingCategoryNumber	= stripslashes( $_GET['shpcn'] );
		$shoppingCategoryObject	= spider_Controller::createObject('shopping_DaoShoppingCategory');
		
		if ( strlen(trim($shoppingCategoryNumber)) == 0 ) {
			$request->addLocaledError('shopping.error.category.selectcategory',SPIDER_LOG_LEVEL_ERROR,array());
		} else if( preg_match('/^[0-9]+$/',$shoppingCategoryNumber) > 0 ){
			if ( !$dbo->loadByNumber( $shoppingCategoryObject, $shoppingCategoryNumber ) ) {
				$request->addLocaledError('shopping.error.category.notfound',SPIDER_LOG_LEVEL_ERROR,array());
			}
		}
		
		$request->setAttribute('shopping.category.category_object',		$shoppingCategoryObject);
		$request->setAttribute('shopping.category.require_columns_hash',	$GLOBALS['SHOPPING_CATEGORY_REQUIRE_COLUMNS_HASH']);
		$request->setAttribute('shopping.category.regist_permit_hash',	$GLOBALS['REGIST_PERMIT_HASH']);
	}
}
?>