<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * 自动加载
 */
if(!defined('GROWTH_DIR')) {
    throw new Exception("没有定义常量：GROWTH_DIR");
}

class Growth {
    public function __construct(){

    }
    
    public static function getDir() {
        return GROWTH_DIR;
    }
    
    public static function getCoreLibDir() {
        return GROWTH_DIR.'../../../core/lib/';
    }
}

class ClassAutoloader {
        public function __construct() {
            spl_autoload_register(array($this, 'loader'));
        }
        private function loader($className) {
            $core_lib_dir = Growth::getCoreLibDir();
            $web_model_dir = GROWTH_DIR.'../../model/';
            $moduleName = strtolower(substr(get_class($this), 0, '-15'));       
            $libGrowth = $core_lib_dir."$moduleName/".$className.'.php';
            $modelGrowth = $web_model_dir."$moduleName/".$className.'.php';
            if(file_exists($libGrowth)) {
               $this->loadFile($libGrowth);
            } else if (file_exists ($modelGrowth)) {
                $this->loadFile($modelGrowth);
            }
            
        }
        private function loadFile($filename) {
            include_once $filename;
        }
    }

class Growth_njClassAutoloader extends ClassAutoloader {
    }
new Growth_njClassAutoloader();
//
class Block_njClassAutoloader extends ClassAutoloader {
    }
new Block_njClassAutoloader();
class VasClassAutoloader extends ClassAutoloader {
    }
new VasClassAutoloader();
class LoanClassAutoloader extends ClassAutoloader {
    }
new LoanClassAutoloader();

class StreetClassAutoloader extends ClassAutoloader {
    }
new StreetClassAutoloader();
class PaymentClassAutoloader extends ClassAutoloader {
    }
new PaymentClassAutoloader();
class ComplainClassAutoloader extends ClassAutoloader {
    }
new ComplainClassAutoloader();
class School_njClassAutoloader extends ClassAutoloader {
    }
new School_njClassAutoloader();
include_once Growth::getCoreLibDir().'../common/func_tony.php';
include_once Growth::getCoreLibDir().'/SqlCombinHelper.php';
include_once Growth::getCoreLibDir().'/CommonBase.php';
include_once Growth::getCoreLibDir().'/broker/BrokerGroup.php';
include_once Growth::getCoreLibDir().'/OperateRecord.php';
if(isset($db_sys)&&isset($conf_cityflag)) {
    $operateRecord = new OperateRecord($db_sys, $conf_cityflag);
}
include_once Growth::getCoreLibDir().'/broker/BrokerGroup.php';
//include_once CORE_LIB.'/block/BlockLevelHeatSetting.php';
include_once Growth::getCoreLibDir().'/MCache.php';
include_once Growth::getCoreLibDir().'/class_adodb.php';
if(isset($conf_city)&&isset($mc)) {
    $MCache = new MCache($conf_city,true);//第二个参数表示是否开启缓存
}
//include_once Growth::getCoreLibDir().'/growth/Container.php';
/*$container = Container::getInstance();

if(isset($db)&&isset($dbback)&&isset($MCache)) {
    $container->set('db', $db);
    $container->set('dbback', $dbback);
    $container->set('mc', $MCache);
}*/
?>
