本文整理汇总了PHP中Contact::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::setId方法的具体用法?PHP Contact::setId怎么用?PHP Contact::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::setId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
function update(Contact $contact) {
$id = $contact->getId();
if ($id == "" && $contact->getEmail() != "") {
/* on va rechercher par rapport à l'adresse Email */
$id = $this->recherche_email($contact->getEmail());
if ($id === false) {
} else {
$contact->setId($id);
}
}
if ($contact->getId() == '') {
/* Il faut faire une création et pas un update */
} else {
$elt = $contact->toAdd();
$response = $this->mySforceConnection->update(array($elt), 'Contact');
if ($response[0]->success) {
} else {
print_r($response);
$msg = implode(';', $response[0]->errors);
return $msg;
}
}
return true;
}
示例2: __construct
public function __construct($arrayAccounts)
{
// browse through list
$collection = array();
if ($arrayAccounts) {
foreach ($arrayAccounts as $arrayAccount) {
if (empty($arrayAccount['name_value_list']['account_name'])) {
$arrayAccount['name_value_list']['account_name'] = "";
}
$contact = new Contact();
$contact->setId($arrayAccount['name_value_list']['id']);
$contact->setGroup($arrayAccount['name_value_list']['account_name']);
$contact->setFirstname(htmlspecialchars_decode($arrayAccount['name_value_list']['first_name'], ENT_QUOTES));
$contact->setLastname($arrayAccount['name_value_list']['last_name']);
$contact->setWorkPhone($arrayAccount['name_value_list']['phone_work']);
$contact->setWorkMobile($arrayAccount['name_value_list']['phone_mobile']);
$contact->sethomePhone('');
$contact->sethomeMobile('');
$collection[$contact->getId()] = $contact;
}
// Sort accounts by name
usort($collection, function ($a, $b) {
return strcmp($a->getFirstname(), $b->getFirstname());
});
}
// build ArrayObject using collection
return parent::__construct($collection);
}
示例3: testDeleteContacts
public function testDeleteContacts()
{
for ($i = 0; $i < MAX_CONTACTS; $i++) {
$contact = new Contact();
$contact->setId($i);
$this->agenda->deleteContact($contact);
}
}
示例4: modify
protected function modify(Contact $contact)
{
$q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET USER_ID_1 = :userId1, USER_ID_2 = :userId2, CONTACT_GROUP_ID = :contactGroupId WHERE ID=:id');
$q->bindValue(':userId1', $contact->getUserId1(), PDO::PARAM_INT);
$q->bindValue(':userId2', $contact->getUserId2(), PDO::PARAM_INT);
$q->bindValue(':contactGroupId', $contact->getContactGroupId(), PDO::PARAM_INT);
$q->bindValue(':id', $contact->id(), PDO::PARAM_INT);
$q->execute();
$contact->setId($this->dao->lastInsertId());
}
示例5: die
/**
* Finish the installation - create owner company and administrator
*
* @param void
* @return null
*/
function complete_installation()
{
if (Companies::getOwnerCompany() instanceof Company) {
die('Owner company already exists');
// Somebody is trying to access this method even if the user already exists
}
// if
$this->setLayout('complete_install');
$form_data = array_var($_POST, 'form');
tpl_assign('form_data', $form_data);
if (array_var($form_data, 'submitted') == 'submitted') {
try {
$admin_password = trim(array_var($form_data, 'admin_password'));
$admin_password_a = trim(array_var($form_data, 'admin_password_a'));
if (trim($admin_password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($admin_password != $admin_password_a) {
throw new Error(lang('passwords dont match'));
}
// if
DB::beginWork();
Users::delete();
// clear users table
Companies::delete();
// clear companies table
// Create the administrator user
$administrator = new User();
$administrator->setId(1);
$administrator->setUsername(array_var($form_data, 'admin_username'));
$administrator->setEmail(array_var($form_data, 'admin_email'));
$administrator->setPassword($admin_password);
$administrator->setIsAdmin(true);
$administrator->setAutoAssign(true);
$administrator->save();
// Create the contact for administrator
$administrator_contact = new Contact();
$administrator_contact->setId(1);
$administrator_contact->setCompanyId(1);
$administrator_contact->setEmail(array_var($form_data, 'admin_email'));
$administrator_contact->setUserId($administrator->getId());
$administrator_contact->setDisplayName($administrator->getUsername());
$administrator_contact->save();
// Create a company
$company = new Company();
$company->setId(1);
$company->setClientOfId(0);
$company->setName(array_var($form_data, 'company_name'));
$company->setCreatedById(1);
$company->save();
DB::commit();
$this->redirectTo('access', 'login');
} catch (Exception $e) {
tpl_assign('error', $e);
DB::rollback();
}
// try
}
// if
}
示例6: 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;
}
示例7: getListMembers
/**
* Public function that gets list members of a single list object passed to it.
*
* @param object $list - a valid list object with a valid list link
* @return array $List - returns first 50 contact objects that are part of that list, and a link to next 50
*/
public function getListMembers($list)
{
$utility = new Utility();
$call = $utility->getApiPath() . $list->getLink() . '/members';
$return = $utility->httpGet($call);
$parsedReturn = simplexml_load_string($return['xml']);
$List = array();
$listMembers = array();
$pages = array();
foreach ($parsedReturn->entry as $item)
{
$contact = new Contact();
$contact->setLink($item->link->Attributes()->href);
$contact->setId($item->id);
$contact->setFullName($item->content->ContactListMember->Name);
$contact->setEmailAddress($item->content->ContactListMember->EmailAddress);
$listMembers[] = $contact;
}
$pages[] = $parsedReturn->link[2]->Attributes();
$pages[] = $parsedReturn->link[3]->Attributes();
//$pages[] = $parsedReturn->link[4]->Attributes();
$List = array($listMembers, $pages);
if (!$return)
{
return false;
}
else
{
return $List;
}
}
示例8: 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;
}
示例9: getAllContact
function getAllContact()
{
$contactRequete = "SELECT * FROM contact WHERE ID_QUESTIONNAIRE";
$contactResultat = $GLOBALS['bdd']->query($contactRequete);
$listeContacts = new ArrayObject();
while ($unContact = $contactResultat->fetch()) {
$contact = new Contact();
$contact->setId($unContact['ID_CONTACT']);
$contact->setIdQuestionnaire($unContact['ID_QUESTIONNAIRE']);
$contact->setNom($unContact['NOM_CONTACT']);
$contact->setPrenom($unContact['PRENOM_CONTACT']);
$contact->setDateNaissance($unContact['DATENAISSANCE_CONTACT']);
$contact->setNumero($unContact['NUMTEL_CONTACT']);
$contact->setRegion($unContact['IDREGION_CONTACT']);
$contact->setARepondu($unContact['aRepondu']);
$contact->setNotes($unContact['notes']);
$listeContacts->append($contact);
}
return $listeContacts;
}
示例10: _create
/**
* Create object with given data
*
* @param array $data
* @param static $instance
* @return static
*/
public static function _create($data, $instance = null)
{
if (null === $instance || !is_object($instance)) {
$instance = new static();
}
$instance->created = true;
foreach ($data as $key => $value) {
$key = trim($key);
switch ($key) {
// Skip some -other- elements
case 'language_name':
case 'contact_or_company':
break;
case substr($key, 0, 3) == 'cf_':
$id = substr($key, 3);
$instance->addCustomField($id, $value);
break;
case 'for_id':
case 'contact_or_company_id':
$target = isset($data['for']) ? $data['for'] : $data['contact_or_company'];
$id = isset($data['for_id']) ? $data['for_id'] : $data['contact_or_company_id'];
switch ($target) {
case 'company':
$value = new Company();
$value->setId($id);
break;
case 'contact':
$value = new Contact();
$value->setId($id);
break;
default:
exit('SHOULD STILL MAP: ' . $target . '! Please report at https://github.com/bmoex/teamleader!');
break;
}
if (method_exists($instance, 'setClient')) {
$instance->setClient($value);
}
break;
case 'deleted':
$instance->setDeleted($value == 1);
break;
default:
$key = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
$methodName = 'set' . $key;
if (method_exists($instance, $methodName)) {
call_user_func(array($instance, $methodName), $value);
} else {
// Ignore empty values
if (empty($value)) {
continue;
}
$key = lcfirst($key);
// Always try to set the key
if (!isset($instance->{$key})) {
$instance->{$key} = $value;
}
}
}
}
return $instance;
}