Exemple #1
0
 public function MakeMenu(array $items)
 {
     $list = '';
     foreach ($items as $pageName => $pageDetails) {
         if (isset($pageDetails['attribs'])) {
             $attribs = self::_getAttribs($pageDetails['attribs']);
         } else {
             $attribs = '';
         }
         if (!isset($pageDetails['url']['category'])) {
             $pageDetails['url']['category'] = false;
         } else {
             $pageDetails['url']['category'] = (array) $pageDetails['url']['category'];
         }
         if (!isset($pageDetails['displayName'])) {
             if (Taplod_ObjectCache::isCached('PAGES')) {
                 $pageDetails['displayName'] = Taplod_ObjectCache::get('PAGES')->getLabelFor($pageName);
             } else {
                 $pageDetails['displayName'] = $pageName;
             }
         }
         if (Taplod_ObjectCache::get('URL')->isCurrentPage($pageName, $pageDetails['url']['category'])) {
             $attribs .= ' class="active"';
         }
         $args = isset($pageDetails['url']['arguments']) ? $pageDetails['url']['arguments'] : false;
         $url = Taplod_ObjectCache::get('URL')->buildUri($pageName, $args, $pageDetails['url']['category']);
         $list .= '<li' . $attribs . '><a href="' . $url . '">' . $pageDetails['displayName'] . '</a></li>' . "\n";
     }
     return '<ul>' . $list . '</ul>';
 }
Exemple #2
0
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemple #3
0
 protected function translate(array $items)
 {
     if (!Taplod_ObjectCache::isCached('PAGES')) {
         throw new Taplod_Exception('requested component "Taplod_Pages" not initialized.');
     }
     $pages = Taplod_ObjectCache::get('PAGES');
     $translated = array();
     foreach ($items as $k => $name) {
         $translated[$k] = $pages->getLabelFor($name);
     }
     return $translated;
 }
Exemple #4
0
<?php

/**
 * @category Ayaq
 * @copyright Copyright (c) 2009, Bellière Ludovic
 * @license http://opensource.org/licenses/mit-license.php MIT license
 */
error_reporting(E_ALL);
session_name('zombie_quizz');
session_start();
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/'));
set_include_path(realpath(APPLICATION_PATH . '/../inc') . PATH_SEPARATOR . get_include_path());
require_once 'functions.php';
require_once 'Taplod/Loader.php';
Taplod_Loader::registerAutoload();
$config = new Taplod_Config(require '../config.php');
Taplod_ObjectCache::set('config', $config);
try {
    require APPLICATION_PATH . '/bootstrap.php';
} catch (Exception $exception) {
    echo '<html><body><center>' . 'An exception occured while bootstrapping the application.';
    if (defined('APPLICATION_ENVIRONMENT') && APPLICATION_ENVIRONMENT != 'production') {
        echo '<br /><br />' . $exception->getMessage() . '<br />' . '<div align="left">Stack Trace:' . '<pre>' . $exception->getTraceAsString() . '</pre></div>';
        if ($exception instanceof Taplod_Db_Exception) {
            $trace = $exception->getTrace();
            echo '<div align="left">Query Trace:' . '<pre>' . $trace[0]['args'][0] . '</pre></div>';
        }
    }
    echo '</center></body></html>';
    exit(1);
}
Exemple #5
0
<?php

/**
 * @category Ayaq
 * @copyright Copyright (c) 2009, Bellière Ludovic
 * @license http://opensource.org/licenses/mit-license.php MIT license
 */
defined('APPLICATION_PATH') or define('APPLICATION_PATH', dirname(__FILE__));
defined('APPLICATION_ENVIRONMENT') or define('APPLICATION_ENVIRONMENT', 'development');
defined('TEMPLATE_PATH') or define('TEMPLATE_PATH', realpath(dirname(__FILE__) . '/../templates') . '/');
if (!isset($_SESSION['quizz_step'])) {
    // quizz_step = 0 -> n-1
    $_SESSION['quizz_step'] = 0;
}
mb_internal_encoding("UTF-8");
$db = Taplod_Db::factory('Pdo_Mysql', $config->db);
$db->exec("SET character_set_results='utf8'");
require_once 'Taplod/Url.php';
$url = Taplod_Url::getInstance($config->url);
Taplod_ObjectCache::set('URL', $url);
$tpl = new Taplod_Templates();
if ($category = $url->getCategoryPath()) {
    if (file_exists($category . 'bootstrap.php')) {
        require $category . 'bootstrap.php';
    }
    unset($category);
}
require $url->getPagePath() . '.php';