Example #1
0
    $gSystemComponent =& $gCurrentSession->getObject('gSystemComponent');
    // read language data from session and assign them to the language object
    $gL10n->addLanguageData($gCurrentSession->getObject('gLanguageData'));
    // read organization data from session object
    $gCurrentOrganization =& $gCurrentSession->getObject('gCurrentOrganization');
    $gPreferences = $gCurrentOrganization->getPreferences();
} else {
    // create new session object and store it in PHP session
    $gCurrentSession = new Session($gDb, $gSessionId, $gCookiePraefix);
    $_SESSION['gCurrentSession'] = $gCurrentSession;
    // create system component
    $gSystemComponent = new Component($gDb);
    $gSystemComponent->readDataByColumns(array('com_type' => 'SYSTEM', 'com_name_intern' => 'CORE'));
    $gCurrentSession->addObject('gSystemComponent', $gSystemComponent);
    // create object of the organization of config file with their preferences
    if ($gCurrentSession->getOrganizationId() > 0) {
        $gCurrentOrganization = new Organization($gDb, $gCurrentSession->getOrganizationId());
    } else {
        $gCurrentOrganization = new Organization($gDb, $g_organization);
    }
    if ($gCurrentOrganization->getValue('org_id') === 0) {
        // organization not found
        exit('<div style="color: #cc0000;">Error: The organization of the config.php could not be found in the database!</div>');
    }
    // add the organization to the session
    $gPreferences = $gCurrentOrganization->getPreferences();
    $gCurrentSession->addObject('gCurrentOrganization', $gCurrentOrganization);
    $gCurrentSession->setValue('ses_org_id', $gCurrentOrganization->getValue('org_id'));
    // create a language data object and assign it to the language object
    $gLanguageData = new LanguageData($gPreferences['system_language']);
    $gL10n->addLanguageData($gLanguageData);