本文整理汇总了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