/** * Generates the string url for a route and arguments. * * The "to" string parameter is the route name. * The "with" associative array parameter is the route arguments. * * Example usage: * <code> * {route "admin_create" with array( 'poClass' => 'yourClass' )} * </code> * * @param mixed $params array with "to" and eventually "with" * @return string Generated url. */ public static function reverseRoute($params) { $project = aiiProjectConfiguration::instance(); $routes = $project->createRouter(new ezcMvcRequest())->createRoutes(); $route = $routes[$params["to"]]; $url = $route->generateUrl($params["with"]); return $url; }
<?php // Include the configuration file include '../config.php'; // Instantiate the dispatcher configuration object. $project = aiiProjectConfiguration::instance(); // Send the configuration to the dispatcher, and run it. $dispatcher = new ezcMvcConfigurableDispatcher($project); $dispatcher->run();
<?php // {{{ class autoload setup define('EZC_TRUNK_PATH', join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'ezc', 'trunk'))); define('APPS_TRUNK_PATH', join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'apps'))); define('DOCTRINE_PATH', join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'doctrine'))); set_include_path(join(PATH_SEPARATOR, array(get_include_path(), EZC_TRUNK_PATH, APPS_TRUNK_PATH))); require join(DIRECTORY_SEPARATOR, array(DOCTRINE_PATH, 'lib', 'Doctrine.php')); spl_autoload_register(array('Doctrine', 'autoload')); require 'ezc/Base/src/base.php'; ezcBase::setRunMode(ezcBase::MODE_DEVELOPMENT); spl_autoload_register(array('ezcBase', 'autoload')); include dirname(__FILE__) . '/apps/dev/autoload_config.php'; // }}} Doctrine_Manager::connection("mysql://*****:*****@localhost/shared", 'main'); include 'framework_part0.php'; $project = aiiProjectConfiguration::instance(dirname(__FILE__), 'ocpsys'); $installedApps = array('core', 'admin', 'sites', 'dev', 'pages'); $appsPaths = array(); foreach ($installedApps as $appName) { // i know my apps are all in the same dir $appsPaths[] = join(DIRECTORY_SEPARATOR, array(APPS_TRUNK_PATH, $appName)); } $project->setUp($appsPaths); unset($installedApps); unset($appsPaths); unset($appName);
public static function configureObject($instance) { $project = aiiProjectConfiguration::instance(); $managers = array(); foreach ($project->apps as $app) { $manager = $project->getComponentConfig('PersistentObject', 'definitionsManager'); if (!$manager instanceof ezcPersistentDefinitionManager) { $testPath = join(DIRECTORY_SEPARATOR, array($app->path, $app->getComponentConfig('PersistentObject', 'definitionsPath'))); if (is_dir($testPath)) { $manager = new ezcPersistentCacheManager(new ezcPersistentCodeManager($testPath)); } } if ($manager instanceof ezcPersistentDefinitionManager) { $managers[] = $manager; } } $session = new ezcPersistentSession(ezcDbInstance::get(), new ezcPersistentMultiManager($managers)); return $session; }