本文整理汇总了PHP中Contact::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::getId方法的具体用法?PHP Contact::getId怎么用?PHP Contact::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getActiveContextPermissions
function getActiveContextPermissions(Contact $contact, $object_type_id, $context, $dimension_members, $can_write = false, $can_delete = false)
{
if ($contact instanceof Contact && $contact->isAdministrator()) {
return $dimension_members;
}
$allowed_members = array();
$permission_group_ids = ContactPermissionGroups::getContextPermissionGroupIdsByContactCSV($contact->getId());
$perm_ids_array = explode(",", $permission_group_ids);
foreach ($perm_ids_array as $pid) {
foreach ($dimension_members as $member_id) {
//check if exists a context permission group for this object type id in this member
$contact_member_permission = self::findById(array('permission_group_id' => $pid, 'member_id' => $member_id, 'object_type_id' => $object_type_id));
if ($contact_member_permission instanceof ContactMemberPermission && (!$can_write || $contact_member_permission->getCanWrite() && !$can_delete || $contact_member_permission->getCanDelete())) {
$permission_contexts = PermissionContexts::findAll(array('`contact_id` = ' . $contact->getId(), 'permission_group_id' => $pid, 'member_id' => $member_id));
//check if the actual context applies to this permission group
if (!is_null($permission_contexts)) {
$dimensions = array();
$context_members = array();
foreach ($permission_contexts as $pc) {
$member = $pc->getMember();
$dimension_id = $member->getDimensionId();
if (!in_array($dimension_id, $dimensions)) {
$dimensions[] = $dimension_id;
$context_members[$dimension_id] = array();
}
$context_members[$dimension_id][] = $member;
}
$include = true;
foreach ($dimensions as $dim_id) {
$members_in_context = array();
foreach ($context_members[$dim_id] as $value) {
if (in_array($value, $context)) {
$members_in_context[] = $value;
}
}
if (count($members_in_context) == 0) {
$include = $include && false;
}
}
if ($include && count($dimensions) != 0) {
$allowed_members[] = $member_id;
}
}
}
}
}
return $allowed_members;
}
示例3: eventAddFeed
/**
* eventAddFeed
* This event is triggered when the note is added in the
* contact.php page.
* Its the last event and assume that the ContactNoteEditSave has
* a primary key from the database table.
* This event action prepare all the data so no additional query is needed
* in the display table.
* @param EventControler
*/
function eventAddFeed(EventControler $evtcl)
{
$this->note = $_SESSION['ContactNoteEditSave']->note;
$this->iduser = $evtcl->iduser_for_feed;
$this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact;
$this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note;
$user = new User();
$user->getId($this->iduser);
$do_contact = new Contact();
$do_contact->getId($this->idcontact);
if ($evtcl->added_by_cont == 'Yes') {
$this->added_by = $do_contact->getContactFullName();
} else {
$this->added_by = $user->getFullName();
}
$this->contact_full_name = $do_contact->getContactFullName();
$this->contact_image_url = $do_contact->getContactPicture();
if (strlen($this->note) > 200) {
$this->note = substr($this->note, 0, 200);
$this->more = True;
} else {
$this->more = false;
}
$user_relation = new ContactSharing();
$user_array = $user_relation->getCoWorkerByContact($this->idcontact);
@array_push($user_array, $this->iduser);
if (!is_array($user_array) || $user_array === false) {
$user_array = array($evtcl->iduser_for_feed);
}
//print_r($user_array);exit;
$this->addFeed($user_array);
}
示例4: maintContact
function maintContact()
{
$results = '';
if (isset($_POST['save']) and $_POST['save'] == 'Save') {
// check the token
$badToken = true;
if (!isset($_POST['token']) || !isset($_SESSION['token']) || empty($_POST['token']) || $_POST['token'] !== $_SESSION['token']) {
$results = array('', 'Sorry, go back and try again. There was a security issue.');
$badToken = true;
} else {
$badToken = false;
unset($_SESSION['token']);
// Put the sanitized variables in an associative array
// Use the FILTER_FLAG_NO_ENCODE_QUOTES to allow names like O'Connor
$item = array('id' => (int) $_POST['id'], 'first_name' => filter_input(INPUT_POST, 'first_name', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'last_name' => filter_input(INPUT_POST, 'last_name', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'position' => filter_input(INPUT_POST, 'position', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES), 'email' => filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING), 'phone' => filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING));
// Set up a Contact object based on the posts
$contact = new Contact($item);
if ($contact->getId()) {
$results = $contact->editRecord();
} else {
$results = $contact->addRecord();
}
}
}
return $results;
}
示例5: __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);
}
示例6: addContact
public function addContact(Contact $contact)
{
if (isset($contact)) {
$this->db[$contact->getId()] = $contact;
} else {
echo "Error: Contact not added. Null parameters.\n";
}
}
示例7: getActiveMilestonesByUserAndProject
/**
* Return active milestones that are assigned to the specific user and belongs to specific project
*
* @param User $user
* @param Project $project
* @return array
*/
static function getActiveMilestonesByUserAndProject(Contact $contact, $archived = false) {
if ($archived) $archived_cond = "`archived_on` <> 0 AND ";
else $archived_cond = "`archived_on` = 0 AND ";
return self::findAll(array(
'conditions' => array('`is_template` = false AND (`assigned_to_contact_id` = ? OR `assigned_to_contact_id` = ? ) AND ' . $archived_cond . ' AND `completed_on` = ?', $contact->getId(), $contact->getCompanyId(), EMPTY_DATETIME),
'order' => '`due_date`'
)); // findAll
} // getActiveMilestonesByUserAndProject
示例8: Contact
function test_getId()
{
//arrange
$id = 1;
$name = "Jane Doe";
$test_contact = new Contact($name, $id);
//act
$result = $test_contact->getId();
//assert
$this->assertEquals(1, $result);
}
示例9: addContactSharings
/**
* Method adding contact sharing
* @param integer $idcontact
* @param integer $idcoworker
*/
function addContactSharings($idcontact, $idcoworker)
{
$q = new sqlQuery($this->getDbCon());
$iduser = $_SESSION['do_User']->iduser;
$ins_qry = "INSERT INTO " . $this->table . "(idcontact,idcoworker,iduser) VALUES (\n '{$idcontact}','{$idcoworker}','{$iduser}')";
$q->query($ins_qry);
$do_contact = new Contact();
$do_contact->getId($idcontact);
$do_contact_view = new ContactView();
$do_contact_view->setUser($idcoworker);
$do_contact_view->addFromContact($do_contact);
}
示例10: getOpenTimeslotTasks
/**
* Return tasks on which the user has an open timeslot
*
* @return array
*/
static function getOpenTimeslotTasks($context, Contact $user, $assigned_to_contact = null, $archived = false)
{
$archived_cond = " AND `o`.`archived_on` " . ($archived ? "<>" : "=") . " 0 ";
$open_timeslot = " AND `e`.`object_id` IN (SELECT `t`.`rel_object_id` FROM " . Timeslots::instance()->getTableName(true) . " `t` WHERE `t`.`contact_id` = " . $user->getId() . " AND `t`.`end_time` = '" . EMPTY_DATETIME . "')";
$assigned_to_str = "";
if ($assigned_to_contact) {
if ($assigned_to_contact == -1) {
$assigned_to_contact = 0;
}
$assigned_to_str = " AND `e`.`assigned_to_contact_id` = " . DB::escape($assigned_to_contact) . " ";
}
$result = self::instance()->listing(array("order" => 'due_date', "order_dir" => "ASC", "extra_conditions" => ' AND `is_template` = false' . $archived_cond . $assigned_to_str . $open_timeslot));
$objects = $result->objects;
return $objects;
}
示例11: addTweet
/**
* addTweet
* Prepare all the data for the RSS feed
* look for Co-Workers associated with the contact
* and add the users as a feed recipient.
* @note this is used in a cronjob so no session variables will works.
* @param ContactNote object
* @param website url
* @param note_content (without the link to source)
*/
function addTweet($do_contact_note, $website, $note_content)
{
$do_contact = new Contact();
$this->idcontact = $do_contact_note->idcontact;
$do_contact->getId($this->idcontact);
$this->iduser = $do_contact->iduser;
if (strlen($note_content) > 200) {
$this->feed_content = substr($note_content, 0, 200);
} else {
$this->feed_content = $note_content;
}
$picture = $do_contact->getContactPicture();
$this->full_contact_name = $do_contact->getContactFullName($this->idcontact);
//$this->task_event_type = "rss_feed_cron";
$this->cont_image_url = $picture;
$this->website_url = $website;
$user_relation = new ContactSharing();
$users = $user_relation->getCoWorkerByContact($this->idcontact);
$users[] = $do_contact->iduser;
$this->addFeed($users);
}
示例12: addUnsubscribeEmailWorkfeed
/**
* Function adds workfeed when a contact unsubscibe emails
* @param object $obj, object containing the contact and user id
* @param string $responder , name of the responder
*/
function addUnsubscribeEmailWorkfeed($obj, $responder = "")
{
if ($responder == "") {
$this->note = _('has unsubscribed from emails');
} else {
$this->note = _('has unsubscribed from the auto-responder series ') . $responder;
}
$this->iduser = $obj->iduser;
$this->idcontact = $obj->idcontact;
$user = new User();
$user->getId($this->iduser);
$do_contact = new Contact();
$do_contact->getId($this->idcontact);
//$this->added_by = $do_contact->getContactFullName();
$this->contact_full_name = $do_contact->getContactFullName();
$this->contact_image_url = $do_contact->getContactPicture();
$user_relation = new ContactSharing();
$user_array = $user_relation->getCoWorkerByContact($this->idcontact);
@array_push($user_array, $this->iduser);
$this->addFeed($user_array);
}
示例13: eventAddFeed
/**
* eventAddFeed
* This event is triggered when the note is added in the
* contact.php page.
* Its the last event and assume that the ContactNoteEditSave has
* a primary key from the database table.
* This event action prepare all the data so no additional query is needed
* in the display table.
* @param EventControler
*/
function eventAddFeed(EventControler $evtcl)
{
$this->note = $_SESSION['ContactNoteEditSave']->note;
$this->iduser = $_SESSION['ContactNoteEditSave']->iduser;
$this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact;
$this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note;
$user = new User();
$user->getId($this->iduser);
$this->user_full_name = $user->getFullName();
$do_contact = new Contact();
$do_contact->getId($this->idcontact);
$this->contact_full_name = $do_contact->getContactFullName();
$this->contact_image_url = $do_contact->getContactPicture();
if (strlen($this->note) > 200) {
$this->note = substr($this->note, 0, 200);
$this->more = True;
} else {
$this->more = false;
}
$user_relation = new ContactSharing();
$this->addFeed($user_relation->getCoWorkerByContact($this->idcontact));
}
示例14: clearByContact
/**
* Clear IM values by contact
*
* @access public
* @param Contact $contact
* @return boolean
*/
function clearByContact(Contact $contact)
{
return DB::execute('DELETE FROM ' . self::instance()->getTableName(true) . ' WHERE `contact_id` = ?', $contact->getId());
}
示例15: Contact
</li>
</ul>
</div>
<div class="section">
<h1>Contacts</h1>
<?php
foreach (GuiHelpers::getAllChannels() as $id => $info) {
$contact = new Contact($id);
?>
<div class="info">
<strong><?php
p($info['name']);
?>
</strong>
<div class="right"><a href="?page=contact&id=<?php
p($contact->getId());
?>
">Edit</a> - <a
href="?page=contact-delete&id=<?php
p($contact->getId());
?>
">Delete</a></div>
</div>
<ul class="information">
<?php
foreach ($info['channels'] as $chan) {
$chandle = Channel::fetch(intval($chan['id']));
?>
<li>
<?php
p($chandle->getName());