function __construct($request, $controller, $action) { $this->_setRequest($request); $this->_setController($controller); $this->_setAction($action); $this->_setParams($request->params); $this->_set_REQUEST($request->_REQUEST); $this->_set_POST($request->_POST); $this->_set_GET($request->_GET); $this->Model = new Model(SimPHPfy::getDatasource(), $this->getController()); $this->View = new View($this); register_shutdown_function('_shutdown', $this); }
<?php /* * Created by Hei */ SimPHPfy::definePackage(array('Controller'), SIMPHPFY_CONTROLLER);
<?php /* * Created by Hei */ SimPHPfy::definePackage(array('View', 'Template', 'Mimetype'), SIMPHPFY_VIEW);
// Setup the SimPHPfy Core package SimPHPfy::package(SIMPHPFY_MODEL); SimPHPfy::package(SIMPHPFY_VIEW); SimPHPfy::package(SIMPHPFY_CONTROLLER); SimPHPfy::package(SIMPHPFY_LIBRARY); SimPHPfy::package(SIMPHPFY_UTILITY); // Setup the ROUTER package SimPHPfy::package(ROUTER); // Setup the app Core package SimPHPfy::package(MODEL); SimPHPfy::package(VIEW); SimPHPfy::package(CONTROLLER); // Include the database configuration require CONFIG . 'datasource.php'; $datasourceConfig = new DataSourceConfig(); SimPHPfy::setDatasource(new DataSource($datasourceConfig->config)); // Include the routes.php from the configuration require CONFIG . 'routes.php'; /* * shutdown function * * The shutdown function accepts a controller object and is responsible to * render a View if there is no specified render call in the * :Controller->:Action() * * @params View $controllerObj * * @return void */ function _shutdown($controllerObj) {
public static function setDatasource($datasource) { self::$_datasource = $datasource; }
<?php /* * Created by Hei */ SimPHPfy::definePackage(array('JSMin'), SIMPHPFY_LIBRARY);
<?php /* * Created by Hei */ /* * namespace file for all the Exceptions */ SimPHPfy::definePackage(array('SimPHPfyBaseException', 'HttpException', 'FileNotFoundException', 'SimPHPfyException', 'ClassCollisionException', 'MissingClassFileException', 'UnknownClassException', 'InvalidPackagePathException', 'ArgumentTypeMismatchException', 'InvalidRouteException', 'InvalidControllerException', 'MissingControllerException', 'InvalidTemplateException', 'MissingTemplateException', 'InvalidViewException', 'InvalidDataSourceException', 'DataSourceConnectionException', 'DatabaseConnectionException', 'InvalidModelException', 'MissingModelException', 'DatabaseORMException', 'DatabaseDataRowException', 'InvalidModelDataRowException'), EXCEPTION);
<?php /* * Created by Hei */ SimPHPfy::definePackage(array('FileUtility'), SIMPHPFY_UTILITY);
<?php /* * Created by Hei */ SimPHPfy::definePackage(array('Router', 'Route', 'Request'), ROUTER);
<?php /* * Created by Hei */ SimPHPfy::definePackage(array('DataSource', 'Model', 'DatabaseORM', 'ModelDataRow', 'Validator'), SIMPHPFY_MODEL);