当前位置: 首页>>代码示例>>PHP>>正文


PHP Contact::setName方法代码示例

本文整理汇总了PHP中Contact::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::setName方法的具体用法?PHP Contact::setName怎么用?PHP Contact::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact::setName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addContact

 /**
  * Adiciona um contato.
  * @param string $email Email do contato (UNIQUE)
  * @param string $name Nome do contato
  * @param string $photo Uma foto do contato (opcional)
  */
 public function addContact($email, $name, $photo = null)
 {
     $contact = new Contact();
     $contact->setEmail($email);
     $contact->setName($name);
     $contact->setPhoto($photo);
     return $this->contactStorage->save($contact);
 }
开发者ID:lga37,项目名称:contacts,代码行数:14,代码来源:ContactsManager.php

示例2: createContact

 private function createContact(array $data)
 {
     $contact = new Contact();
     $contact->setEmail($data['email']);
     $contact->setName($data['name']);
     $contact->setPhoto($data['photo']);
     return $contact;
 }
开发者ID:lga37,项目名称:contacts,代码行数:8,代码来源:ContactMongoStorage.php

示例3: testAddContacts

 public function testAddContacts()
 {
     for ($i = 0; $i < MAX_CONTACTS; $i++) {
         $contact = new Contact();
         $contact->setId($i);
         $contact->setName($this->names[$i % sizeof($this->names)] . " " . $i);
         $contact->setEmail($this->names[$i % sizeof($this->names)] . $i . "@email.com");
         $contact->setPhoneContact(999999999);
         $this->agenda->addContact($contact);
     }
 }
开发者ID:chaws-unb,项目名称:gcs_agenda,代码行数:11,代码来源:Cellphone.php

示例4: testSetContactName

 function testSetContactName()
 {
     //arrange
     $name = "Jane Doe";
     $phone_number = "";
     $address = "";
     $test_contact = new Contact($name, $phone_number, $address);
     //act
     $test_contact->setName("John Doe");
     $result = $test_contact->getName();
     //assert
     $this->assertEquals("John Doe", $result);
 }
开发者ID:julianstewart,项目名称:address_book,代码行数:13,代码来源:ContactTest.php

示例5: XMLObject

$e->setUid("uid");
$e->setPriority(1);
$xo = new XMLObject();
print $xo->writeEvent($e, kolabobject::KolabV2, "test.php");
print $xo->writeEvent($e, kolabobject::KolabV3, "test.php");
////// Test Contact
$c = new Contact();
$nc = new NameComponents();
$sn = new vectors();
$sn->push("Contact");
$nc->setSurnames($sn);
$gn = new vectors();
$gn->push("Sample");
$nc->setGiven($gn);
$c->setNameComponents($nc);
$c->setName("Sample Contact");
$em = new vectors();
$em->push("sample.v2@localhost");
$c->setEmailAddresses($em);
$xo = new XMLObject();
print $xo->writeContact($c, kolabobject::KolabV2, "test.php");
print "UID = " . $xo->getSerializedUID() . "\n\n";
print $xo->writeContact($c, kolabobject::KolabV3, "test.php");
print "UID = " . $xo->getSerializedUID() . "\n\n";
$dlxml = <<<EOL
<?xml version="1.0"?>
<distribution-list version="1.0">
  <uid>ebb1774429a2e03afafb31f233e23b42</uid>
  <body></body>
  <categories></categories>
  <creation-date>2010-11-25T18:02:32Z</creation-date>
开发者ID:netrunner-debian-kubuntu,项目名称:libkolab,代码行数:31,代码来源:test.php

示例6: Todo

assertequal($vdelegatees_->size(), 1, "Attendee::delegatedTo()");
assertequal($vdelegatees_->get(0)->email(), "jane@kolab.org", "Delegated-To email");
/////// Test Todo
$t = new Todo();
$t->setCreated(new cDateTime(2014, 3, 14, 9, 5, 30, true));
$due = new cDateTime(2014, 5, 20, 17, 30, 0);
$t->setDue($due);
$t->setStart(new cDateTime(2014, 4, 30, 8, 0, 0));
$t->setSummary('Test Task');
$xml = kolabformat::writeTodo($t);
#print $xml;
assertcontains($xml, '<due><date-time>2014-05-20T17:30:00</date-time></due>', "Todo::setDue() with date/time");
assertcontains($xml, '<dtstart><date-time>2014-04-30T08:00:00</date-time></dtstart>', "Todo::setStart() with date/time");
/////// Test Contact
$c = new Contact();
$c->setName("Contact-FN");
$nc = new NameComponents();
$nc->setSurnames(array2vector("Surname"));
$nc->setGiven(array2vector("Given"));
$nc->setAdditional(array2vector(array("Middle1", "Middle2")));
$nc->setPrefixes(array2vector("Prefix"));
#$nc->setSuffixes(new vectors);
assertcontains($nc->surnames()->size(), 1, "NameComponents::setSurnames()");
assertcontains($nc->given()->size(), 1, "NameComponents::setGiven()");
assertcontains($nc->additional()->size(), 2, "NameComponents::setAdditional()");
assertcontains($nc->prefixes()->size(), 1, "NameComponents::setPrefixes()");
assertcontains($nc->suffixes()->size(), 0, "NameComponents::suffixes()");
$c->setNameComponents($nc);
$c->setTitles(array2vector("MyProfession"));
$pic = "R0lGODlhEgASAIAAAMDAwAAAACH5BAEAAAAALAAAAAASABIAQAIPhI+py+0Po5y02ouz3pwXADs=";
$c->setPhoto(base64_decode($pic), 'image/gif');
开发者ID:netrunner-debian-kubuntu,项目名称:libkolabxml,代码行数:31,代码来源:test.php

示例7: fromJSON

 /**
  * Create Contact object from json string
  * 
  * @param str $json json string representing contact state
  * 
  * @return Contact
  */
 public static function fromJSON($json)
 {
     $data = CommonFunctions::fromJSON($json, 'info')->result;
     $contact = new Contact();
     $contact->setContactId($data['id'])->setEmail($data['email'])->setPhoneNumber($data['voice'])->setFaxNumber($data['fax']);
     foreach (array(Contact::POSTALINFO_INT, Contact::POSTALINFO_LOCAL) as $type) {
         if (isset($data['postalInfo'][$type])) {
             $pi = $data['postalInfo'][$type];
             $contact->setName($pi['name'], $type)->setOrganization($pi['org'], $type)->setAddress(@$pi['addr']['street'][0], @$pi['addr']['street'][1], @$pi['addr']['street'][2])->setCity($pi['addr']['city'])->setCountryCode($pi['addr']['cc'])->setState($pi['addr']['sp'])->setPostalCode($pi['addr']['pc']);
         }
     }
     return $contact;
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:20,代码来源:Contact.php

示例8: parseContact

 public function parseContact($data)
 {
     $contact = new Contact();
     if (isset($data['id'])) {
         $contact->setId($data['id']);
     }
     if (isset($data['firstName'])) {
         $contact->setFirstName($data['firstName']);
     }
     if (isset($data['name'])) {
         $contact->setName($data['name']);
     }
     if (isset($data['mail'])) {
         $contact->setMail($data['mail']);
     }
     if (isset($data['company'])) {
         $contact->setCompany($data['company']);
     }
     if (isset($data['phone'])) {
         $contact->setPhone($data['phone']);
     }
     if (isset($data['phone2'])) {
         $contact->setPhone2($data['phone2']);
     }
     if (isset($data['phone3'])) {
         $contact->setPhone3($data['phone3']);
     }
     if (isset($data['address'])) {
         $contact->setAddress($this->addressService->getAddress($data['address']));
     }
     if (isset($data['type'])) {
         $contact->setType($this->typeService->getType($data['type']));
     }
     if (isset($data['exchangeId'])) {
         $contact->setExchangeId($data['exchangeId']);
     }
     return $contact;
 }
开发者ID:alex148,项目名称:SmartMastore,代码行数:38,代码来源:ContactService.php

示例9: contactParser

function contactParser($data)
{
    $contact = new Contact();
    if (isset($data['id'])) {
        $contact->setId($data['id']);
    }
    if (isset($data['firstName'])) {
        $contact->setFirstName($data['firstName']);
    }
    if (isset($data['name'])) {
        $contact->setName($data['name']);
    }
    if (isset($data['mail'])) {
        $contact->setMail($data['mail']);
    }
    if (isset($data['phone'])) {
        $contact->setPhone($data['phone']);
    }
    if (isset($data['phone2'])) {
        $contact->setPhone2($data['phone2']);
    }
    if (isset($data['phone3'])) {
        $contact->setPhone3($data['phone3']);
    }
    if (isset($data['company'])) {
        $contact->setCompany($data['company']);
    }
    if (isset($data['address'])) {
        $dataAddress = $data['address'];
        $address = new Address();
        if (isset($dataAddress['id'])) {
            $address->setId($dataAddress['id']);
        }
        if (isset($dataAddress['line1'])) {
            $address->setLine1($dataAddress['line1']);
        }
        if (isset($dataAddress['line2'])) {
            $address->setLine2($dataAddress['line2']);
        }
        if (isset($dataAddress['zipCode'])) {
            $address->setZipCode($dataAddress['zipCode']);
        }
        if (isset($dataAddress['city'])) {
            $address->setCity($dataAddress['city']);
        }
        if (isset($dataAddress['latitude']) && isset($dataAddress['longitude'])) {
            $address->setLatitude($dataAddress['latitude']);
            $address->setLongitude($dataAddress['longitude']);
        } else {
            $mapService = new GoogleMapService();
            $latlng = $mapService->getLatLong($address);
            if ($latlng != [] && sizeof($latlng) == 2) {
                $address->setLatitude($latlng[0]);
                $address->setLongitude($latlng[1]);
            }
        }
        $contact->setAddress($address);
    }
    if (isset($data['type'])) {
        if (isset($data['type']['id']) && isset($data['type']['name'])) {
            $type = new Type($data['type']['id'], $data['type']['name']);
        } elseif (isset($data['type']['name'])) {
            $type = new Type(null, $data['type']['name']);
        } else {
            $type = null;
        }
        $contact->setType($type);
    }
    if (isset($data['exchangeId'])) {
        $contact->setExchangeId($data['exchangeId']);
    }
    return $contact;
}
开发者ID:alex148,项目名称:SmartMastore,代码行数:73,代码来源:index.php

示例10: getAllContacts

 /**
  * Used to get all the contacts from Exchange
  * @return array of contact
  */
 public function getAllContacts()
 {
     try {
         $contactList = [];
         $request = new EWSType_FindItemType();
         $request->ItemShape = new EWSType_ItemResponseShapeType();
         $request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;
         $request->ContactsView = new EWSType_ContactsViewType();
         $request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
         $request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
         $request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CONTACTS;
         $request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;
         $response = parent::getEws()->FindItem($request);
         if (isset($response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Contact)) {
             $stdContacts = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->Contact;
         } else {
             return null;
         }
         foreach ($stdContacts as $c) {
             $contact = new Contact();
             if (isset($c->ItemId->Id)) {
                 $contact->setExchangeId($c->ItemId->Id);
             }
             if (isset($c->CompleteName)) {
                 if (isset($c->CompleteName->FirstName)) {
                     $contact->setFirstName($c->CompleteName->FirstName);
                 }
                 if (isset($c->CompleteName->LastName)) {
                     if (strpos($c->CompleteName->LastName, '--') !== false) {
                         $nameAndType = $this->getTypeFromName($c->CompleteName->LastName);
                         if (sizeof($nameAndType) == 2) {
                             $contact->setName($nameAndType[0]);
                             $typeService = new TypeService();
                             $type = $typeService->getType($nameAndType[1]);
                             if ($type != null) {
                                 $contact->setType($type);
                             } else {
                                 $contact->setType(null);
                             }
                         } else {
                             $contact->setName($c->CompleteName->LastName);
                         }
                     } else {
                         $contact->setName($c->CompleteName->LastName);
                     }
                 }
             }
             if (isset($c->PhoneNumbers->Entry)) {
                 if (is_array($c->PhoneNumbers->Entry)) {
                     $contact->setPhone($c->PhoneNumbers->Entry[0]->_);
                     if (sizeof($c->PhoneNumbers->Entry) > 1) {
                         if (isset($c->PhoneNumbers->Entry[1])) {
                             $contact->setPhone2($c->PhoneNumbers->Entry[1]->_);
                         }
                     }
                     if (sizeof($c->PhoneNumbers->Entry) > 2) {
                         if (isset($c->PhoneNumbers->Entry[2])) {
                             $contact->setPhone3($c->PhoneNumbers->Entry[2]->_);
                         }
                     }
                 } else {
                     $contact->setPhone($c->PhoneNumbers->Entry->_);
                 }
             }
             if (isset($c->EmailAddresses->Entry)) {
                 if (is_array($c->EmailAddresses->Entry)) {
                     $contact->setMail($c->EmailAddresses->Entry[0]->_);
                 } else {
                     $contact->setMail($c->EmailAddresses->Entry->_);
                 }
             }
             if (isset($c->CompanyName)) {
                 $contact->setCompany($c->CompanyName);
             }
             if (isset($c->PhysicalAddresses->Entry)) {
                 $address = new Address();
                 $stdAddress = $c->PhysicalAddresses->Entry;
                 if (is_array($stdAddress)) {
                     $address->setLine1($stdAddress[0]->Street);
                     $address->setZipCode($stdAddress[0]->PostalCode);
                     $address->setCity($stdAddress[0]->City);
                 } else {
                     if (isset($stdAddress->Street)) {
                         $address->setLine1($stdAddress->Street);
                     }
                     if (isset($stdAddress->PostalCode)) {
                         $address->setZipCode($stdAddress->PostalCode);
                     }
                     if (isset($stdAddress->City)) {
                         $address->setCity($stdAddress->City);
                     }
                 }
                 $contact->setAddress($address);
             }
             array_push($contactList, $contact);
         }
//.........这里部分代码省略.........
开发者ID:alex148,项目名称:SmartMastore,代码行数:101,代码来源:ExchangeService.php


注:本文中的Contact::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。