本文整理汇总了PHP中ContactsModule::getMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactsModule::getMetadata方法的具体用法?PHP ContactsModule::getMetadata怎么用?PHP ContactsModule::getMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactsModule
的用法示例。
在下文中一共展示了ContactsModule::getMetadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadStartingData
/**
* Used on first load to install ContactState data
* and the startingState for the Contacts module.
* @return true/false if data was in fact loaded.
*/
public static function loadStartingData()
{
if (count(ContactState::GetAll()) != 0) {
return false;
}
$data = array(Zurmo::t('Core', 'New'), Zurmo::t('Core', 'In Progress'), Zurmo::t('ContactsModule', 'Recycled'), Zurmo::t('ContactsModule', 'Dead'), Zurmo::t('ContactsModule', 'Qualified'), Zurmo::t('ZurmoModule', 'Customer'));
$order = 0;
$startingStateId = null;
foreach ($data as $stateName) {
$state = new ContactState();
$state->name = $stateName;
$state->order = $order;
$saved = $state->save();
assert('$saved');
if ($stateName == Zurmo::t('ContactsModule', 'Qualified')) {
$startingStateId = $state->id;
}
$order++;
}
if ($startingStateId == null) {
throw new NotSupportedException();
}
$metadata = ContactsModule::getMetadata();
$metadata['global']['startingStateId'] = $startingStateId;
ContactsModule::setMetadata($metadata);
assert('count(ContactState::GetAll()) == 6');
return true;
}
示例2: setStartingStateById
public static function setStartingStateById($startingStateId)
{
assert('is_int($startingStateId)');
$metadata = ContactsModule::getMetadata();
$metadata['global']['startingStateId'] = $startingStateId;
ContactsModule::setMetadata($metadata);
}
示例3: testLeadsStateMetadataAdapterWithNoStates
public function testLeadsStateMetadataAdapterWithNoStates()
{
$metadata = ContactsModule::getMetadata();
$metadata['global']['startingStateId'] = LeadsUtil::getStartingState()->id;
ContactsModule::setMetadata($metadata);
$adapter = new LeadsStateMetadataAdapter(array('clauses' => array(), 'structure' => ''));
$adaptedMetadata = $adapter->getAdaptedDataProviderMetadata();
$compareMetadata = array('clauses' => array(1 => array('attributeName' => 'state', 'operatorType' => 'equals', 'value' => '-1')), 'structure' => '(1)');
$this->assertEquals($compareMetadata, $adaptedMetadata);
}
示例4: 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);
}
示例5: testUpdateLatestActivityDateTimeMethods
public function testUpdateLatestActivityDateTimeMethods()
{
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted();
$this->assertTrue($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated();
$this->assertTrue($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived();
$this->assertTrue($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast();
$this->assertTrue($value);
$metadata = ContactsModule::getMetadata();
$metadata['global']['updateLatestActivityDateTimeWhenATaskIsCompleted'] = false;
ContactsModule::setMetadata($metadata);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated();
$this->assertTrue($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived();
$this->assertTrue($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast();
$this->assertTrue($value);
$metadata = ContactsModule::getMetadata();
$metadata['global']['updateLatestActivityDateTimeWhenANoteIsCreated'] = false;
ContactsModule::setMetadata($metadata);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived();
$this->assertTrue($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast();
$this->assertTrue($value);
$metadata = ContactsModule::getMetadata();
$metadata['global']['updateLatestActivityDateTimeWhenAnEmailIsSentOrArchived'] = false;
ContactsModule::setMetadata($metadata);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast();
$this->assertTrue($value);
$metadata = ContactsModule::getMetadata();
$metadata['global']['updateLatestActivityDateTimeWhenAMeetingIsInThePast'] = false;
ContactsModule::setMetadata($metadata);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived();
$this->assertFalse($value);
$value = ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast();
$this->assertFalse($value);
}