本文整理汇总了PHP中ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById方法的具体用法?PHP ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById怎么用?PHP ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactsUtil
的用法示例。
在下文中一共展示了ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeActiveCustomerEmailList
public static function makeActiveCustomerEmailList()
{
$contactStateIdsAndNames = ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById();
$report = new Report();
$report->setDescription('A report showing active customers who have not opted out of receiving emails');
$report->setModuleClassName('ContactsModule');
$report->setName('Active Customer Email List');
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setOwner(Yii::app()->user->userModel);
$report->setFiltersStructure('1 AND 2 AND 3');
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_BASE);
$filter = new FilterForReportForm('ContactsModule', 'Contact', $report->getType());
$filter->attributeIndexOrDerivedType = 'account___type';
$filter->value = 'Customer';
$filter->operator = OperatorRules::TYPE_EQUALS;
$report->addFilter($filter);
$filter = new FilterForReportForm('ContactsModule', 'Contact', $report->getType());
$filter->attributeIndexOrDerivedType = 'state';
$filter->value = array_keys($contactStateIdsAndNames);
$filter->operator = OperatorRules::TYPE_ONE_OF;
$report->addFilter($filter);
$filter = new FilterForReportForm('ContactsModule', 'Contact', $report->getType());
$filter->attributeIndexOrDerivedType = 'primaryEmail___optOut';
$filter->value = false;
$filter->operator = OperatorRules::TYPE_EQUALS;
$report->addFilter($filter);
$displayAttribute = new DisplayAttributeForReportForm('ContactsModule', 'Contact', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'FullName';
$report->addDisplayAttribute($displayAttribute);
$displayAttribute = new DisplayAttributeForReportForm('ContactsModule', 'Contact', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'account___name';
$displayAttribute->label = 'Account Name';
$report->addDisplayAttribute($displayAttribute);
$displayAttribute = new DisplayAttributeForReportForm('ContactsModule', 'Contact', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'primaryEmail___emailAddress';
$report->addDisplayAttribute($displayAttribute);
$savedReport = new SavedReport();
SavedReportToReportAdapter::resolveReportToSavedReport($report, $savedReport);
//set explicit
$saved = $savedReport->save();
assert('$saved');
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedReport);
$explicitReadWriteModelPermissions->addReadWritePermitable(Group::getByName(Group::EVERYONE_GROUP_NAME));
$success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($savedReport, $explicitReadWriteModelPermissions);
assert('$success');
$saved = $savedReport->save();
assert('$saved');
}
示例2: resolveStates
protected function resolveStates()
{
return ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById();
}
示例3: testContactStateAdapterReturnsCorrectStatesUponStartingStateChange
public function testContactStateAdapterReturnsCorrectStatesUponStartingStateChange()
{
$this->assertEquals(7, count(ContactState::GetAll()));
$metadata = ContactsModule::getMetadata();
$metadata['global']['startingStateId'] = ContactsUtil::getStartingState()->id;
ContactsModule::setMetadata($metadata);
$metadata = array('clauses' => array(), 'structure' => '');
$adapter = new ContactsStateMetadataAdapter($metadata);
$adaptedMetadata = $adapter->getAdaptedDataProviderMetadata();
$statesToInclude = ContactsUtil::getContactStateDataFromStartingStateOnAndKeyedById();
$this->assertEquals(7, count($statesToInclude));
$compareMetadata['clauses'] = array();
$compareMetadata['structure'] = '(1 or 2 or 3 or 4 or 5 or 6 or 7)';
$index = 1;
foreach ($statesToInclude as $stateId => $notUsed) {
$compareMetadata['clauses'][$index] = array('attributeName' => 'state', 'operatorType' => 'equals', 'value' => $stateId);
$index++;
}
$this->assertEquals($compareMetadata, $adaptedMetadata);
}