本文整理汇总了PHP中ZurmoConfigurationUtil::getForCurrentUserByModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoConfigurationUtil::getForCurrentUserByModuleName方法的具体用法?PHP ZurmoConfigurationUtil::getForCurrentUserByModuleName怎么用?PHP ZurmoConfigurationUtil::getForCurrentUserByModuleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZurmoConfigurationUtil
的用法示例。
在下文中一共展示了ZurmoConfigurationUtil::getForCurrentUserByModuleName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForCurrentUserByPortletIdAndKey
/**
* Get a persistent config value for current user against portletId and keyName.
* @param $portletId integer Id of the portlet or string representation of the unique id of the portlet to get value against
* @param $keyName string Name of the key that should be returned
* @param bool $returnBoolean bool Force return value to be boolean (explicit type casting)
* @return bool|null|string
*/
public static function getForCurrentUserByPortletIdAndKey($portletId, $keyName, $returnBoolean = false)
{
assert('is_int($portletId) || is_string($portletId)');
assert('is_string($keyName)');
$moduleName = static::getModuleName();
$keyName = static::resolveKeyNameByPortletId($portletId, $keyName);
$value = ZurmoConfigurationUtil::getForCurrentUserByModuleName($moduleName, $keyName);
if ($returnBoolean) {
$value = (bool) $value;
}
return $value;
}
示例2: testGetAndSetByCurrentUserByModuleName
public function testGetAndSetByCurrentUserByModuleName()
{
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertNull(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'aKey', 'aValue');
Yii::app()->user->userModel = User::getByUsername('billy');
$this->assertNull(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'aKey', 'bValue');
Yii::app()->user->userModel = User::getByUsername('sally');
$this->assertNull(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'aKey', 'cValue');
//now retrieve again.
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertEquals('aValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
Yii::app()->user->userModel = User::getByUsername('billy');
$this->assertEquals('bValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
Yii::app()->user->userModel = User::getByUsername('sally');
$this->assertEquals('cValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'aKey'));
//Test retrieving a generic value that is set globally on ZurmoModule. The value returned should be the
//same for all users.
$metadata = ZurmoModule::getMetadata();
$this->assertTrue(!isset($metadata['global']['bKey']));
$metadata['global']['bKey'] = 'GlobalValue';
ZurmoModule::setMetadata($metadata);
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
Yii::app()->user->userModel = User::getByUsername('billy');
$this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
Yii::app()->user->userModel = User::getByUsername('sally');
$this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
//Now change the bKey value, just for billy and retrieve again for all users. Only billy's bKey value
//should be different.
ZurmoConfigurationUtil::setByUserAndModuleName(User::getByUsername('billy'), 'ZurmoModule', 'bKey', 'BillyBKey');
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
Yii::app()->user->userModel = User::getByUsername('billy');
$this->assertEquals('BillyBKey', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
Yii::app()->user->userModel = User::getByUsername('sally');
$this->assertEquals('GlobalValue', ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'bKey'));
}
示例3: isCurrentUsersTimeZoneConfirmed
public function isCurrentUsersTimeZoneConfirmed()
{
$keyName = 'timeZoneConfirmed';
if (false != ZurmoConfigurationUtil::getForCurrentUserByModuleName('UsersModule', $keyName)) {
return true;
}
return false;
}
示例4: deleteModelFromRecentlyViewed
/**
* @param $moduleName
* @param RedBeanModel $model
*/
public static function deleteModelFromRecentlyViewed($moduleName, RedBeanModel $model)
{
if (!isset($model) || !isset($moduleName)) {
return;
}
$newItem = array($moduleName, $model->id, strval($model));
$recentlyViewed = unserialize(ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'recentlyViewed'));
if (!is_array($recentlyViewed)) {
return;
}
if (in_array($newItem, $recentlyViewed)) {
$key = array_search($newItem, $recentlyViewed);
unset($recentlyViewed[$key]);
array_keys($recentlyViewed);
}
ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'recentlyViewed', serialize($recentlyViewed));
}
示例5: testResolveNewRecentlyViewedModelAfterChangingName
public function testResolveNewRecentlyViewedModelAfterChangingName()
{
Yii::app()->user->userModel = User::getByUsername('super');
ZurmoConfigurationUtil::setForCurrentUserByModuleName('ZurmoModule', 'recentlyViewed', null);
$account1 = new Account();
$account1->name = 'For test recently viewed';
$this->assertTrue($account1->save());
AuditEventsRecentlyViewedUtil::resolveNewRecentlyViewedModel('AccountsModule', $account1, 2);
$this->assertEquals(serialize(array(array('AccountsModule', $account1->id, strval($account1)))), ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'recentlyViewed'));
$account1->name = 'new name for same account';
$this->assertTrue($account1->save());
AuditEventsRecentlyViewedUtil::resolveNewRecentlyViewedModel('AccountsModule', $account1, 2);
$this->assertEquals(serialize(array(array('AccountsModule', $account1->id, strval($account1)))), ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'recentlyViewed'));
AuditEventsRecentlyViewedUtil::resolveNewRecentlyViewedModel('ContactsModule', $account1, 2);
$this->assertEquals(serialize(array(array('ContactsModule', $account1->id, strval($account1)), array('AccountsModule', $account1->id, strval($account1)))), ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', 'recentlyViewed'));
}
示例6: getForCurrentUserByType
/**
* Get the pagination value for the current user by pagination type.
* @param $type - pagination type
* @param $moduleName - optional. Module class name.
* @return $pageSize - integer.
*/
public function getForCurrentUserByType($type, $moduleName = null)
{
assert('in_array($type, static::getAvailablePageSizeNames()) == true');
assert('$moduleName == null || is_string($moduleName)');
$keyName = $this->getKeyByTypeAndModuleName($type);
if (null != ($pageSize = ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', $keyName))) {
return $pageSize;
}
return $this->{'_' . $type};
}
示例7: actionToggleDismissIntroView
public function actionToggleDismissIntroView($moduleName, $panelId)
{
$value = (bool) ZurmoConfigurationUtil::getForCurrentUserByModuleName($moduleName, $panelId);
ZurmoConfigurationUtil::setForCurrentUserByModuleName($moduleName, $panelId, !$value);
}
示例8: isIntroViewDismissed
public function isIntroViewDismissed()
{
if (ZurmoConfigurationUtil::getForCurrentUserByModuleName($this->moduleName, $this->getPanelId())) {
return true;
}
return false;
}
示例9: isMenuCollapsed
public function isMenuCollapsed()
{
return (bool) ZurmoConfigurationUtil::getForCurrentUserByModuleName('ZurmoModule', static::TOGGLE_COLLAPSE_KEY);
}