本文整理汇总了PHP中ZurmoConfigurationUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoConfigurationUtil类的具体用法?PHP ZurmoConfigurationUtil怎么用?PHP ZurmoConfigurationUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZurmoConfigurationUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preFilter
protected function preFilter($filterChain)
{
$sendGridPluginEnabled = (bool) ZurmoConfigurationUtil::getByModuleName('SendGridModule', 'enableSendgrid');
try {
if ($sendGridPluginEnabled) {
SendGridEmailAccount::getByUserAndName(Yii::app()->user->userModel, null);
} else {
EmailAccount::getByUserAndName(Yii::app()->user->userModel);
}
} catch (NotFoundException $e) {
$redirectUrl = Yii::app()->request->getParam('redirectUrl');
if ($sendGridPluginEnabled) {
try {
EmailAccount::getByUserAndName(Yii::app()->user->userModel);
} catch (NotFoundException $ex) {
$messageView = new NoUserEmailConfigurationYetView($redirectUrl);
$view = new ModalView($this->controller, $messageView);
Yii::app()->getClientScript()->setToAjaxMode();
echo $view->render();
return false;
}
} else {
$messageView = new NoUserEmailConfigurationYetView($redirectUrl);
$view = new ModalView($this->controller, $messageView);
Yii::app()->getClientScript()->setToAjaxMode();
echo $view->render();
return false;
}
}
return true;
}
示例2: 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);
}
示例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: testListDefault
public function testListDefault()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
ZurmoConfigurationUtil::setByUserAndModuleName($super, 'ZurmoModule', 'defaultPermissionSetting', null);
ZurmoConfigurationUtil::setByUserAndModuleName($super, 'ZurmoModule', 'defaultPermissionGroupSetting', null);
$this->assertNull(UserConfigurationFormAdapter::resolveAndGetValue($super, 'defaultPermissionGroupSetting', false));
$this->assertEquals(UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($super), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE);
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$response = $this->listDefaultPermissionsForCurrentUser($headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertArrayHasKey('data', $response);
$this->assertCount(2, $response['data']);
$this->assertArrayHasKey('owner', $response['data']);
$this->assertCount(1, $response['data']['owner']);
$this->assertArrayHasKey('id', $response['data']['owner']);
$this->assertEquals($super->id, $response['data']['owner']['id']);
$this->assertArrayHasKey('explicitReadWriteModelPermissions', $response['data']);
$this->assertCount(2, $response['data']['explicitReadWriteModelPermissions']);
$this->assertArrayHasKey('type', $response['data']['explicitReadWriteModelPermissions']);
$this->assertEquals(1, $response['data']['explicitReadWriteModelPermissions']['type']);
$this->assertArrayHasKey('nonEveryoneGroup', $response['data']['explicitReadWriteModelPermissions']);
$this->assertEquals('', $response['data']['explicitReadWriteModelPermissions']['nonEveryoneGroup']);
}
示例5: setConfigForKey
protected static function setConfigForKey($key, $value)
{
if ($key == 'bounceImapPassword') {
$value = ZurmoPasswordSecurityUtil::encrypt($value);
}
ZurmoConfigurationUtil::setByModuleName(static::CONFIG_MODULE_NAME, $key, $value);
}
示例6: renderContent
protected function renderContent()
{
$homeUrl = Yii::app()->createUrl('home/default');
$content = '<div class="clearfix">';
$content .= '<a href="#" id="nav-trigger" title="Toggle Navigation">›</a>';
$content .= '<div id="corp-logo">';
if ($logoFileModelId = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'logoFileModelId')) {
$logoFileModel = FileModel::getById($logoFileModelId);
$logoFileSrc = Yii::app()->getAssetManager()->getPublishedUrl(Yii::getPathOfAlias('application.runtime.uploads') . DIRECTORY_SEPARATOR . $logoFileModel->name);
} else {
$logoFileSrc = Yii::app()->themeManager->baseUrl . '/default/images/Zurmo_logo.png';
}
$logoHeight = ZurmoConfigurationFormAdapter::resolveLogoHeight();
$logoWidth = ZurmoConfigurationFormAdapter::resolveLogoWidth();
if (Yii::app()->userInterface->isMobile()) {
$content .= '<a href="' . $homeUrl . '"><img src="' . $logoFileSrc . '" alt="Zurmo Logo" /></a>';
//make sure width and height are NEVER defined
} else {
$content .= '<a href="' . $homeUrl . '"><img src="' . $logoFileSrc . '" alt="Zurmo Logo" height="' . $logoHeight . '" width="' . $logoWidth . '" /></a>';
}
if ($this->applicationName != null) {
$content .= ZurmoHtml::tag('span', array(), $this->applicationName);
}
$content .= '</div>';
if (!empty($this->userMenuItems) && !empty($this->settingsMenuItems)) {
$content .= '<div id="user-toolbar" class="clearfix">';
$content .= static::renderHeaderMenus($this->userMenuItems, $this->settingsMenuItems);
$content .= '</div>';
}
$content .= '</div>';
return $content;
}
示例7: getGeoCodeApiKey
/**
* Gets the geocode api key from the cofig table.
* @return string $apiKey or null - geocode Api Key.
*/
public static function getGeoCodeApiKey()
{
if (null != ($apiKey = ZurmoConfigurationUtil::getByModuleName('MapsModule', 'googleMapApiKey'))) {
return $apiKey;
} else {
return null;
}
}
示例8: getTitle
public function getTitle()
{
$applicationName = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'applicationName');
if ($applicationName != null) {
$applicationName = ' - ' . $applicationName;
}
return Zurmo::t('MarketingListsModule', 'My Subscriptions') . $applicationName;
}
示例9: getMaxCount
/**
* @return int
*/
public static function getMaxCount()
{
$maxCount = ZurmoConfigurationUtil::getByModuleName(static::CONFIG_MODULE_NAME, static::CONFIG_KEY);
if ($maxCount == null) {
$maxCount = static::$maxCount;
}
return (int) $maxCount;
}
示例10: getTitle
/**
* Get the global page title value.
* @return string - page title.
*/
public function getTitle()
{
if (null != ($pageTitle = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'pageTitle'))) {
return $pageTitle;
} else {
return Zurmo::t('ZurmoModule', 'ZurmoCRM');
}
}
示例11: 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);
}
示例12: isSetCaptchaKeys
protected function isSetCaptchaKeys()
{
$reCaptchaPrivateKey = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'reCaptchaPrivateKey');
$reCaptchaPublicKey = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'reCaptchaPublicKey');
if ($reCaptchaPrivateKey === null || empty($reCaptchaPrivateKey) || $reCaptchaPublicKey === null || empty($reCaptchaPublicKey)) {
return false;
}
return true;
}
示例13: 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;
}
示例14: 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);
}
示例15: __construct
public function __construct(CController $controller, SplashView $splashView)
{
$applicationName = ZurmoConfigurationUtil::getByModuleName('ZurmoModule', 'applicationName');
$header = new HeaderLinksView(array(), array());
$gridView = new GridView(3, 1);
$gridView->setView($header, 0, 0);
$gridView->setView($splashView, 1, 0);
$gridView->setView(new FooterView(), 2, 0);
parent::__construct($gridView);
}