本文整理汇总了PHP中ContactsUtil::getContactStateDataKeyedByOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactsUtil::getContactStateDataKeyedByOrder方法的具体用法?PHP ContactsUtil::getContactStateDataKeyedByOrder怎么用?PHP ContactsUtil::getContactStateDataKeyedByOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactsUtil
的用法示例。
在下文中一共展示了ContactsUtil::getContactStateDataKeyedByOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Contact $model = null, $attributeName = null)
{
assert('$model != null');
assert('$attributeName != null && is_string($attributeName)');
parent::__construct($model, $attributeName);
$this->contactStatesData = ContactsUtil::getContactStateDataKeyedByOrder();
$this->contactStatesLabels = ContactsUtil::getContactStateLabelsKeyedByLanguageAndOrder();
$startingState = ContactsUtil::getStartingState();
$this->startingStateOrder = $startingState->order;
}
示例2: testSuperUserModifyContactStatesDefaultValueItemsInDropDown
/**
* @depends testLayoutsLoadOkAfterCustomFieldsPlacedForContactsModule
*/
public function testSuperUserModifyContactStatesDefaultValueItemsInDropDown()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//test existing ContactState changes to labels.
$extraPostData = array('startingStateOrder' => '4', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array('New', 'In ProgressD', 'RecycledC', 'QualifiedA', 'CustomerF', 'YRE'), 'contactStatesDataExistingValues' => array('New', 'In Progress', 'Recycled', 'Qualified', 'Customer', 'YRE'));
$this->createCustomAttributeWalkthroughSequence('ContactsModule', 'state', 'ContactState', $extraPostData, 'state');
$compareData = array('New', 'In ProgressD', 'RecycledC', 'QualifiedA', 'CustomerF', 'YRE');
$this->assertEquals($compareData, ContactsUtil::getContactStateDataKeyedByOrder());
//todo: test that the changed labels, updated the existing data if any existed.
//Removing ContactStates items
$extraPostData = array('startingStateOrder' => '2', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array('New', 'RecycledC', 'QualifiedA'));
$this->createCustomAttributeWalkthroughSequence('ContactsModule', 'state', 'ContactState', $extraPostData, 'state');
$compareData = array('New', 'RecycledC', 'QualifiedA');
$this->assertEquals($compareData, ContactsUtil::getContactStateDataKeyedByOrder());
//Adding ContactStates items
$extraPostData = array('startingStateOrder' => '2', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array('New', 'RecycledC', 'QualifiedA', 'NewItem', 'NewItem2'));
$this->createCustomAttributeWalkthroughSequence('ContactsModule', 'state', 'ContactState', $extraPostData, 'state');
$compareData = array('New', 'RecycledC', 'QualifiedA', 'NewItem', 'NewItem2');
$this->assertEquals($compareData, ContactsUtil::getContactStateDataKeyedByOrder());
//Changing order of ContactStates items
$extraPostData = array('startingStateOrder' => '2', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array('New', 'NewItem2', 'RecycledC', 'QualifiedA', 'NewItem'));
$this->createCustomAttributeWalkthroughSequence('ContactsModule', 'state', 'ContactState', $extraPostData, 'state');
$compareData = array('New', 'NewItem2', 'RecycledC', 'QualifiedA', 'NewItem');
$this->assertEquals($compareData, ContactsUtil::getContactStateDataKeyedByOrder());
//test trying to save 2 ContactStates with the same name (QualifiedA is twice)
$extraPostData = array('startingStateOrder' => '2', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array('New', 'NewItem2', 'QualifiedA', 'QualifiedA', 'NewItem'));
$this->setGetArray(array('moduleClassName' => 'ContactsModule', 'attributeTypeName' => 'ContactState', 'attributeName' => 'state'));
$this->setPostArray(array('ajax' => 'edit-form', 'ContactStateAttributeForm' => array_merge(array('attributeLabels' => $this->createAttributeLabelGoodValidationPostData('state'), 'attributeName' => 'state'), $extraPostData)));
$content = $this->runControllerWithExitExceptionAndGetContent('designer/default/attributeEdit');
$this->assertTrue(strlen($content) > 50);
//approximate, but should definetely be larger than 50.
//test trying to save 0 ContactStates
$extraPostData = array('startingStateOrder' => '2', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array());
$this->setPostArray(array('ajax' => 'edit-form', 'ContactStateAttributeForm' => array_merge(array('attributeLabels' => $this->createAttributeLabelGoodValidationPostData('state'), 'attributeName' => 'state'), $extraPostData)));
$content = $this->runControllerWithExitExceptionAndGetContent('designer/default/attributeEdit');
$this->assertTrue(strlen($content) > 50);
//approximate, but should definetely be larger than 50.
//test trying to save contact states that are shorter than the minimum length.
$extraPostData = array('startingStateOrder' => '2', 'isAudited' => '1', 'isRequired' => '1', 'contactStatesData' => array('NA', ' NB', 'NC'));
$this->setPostArray(array('ajax' => 'edit-form', 'ContactStateAttributeForm' => array_merge(array('attributeLabels' => $this->createAttributeLabelGoodValidationPostData('state'), 'attributeName' => 'state'), $extraPostData)));
$content = $this->runControllerWithExitExceptionAndGetContent('designer/default/attributeEdit');
$this->assertTrue(strlen($content) > 50);
//approximate, but should definetely be larger than 50.
}
示例3: testContactsUtilGetContactStateDataKeyedByOrder
public function testContactsUtilGetContactStateDataKeyedByOrder()
{
$contactStatesData = ContactsUtil::getContactStateDataKeyedByOrder();
$compareData = array(0 => 'New', 1 => 'In Progress', 2 => 'Recycled', 3 => 'Dead', 4 => 'Qualified', 5 => 'Customer', 6 => 'Novo Hermão');
$this->assertEquals($compareData, $contactStatesData);
}