本文整理匯總了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);
}