本文整理汇总了PHP中Contact::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::getAll方法的具体用法?PHP Contact::getAll怎么用?PHP Contact::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSuperUserThatContactsAndLeadsShowZeroModelUserInterfaceCorrectly
public function testSuperUserThatContactsAndLeadsShowZeroModelUserInterfaceCorrectly()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$this->assertEquals(0, count(Contact::getAll()));
//At this point the zero model ui should show up for contacts and leads
$content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/list');
$this->assertFalse(strpos($content, 'Arthur Conan') === false);
$content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/list');
$this->assertFalse(strpos($content, 'Thomas Paine') === false);
$contact = ContactTestHelper::createContactByNameForOwner('Jimmy', $super);
//At this point leads should still show the zero model message
$content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/list');
$this->assertTrue(strpos($content, 'Arthur Conan') === false);
$content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/list');
$this->assertFalse(strpos($content, 'Thomas Paine') === false);
$this->assertTrue($contact->delete());
$this->assertEquals(0, count(Contact::getAll()));
//Create lead.
$lead = LeadTestHelper::createLeadByNameForOwner('Jammy', $super);
//At this point contacts should still show the zero model message
$content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/list');
$this->assertFalse(strpos($content, 'Arthur Conan') === false);
$content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/list');
$this->assertTrue(strpos($content, 'Thomas Paine') === false);
}
示例2: populateAutoresponderItem
public static function populateAutoresponderItem($processed, $processDateTime, $autoresponder = null, $contact = null)
{
assert('is_string($processed) || is_int($processed)');
assert('is_string($processDateTime)');
assert('is_object($autoresponder) || $autoresponder === null');
assert('is_object($contact) || $contact === null');
if (empty($autoresponder)) {
$autoresponders = Autoresponder::getAll();
if (!empty($autoresponders)) {
$autoresponder = RandomDataUtil::getRandomValueFromArray($autoresponders);
}
}
if (empty($contact)) {
$contacts = Contact::getAll();
if (!empty($contacts)) {
$contact = RandomDataUtil::getRandomValueFromArray($contacts);
}
}
$autoresponderItem = new AutoresponderItem();
$autoresponderItem->processed = $processed;
$autoresponderItem->processDateTime = $processDateTime;
$autoresponderItem->autoresponder = $autoresponder;
$autoresponderItem->contact = $contact;
return $autoresponderItem;
}
示例3: testUnlinkContactForAccount
public function testUnlinkContactForAccount()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$simpleUser = User::getByUsername('simpleUser');
Yii::app()->user->userModel = $simpleUser;
$simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
$simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
$simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
$simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
$this->assertTrue($simpleUser->save());
$account = AccountTestHelper::createAccountByNameForOwner('simpleUserAccount', $simpleUser);
$contact = ContactTestHelper::createContactWithAccountByNameForOwner('simpleUserContact', $simpleUser, $account);
$accounts = Account::getAll();
$this->assertEquals(1, count($accounts));
$contacts = Contact::getAll();
$this->assertEquals(1, count($contacts));
$superAccountId = self::getModelIdByModelNameAndName('Account', 'simpleUserAccount');
$this->setGetArray(array('id' => $superAccountId));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
$contactId = self::getModelIdByModelNameAndName('Contact', 'simpleUserContact simpleUserContactson');
//unlinking the contact
$this->setGetArray(array('id' => $contactId, 'relationModelClassName' => 'Account', 'relationModelId' => $superAccountId, 'relationModelRelationName' => 'contacts'));
$content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/unlink', true);
$accounts = Account::getAll();
$this->assertEquals(1, count($accounts));
$contacts = Contact::getAll();
$contactId = $contacts[0]->id;
$contacts[0]->forget();
$contact = Contact::getById($contactId);
$this->assertTrue($contact->account->id < 0);
}
示例4: testAdditionOfPortletsInEmptyRightPanel
public function testAdditionOfPortletsInEmptyRightPanel()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$superLeadId = self::getModelIdByModelNameAndName('Contact', 'superLead superLeadson');
$marketingListId = self::getModelIdByModelNameAndName('MarketingList', 'MarketingListName');
$leads = Contact::getAll();
$this->assertEquals(1, count($leads));
//Load Model Detail Views
$this->setGetArray(array('id' => $superLeadId, 'lockPortlets' => '0'));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('leads/default/details');
$portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('LeadDetailsAndRelationsView', $super->id, array());
$this->assertEquals(3, count($portlets[1]));
$this->assertFalse(array_key_exists(3, $portlets));
$this->assertEquals(2, count($portlets[2]));
foreach ($portlets[2] as $position => $portlet) {
$portlet->delete();
}
$this->setGetArray(array('modelId' => $superLeadId, 'uniqueLayoutId' => 'LeadDetailsAndRelationsView', 'portletType' => 'MarketingListsForContactRelatedList', 'redirect' => '0'));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('leads/defaultPortlet/add', true);
$portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('LeadDetailsAndRelationsView', $super->id, array());
$this->assertEquals(1, count($portlets[2]));
//Test subscribe to list link
$portlet = $portlets[2][1];
$this->setGetArray(array('portletId' => $portlet->id, 'relationAttributeName' => 'lead', 'relationModelId' => $superLeadId, 'relationModuleId' => 'leads', 'uniqueLayoutId' => $portlet->getUniquePortletPageId(), 'relationModelClassName' => null));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('marketingLists/default/selectFromRelatedList');
//Test subscribe a marketing list
$this->setGetArray(array('modelId' => $marketingListId, 'portletId' => $portlet->id, 'relationAttributeName' => 'lead', 'relationModelId' => $superLeadId, 'relationModuleId' => 'leads', 'uniqueLayoutId' => $portlet->getUniquePortletPageId(), 'relationModelClassName' => null));
$this->resetPostArray();
$content = $this->runControllerWithRedirectExceptionAndGetContent('marketingLists/defaultPortlet/selectFromRelatedListSave');
}
示例5: indexAction
public function indexAction()
{
$this->view->Title = "Danh sách đặt hàng";
$this->view->headTitle($this->view->Title);
$page = $this->getRequest()->getParam('page');
$condition = array();
list($this->view->Pager, $this->view->Contact) = Contact::getAll($condition, $page);
}
示例6: actionGenerateManageSubscriptionHash
/**
* Method for testing creating a simple notification for the current user.
*/
public function actionGenerateManageSubscriptionHash()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$contact = RandomDataUtil::getRandomValueFromArray(Contact::getAll());
$personId = $contact->getClassId('Person');
$marketingList = RandomDataUtil::getRandomValueFromArray(MarketingList::getAll());
$marketingListId = $marketingList->id;
$model = RandomDataUtil::getRandomValueFromArray(CampaignItem::getAll());
$modelId = $model->id;
$modelType = get_class($model);
$hash = GlobalMarketingFooterUtil::resolveHash($personId, $marketingListId, $modelId, $modelType, false);
echo 'index.php/marketingLists/external/manageSubscriptions?hash=' . $hash;
}
示例7: actionGenerateManageSubscriptionHash
/**
* Method for testing creating a simple notification for the current user.
*/
public function actionGenerateManageSubscriptionHash()
{
if (Yii::app()->user->userModel->username != 'super') {
throw new NotSupportedException();
}
$contact = RandomDataUtil::getRandomValueFromArray(Contact::getAll());
$personId = $contact->getClassId('Person');
$marketingList = RandomDataUtil::getRandomValueFromArray(MarketingList::getAll());
$marketingListId = $marketingList->id;
$model = RandomDataUtil::getRandomValueFromArray(CampaignItem::getAll());
$modelId = $model->id;
$modelType = get_class($model);
$hash = EmailMessageActivityUtil::resolveHashForUnsubscribeAndManageSubscriptionsUrls($personId, $marketingListId, $modelId, $modelType, false);
echo 'index.php/marketingLists/external/manageSubscriptions?hash=' . $hash;
}
示例8: populateMarketingListMember
public static function populateMarketingListMember($unsubscribed = 0, $marketingList = null, $contact = null)
{
if (empty($marketingList)) {
$marketingLists = MarketingList::getAll();
if (!empty($marketingLists)) {
$marketingList = RandomDataUtil::getRandomValueFromArray($marketingLists);
}
}
if (empty($contact)) {
$contacts = Contact::getAll();
if (!empty($contacts)) {
$contact = RandomDataUtil::getRandomValueFromArray($contacts);
}
}
$marketingListMember = new MarketingListMember();
$marketingListMember->unsubscribed = $unsubscribed;
$marketingListMember->contact = $contact;
$marketingListMember->marketingList = $marketingList;
return $marketingListMember;
}
示例9: fillAutoresponderItem
public static function fillAutoresponderItem($processed, $processDateTime, $autoresponder = null, $contact = null)
{
if (empty($autoresponder)) {
$autoresponders = Autoresponder::getAll();
if (!empty($autoresponders)) {
$autoresponder = RandomDataUtil::getRandomValueFromArray($autoresponders);
}
}
if (empty($contact)) {
$contacts = Contact::getAll();
if (!empty($contacts)) {
$contact = RandomDataUtil::getRandomValueFromArray($contacts);
}
}
$autoresponderItem = new AutoresponderItem();
$autoresponderItem->processed = $processed;
$autoresponderItem->processDateTime = $processDateTime;
$autoresponderItem->autoresponder = $autoresponder;
$autoresponderItem->contact = $contact;
return $autoresponderItem;
}
示例10: makeAll
/**
* @param DemoDataHelper $demoDataHelper
*/
public function makeAll(&$demoDataHelper)
{
assert('$demoDataHelper instanceof DemoDataHelper');
assert('$demoDataHelper->isSetRange("Contact")');
assert('$demoDataHelper->isSetRange("MarketingList")');
$members = array();
foreach (MarketingList::getAll() as $marketingList) {
foreach (Contact::getAll() as $contact) {
$interval = mt_rand(1, 30) * 86400;
$member = new MarketingListMember();
$member->setScenario('importModel');
$member->createdDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - $interval);
$member->contact = $contact;
$member->marketingList = $marketingList;
$this->populateModel($member);
$saved = $member->unrestrictedSave();
assert('$saved');
$members[] = $member->id;
}
}
$demoDataHelper->setRangeByModelName('MarketingListMember', $members[0], $members[count($members) - 1]);
}
示例11: populateCampaignItem
public static function populateCampaignItem($processed, $campaign = null, $contact = null)
{
assert('is_bool($processed)');
assert('is_object($campaign) || $campaign === null');
assert('is_object($contact) || $contact === null');
if (empty($campaign)) {
$campaigns = Campaign::getAll();
if (!empty($campaigns)) {
$campaign = RandomDataUtil::getRandomValueFromArray($campaigns);
}
}
if (empty($contact)) {
$contacts = Contact::getAll();
if (!empty($contacts)) {
$contact = RandomDataUtil::getRandomValueFromArray($contacts);
}
}
$campaignItem = new CampaignItem();
$campaignItem->processed = $processed;
$campaignItem->campaign = $campaign;
$campaignItem->contact = $contact;
return $campaignItem;
}
示例12: indexAction
public function indexAction()
{
$this->view->Title = "Contact list";
$this->view->headTitle($this->view->Title);
if ($this->getRequest()->getParam('contact_type')) {
$params = $this->getRequest()->getParam('contact_type', 'List All');
if ($params != 'List All') {
$condition = array('contact_type =?' => $params);
$_SESSION['contact_type'] = $params;
} else {
$condition = array();
$this->view->contact_type = 'List All';
$_SESSION['contact_type'] = 'List All';
}
$page = $this->getRequest()->getParam('page');
list($this->view->Pager, $this->view->Contact) = Contact::getAll($condition, $page);
} else {
$page = $this->getRequest()->getParam('page');
$condition = array();
list($this->view->Pager, $this->view->Contact) = Contact::getAll($condition, $page);
$_SESSION['contact_type'] = 'List All';
}
}
示例13: testAccountAndContactIndustries
public function testAccountAndContactIndustries()
{
Yii::app()->user->userModel = User::getByUsername('super');
$values = array('Automotive', 'Adult Entertainment', 'Financial Services', 'Mercenaries & Armaments');
$industryFieldData = CustomFieldData::getByName('Industries');
$industryFieldData->defaultValue = $values[0];
$industryFieldData->serializedData = serialize($values);
$this->assertTrue($industryFieldData->save());
unset($industryFieldData);
$user = UserTestHelper::createBasicUser('Billy');
$account = new Account();
$account->name = 'Consoladores-R-Us';
$account->owner = $user;
$data = unserialize($account->industry->data->serializedData);
$this->assertEquals('Automotive', $account->industry->value);
$account->industry->value = $values[1];
$this->assertTrue($account->save());
unset($account);
ContactsModule::loadStartingData();
$states = ContactState::GetAll();
$contact = new Contact();
$contact->firstName = 'John';
$contact->lastName = 'Johnson';
$contact->owner = $user;
$contact->state = $states[0];
$values = unserialize($contact->industry->data->serializedData);
$this->assertEquals(4, count($values));
$contact->industry->value = $values[3];
$this->assertTrue($contact->save());
unset($contact);
$accounts = Account::getByName('Consoladores-R-Us');
$account = $accounts[0];
$this->assertEquals('Adult Entertainment', $account->industry->value);
$contacts = Contact::getAll();
$contact = $contacts[0];
$this->assertEquals('Mercenaries & Armaments', $contact->industry->value);
}
示例14: testGetChartData
/**
* @dataProvider dataForTestGetChartData
*/
public function testGetChartData($activityCreationArray, $emailMessageSentDateTime, $isMultiplierOn)
{
$contacts = Contact::getAll();
$this->addCampaignItem($contacts[0], $emailMessageSentDateTime, $activityCreationArray);
$this->addAutoresponderItem($contacts[0], $emailMessageSentDateTime, $activityCreationArray);
if ($isMultiplierOn) {
$this->addCampaignItem($contacts[1], $emailMessageSentDateTime, $activityCreationArray);
$this->addAutoresponderItem($contacts[1], $emailMessageSentDateTime, $activityCreationArray);
}
$isSent = true;
if (!isset($emailMessageSentDateTime)) {
$emailMessageSentDateTime = date('Y-m-d');
$isSent = false;
}
//Test when beginDate < sentDate < endDate
//Grouping by day
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'between', MarketingOverallMetricsForm::GROUPING_TYPE_DAY, $isSent, $isMultiplierOn);
//Grouping by week
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'between', MarketingOverallMetricsForm::GROUPING_TYPE_WEEK, $isSent, $isMultiplierOn);
//Grouping by month
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'between', MarketingOverallMetricsForm::GROUPING_TYPE_MONTH, $isSent, $isMultiplierOn);
//Test when beginDate < endDate < sentDate
//Grouping by day
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'after', MarketingOverallMetricsForm::GROUPING_TYPE_DAY, $isSent, $isMultiplierOn);
//Grouping by week
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'after', MarketingOverallMetricsForm::GROUPING_TYPE_WEEK, $isSent, $isMultiplierOn);
//Grouping by month
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'after', MarketingOverallMetricsForm::GROUPING_TYPE_MONTH, $isSent, $isMultiplierOn);
//Test when sentDate < beginDate < endDate
//Grouping by day
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'before', MarketingOverallMetricsForm::GROUPING_TYPE_DAY, $isSent, $isMultiplierOn);
//Grouping by week
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'before', MarketingOverallMetricsForm::GROUPING_TYPE_WEEK, $isSent, $isMultiplierOn);
//Grouping by month
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'before', MarketingOverallMetricsForm::GROUPING_TYPE_MONTH, $isSent, $isMultiplierOn);
//Test when sentDate = beginDate = endDate
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'equals', MarketingOverallMetricsForm::GROUPING_TYPE_DAY, $isSent, $isMultiplierOn);
//Grouping by week
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'equals', MarketingOverallMetricsForm::GROUPING_TYPE_WEEK, $isSent, $isMultiplierOn);
//Grouping by month
$this->assertChartDataAsExpectedBySentTimeAndConditionAndGroupingBy($activityCreationArray, $emailMessageSentDateTime, 'equals', MarketingOverallMetricsForm::GROUPING_TYPE_MONTH, $isSent, $isMultiplierOn);
}
示例15: array
<?php
require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/contact.php";
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
session_start();
if (empty($_SESSION['list_of_contacts'])) {
$_SESSION['list_of_contacts'] = array();
}
$app->get("/", function () use($app) {
return $app['twig']->render('home.html.twig', array('all_contacts' => Contact::getAll()));
});
$app->post("/create_contact", function () use($app) {
$my_contact = new Contact($_POST['name'], $_POST['phone'], $_POST['address']);
$my_contact->save();
return $app['twig']->render('create_contact.html.twig', array('new_contact' => $my_contact));
});
$app->post("/delete_contacts", function () use($app) {
$_SESSION['list_of_contacts'] = array();
return $app['twig']->render('delete_contacts.html.twig');
});
return $app;