本文整理匯總了PHP中Organization::setPreferences方法的典型用法代碼示例。如果您正苦於以下問題:PHP Organization::setPreferences方法的具體用法?PHP Organization::setPreferences怎麽用?PHP Organization::setPreferences使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Organization
的用法示例。
在下文中一共展示了Organization::setPreferences方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Organization
// there should be no error output because of safe mode
@set_time_limit(120);
$gDb->startTransaction();
// create new organization
$newOrganization = new Organization($gDb, $_POST['orgaShortName']);
$newOrganization->setValue('org_longname', $_POST['orgaLongName']);
$newOrganization->setValue('org_shortname', $_POST['orgaShortName']);
$newOrganization->setValue('org_homepage', $_SERVER['HTTP_HOST']);
$newOrganization->save();
// write all preferences from preferences.php in table adm_preferences
require_once '../../installation/db_scripts/preferences.php';
// set some specific preferences whose values came from user input of the installation wizard
$orga_preferences['email_administrator'] = $_POST['orgaEmail'];
$orga_preferences['system_language'] = $gPreferences['system_language'];
// create all necessary data for this organization
$newOrganization->setPreferences($orga_preferences, false);
$newOrganization->createBasicData($gCurrentUser->getValue('usr_id'));
// if installation of second organization than show organization select at login
if ($gCurrentOrganization->countAllRecords() === 2) {
$sql = 'UPDATE ' . TBL_PREFERENCES . ' SET prf_value = 1
WHERE prf_name = \'system_organization_select\' ';
$gDb->query($sql);
}
$gDb->endTransaction();
// create html page object
$page = new HtmlPage($gL10n->get('INS_SETUP_WAS_SUCCESSFUL'));
$page->addHtml('<p class="lead">' . $gL10n->get('ORG_ORGANIZATION_SUCCESSFULL_ADDED', $_POST['orgaLongName']) . '</p>');
// show form
$form = new HtmlForm('add_new_organization_form', $g_root_path . '/adm_program/modules/preferences/preferences.php', $page);
$form->addSubmitButton('btn_foward', $gL10n->get('SYS_NEXT'), array('icon' => THEME_PATH . '/icons/forward.png'));
// add form to html page and show page
示例2: substr
@set_time_limit(300);
$mainVersion = substr($installedDbVersion, 0, 1);
$subVersion = substr($installedDbVersion, 2, 1);
$microVersion = substr($installedDbVersion, 4, 1);
$microVersion = (int) $microVersion + 1;
$flagNextVersion = true;
// erst einmal die evtl. neuen Orga-Einstellungen in DB schreiben
require_once 'db_scripts/preferences.php';
// calculate the best cost value for your server performance
$benchmarkResults = PasswordHashing::costBenchmark();
$orga_preferences['system_hashing_cost'] = $benchmarkResults['cost'];
$sql = 'SELECT * FROM ' . TBL_ORGANIZATIONS;
$orgaStatement = $gDb->query($sql);
while ($row_orga = $orgaStatement->fetch()) {
$gCurrentOrganization->setValue('org_id', $row_orga['org_id']);
$gCurrentOrganization->setPreferences($orga_preferences, false);
}
if ($gDbType === 'mysql') {
// disable foreign key checks for mysql, so tables can easily deleted
$sql = 'SET foreign_key_checks = 0 ';
$gDb->query($sql);
}
// before version 3 we had an other update mechanism which will be handled here
if ($mainVersion < 3) {
// nun in einer Schleife die Update-Scripte fuer alle Versionen zwischen der Alten und Neuen einspielen
while ($flagNextVersion) {
$flagNextVersion = false;
if ($mainVersion < 3) {
// until version 3 Admidio had sql and php files where the update statements where stored
// these files must be executed
// in der Schleife wird geschaut ob es Scripte fuer eine Microversion (3.Versionsstelle) gibt