本文整理汇总了PHP中ContactsModule类的典型用法代码示例。如果您正苦于以下问题:PHP ContactsModule类的具体用法?PHP ContactsModule怎么用?PHP ContactsModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContactsModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $super;
ContactsModule::loadStartingData();
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ContactsModule::loadStartingData();
$bobbyBoss = UserTestHelper::createBasicUserWithEmailAddress('bobbyBoss');
$sarahBoss = UserTestHelper::createBasicUserWithEmailAddress('sarahBoss');
$superBoss = UserTestHelper::createBasicUserWithEmailAddress('superBoss');
$super = User::getByUsername('super');
$super->primaryEmail = new Email();
$super->primaryEmail->emailAddress = 'super@zurmo.com';
$super->manager = $superBoss;
assert($super->save());
// Not Coding Standard
$bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
$bobby->manager = $bobbyBoss;
assert($bobby->save());
// Not Coding Standard
$sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
$sarah->manager = $sarahBoss;
assert($sarah->save());
// Not Coding Standard
self::$superUserId = $super->id;
self::$bobbyUserId = $bobby->id;
self::$sarahUserId = $sarah->id;
self::$superBossUserId = $superBoss->id;
self::$bobbyBossUserId = $bobbyBoss->id;
self::$sarahBossUserId = $sarahBoss->id;
}
示例3: renderEmailMessageToMatchContent
/**
* @return string content
* @param EmailMessage object $emailMessage
* @param User object $user
*/
public static function renderEmailMessageToMatchContent(EmailMessage $emailMessage, $user)
{
$userCanAccessContacts = RightsUtil::canUserAccessModule('ContactsModule', $user);
$userCanAccessLeads = RightsUtil::canUserAccessModule('LeadsModule', $user);
$userCanCreateContact = RightsUtil::doesUserHaveAllowByRightName('ContactsModule', ContactsModule::getCreateRight(), $user);
$userCanCreateLead = RightsUtil::doesUserHaveAllowByRightName('LeadsModule', LeadsModule::getCreateRight(), $user);
if ($userCanAccessLeads && $userCanAccessContacts) {
$selectForm = new AnyContactSelectForm();
} elseif (!$userCanAccessLeads && $userCanAccessContacts) {
$selectForm = new ContactSelectForm();
} else {
$selectForm = new LeadSelectForm();
}
if ($userCanCreateContact && $userCanCreateLead) {
$gridSize = 3;
} elseif ($userCanCreateContact || $userCanCreateLead) {
$gridSize = 2;
} else {
$gridSize = 1;
}
$contact = new Contact();
self::resolveEmailAddressAndNameToContact($emailMessage, $contact);
$view = new ArchivedEmailMatchingView('default', 'emailMessages', $emailMessage, $contact, $selectForm, $userCanAccessLeads, $userCanAccessContacts, $userCanCreateContact, $userCanCreateLead, $gridSize);
return $view->render();
}
示例4: testMakeCollectionByAttributeImportRules
public function testMakeCollectionByAttributeImportRules()
{
//Contact
$attributeImportRules = new ContactAttributeImportRules(new ImportModelTestItem(), 'hasOne');
$collection = MappingRuleFormAndElementTypeUtil::makeCollectionByAttributeImportRules($attributeImportRules, 'hasOne', 'importColumn');
$this->assertEquals(2, count($collection));
$this->assertEquals('ImportMappingRuleDefaultModelNameId', $collection[0]['elementType']);
$this->assertEquals('DefaultModelNameIdMappingRuleForm', get_class($collection[0]['mappingRuleForm']));
$this->assertEquals('ImportMappingRelatedModelValueTypeDropDown', $collection[1]['elementType']);
$this->assertEquals('RelatedModelValueTypeMappingRuleForm', get_class($collection[1]['mappingRuleForm']));
//Contact Derived
$attributeImportRules = new ContactDerivedAttributeImportRules(new ImportModelTestItem(), 'contactDerived');
$collection = MappingRuleFormAndElementTypeUtil::makeCollectionByAttributeImportRules($attributeImportRules, 'contactDerived', 'importColumn');
$this->assertEquals(2, count($collection));
$this->assertEquals('ImportMappingRuleDefaultModelNameId', $collection[0]['elementType']);
$this->assertEquals('DefaultModelNameIdDerivedAttributeMappingRuleForm', get_class($collection[0]['mappingRuleForm']));
$this->assertEquals('ImportMappingModelIdValueTypeDropDown', $collection[1]['elementType']);
$this->assertEquals('IdValueTypeMappingRuleForm', get_class($collection[1]['mappingRuleForm']));
//Contact State
ContactsModule::loadStartingData();
$attributeImportRules = new ContactStateAttributeImportRules(new ImportModelTestItem(), 'state');
$collection = MappingRuleFormAndElementTypeUtil::makeCollectionByAttributeImportRules($attributeImportRules, 'state', 'importColumn');
$this->assertEquals(1, count($collection));
$this->assertEquals('ImportMappingRuleContactStatesDropDown', $collection[0]['elementType']);
$this->assertEquals('DefaultContactStateIdMappingRuleForm', get_class($collection[0]['mappingRuleForm']));
}
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ContactsModule::loadStartingData();
SecurityTestHelper::createSuperAdmin();
$sally = UserTestHelper::createBasicUser('sally');
$sally->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
$sally->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
$sally->setRight('MeetingsModule', MeetingsModule::RIGHT_ACCESS_MEETINGS);
$sally->setRight('OpportunitiesModule', OpportunitiesModule::RIGHT_ACCESS_OPPORTUNITIES);
$sally->setRight('ReportsTestModule', ReportsTestModule::RIGHT_ACCESS_REPORTS_TESTS);
if (!$sally->save()) {
throw new FailedToSaveModelException();
}
$sarah = UserTestHelper::createBasicUser('sarah');
$sarah->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
$sarah->setRight('LeadsModule', LeadsModule::RIGHT_ACCESS_LEADS);
$sarah->setRight('MeetingsModule', MeetingsModule::RIGHT_ACCESS_MEETINGS);
$sarah->setRight('OpportunitiesModule', OpportunitiesModule::RIGHT_ACCESS_OPPORTUNITIES);
$sarah->setRight('ReportsTestModule', ReportsTestModule::RIGHT_ACCESS_REPORTS_TESTS);
if (!$sarah->save()) {
throw new FailedToSaveModelException();
}
$nobody = UserTestHelper::createBasicUser('nobody');
if (!$nobody->save()) {
throw new FailedToSaveModelException();
}
}
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
ContactsModule::loadStartingData();
//Need to instantiate a controller so the clipWidget can work properly in elements that utilize it.
$controller = Yii::app()->createController('reports/default');
list($controller, $actionId) = $controller;
Yii::app()->setController($controller);
$values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
$customFieldData = CustomFieldData::getByName('ReportTestDropDown');
$customFieldData->serializedData = serialize($values);
$saved = $customFieldData->save();
assert($saved);
// Not Coding Standard
$values = array('Multi 1', 'Multi 2', 'Multi 3');
$customFieldData = CustomFieldData::getByName('ReportTestMultiDropDown');
$customFieldData->serializedData = serialize($values);
$saved = $customFieldData->save();
assert($saved);
// Not Coding Standard
$values = array('Radio 1', 'Radio 2', 'Radio 3');
$customFieldData = CustomFieldData::getByName('ReportTestRadioDropDown');
$customFieldData->serializedData = serialize($values);
$saved = $customFieldData->save();
assert($saved);
// Not Coding Standard
$values = array('Cloud 1', 'Cloud 2', 'Cloud 3');
$customFieldData = CustomFieldData::getByName('ReportTestTagCloud');
$customFieldData->serializedData = serialize($values);
$saved = $customFieldData->save();
assert($saved);
// Not Coding Standard
}
示例7: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$user = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $user;
$loaded = ContactsModule::loadStartingData();
assert($loaded);
// Not Coding Standard
$contactData = array('Sam', 'Sally', 'Sarah', 'Jason', 'James', 'Roger');
$contactStates = ContactState::getAll();
$lastContactState = $contactStates[count($contactStates) - 1];
foreach ($contactData as $key => $firstName) {
$contact = new Contact();
$contact->title->value = 'Mr.';
$contact->firstName = $firstName;
$contact->lastName = $firstName . 'son';
$contact->owner = $user;
$contact->state = $lastContactState;
$contact->primaryEmail = new Email();
$contact->primaryEmail->emailAddress = $key . '@zurmoland.com';
$contact->secondaryEmail = new Email();
$contact->secondaryEmail->emailAddress = 'a' . $key . $firstName . '@zurmoworld.com';
assert($contact->save());
// Not Coding Standard
}
}
示例8: testCreateAndGetContactWebFormById
public function testCreateAndGetContactWebFormById()
{
$allAttributes = ContactWebFormsUtil::getAllAttributes();
$placedAttributes = array('firstName', 'lastName', 'companyName', 'jobTitle');
$contactFormAttributes = ContactWebFormsUtil::getAllPlacedAttributes($allAttributes, $placedAttributes);
$attributes = array_keys($contactFormAttributes);
$this->assertTrue(ContactsModule::loadStartingData());
$contactStates = ContactState::getByName('New');
$contactWebForm = new ContactWebForm();
$contactWebForm->name = 'Test Form';
$contactWebForm->redirectUrl = 'http://google.com';
$contactWebForm->submitButtonLabel = 'Save';
$contactWebForm->defaultState = $contactStates[0];
$contactWebForm->serializedData = serialize($attributes);
$contactWebForm->defaultOwner = Yii::app()->user->userModel;
$this->assertTrue($contactWebForm->save());
$id = $contactWebForm->id;
unset($contactWebForm);
$contactWebForm = ContactWebForm::getById($id);
$this->assertEquals('Test Form', $contactWebForm->name);
$this->assertEquals('http://google.com', $contactWebForm->redirectUrl);
$this->assertEquals('Save', $contactWebForm->submitButtonLabel);
$this->assertEquals('New', $contactWebForm->defaultState->name);
$this->assertEquals($attributes, unserialize($contactWebForm->serializedData));
}
示例9: testGetContactStateDataFromStartingStateOnAndKeyedById
/**
* @depends testResolveContactStateAdapterByModulesUserHasAccessTo
*/
public function testGetContactStateDataFromStartingStateOnAndKeyedById()
{
$this->assertTrue(ContactsModule::loadStartingData());
$this->assertEquals(6, count(ContactState::GetAll()));
$contactStates = ContactsUtil::GetContactStateDataFromStartingStateOnAndKeyedById();
$this->assertEquals(2, count($contactStates));
}
示例10: testSaveAllMetadata
public function testSaveAllMetadata()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$this->assertTrue(ContactsModule::loadStartingData());
$messageLogger = new MessageLogger();
InstallUtil::autoBuildDatabase($messageLogger, true);
chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands');
$command = "php zurmocTest.php manageMetadata super saveAllMetadata";
if (!IS_WINNT) {
$command .= ' 2>&1';
}
exec($command, $output);
// Check if data are saved for some specific View
$moduleMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='NotesModule'");
$this->assertTrue($moduleMetadata['id'] > 0);
$this->assertTrue(strlen($moduleMetadata['serializedmetadata']) > 0);
// Check if data are saved for some specific View
$modelMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='Note'");
$this->assertTrue($modelMetadata['id'] > 0);
$this->assertTrue(strlen($modelMetadata['serializedmetadata']) > 0);
// Check if data are saved for some specific View
$viewMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='ContactsListView'");
$this->assertTrue($viewMetadata['id'] > 0);
$this->assertTrue(strlen($viewMetadata['serializedmetadata']) > 0);
}
示例11: resolveMergeTagValidatorProperties
protected function resolveMergeTagValidatorProperties($object)
{
$this->modelClassName = ContactsModule::getPrimaryModelName();
$this->type = EmailTemplate::TYPE_CONTACT;
$this->language = null;
// TODO: @Shoaibi/@Jason: High: We might utilize this.
}
示例12: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$loaded = ContactsModule::loadStartingData();
assert($loaded);
// Not Coding Standard
}
示例13: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
ContactsModule::loadStartingData();
$everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
$everyoneGroup->save();
}
示例14: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ContactsModule::loadStartingData();
UserTestHelper::createBasicUser('bobby');
Currency::getAll();
//Ensure USD is present
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
$loaded = ContactsModule::loadStartingData();
assert('$loaded');
// Not Coding Standard
}