$action = $env->request->get('action'); if ($controller == "admin/module/source") { $sublinks = array(); } $naviMain = new CMF_Hydrogen_View_Helper_Navigation_SingleList($links, NULL, 'layout-navigation-main-inner'); $naviMain = $naviMain->render($controller . '/' . $action, TRUE); $naviSub = ""; foreach ($sublinks as $path => $links) { if (substr($controller . '/', 0, strlen($path)) == $path) { $naviSub = new CMF_Hydrogen_View_Helper_Navigation_SingleList($links, NULL, 'layout-navigation-sub-inner'); $naviSub = $naviSub->render($controller, TRUE); } } $model = new Model_Instance($env); $optInstance = array('' => '-'); foreach ($model->getAll() as $instanceId => $instance) { $optInstance[$instanceId] = $instance->title; } asort($optInstance); $instanceId = $env->getSession()->get('instanceId'); $optInstance = UI_HTML_Elements::Options($optInstance, $instanceId); $badges = array(); $infos = array($words['footer_info']['copyright'], sprintf($words['footer_info']['date'], date('d.m.Y')), sprintf($words['footer_info']['time'], date('H:i:s'))); if (!$config->get('app.production')) { $infos[] = sprintf($words['footer_info']['time_stopped'], $env->getClock()->stop(0, 2)); if ($env->has('dbc') && $env->getDatabase()->numberStatements) { $infos[] = sprintf($words['footer_info']['requests'], $env->getDatabase()->numberStatements); } } $userId = (int) $session->get('userId'); $roleId = (int) $session->get('roleId');
protected function initRemote( $forceInstanceId = NULL ){ $messenger = $this->getMessenger(); $instance = $this; $this->remote = $this; // use own environment by default if( class_exists( 'Model_Instance' ) ){ // module for instance support is installed $model = new Model_Instance( $this ); // create model for reading instance settings $instances = $model->getAll(); // get all configured instances if( count( $instances ) == 1 ) // only one instance is configured $instance = array_pop( $instances ); // get this instance's environment else if( $instances ){ // several instances are configured $sessionedId = $this->session->get( 'instanceId' ); // if( $forceInstanceId ){ // an instance is forced if( !array_key_exists( $forceInstanceId, $instances ) ) // but not configured throw new InvalidArgumentException( 'Forced instance "'.$forceInstanceId.'" is not existing' ); $instance = $instances[$forceInstanceId]; // get forced instance's environment } else if( $sessionedId ){ // an instance has been selected before if( !array_key_exists( $sessionedId, $instances ) ){ // but is not configured anymore $this->session->remove( 'instanceId' ); // remove selected instance ID from session throw new InvalidArgumentException( 'Selected instance "'.$sessionedId.'" is not existing anymore' ); } $instance = $instances[$sessionedId]; // get instance environment } # else{ # $instance = $instances[array_shift( array_keys( $instances ) )]; # } } $pathApp = $instance->uri; $pathConfig = !empty( $instance->configPath ) ? $instance->configPath : "config/"; $fileConfig = !empty( $instance->configFile ) ? $instance->configFile : "config.ini"; if( !preg_match( '/^\//', $pathApp ) ) $pathApp = getEnv( 'DOCUMENT_ROOT' ).'/'.$pathApp; $options = array( 'configFile' => $pathApp.$pathConfig.$fileConfig, 'pathApp' => $pathApp ); try{ $this->remote = new CMF_Hydrogen_Environment_Remote( $options ); } catch( Exception $e ) { switch( $e->getCode() ){ case 503: $this->getMessenger()->noteError( 'Access to application denied: Server load to high' ); break; default: $this->getMessenger()->noteError( $e->getMessage() ); } $this->remote = new CMF_Hydrogen_Environment_Dummy( $options ); } $this->pathApp = $pathApp; $this->pathConfig = $pathApp.$pathConfig; } $this->clock->profiler->tick( 'env: remote' ); }
public function index( $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg4 = NULL, $arg5 = NULL ){ if( $this->env->getRequest()->has( 'resetInstanceId' ) ){ $this->env->getSession()->remove( 'instanceId' ); $this->restart( NULL ); } $logicInstance = Logic_Instance::getInstance( $this->env ); $modelInstance = new Model_Instance( $this->env ); $instances = $modelInstance->getAll(); foreach( $instances as $instanceId => $instance ){ $instance->modules = $logicInstance->listModules( $instanceId ); } $instanceId = $this->env->getSession()->get( 'instanceId' ); $this->addData( 'instances', $instances ); $this->addData( 'instanceId', $instanceId ); if( $instanceId ){ $remote = $this->env->getRemote(); $logicModule = Logic_Module::getInstance( $this->env ); $this->env->clock->profiler->tick( 'Index::index: init' ); $listModulesMissing = array(); $listModulesPossible = array(); $listModulesUpdate = array(); $modulesInstalled = array(); $modulesAll = $logicModule->model->getAll(); $this->env->clock->profiler->tick( 'Index::index: get all' ); if( $remote instanceof CMF_Hydrogen_Environment_Remote ){ $modulesInstalled = $remote->getModules()->getAll(); $this->env->clock->profiler->tick( 'Index::index: get installed' ); foreach( $modulesInstalled as $module ){ foreach( $module->relations->needs as $need ) if( !array_key_exists( $need, $modulesInstalled ) ) $listModulesMissing[] = $need; foreach( $module->relations->supports as $support ) if( !array_key_exists( $support, $modulesInstalled ) ) $listModulesPossible[] = $support; } $this->env->clock->profiler->tick( 'Index::index: get more' ); foreach( $modulesInstalled as $module ) if( $module->versionInstalled && $module->versionAvailable ) if( version_compare( $module->versionAvailable, $module->versionInstalled ) > 0 ) $listModulesUpdate[] = $module; foreach( $listModulesMissing as $module ){ $url = './admin/module/installer/index/'.$module; $link = UI_HTML_Tag::create( 'a', $module, array( 'href' => $url ) ); $span = UI_HTML_Tag::create( 'span', $link, array( 'class' => 'icon module module-status-4' ) ); $this->env->getMessenger()->noteFailure( 'Modul '.$span.' ist nicht vollständig installiert.' ); } $this->addData( 'remote', $remote ); $this->addData( 'remoteConfig', $remote->getConfig() ); } $this->addData( 'instance', $modelInstance->get( $instanceId ) ); $this->addData( 'modulesAll', $modulesAll ); $this->addData( 'modulesInstalled', $modulesInstalled ); $this->addData( 'modulesMissing', $listModulesMissing ); $this->addData( 'modulesPossible', $listModulesPossible ); $this->addData( 'modulesUpdate', $listModulesUpdate ); } $this->env->clock->profiler->tick( 'Index::index: done' ); }