本文整理汇总了PHP中ZurmoConfigurationUtil::setByModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoConfigurationUtil::setByModuleName方法的具体用法?PHP ZurmoConfigurationUtil::setByModuleName怎么用?PHP ZurmoConfigurationUtil::setByModuleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZurmoConfigurationUtil
的用法示例。
在下文中一共展示了ZurmoConfigurationUtil::setByModuleName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setContentByType
/**
* @param string $content
* @param bool $isHtmlContent
*/
public static function setContentByType($content, $isHtmlContent)
{
assert('is_string($content)');
assert('is_bool($isHtmlContent)');
$key = static::resolveConfigKeyByContentType((bool) $isHtmlContent);
ZurmoConfigurationUtil::setByModuleName(static::CONFIG_MODULE_NAME, $key, $content);
}
示例2: setConfigForKey
protected static function setConfigForKey($key, $value)
{
if ($key == 'bounceImapPassword') {
$value = ZurmoPasswordSecurityUtil::encrypt($value);
}
ZurmoConfigurationUtil::setByModuleName(static::CONFIG_MODULE_NAME, $key, $value);
}
示例3: testMakeFormAndSetConfigurationFromForm
public function testMakeFormAndSetConfigurationFromForm()
{
$billy = User::getByUsername('billy');
Yii::app()->timeZoneHelper->setTimeZone('America/New_York');
Yii::app()->pagination->setGlobalValueByType('listPageSize', 50);
Yii::app()->pagination->setGlobalValueByType('subListPageSize', 51);
Yii::app()->pagination->setGlobalValueByType('modalListPageSize', 52);
Yii::app()->pagination->setGlobalValueByType('dashboardListPageSize', 53);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'applicationName', 'demoCompany');
$form = ZurmoConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('America/New_York', $form->timeZone);
$this->assertEquals(50, $form->listPageSize);
$this->assertEquals(51, $form->subListPageSize);
$this->assertEquals(52, $form->modalListPageSize);
$this->assertEquals(53, $form->dashboardListPageSize);
$this->assertEquals('demoCompany', $form->applicationName);
$form->timeZone = 'America/Chicago';
$form->listPageSize = 60;
$form->subListPageSize = 61;
$form->modalListPageSize = 62;
$form->dashboardListPageSize = 63;
$form->applicationName = 'demoCompany2';
ZurmoConfigurationFormAdapter::setConfigurationFromForm($form);
$form = ZurmoConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('America/Chicago', $form->timeZone);
$this->assertEquals(60, $form->listPageSize);
$this->assertEquals(61, $form->subListPageSize);
$this->assertEquals(62, $form->modalListPageSize);
$this->assertEquals(63, $form->dashboardListPageSize);
$this->assertEquals('demoCompany2', $form->applicationName);
}
示例4: testResolveApplicationName
/**
* @depends testResolveBaseUrl
*/
public function testResolveApplicationName()
{
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'applicationName', 'Demo App');
$resolvedApplicationName = SpecialMergeTagsAdapter::resolve('applicationName', null);
$expectedApplicationName = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'applicationName');
$this->assertNotNull($resolvedApplicationName);
$this->assertEquals($expectedApplicationName, $resolvedApplicationName);
}
示例5: run
/**
* A test job. This test job will update the config table with a datetime stamp.
* (non-PHPdoc)
* @see BaseJob::run()
*/
public function run()
{
ZurmoConfigurationUtil::setByModuleName('JobsManagerModule', 'test', $this->testValue);
if ($this->causeFailure) {
$this->errorMessage = 'The test job failed';
return false;
}
return true;
}
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
if (Yii::app()->params['testGoogleGeoCodeApiKey'] != null) {
ZurmoConfigurationUtil::setByModuleName('MapsModule', 'googleMapApiKey', Yii::app()->params['testGoogleGeoCodeApiKey']);
}
Yii::app()->user->userModel = $super;
AddressGeoCodeTestHelper::createAndRemoveAccountWithAddress($super);
}
示例7: testMakeFormAndSetConfigurationFromForm
public function testMakeFormAndSetConfigurationFromForm()
{
$billy = User::getByUsername('billy');
Yii::app()->timeZoneHelper->setTimeZone('America/New_York');
Yii::app()->pagination->setGlobalValueByType('listPageSize', 50);
Yii::app()->pagination->setGlobalValueByType('subListPageSize', 51);
Yii::app()->pagination->setGlobalValueByType('modalListPageSize', 52);
Yii::app()->pagination->setGlobalValueByType('dashboardListPageSize', 53);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'applicationName', 'demoCompany');
$logoFileName = 'testLogo.png';
$logoFilePath = Yii::getPathOfAlias('application.modules.zurmo.tests.unit.files') . DIRECTORY_SEPARATOR . $logoFileName;
ZurmoConfigurationFormAdapter::resizeLogoImageFile($logoFilePath, $logoFilePath, null, ZurmoConfigurationForm::DEFAULT_LOGO_HEIGHT);
$logoFileId = ZurmoConfigurationFormAdapter::saveLogoFile($logoFileName, $logoFilePath, 'logoFileModelId');
ZurmoConfigurationFormAdapter::publishLogo($logoFileName, $logoFilePath);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'logoFileModelId', $logoFileId);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'logoThumbFileModelId', $logoFileId);
$form = ZurmoConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('America/New_York', $form->timeZone);
$this->assertEquals(50, $form->listPageSize);
$this->assertEquals(51, $form->subListPageSize);
$this->assertEquals(52, $form->modalListPageSize);
$this->assertEquals(53, $form->dashboardListPageSize);
$this->assertEquals('demoCompany', $form->applicationName);
$this->assertEquals(AutoresponderOrCampaignBatchSizeConfigUtil::CONFIG_DEFAULT_VALUE, $form->autoresponderOrCampaignBatchSize);
$this->assertEquals(UnsubscribeAndManageSubscriptionsPlaceholderUtil::getContentByType(false), $form->autoresponderOrCampaignFooterPlainText);
$this->assertEquals(UnsubscribeAndManageSubscriptionsPlaceholderUtil::getContentByType(true), $form->autoresponderOrCampaignFooterRichText);
$this->assertEquals($logoFileName, $form->logoFileData['name']);
$form->timeZone = 'America/Chicago';
$form->listPageSize = 60;
$form->subListPageSize = 61;
$form->modalListPageSize = 62;
$form->dashboardListPageSize = 63;
$form->applicationName = 'demoCompany2';
$form->autoresponderOrCampaignBatchSize = 20;
$logoFileName2 = 'testLogo2.png';
$form->autoresponderOrCampaignFooterPlainText = 'abc';
$form->autoresponderOrCampaignFooterRichText = 'def';
$logoFilePath2 = Yii::getPathOfAlias('application.modules.zurmo.tests.unit.files') . DIRECTORY_SEPARATOR . $logoFileName2;
copy($logoFilePath2, sys_get_temp_dir() . DIRECTORY_SEPARATOR . $logoFileName2);
copy($logoFilePath2, sys_get_temp_dir() . DIRECTORY_SEPARATOR . ZurmoConfigurationForm::LOGO_THUMB_FILE_NAME_PREFIX . $logoFileName2);
Yii::app()->user->setState('logoFileName', $logoFileName2);
ZurmoConfigurationFormAdapter::setConfigurationFromForm($form);
$form = ZurmoConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('America/Chicago', $form->timeZone);
$this->assertEquals(60, $form->listPageSize);
$this->assertEquals(61, $form->subListPageSize);
$this->assertEquals(62, $form->modalListPageSize);
$this->assertEquals(63, $form->dashboardListPageSize);
$this->assertEquals('demoCompany2', $form->applicationName);
$this->assertEquals(20, $form->autoresponderOrCampaignBatchSize);
$this->assertEquals('abc', $form->autoresponderOrCampaignFooterPlainText);
$this->assertEquals('def', $form->autoresponderOrCampaignFooterRichText);
$this->assertEquals($logoFileName2, $form->logoFileData['name']);
}
示例8: setConfigurationFromForm
/**
* Given a ZurmoConfigurationForm, save the configuration global values.
*/
public static function setConfigurationFromForm(ZurmoConfigurationForm $form)
{
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'applicationName', $form->applicationName);
Yii::app()->timeZoneHelper->setGlobalValue((string) $form->timeZone);
Yii::app()->pagination->setGlobalValueByType('listPageSize', (int) $form->listPageSize);
Yii::app()->pagination->setGlobalValueByType('subListPageSize', (int) $form->subListPageSize);
Yii::app()->pagination->setGlobalValueByType('modalListPageSize', (int) $form->modalListPageSize);
Yii::app()->pagination->setGlobalValueByType('dashboardListPageSize', (int) $form->dashboardListPageSize);
Yii::app()->emailHelper->setDefaultFromAddress($form->defaultFromEmailAddress);
Yii::app()->emailHelper->setDefaultTestToAddress($form->defaultTestToEmailAddress);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'gamificationModalNotificationsEnabled', (bool) $form->gamificationModalNotificationsEnabled);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'gamificationModalCollectionsEnabled', (bool) $form->gamificationModalCollectionsEnabled);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'gamificationModalCoinsEnabled', (bool) $form->gamificationModalCoinsEnabled);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'realtimeUpdatesEnabled', (bool) $form->realtimeUpdatesEnabled);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'reCaptchaPrivateKey', $form->reCaptchaPrivateKey);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'reCaptchaPublicKey', $form->reCaptchaPublicKey);
}
示例9: actionConfigurationView
/**
* Admin configuration action for entering the google map api key.
*/
public function actionConfigurationView()
{
$configurationForm = new MapsConfigurationForm();
$configurationForm->apiKey = Yii::app()->mappingHelper->getGeoCodeApiKey();
$postVariableName = get_class($configurationForm);
if (isset($_POST[$postVariableName])) {
$configurationForm->setAttributes($_POST[$postVariableName]);
if ($configurationForm->validate()) {
ZurmoConfigurationUtil::setByModuleName('MapsModule', 'googleMapApiKey', $configurationForm->apiKey);
Yii::app()->user->setFlash('notification', Zurmo::t('MapsModule', 'Maps configuration saved successfully.'));
$this->redirect(Yii::app()->createUrl('maps/default/configurationView'));
}
}
$editView = new MapConfigurationView('Edit', $this->getId(), $this->getModule()->getId(), $configurationForm);
$editView->setCssClasses(array('AdministrativeArea'));
$view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeStandardViewForCurrentUser($this, $editView));
echo $view->render();
}
示例10: testMakeFormAndSetConfigurationFromForm
public function testMakeFormAndSetConfigurationFromForm()
{
$form = BounceConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertNull($form->imapHost);
$this->assertNull($form->imapPort);
$this->assertNull($form->imapUsername);
$this->assertNull($form->imapPassword);
$this->assertNull($form->imapSSL);
$this->assertNull($form->imapFolder);
$this->assertNull($form->returnPath);
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceImapHost', 'bounce.com');
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceImapPort', '420');
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceImapSSL', '1');
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceImapUsername', 'bouncy');
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceImapPassword', ZurmoPasswordSecurityUtil::encrypt('bounces'));
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceImapFolder', 'BOUNCES');
ZurmoConfigurationUtil::setByModuleName('EmailMessagesModule', 'bounceReturnPath', 'bounce@bounce.com');
$form = BounceConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('bounce.com', $form->imapHost);
$this->assertEquals('420', $form->imapPort);
$this->assertEquals('bouncy', $form->imapUsername);
$this->assertEquals('bounces', $form->imapPassword);
$this->assertEquals('1', $form->imapSSL);
$this->assertEquals('BOUNCES', $form->imapFolder);
$this->assertEquals('bounce@bounce.com', $form->returnPath);
$form = BounceConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$form->imapHost = 'example.com';
$form->imapPort = '111';
$form->imapSSL = '0';
$form->imapUsername = 'user';
$form->imapPassword = 'password';
$form->imapFolder = 'folder';
$form->returnPath = 'path';
BounceConfigurationFormAdapter::setConfigurationFromForm($form);
$form = BounceConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('example.com', $form->imapHost);
$this->assertEquals('111', $form->imapPort);
$this->assertEquals('user', $form->imapUsername);
$this->assertEquals('password', $form->imapPassword);
$this->assertEquals('0', $form->imapSSL);
$this->assertEquals('folder', $form->imapFolder);
$this->assertEquals('path', $form->returnPath);
}
示例11: makeAll
/**
* @param DemoDataHelper $demoDataHelper
*/
public function makeAll(&$demoDataHelper)
{
assert('$demoDataHelper instanceof DemoDataHelper');
$currency = new Currency();
$currency->code = 'EUR';
$currency->rateToBase = 1.5;
$saved = $currency->save();
assert('$saved');
$currency = new Currency();
$currency->code = 'CAD';
$currency->rateToBase = 1.1;
$saved = $currency->save();
assert('$saved');
$currency = new Currency();
$currency->code = 'JPY';
$currency->rateToBase = 0.75;
$saved = $currency->save();
assert('$saved');
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'applicationName', 'Demo Company Inc.');
}
示例12: testMakeFormAndSetConfigurationFromForm
public function testMakeFormAndSetConfigurationFromForm()
{
$billy = User::getByUsername('billy');
Yii::app()->themeManager->customThemeColorsArray = array('#111111', '#222222', '#333333');
Yii::app()->themeManager->globalThemeColor = 'custom';
Yii::app()->themeManager->forceAllUsersTheme = true;
$logoFileName = 'testLogo.png';
$logoFilePath = Yii::getPathOfAlias('application.modules.zurmo.tests.unit.files') . DIRECTORY_SEPARATOR . $logoFileName;
ZurmoUserInterfaceConfigurationFormAdapter::resizeLogoImageFile($logoFilePath, $logoFilePath, null, ZurmoUserInterfaceConfigurationForm::DEFAULT_LOGO_HEIGHT);
$logoFileId = ZurmoUserInterfaceConfigurationFormAdapter::saveLogoFile($logoFileName, $logoFilePath, 'logoFileModelId');
ZurmoUserInterfaceConfigurationFormAdapter::publishLogo($logoFileName, $logoFilePath);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'logoFileModelId', $logoFileId);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'logoThumbFileModelId', $logoFileId);
//Getting values
$form = ZurmoUserInterfaceConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals($logoFileName, $form->logoFileData['name']);
$this->assertEquals('custom', $form->themeColor);
$this->assertEquals('#111111', $form->customThemeColor1);
$this->assertEquals('#222222', $form->customThemeColor2);
$this->assertEquals('#333333', $form->customThemeColor3);
$this->assertEquals('1', $form->forceAllUsersTheme);
//Setting values
$form->themeColor = 'lime';
$form->customThemeColor1 = '#999999';
$form->customThemeColor2 = '#888888';
$form->customThemeColor3 = '#777777';
$form->forceAllUsersTheme = false;
$logoFileName2 = 'testLogo2.png';
$logoFilePath2 = Yii::getPathOfAlias('application.modules.zurmo.tests.unit.files') . DIRECTORY_SEPARATOR . $logoFileName2;
copy($logoFilePath2, sys_get_temp_dir() . DIRECTORY_SEPARATOR . $logoFileName2);
copy($logoFilePath2, sys_get_temp_dir() . DIRECTORY_SEPARATOR . ZurmoUserInterfaceConfigurationForm::LOGO_THUMB_FILE_NAME_PREFIX . $logoFileName2);
Yii::app()->user->setState('logoFileName', $logoFileName2);
ZurmoUserInterfaceConfigurationFormAdapter::setConfigurationFromForm($form);
$form = ZurmoUserInterfaceConfigurationFormAdapter::makeFormFromGlobalConfiguration();
$this->assertEquals('lime', $form->themeColor);
$this->assertEquals('#999999', $form->customThemeColor1);
$this->assertEquals('#888888', $form->customThemeColor2);
$this->assertEquals('#777777', $form->customThemeColor3);
$this->assertEquals(false, $form->forceAllUsersTheme);
$this->assertEquals($logoFileName2, $form->logoFileData['name']);
}
示例13: actionConfigurationView
/**
* Admin configuration action for enabling sendgrid plugin.
*/
public function actionConfigurationView()
{
$breadCrumbLinks = array(Zurmo::t('SendGridModule', 'SendGrid Configuration'));
$configurationForm = new SendGridConfigurationForm();
$configurationForm->enableSendgrid = (bool) ZurmoConfigurationUtil::getByModuleName('SendGridModule', 'enableSendgrid');
$postVariableName = get_class($configurationForm);
if (isset($_POST[$postVariableName])) {
$_POST[$postVariableName]['enableSendgrid'] = (bool) $_POST[$postVariableName]['enableSendgrid'];
$configurationForm->setAttributes($_POST[$postVariableName]);
if ($configurationForm->validate()) {
ZurmoConfigurationUtil::setByModuleName('SendGridModule', 'enableSendgrid', $configurationForm->enableSendgrid);
Yii::app()->user->setFlash('notification', Zurmo::t('SendGridModule', 'Sendgrid configuration saved successfully.'));
if ($configurationForm->enableSendgrid) {
$this->redirect(Yii::app()->createUrl('sendGrid/default/configurationEditOutbound'));
} else {
$this->redirect(Yii::app()->createUrl('sendGrid/default/configurationView'));
}
}
}
$editView = new SendGridConfigurationView('Edit', $this->getId(), $this->getModule()->getId(), $configurationForm);
$editView->setCssClasses(array('AdministrativeArea'));
$view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editView, $breadCrumbLinks, 'PluginsBreadCrumbView'));
echo $view->render();
}
示例14: setGlobalValueByType
/**
* Set the global pagination value by pagination type.
* @param $type - pagination type
* @param $value - integer pagination value.
* @param $moduleName - optional. Module class name.
*/
public function setGlobalValueByType($type, $value, $moduleName = null)
{
assert('in_array($type, static::getAvailablePageSizeNames()) == true');
assert('is_int($value) && $value > 0');
assert('$moduleName == null || is_string($moduleName)');
$keyName = $this->getKeyByTypeAndModuleName($type);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', $keyName, $value);
}
示例15: testDesktopNotifications
/**
* Test for the desktopNotifications managed by the ZurmoNotificationUtil
*/
public function testDesktopNotifications()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$content = $this->runControllerWithNoExceptionsAndGetContent('zurmo/default/about');
$this->assertNotContains('startAutoUpdater', $content);
ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'realtimeUpdatesEnabled', (bool) true);
$content = $this->runControllerWithNoExceptionsAndGetContent('zurmo/default/about');
$this->assertContains('startAutoUpdater', $content);
}