public function getPredefinedBreadcrumbLinks($type, $project = null) { $i18n = Context::getI18n(); $links = array(); switch ($type) { case 'main_links': $links[] = array('url' => Context::getRouting()->generate('home'), 'title' => $i18n->__('Frontpage')); $links[] = array('url' => Context::getRouting()->generate('dashboard'), 'title' => $i18n->__('Personal dashboard')); $links[] = array('title' => $i18n->__('Issues')); $links[] = array('title' => $i18n->__('Teams')); $links[] = array('title' => $i18n->__('Clients')); $links = Event::createNew('core', 'breadcrumb_main_links', null, array(), $links)->trigger()->getReturnList(); if (Context::getUser()->canAccessConfigurationPage()) { $links[] = array('url' => make_url('configure'), 'title' => $i18n->__('Configure %sitename', array('%sitename' => Settings::getSiteHeaderName()))); } $links[] = array('url' => Context::getRouting()->generate('about'), 'title' => $i18n->__('About %sitename', array('%sitename' => Settings::getSiteHeaderName()))); $links[] = array('url' => Context::getRouting()->generate('account'), 'title' => $i18n->__('Account details')); break; case 'project_summary': $links['project_dashboard'] = array('url' => Context::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $i18n->__('Dashboard')); $links['project_releases'] = array('url' => Context::getRouting()->generate('project_release_center', array('project_key' => $project->getKey())), 'title' => $i18n->__('Releases')); $links['project_roadmap'] = array('url' => Context::getRouting()->generate('project_roadmap', array('project_key' => $project->getKey())), 'title' => $i18n->__('Roadmap')); $links['project_team'] = array('url' => Context::getRouting()->generate('project_team', array('project_key' => $project->getKey())), 'title' => $i18n->__('Team overview')); $links['project_statistics'] = array('url' => Context::getRouting()->generate('project_statistics', array('project_key' => $project->getKey())), 'title' => $i18n->__('Statistics')); $links['project_timeline'] = array('url' => Context::getRouting()->generate('project_timeline', array('project_key' => $project->getKey())), 'title' => $i18n->__('Timeline')); $links['project_issues'] = array('url' => Context::getRouting()->generate('project_issues', array('project_key' => $project->getKey())), 'title' => $i18n->__('Issues')); $links = Event::createNew('core', 'breadcrumb_project_links', null, array(), $links)->trigger()->getReturnList(); $links['project_release_center'] = array('url' => Context::getRouting()->generate('project_release_center', array('project_key' => $project->getKey())), 'title' => $i18n->__('Release center')); $links['project_settings'] = array('url' => Context::getRouting()->generate('project_settings', array('project_key' => $project->getKey())), 'title' => $i18n->__('Settings')); break; case 'client_list': foreach (\thebuggenie\core\entities\Client::getAll() as $client) { if ($client->hasAccess()) { $links[] = array('url' => Context::getRouting()->generate('client_dashboard', array('client_id' => $client->getID())), 'title' => $client->getName()); } } break; case 'team_list': foreach (\thebuggenie\core\entities\Team::getAll() as $team) { if ($team->hasAccess()) { $links[] = array('url' => Context::getRouting()->generate('team_dashboard', array('team_id' => $team->getID())), 'title' => $team->getName()); } } break; } return $links; }
public static function initialize() { // The time the script was loaded $starttime = explode(' ', microtime()); define('NOW', $starttime[1]); // Set the start time self::setLoadStart($starttime[1] + $starttime[0]); // Start loading Caspar Logging::log('Initializing Caspar framework'); Logging::log('PHP_SAPI says "' . \PHP_SAPI . '"'); Logging::log('PHP_VERSION_ID says "' . \PHP_VERSION_ID . '"'); Logging::log('PHP_VERSION says "' . \PHP_VERSION . '"'); Logging::log(Cache::isInMemorycacheEnabled() ? 'APC cache is enabled' : 'APC cache is not enabled'); require CASPAR_APPLICATION_PATH . 'bootstrap.inc.php'; self::loadConfiguration(); self::initializeServices(); self::loadRoutes(); Logging::log('Caspar framework loaded'); $event = Event::createNew('caspar/core', 'post_initialize')->trigger(); if (!self::isCLI()) { self::go(); } }
public function getPredefinedBreadcrumbLinks($type, $project = null) { $i18n = Context::getI18n(); $links = array(); switch ($type) { case 'main_links': $links[] = array('url' => Context::getRouting()->generate('home'), 'title' => $i18n->__('Frontpage')); $links[] = array('url' => Context::getRouting()->generate('dashboard'), 'title' => $i18n->__('Personal dashboard')); $links[] = array('title' => $i18n->__('Issues')); if (Context::getUser()->hasPageAccess('teamlist')) { $links[] = array('url' => make_url('team_list'), 'title' => $i18n->__('Teams')); } if (Context::getUser()->hasPageAccess('clientlist')) { $links[] = array('url' => make_url('client_list'), 'title' => $i18n->__('Clients')); } $links = Event::createNew('core', 'breadcrumb_main_links', null, array(), $links)->trigger()->getReturnList(); if (Context::getUser()->canAccessConfigurationPage()) { $links[] = array('url' => make_url('configure'), 'title' => $i18n->__('Configure %sitename', array('%sitename' => Settings::getSiteHeaderName()))); } $links[] = array('url' => Context::getRouting()->generate('about'), 'title' => $i18n->__('About %sitename', array('%sitename' => Settings::getSiteHeaderName()))); $links[] = array('url' => Context::getRouting()->generate('account'), 'title' => $i18n->__('Account details')); $root_projects = array_merge(\thebuggenie\core\entities\Project::getAllRootProjects(true), \thebuggenie\core\entities\Project::getAllRootProjects(false)); $first = true; foreach ($root_projects as $project) { if (!$project->hasAccess()) { continue; } if ($first) { $first = false; $links[] = array('separator' => true); } $links[] = array('url' => Context::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $project->getName()); } break; case 'project_summary': $links['project_dashboard'] = array('url' => Context::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $i18n->__('Dashboard')); $links['project_releases'] = array('url' => Context::getRouting()->generate('project_releases', array('project_key' => $project->getKey())), 'title' => $i18n->__('Releases')); $links['project_roadmap'] = array('url' => Context::getRouting()->generate('project_roadmap', array('project_key' => $project->getKey())), 'title' => $i18n->__('Roadmap')); $links['project_team'] = array('url' => Context::getRouting()->generate('project_team', array('project_key' => $project->getKey())), 'title' => $i18n->__('Team overview')); $links['project_statistics'] = array('url' => Context::getRouting()->generate('project_statistics', array('project_key' => $project->getKey())), 'title' => $i18n->__('Statistics')); $links['project_timeline'] = array('url' => Context::getRouting()->generate('project_timeline', array('project_key' => $project->getKey())), 'title' => $i18n->__('Timeline')); $links['project_issues'] = array('url' => Context::getRouting()->generate('project_issues', array('project_key' => $project->getKey())), 'title' => $i18n->__('Issues')); $links = Event::createNew('core', 'breadcrumb_project_links', null, array(), $links)->trigger()->getReturnList(); $links['project_release_center'] = array('url' => Context::getRouting()->generate('project_release_center', array('project_key' => $project->getKey())), 'title' => $i18n->__('Release center')); $links['project_settings'] = array('url' => Context::getRouting()->generate('project_settings', array('project_key' => $project->getKey())), 'title' => $i18n->__('Settings')); break; case 'client_list': foreach (\thebuggenie\core\entities\Client::getAll() as $client) { if ($client->hasAccess()) { $links[] = array('url' => Context::getRouting()->generate('client_dashboard', array('client_id' => $client->getID())), 'title' => $client->getName()); } } break; case 'team_list': foreach (\thebuggenie\core\entities\Team::getAll() as $team) { if ($team->hasAccess()) { $links[] = array('url' => Context::getRouting()->generate('team_dashboard', array('team_id' => $team->getID())), 'title' => $team->getName()); } } break; case 'configure': $config_sections = Settings::getConfigSections($i18n); foreach ($config_sections as $key => $sections) { foreach ($sections as $section) { if ($key == Settings::CONFIGURATION_SECTION_MODULES) { $url = is_array($section['route']) ? make_url($section['route'][0], $section['route'][1]) : make_url($section['route']); $links[] = array('url' => $url, 'title' => $section['description']); } else { $links[] = array('url' => make_url($section['route']), 'title' => $section['description']); } } } break; } return $links; }
/** * Present a template * @param string $template_file * @param array $params */ public static function presentTemplate($template_file, $params = array()) { Logging::log("configuring template variables for template {$template_file}"); foreach ($params as $key => $val) { ${$key} = $val; } if (array_key_exists('key', $params)) { $key = $params['key']; } if (array_key_exists('val', $params)) { $val = $params['val']; } /** * @global Request The request object */ $csp_request = Caspar::getRequest(); /** * @global Response The response object */ $csp_response = Caspar::getResponse(); /** * @global Request The request object */ $csp_routing = Caspar::getRouting(); /** * @global User The user object */ $csp_user = Caspar::getUser(); Caspar::loadLibrary('common'); Caspar::loadLibrary('ui'); Logging::log('rendering template output'); $___vars = Event::createNew('core', 'loadTemplateVariables')->trigger()->getReturnList(); foreach ($___vars as $k => $v) { ${$k} = $v; } require $template_file; }