本文整理汇总了PHP中Company::getPrimaryKeyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::getPrimaryKeyValue方法的具体用法?PHP Company::getPrimaryKeyValue怎么用?PHP Company::getPrimaryKeyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::getPrimaryKeyValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importFacebookFriends
/**
* Function to import the facebook contact to ofuz.
* Since Facebook does provide limited information on friends so just the basic
* information will be imported and also keep track of the Facebook user id so that
* for the first time it will just add and on next import it will update.
* @param $fb_friend_id
*/
function importFacebookFriends($friends_data)
{
$do_tag = new Tag();
$do_company = new Company();
$frnd_fb_uid = $friends_data["fb_uid"];
$idcontact = $this->isFbFriendInContact($frnd_fb_uid);
$fname = $friends_data["name"]["first_name"];
$lname = $friends_data["name"]["last_name"];
$work = $friends_data["work"];
$work_detail = $work[0];
$work_history = @$work_detail["work_history"];
$profile_url = @$friends_data["profile_url"][0]["profile_url"];
$profile_pic = @$friends_data["pic_with_logo"][0]["pic_with_logo"];
if (is_array($work_history)) {
$company = $work_history[0]["company_name"];
$position = $work_history[0]["position"];
$desc = $work_history[0]["description"];
}
$list_name = $friends_data['listname'];
$this->firstname = $fname;
$this->lastname = $lname;
$this->fb_userid = $frnd_fb_uid;
$this->iduser = $_SESSION['do_User']->iduser;
if ($idcontact) {
//update the data
$this->checkFbProfileUrlOnUpdate($idcontact, $profile_url);
$this->updateFbProfilePic($idcontact, $profile_pic);
$do_tag->addTagAssociation($idcontact, "Facebook", "contact", $_SESSION['do_User']->iduser);
if (is_array($list_name) && count($list_name) > 0) {
foreach ($list_name as $list_name) {
$do_tag->addTagAssociation($idcontact, $list_name, "contact", $_SESSION['do_User']->iduser);
}
}
$this->getId($idcontact);
if ($company != '' && !empty($company)) {
if ($position != '') {
$this->position = $position;
} else {
$this->position = '';
}
$q = new sqlQuery($this->getDbCon());
$q->query("select idcompany from company where name = '" . trim($company) . "' AND iduser = " . $_SESSION['do_User']->iduser);
if ($q->getNumRows()) {
$q->fetch();
$idcompany = $q->getData("idcompany");
$this->idcompany = $idcompany;
$this->company = trim($company);
$this->update();
$idcontact = $this->getPrimaryKeyValue();
} else {
$do_company->name = trim($company);
$do_company->iduser = $_SESSION['do_User']->iduser;
$do_company->add();
$idcompany = $do_company->getPrimaryKeyValue();
$this->idcompany = $idcompany;
$this->company = trim($company);
$this->update();
}
} else {
$iduser = $_SESSION['do_User']->iduser;
$q = new sqlQuery($this->getDbCon());
$q_upd = "UPDATE contact set firstname = '" . $fname . "',lastname = '" . $lname . "',fb_userid = " . $frnd_fb_uid . ",position = '" . $position . "' where idcontact = " . $idcontact;
$q->query($q_upd);
}
} else {
// new entry
$do_company = new Company();
$do_cont_website = new ContactWebsite();
if ($company != '' && !empty($company)) {
if ($position != '') {
$this->position = $position;
} else {
$this->position = '';
}
$q = new sqlQuery($this->getDbCon());
$q->query("select idcompany from company where name = '" . trim($company) . "' AND iduser = " . $_SESSION['do_User']->iduser);
if ($q->getNumRows()) {
$q->fetch();
$idcompany = $q->getData("idcompany");
$this->idcompany = $idcompany;
$this->company = trim($company);
$this->add();
$idcontact = $this->getPrimaryKeyValue();
$do_cont_website->idcontact = $idcontact;
$do_cont_website->website = $profile_url;
$do_cont_website->website_type = 'Facebook';
$do_cont_website->add();
$this->updateFbProfilePic($idcontact, $profile_pic);
$do_tag->addTagAssociation($idcontact, "Facebook", "contact", $_SESSION['do_User']->iduser);
if (is_array($list_name) && count($list_name) > 0) {
foreach ($list_name as $list_name) {
$do_tag->addTagAssociation($idcontact, $list_name, "contact", $_SESSION['do_User']->iduser);
}
//.........这里部分代码省略.........
示例2: eventImportContactsFromCsv
//.........这里部分代码省略.........
break;
case "im_skype_per":
$contact_im_skype_per = $data[$c];
$im_skype = "Skype";
$contact_im_skype_per_type = "Personal";
break;
case "im_skype_ot":
$contact_im_skype_ot = $data[$c];
$im_skype = "Skype";
$contact_im_skype_ot_type = "Other";
case "im_gt_wk":
$contact_im_gt_wk = $data[$c];
$im_gt = "Google Talk";
$contact_im_gt_wk_type = "Work";
break;
case "im_gt_per":
$contact_im_gt_per = $data[$c];
$im_gt = "Google Talk";
$contact_im_gt_per_type = "Personal";
break;
case "im_gt_ot":
$contact_im_gt_ot = $data[$c];
$im_gt = "Google Talk";
$contact_im_gt_ot_type = "Other";
break;
case "note":
$contact_note .= "<p>" . $data[$c] . "</p>";
break;
}
}
$do_company->name = $company;
$do_company->iduser = $iduser;
$do_company->add();
$idcompany = $do_company->getPrimaryKeyValue();
$do_contact->idcompany = $idcompany;
$do_contact->iduser = $iduser;
$do_contact->firstname = $contact_firstname;
$do_contact->lastname = $contact_lastname;
$do_contact->company = $contact_company;
$do_contact->position = $contact_position;
$do_contact->summary = $contact_summary;
$do_contact->birthday = $contact_birthday;
$do_contact->add();
$idcontact = $do_contact->getPrimaryKeyValue();
//In theory this below should not be needed
$do_contact->idcontact = $idcontact;
$do_tag = new Tag();
if (strpos($_SESSION['import_tag'], ",") === false) {
$do_tag->addTagAssociation($idcontact, trim($_SESSION['import_tag']), "contact", $_SESSION['do_User']->iduser);
} else {
$tags = explode(",", $_SESSION['import_tag']);
foreach ($tags as $tag) {
$do_tag->addTagAssociation($idcontact, trim($tag), "contact", $_SESSION['do_User']->iduser);
}
}
if ($contact_address_hm != "" || $contact_city != "" || $contact_state != "" || $contact_street != "" || $contact_zipcode != "" || $contact_country != "") {
$do_contact->addAddress($contact_address_hm, $contact_address_hm_type, $contact_city, $contact_state, $contact_street, $contact_zipcode, $contact_country);
}
if ($contact_address_wk != "" || $contact_city != "" || $contact_state != "" || $contact_street != "" || $contact_zipcode != "" || $contact_country != "") {
$do_contact->addAddress($contact_address_wk, $contact_address_wk_type, $contact_city, $contact_state, $contact_street, $contact_zipcode, $contact_country);
}
if ($contact_address_ot != "" || $contact_city != "" || $contact_state != "" || $contact_street != "" || $contact_zipcode != "" || $contact_country != "") {
$do_contact->addAddress($contact_address_ot, $contact_address_ot_type, $contact_city, $contact_state, $contact_street, $contact_zipcode, $contact_country);
}
if ($contact_email_hm != "") {
$do_contact->addEmail($contact_email_hm, $contact_email_hm_type);
示例3: Contact
function add_contact()
{
$do_api_contact = new Contact();
$do_Contact_View = new ContactView();
$do_api_contact->addNew();
$do_api_contact->firstname = $this->firstname;
$do_api_contact->lastname = $this->lastname;
$do_api_contact->position = $this->position;
$do_api_contact->iduser = $this->iduser;
if ($this->tags != '') {
$tags = explode(",", $this->tags);
}
if ($this->firstname == "" && $this->lastname == "") {
$this->setMessage("610", "First Name OR Last Name is Required");
return false;
} elseif (!$this->iduser) {
$this->setMessage("502", "The User Session is expired");
return false;
} elseif ($idcontact = $do_api_contact->duplicateContact($this->iduser, $this->email_work, $this->email_home, $this->email_other)) {
$this->setMessage("613", "The Contact is duplicated. Contact ID: " . $idcontact);
return false;
} else {
if ($this->company != "") {
$do_api_contact->company = $this->company;
$do_api_company = new Company();
$idcompany = $do_api_company->isDuplicateCompany($this->company, $this->iduser);
if (!$idcompany) {
$do_api_company->addNew();
$do_api_company->iduser = $this->iduser;
$do_api_company->name = trim($this->company);
$do_api_company->add();
$this->idcompany = $do_api_company->getPrimaryKeyValue();
} else {
$this->idcompany = $idcompany;
}
$do_api_contact->idcompany = $this->idcompany;
}
$do_api_contact->add();
$this->idcontact = $do_api_contact->getPrimaryKeyValue();
$do_api_contact->idcontact = $this->idcontact;
//child data starts here
// Phones
if ($this->phone_work != "") {
$do_api_contact->addPhone($this->phone_work, "Work");
}
if ($this->phone_home != "") {
$do_api_contact->addPhone($this->phone_home, "Home");
}
if ($this->mobile_number != "") {
$do_api_contact->addPhone($this->mobile_number, "Mobile");
}
if ($this->fax_number != "") {
$do_api_contact->addPhone($this->fax_number, "Fax");
}
if ($this->phone_other != "") {
$do_api_contact->addPhone($this->phone_other, "Other");
}
//emails
if ($this->email_work != "") {
$do_api_contact->addEmail($this->email_work, "Work");
}
if ($this->email_home != "") {
$do_api_contact->addEmail($this->email_home, "Home");
}
if ($this->email_other != "") {
$do_api_contact->addEmail($this->email_other, "Other");
}
//Website
if ($this->company_website != "") {
$do_api_contact->addWebsite($this->company_website, "Company");
}
if ($this->personal_website != "") {
$do_api_contact->addWebsite($this->personal_website, "Personal");
}
if ($this->blog_url != "") {
$do_api_contact->addWebsite($this->blog_url, "Blog");
}
if ($this->twitter_profile_url != "") {
$do_api_contact->addWebsite($this->twitter_profile_url, "Twitter");
}
if ($this->linkedin_profile_url != "") {
$do_api_contact->addWebsite($this->linkedin_profile_url, "LinkedIn");
}
if ($this->facebook_profile_url != "") {
$do_api_contact->addWebsite($this->facebook_profile_url, "Facebook");
}
// API V.02 will have IM and Address
//Add tags if any
if (is_array($tags)) {
$do_api_tags = new Tag();
foreach ($tags as $tag) {
$do_api_tags->addNew();
$do_api_tags->addTagAssociation($this->idcontact, $tag, "contact", $this->iduser);
}
}
// Ok here the last thing that needs to be done so that the contact should also on the table
$do_Contact_View = new ContactView();
$do_Contact_View->setUser($this->iduser);
$do_api_contact->getId($this->idcontact);
$do_Contact_View->addFromContact($do_api_contact);
//.........这里部分代码省略.........
示例4: updateContactEntry
/**
* Updates a contact entry in ofuz Database.
* @param array,int,int : contact details, contact id, company id
* @return void
* @see class : Company, Contact
*/
function updateContactEntry($entry, $id_contact, $id_company = null)
{
if (!$id_company) {
$new_company = new Company();
$new_company->name = $entry['org_name'];
$new_company->iduser = $this->id_user;
$new_company->add();
$id_company = $new_company->getPrimaryKeyValue();
}
$contact = new Contact();
$contact->getId($id_contact);
// Primarykey id of the record to update
$contact->company = $entry['org_name'];
//do not update name while importing since Gmail has only one text box for the name
//$contact->firstname = $entry['title'];
$contact->idcompany = $id_company;
//$contact->iduser = $this->id_user;
$contact->position = $entry['org_title'];
$contact->update();
$q_contact = new sqlQuery($this->getDbCon());
$sql_sel = "SELECT * FROM contact_address WHERE idcontact = " . $id_contact;
$q_contact->query($sql_sel);
if ($q_contact->getNumRows()) {
while ($q_contact->fetch()) {
if ($q_contact->getData("address_type") == "Home") {
$contact->updateAddress($entry['address_home'], 'Home', $q_contact->getData("idcontact_address"));
}
if ($q_contact->getData("address_type") == "Other") {
$contact->updateAddress($entry['address_other'], 'Other', $q_contact->getData("idcontact_address"));
}
if ($q_contact->getData("address_type") == "Work") {
$contact->updateAddress($entry['address_work'], 'Work', $q_contact->getData("idcontact_address"));
}
}
}
$sql_sel = "SELECT * FROM contact_email WHERE idcontact = " . $id_contact;
$q_contact->query($sql_sel);
if ($q_contact->getNumRows()) {
while ($q_contact->fetch()) {
if ($q_contact->getData("email_type") == "Home") {
$contact->updateEmail($entry['em_home'], 'Home', $q_contact->getData("idcontact_email"));
}
if ($q_contact->getData("email_type") == "Other") {
$contact->updateEmail($entry['em_other'], 'Other', $q_contact->getData("idcontact_email"));
}
if ($q_contact->getData("email_type") == "Work") {
$contact->updateEmail($entry['em_work'], 'Work', $q_contact->getData("idcontact_email"));
}
}
}
$sql_sel = "SELECT * FROM contact_phone WHERE idcontact = " . $id_contact;
$q_contact->query($sql_sel);
if ($q_contact->getNumRows()) {
while ($q_contact->fetch()) {
if ($q_contact->getData("phone_type") == "Home") {
$contact->updatePhone($entry['ph_home'], 'Home', $q_contact->getData("idcontact_phone"));
}
if ($q_contact->getData("phone_type") == "Mobile") {
$contact->updatePhone($entry['ph_mobile'], 'Mobile', $q_contact->getData("idcontact_phone"));
}
if ($q_contact->getData("phone_type") == "Work") {
$contact->updatePhone($entry['ph_work'], 'Work', $q_contact->getData("idcontact_phone"));
}
}
}
}
示例5: insertContact
function insertContact()
{
if ($this->contact['ORG']) {
$id_company = $this->checkCompanyExists($this->contact['ORG']);
$id_company_flag = $id_company ? true : false;
$flag = true;
} else {
$flag = true;
$id_company = 0;
$id_company_flag = true;
}
if ($flag) {
if ($id_company_flag) {
$new_contact = new Contact();
$new_contact->firstname = $this->contact['FULLNAME'];
$new_contact->position = $this->contact['TITLE'];
if ($this->contact['ORG']) {
$company = $this->contact['ORG'];
} else {
$company = "";
}
$new_contact->company = $company;
$new_contact->idcompany = $id_company;
$new_contact->iduser = $this->iduser;
$new_contact->birthday = $this->contact['BDAY'];
$new_contact->picture = $this->contact['PHOTO'];
$new_contact->add();
$lastInsertedContId = $new_contact->getPrimaryKeyValue();
} else {
$new_company = new Company();
$new_company->name = $this->contact['ORG'];
$new_company->iduser = $this->iduser;
$new_company->add();
$new_company_id = $new_company->getPrimaryKeyValue();
$new_contact = new Contact();
$new_contact->firstname = $this->contact['FULLNAME'];
$new_contact->position = $this->contact['TITLE'];
$new_contact->company = $this->contact['ORG'];
$new_contact->idcompany = $new_company_id;
$new_contact->iduser = $this->iduser;
$new_contact->birthday = $this->contact['BDAY'];
$new_contact->picture = $this->contact['PHOTO'];
$new_contact->add();
$lastInsertedContId = $new_contact->getPrimaryKeyValue();
}
if ($this->contact['TELL_WORK']) {
$new_contact->addPhone($this->contact['TELL_WORK'], 'Work');
}
if ($this->contact['TELL_HOME']) {
$new_contact->addPhone($this->contact['TELL_HOME'], 'Home');
}
if ($this->contact['TELL_FAX']) {
$new_contact->addPhone($this->contact['TELL_FAX'], 'Fax');
}
if ($this->contact['TELL_CELL']) {
$new_contact->addPhone($this->contact['TELL_CELL'], 'Mobile');
}
if ($this->contact['TELL_OTHER']) {
$new_contact->addPhone($this->contact['TELL_OTHER'], 'Other');
}
if ($this->contact['ADR_WORK']) {
$new_contact->addAddress($this->contact['ADR_WORK'], 'Work');
}
if ($this->contact['ADR_HOME']) {
$new_contact->addAddress($this->contact['ADR_HOME'], 'Home');
}
if ($this->contact['ADR_OTHER']) {
$new_contact->addAddress($this->contact['ADR_OTHER'], 'Other');
}
if ($this->contact['EMAIL_WORK']) {
$new_contact->addEmail($this->contact['EMAIL_WORK'], 'Work');
}
if ($this->contact['EMAIL_HOME']) {
$new_contact->addEmail($this->contact['EMAIL_HOME'], 'Home');
}
if ($this->contact['EMAIL_OTHER']) {
$new_contact->addEmail($this->contact['EMAIL_OTHER'], 'Other');
}
$do_tag = new Tag();
if ($this->contact['CATEGORIES']) {
$contact_tag = explode(",", $this->contact['CATEGORIES']);
$arr_import_tags = explode(",", $_SESSION['import_tag']);
foreach ($arr_import_tags as $imp_tag) {
array_push($contact_tag, $imp_tag);
}
foreach ($contact_tag as $tag) {
$tag = trim($tag);
$do_tag->addTagAssociation($lastInsertedContId, $tag, "contact", $this->iduser);
}
} else {
$arr_import_tags = explode(",", $_SESSION['import_tag']);
foreach ($arr_import_tags as $tag) {
$tag = trim($tag);
$do_tag->addTagAssociation($lastInsertedContId, $tag, "contact", $this->iduser);
}
}
$do_cont_view = new ContactView();
$do_cont_view->addFromContact($new_contact);
$do_cont_view->updateFromContact($new_contact);
// Added the method call updateFromContact() so that the child data is updated just after insert
//.........这里部分代码省略.........
示例6: eventImportAccount
function eventImportAccount(EventControler $evtcl)
{
$msg = "";
$uploaded_file = $_FILES['fields']['name']['import_account'];
$target_path = 'files/' . $uploaded_file;
if (!move_uploaded_file($_FILES['fields']['tmp_name']['import_account'], $target_path)) {
$msg = "There was an error uploading the file, please try again!";
} else {
chmod($target_path, 0755);
if (file_exists($target_path)) {
//$xml = simplexml_load_file($_SERVER['DOCUMENT_ROOT']."/".$target_path);
$str_xml = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $target_path);
$str_xml = preg_replace('/[^(\\x20-\\x7F)]*/', '', $str_xml);
$xml = simplexml_load_string($str_xml);
echo '<pre>';
print_r($xml);
echo '</pre>';
die;
if ($xml !== FALSE) {
$c_cnt = count($xml->contact);
if ($c_cnt) {
for ($i = 0; $i < $c_cnt; $i++) {
$do_contact = new Contact();
$contact = $xml->contact[$i];
$do_contact->firstname = $contact->firstname;
$do_contact->lastname = $contact->lastname;
$do_contact->position = $contact->position;
$do_contact->company = $contact->company;
$do_contact->idcompany = $contact->idcompany;
$do_contact->iduser = $_SESSION['do_User']->iduser;
$do_contact->picture = $contact->picture;
$do_contact->summary = $contact->summary;
$do_contact->birthday = $contact->birthday;
$do_contact->portal_code = $contact->portal_code;
$do_contact->fb_userid = $contact->fb_userid;
$do_contact->tw_user_id = $contact->tw_user_id;
$do_contact->email_optout = $contact->email_optout;
$do_contact->add();
$lastInsertedContId = $do_contact->getPrimaryKeyValue();
/**
*Contact Address
*/
$ca_cnt = count($contact->contact_address);
if ($ca_cnt) {
for ($ca_cnt_i = 0; $ca_cnt_i < $ca_cnt; $ca_cnt_i++) {
$do_contact_address = new ContactAddress();
$contact_address = $contact->contact_address[$ca_cnt_i];
$do_contact_address->city = $contact_address->city;
$do_contact_address->country = $contact_address->country;
$do_contact_address->state = $contact_address->state;
$do_contact_address->street = $contact_address->street;
$do_contact_address->zipcode = $contact_address->zipcode;
$do_contact_address->idcontact = $lastInsertedContId;
$do_contact_address->address = $contact_address->address;
$do_contact_address->address_type = $contact_address->address_type;
$do_contact_address->add();
$do_contact_address->free();
}
}
/**
*Contact Email
*/
$ce_cnt = count($contact->contact_email);
if ($ce_cnt) {
for ($ce_cnt_i = 0; $ce_cnt_i < $ce_cnt; $ce_cnt_i++) {
$do_contact_email = new ContactEmail();
$contact_email = $contact->contact_email[$ce_cnt_i];
$do_contact_email->idcontact = $lastInsertedContId;
$do_contact_email->email_address = $contact_email->email_address;
$do_contact_email->email_type = $contact_email->email_type;
$do_contact_email->email_isdefault = $contact_email->email_isdefault;
$do_contact_email->add();
$do_contact_email->free();
}
}
/**
*Contact Phone
*/
$cp_cnt = count($contact->contact_phone);
if ($cp_cnt) {
for ($cp_cnt_i = 0; $cp_cnt_i < $cp_cnt; $cp_cnt_i++) {
$do_contact_phone = new ContactPhone();
$contact_phone = $contact->contact_phone[$cp_cnt_i];
$do_contact_phone->phone_number = $contact_phone->phone_number;
$do_contact_phone->phone_type = $contact_phone->phone_type;
$do_contact_phone->idcontact = $lastInsertedContId;
$do_contact_phone->add();
$do_contact_phone->free();
}
}
/**
*Contact Note
*/
$cn_cnt = count($contact->contact_note);
if ($cn_cnt) {
for ($cn_cnt_i = 0; $cn_cnt_i < $cn_cnt; $cn_cnt_i++) {
$do_contact_note = new ContactNotes();
$contact_note = $contact->contact_note[$cn_cnt_i];
$do_contact_note->idcontact = $lastInsertedContId;
$do_contact_note->note = $contact_note->note;
//.........这里部分代码省略.........