Source for file Loader.php

Documentation is available at Loader.php

  1. <?php
  2.     /**
  3.      * Contains the loader class
  4.      * @copyright Copyright (c) 2006 Mirchev Ideas Ltd. All rights reserved.
  5.      * @package MIPHPF
  6.      */
  7.     
  8.     /**
  9.      * Loads other classes upon construction
  10.      * @copyright Copyright (c) 2006 Mirchev Ideas Ltd. All rights reserved.
  11.      * @package MIPHPF
  12.      */
  13.     class miLoader {
  14.         protected static $_includePath null;
  15.         
  16.         /**
  17.          * Map from class names to files
  18.          * 
  19.          * @access protected
  20.          */
  21.         protected static $_classMap array(
  22.             'miDBUtilImpl' => 'database/DBUtilImpl.php',
  23.             'miStaticDBUtil' => 'database/StaticDBUtil.php',
  24.         
  25.             'miAction' => 'control/Actions.php',
  26.             'miActionWithWebForm' => 'control/Actions.php',
  27.             'miViewAction' => 'control/Actions.php',
  28.             'miCreateAction' => 'control/Actions.php',
  29.             'miExecCreateAction' => 'control/Actions.php',
  30.             'miEditAction' => 'control/Actions.php',
  31.             'miExecEditAction' => 'control/Actions.php',
  32.             'miExecDeleteAction' => 'control/Actions.php',
  33.             'miListAction' => 'control/Actions.php',
  34.             'miAppFactory' => 'control/AppFactory.php',
  35.             'miControllerCommand' => 'control/ControllerCommand.php',
  36.             'miViewPlugin' => 'control/ViewPlugin.php',
  37.             'miCsvExportAction' => 'control/CsvExport.php',
  38.             'miDispatcher' => 'control/Dispatcher.php',
  39.             'miDefaultDispatcher' => 'control/Dispatcher.php',
  40.             'miSubmitFieldsPlugin' => 'control/SubmitFieldsPlugin.php',
  41.             'miPage' => 'control/Page.php',
  42.             
  43.             'miDomainObject' => 'model/DomainObject.php',
  44.             'miDefaultDomainObject' => 'model/DomainObject.php',
  45.             'miViewMapperController' => 'model/ViewMapper.php',
  46.             'miViewMapperControllerDefault' => 'model/ViewMapper.php',
  47.             'miViewMapper' => 'model/ViewMapper.php',
  48.             'miViewMapperDefault' => 'model/ViewMapper.php',
  49.             
  50.             'miPropertiesRecord' => 'model/PropertiesRecord.php',
  51.             'miSqlComplexPKRecord' => 'model/SqlComplexPKRecord.php',
  52.             'miSqlFilter' => 'model/SqlFilters.php',
  53.             'miSqlFilterOneValue' => 'model/SqlFilters.php',
  54.             'miSqlFilterSubstring' => 'model/SqlFilters.php',
  55.             'miSqlFilterStarts' => 'model/SqlFilters.php',
  56.             'miSqlFilterEnds' => 'model/SqlFilters.php',
  57.             'miSqlFilterSimple' => 'model/SqlFilters.php',
  58.             'miSqlFilterEqual' => 'model/SqlFilters.php',
  59.             'miSqlFilterNotEqual' => 'model/SqlFilters.php',
  60.             'miSqlFilterBiggerThan' => 'model/SqlFilters.php',
  61.             'miSqlFilterBiggerOrEqual' => 'model/SqlFilters.php',
  62.             'miSqlFilterSmallerThan' => 'model/SqlFilters.php',
  63.             'miSqlFilterSmallerOrEqual' => 'model/SqlFilters.php',
  64.             'miSqlFilterRegExp' => 'model/SqlFilters.php',
  65.             'miSqlFilterIn' => 'model/SqlFilters.php',
  66.             'miSqlFilterNotIn' => 'model/SqlFilters.php',
  67.             'miSqlFilterCustom' => 'model/SqlFilters.php',
  68.             'miSqlRecord' => 'model/SqlRecord.php',
  69.             'miSqlRecordset' => 'model/SqlRecordset.php',
  70.             
  71.             'miBreadcrumb' => 'util/Breadcrumb.php',
  72.             'miException' => 'util/Exceptions.php',
  73.             'miDBException' => 'util/Exceptions.php',
  74.             'miConfigurationException' => 'util/Exceptions.php',
  75.             'miTemplateParserSectionInfo' => 'util/TemplateParser.php',
  76.             'miTemplateParser' => 'util/TemplateParser.php',
  77.             'miSettings' => 'util/Settings.php',
  78.             'miState' => 'util/State.php',
  79.             'miUtil' => 'util/Util.php',
  80.             
  81.             'miUIUtil' => 'view/UIUtil.php',
  82.             'miValidator' => 'view/Validators.php',
  83.             'miValidatorEmail' => 'view/Validators.php',
  84.             'miValidatorDate' => 'view/Validators.php',
  85.             'miValidatorInt' => 'view/Validators.php',
  86.             'miValidatorDecimal' => 'view/Validators.php',
  87.             'miValidatorIcq' => 'view/Validators.php',
  88.             'miValidatorHttp' => 'view/Validators.php',
  89.             'miValidatorGsm' => 'view/Validators.php',
  90.             'miValidatorIp' => 'view/Validators.php',
  91.             'miValidatorUnique' => 'view/Validators.php',
  92.             'miTable' => 'view/Table.php',
  93.             'miTableFeature' => 'view/TableFeature.php',
  94.             'miTableFilters' => 'view/TableFilters.php',
  95.             'miTablePager' => 'view/TablePager.php',
  96.             'miDefaultTablePager' => 'view/TablePager.php',
  97.             'miSimpleTablePager' => 'view/TablePager.php',
  98.             'miTableCustomParams' => 'view/TableCustomParams.php',
  99.             'miTableSorter' => 'view/TableSorter.php',
  100.             'miMessage' => 'view/Message.php',
  101.             'miWebForm' => 'view/WebForm.php',
  102.             'miWebFormErrorsHandler' => 'view/WebFormErrorsHandler.php',
  103.             'miWebFormMessageErrorsHandler' => 'view/WebFormErrorsHandler.php',
  104.             'miWidget' => 'view/Widget.php',
  105.             'miBaseWidget' => 'view/BaseWidgets.php',
  106.             'miBaseTextWidget' => 'view/BaseWidgets.php',
  107.             'miBaseCheckboxWidget' => 'view/BaseWidgets.php',
  108.             'miBaseRadioWidget' => 'view/BaseWidgets.php',
  109.             'miBaseSelectWidget' => 'view/BaseWidgets.php',
  110.             'miTextWidget' => 'view/StandardWidgets.php',
  111.             'miCheckboxWidget' => 'view/StandardWidgets.php',
  112.             'miRadioWidget' => 'view/StandardWidgets.php',
  113.             'miSelectWidget' => 'view/StandardWidgets.php',
  114.             'miView' => 'view/View.php',
  115.             'miDefaultView' => 'view/View.php',
  116.         );
  117.         
  118.         /**
  119.          * Loads a class
  120.          * 
  121.          * @access public
  122.          * @param string $className the class to load
  123.          * @return bool true on success
  124.          */
  125.         public static function load($className)
  126.         {
  127.             if (self::$_includePath == null)
  128.                 self::$_includePath dirname(__FILE__'/../'
  129.             
  130.             if (empty(self::$_classMap[$className]))
  131.                 return false;
  132.             
  133.             require_once(self::$_includePath self::$_classMap[$className]);
  134.             return true;
  135.         }
  136.         
  137.         /**
  138.          * Adds a new class to the loader
  139.          * 
  140.          * @access public
  141.          * @param string $className 
  142.          * @param string $classFile 
  143.          */
  144.         public static function addClass($className$classFile)
  145.         {
  146.             self::$_classMap[$className$classFile;
  147.         }
  148.     }
  149. ?>

Documentation generated on Thu, 08 May 2008 16:57:28 +0300 by phpDocumentor 1.4.1