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


PHP Contact::getPrimaryKeyValue方法代码示例

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


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

示例1: eventGetContacts

 function eventGetContacts(EventControler $evtcl)
 {
     $plugType = 'email';
     $provider_box = $evtcl->provider_box;
     $email_box = $evtcl->email_box;
     $password_box = $evtcl->password_box;
     $msg = "";
     $contacts = "";
     $ok = false;
     if (empty($email_box)) {
         $msg = "Email missing !";
     }
     if (empty($password_box)) {
         $msg = "Password missing !";
     }
     if (empty($provider_box)) {
         $msg = "Provider missing !";
     }
     if ($msg == "") {
         $inviter = new OpenInviter();
         $inviter->startPlugin($provider_box);
         $internal = $inviter->getInternalError();
         if ($internal) {
             $msg = $internal;
         } elseif (!$inviter->login($email_box, $password_box)) {
             $internal = $inviter->getInternalError();
             $msg = $internal ? $internal : "Login failed. Please check the email and password you have provided and try again later !";
         } elseif (false === ($contacts = $inviter->getMyContacts())) {
             $msg = "Unable to get contacts !";
         } else {
             $msg = "Contacts imported successfully.";
             $ok = true;
             //$_POST['oi_session_id']=$inviter->plugin->getSessionID();
         }
     }
     if ($ok) {
         /*print_r($contacts);
         		exit();*/
         foreach ($contacts as $email => $name) {
             $do_contact = new Contact();
             $do_contact->firstname = $name;
             $do_contact->iduser = $_SESSION['do_User']->iduser;
             $do_contact->add();
             $lastInsertedContId = $do_contact->getPrimaryKeyValue();
             $do_contact->addEmail($email, 'Home');
             $do_contact->free();
             //contact view
             $do_cv = new ContactView();
             $do_cv->idcontact = $lastInsertedContId;
             $do_cv->firstname = $name;
             $do_cv->email_address = $email;
             $do_cv->add();
             $do_cv->free();
         }
     }
     $_SESSION['in_page_message'] = $msg;
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:57,代码来源:OfuzEmailImporter.class.php

示例2: addInvoice

 /**
  * Custom add method to add an invoice. Needs a contact for each invocie else 
  * do not add the invoice
  * @param $evtcl -- Object  
  */
 function addInvoice(EventControler $evtcl)
 {
     $_SESSION['in_page_message'] = '';
     $rec_value = $evtcl->recurrent;
     $add_invoice = false;
     $do_contact = new Contact();
     $concat_name_in_address = '';
     if ($evtcl->fields["due_date"] == '') {
         $this->due_date = date('Y-m-d');
     } else {
         $this->due_date = $evtcl->fields["due_date"];
     }
     if ($evtcl->idcontact) {
         $idcontact = $evtcl->idcontact;
         $add_invoice = true;
         $do_contact->getId($idcontact);
     } else {
         $cont_name = $evtcl->contact;
         if ($cont_name != '') {
             $do_Contact_View = new ContactView();
             $do_contact->addNew();
             $do_contact->firstname = $cont_name;
             $do_contact->iduser = $_SESSION['do_User']->iduser;
             $do_contact->add();
             $idcontact = $do_contact->getPrimaryKeyValue();
             $do_Contact_View->setUser($_SESSION['do_User']->iduser);
             $do_contact->getId($idcontact);
             $concat_name_in_address = $do_contact->firstname;
             $do_Contact_View->addFromContact($do_contact);
             $do_Contact_View->updateFromContact($do_contact);
             if ($idcontact) {
                 $add_invoice = true;
                 $do_cont_addr = new ContactAddress();
                 $do_cont_addr->addNew();
                 $do_cont_addr->idcontact = $idcontact;
                 $do_cont_addr->address = $evtcl->fields["invoice_address"];
                 $do_cont_addr->address_type = 'Work';
                 if (strlen($evtcl->fields["invoice_address"]) > 0) {
                     $do_cont_addr->add();
                 }
             }
         }
     }
     if ($add_invoice) {
         // Keep the idcontact in case there is an idcompany
         if ($do_contact->idcompany != '' && !empty($do_contact->idcompany)) {
             $this->idcompany = $do_contact->idcompany;
         }
         //$this->num = $this->getUniqueInvoiceNum();
         $this->num = time();
         $this->iduser = $_SESSION['do_User']->iduser;
         $this->idterms = $evtcl->fields["idterms"];
         $this->description = $evtcl->fields["description"];
         $this->discount = $evtcl->fields["discount"];
         $this->tax = $evtcl->fields["tax"];
         $this->datecreated = date("Y-m-d");
         $this->idcontact = $idcontact;
         $this->status = 'Quote';
         $this->invoice_note = $evtcl->fields["invoice_note"];
         $this->invoice_term = $evtcl->fields["invoice_term"];
         if ($concat_name_in_address == '') {
             $this->invoice_address = $evtcl->fields["invoice_address"];
         } else {
             $this->invoice_address = $concat_name_in_address . '<br />' . $evtcl->fields["invoice_address"];
         }
         $this->add();
         $this->idinvoice = $this->getPrimaryKeyValue();
         // If the user set to have the ivoice added as recurrent Invoice then add
         if ($evtcl->setRec == 'Yes') {
             if (!empty($rec_value) && preg_match('/^[0-9]+$/', $rec_value) && $rec_value != 0) {
                 // Add to recurrent
                 $_SESSION['RecurrentInvoice']->addRecurrentInvoice($this->getPrimaryKeyValue(), $evtcl->recurrent, $evtcl->frequency, date("Y-m-d"));
             } else {
                 $_SESSION['in_page_message'] = _("Recurrent Value is not correct.To set as Recurrent edit the invoice and enter numeric value");
             }
         }
     } else {
         $_SESSION['in_page_message'] = _("Invoice could be created. Possible reason Contact Missing.");
         $evtcl->setDisplayNext(new Display('invoices.php'));
     }
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:86,代码来源:.Invoice.class.php

示例3: Contact

        </div><br />

<?php 
$do_contact = new Contact();
$do_np_contact = new Contact();
if (!empty($_SESSION['do_User']->idcontact) && $_SESSION['do_User']->idcontact != 0) {
    $idcontact = $_SESSION['do_User']->idcontact;
    $do_contact->getId($_SESSION['do_User']->idcontact);
} else {
    // Add a new contact and update the idcontact to the user table for the user
    $do_contact->addNew();
    $do_contact->firstname = $_SESSION['do_User']->firstname;
    $do_contact->lastname = $_SESSION['do_User']->lastname;
    $do_contact->iduser = $_SESSION['do_User']->iduser;
    $do_contact->add();
    $idcontact_inserted = $do_contact->getPrimaryKeyValue();
    $do_contact_view = new ContactView();
    $_SESSION['do_User']->idcontact = $idcontact_inserted;
    $do_contact->getId($idcontact_inserted);
}
$_SESSION['edit_from_page'] = 'settings_myinfo.php';
$do_contact->sessionPersistent("ContactEditSave", "contact.php", OFUZ_TTL);
//$do_contact->sessionPersistent("ContactEditSave", "index.php", 120);
//$do_np_contact->sessionPersistent("ContactPictureSave", "index.php", 120);
$do_np_contact->sessionPersistent("ContactPictureSave", "index.php", OFUZ_TTL);
$_SESSION['ContactPictureSave']->getId($idcontact);
$e_fullContact = new Event("ContactPictureSave->eventValuesFromForm");
$e_fullContact->setLevel(1999);
$e_fullContact->setGotFile(true);
$e_fullContact->addEventAction("ContactPictureSave->update", 2000);
echo $e_fullContact->getFormHeader();
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:settings_myinfo.php

示例4: 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);
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:67,代码来源:ContactImport.class.php

示例5: posteventAddContact

 /**
  * saveWebForm()
  * this will check if contact exists with firname, lastname, name and email 
  * If exist add to it, if doesn't exists create a new one.
  */
 function posteventAddContact($fid, $fields, $nxturl, $uid, $tags)
 {
     //echo 'hh';die();
     //$fields = $_REQUEST['fields'];
     //$fields = $event_controler->fields;
     $this->setLog("\n eventAddContact, creating new contact from form, using " . count($fields) . " fields. (" . date("Y/m/d H:i:s") . ")");
     //$dropcode = $_POST['dropcode'];
     $do_contact = new Contact();
     $do_contact->iduser = $uid;
     $do_contact->add();
     $this->setLog("\n new contact:" . $do_contact->idcontact . " for user:" . $uid);
     foreach ($fields as $field_name => $field_value) {
         $this->setLog("\n Processing field:" . $field_name . " with value:" . $field_value);
         $do_webform_fields = new WebFormUserField();
         $do_webform_fields->query("SELECT wfu.name, wff.class as class_name, wff.variable, wff.variable_type, wfu.required \n\t\t                                   FROM webformfields as wff, webformuserfield as wfu \n\t\t\t\t\t\t\t\t\t\t   WHERE wff.name=wfu.name\n\t\t\t\t\t\t\t\t\t\t     AND wfu.name = '" . $field_name . "'\n\t\t\t\t\t\t\t\t\t\t\t AND wfu.idwebformuser= " . $fid);
         $this->setLog("\n Field information class:" . $do_webform_fields->class_name . " Variable:" . $do_webform_fields->variable);
         $this->setLog("\n rows:" . $do_webform_fields->getNumRows());
         if ($do_webform_fields->getNumRows() == 1) {
             if ($do_webform_fields->class_name == "Contact") {
                 $this->setLog("\n     Updating contact");
                 $do_contact->{$do_webform_fields->variable} = $field_value;
                 $do_contact->update();
             } else {
                 $update = false;
                 if (is_object(${'sub_' . $do_webform_fields->class_name})) {
                     if (${'sub_' . $do_webform_fields->class_name}->getType() == $do_webform_fields->variable_type) {
                         $update = true;
                     }
                 }
                 if ($update) {
                     $this->setLog("\n     Updating class:" . $do_webform_fields->class_name);
                     $obj = ${'sub_' . $do_webform_fields->class_name};
                     $obj->{$do_webform_fields->variable} = $field_value;
                     $obj->update();
                 } else {
                     $class_name = $do_webform_fields->class_name;
                     ${'sub_' . $class_name} = new $class_name();
                     $obj = ${'sub_' . $class_name};
                     $obj->{$do_webform_fields->variable} = $field_value;
                     if (method_exists($obj, "setType") && strlen($do_webform_fields->variable_type) > 0) {
                         $obj->setType($do_webform_fields->variable_type);
                     }
                     $obj->idcontact = $do_contact->getPrimaryKeyValue();
                     $obj->add();
                 }
             }
         }
     }
     $contact_view = new ContactView();
     $contact_view->setUser($uid);
     $contact_view->addFromContact($do_contact);
     $tags = explode(",", $tags);
     foreach ($tags as $tag) {
         $tag = trim($tag);
         $do_tag = new Tag();
         $do_tag->addNew();
         $do_tag->addTagAssociation($do_contact->getPrimaryKeyValue(), $tag, "contact", $fid);
         $contact_view->addTag($tag);
     }
     if (strlen($nexturl) > 0) {
         //$event_controler->setUrlNext($this->urlnext);
         header("location:{$nxturl}");
     } else {
         //$event_controler->setUrlNext($GLOBALS['cfg_ofuz_site_http_base'].'web_form_thankyou.php');
         $url = $GLOBALS['cfg_ofuz_site_http_base'] . 'web_form_thankyou.php';
         header("location:{$url}");
     }
     //$event_controler->addParam("do_contact", $do_contact);
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:74,代码来源:WebFormUser.class.php

示例6: updateFromContact

 public function updateFromContact(Contact $contact)
 {
     $do_email = $contact->getChildContactEmail();
     $default_email = $do_email->getDefaultEmail();
     $do_phone = $contact->getChildContactPhone();
     //$do_phone->next();
     $this->query("\n\t\t\tUPDATE " . $this->getTable() . " SET \n\t\t\t       firstname = '" . $contact->firstname . "',\n\t\t\t\t   lastname = '" . $contact->lastname . "',\n\t\t\t\t   company = '" . $contact->company . "', \n\t\t\t\t   idcompany = '" . $contact->idcompany . "',\n\t\t\t\t   position = '" . $contact->position . "',\n\t\t\t\t   picture = '" . $contact->picture . "',\n\t\t\t\t   email_address = '" . $default_email . "',\n\t\t\t\t   phone_number = '" . $do_phone->phone_number . "',\n\t\t\t\t   last_update = now()\n\t\t\t WHERE idcontact = " . $contact->getPrimaryKeyValue() . "\n\t\t");
     $this->setLog("\n Contact View Update: " . $this->getSqlQuery());
     //$this->free();
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:10,代码来源:ContactView.class.php

示例7: 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);
//.........这里部分代码省略.........
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:101,代码来源:OfuzApiMethods.class.php

示例8: insertContactEntry

 /**
  * inserting a contact entry into ofuz Database.
  * @param array : contact details
  * @return void
  * @see class : Contact, Company
  */
 function insertContactEntry($entry)
 {
     $id_company = $this->checkCompanyExists($entry['org_name']);
     if ($id_company) {
         $new_contact = new Contact();
         $new_contact->company = $entry['org_name'];
         $new_contact->firstname = $entry['title'];
         $new_contact->idcompany = $id_company;
         $new_contact->iduser = $this->id_user;
         $new_contact->position = $entry['org_title'];
         $new_contact->add();
         $lastInsertedContId = $new_contact->getPrimaryKeyValue();
     } else {
         $new_company = new Company();
         $new_company->name = $entry['org_name'];
         $new_company->iduser = $this->id_user;
         $new_company->add();
         $new_company_id = $new_company->getPrimaryKeyValue();
         $new_contact = new Contact();
         $new_contact->company = $entry['org_name'];
         $new_contact->firstname = $entry['title'];
         $new_contact->idcompany = $new_company_id;
         $new_contact->iduser = $this->id_user;
         $new_contact->position = $entry['org_title'];
         $new_contact->add();
         $lastInsertedContId = $new_contact->getPrimaryKeyValue();
     }
     if ($entry['ph_mobile']) {
         $new_contact->addPhone($entry['ph_mobile'], 'Mobile');
     }
     if ($entry['ph_home']) {
         $new_contact->addPhone($entry['ph_home'], 'Home');
     }
     if ($entry['ph_work']) {
         $new_contact->addPhone($entry['ph_work'], 'Work');
     }
     if ($entry['address_home']) {
         $new_contact->addAddress($entry['address_home'], 'Home');
     }
     if ($entry['address_other']) {
         $new_contact->addAddress($entry['address_other'], 'Other');
     }
     if ($entry['address_work']) {
         $new_contact->addAddress($entry['address_work'], 'Work');
     }
     if ($entry['em_other']) {
         $new_contact->addEmail($entry['em_other'], 'Other');
     }
     if ($entry['em_home']) {
         $new_contact->addEmail($entry['em_home'], 'Home');
     }
     if ($entry['em_work']) {
         $new_contact->addEmail($entry['em_work'], 'Work');
     }
     $q_ins_contact = new sqlQuery($this->getDbCon());
     $sql_ins = "INSERT INTO\n                    google_contact_info(idcontact,iduser,entry_id,entry_link_edit,entry_link_self)\n                    VALUES(" . $lastInsertedContId . "," . $this->id_user . ",'" . $entry['id'] . "','" . $entry['link_edit'] . "','" . $entry['link_self'] . "')\n                  ";
     $q_ins_contact->query($sql_ins);
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:64,代码来源:GoogleContactImport.class.php

示例9: 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
//.........这里部分代码省略.........
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:101,代码来源:VBook.class.php

示例10: 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;
//.........这里部分代码省略.........
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:101,代码来源:RestoreAccount.class.php

示例11: addUserAsContact

 /**
  * Method adding user as Contact
  * @param $firstname -- STRING
  * @param $lastname -- STRING
  * @param $company -- STRING
  * @param $email -- STRING
  * @param $iduser -- INT
  * FIXME May be no need to rebuilt the contact view but to enter an entry which is faster
  */
 function addUserAsContact($firstname, $lastname, $company, $email, $iduser)
 {
     $idcompany = "";
     if ($company != "") {
         $do_company = new Company();
         $idcompany = $do_company->addNewCompany($company, $iduser);
     }
     $do_contact = new Contact();
     $do_contact->firstname = $firstname;
     $do_contact->lastname = $lastname;
     $do_contact->iduser = $iduser;
     $do_contact->idcompany = $idcompany;
     $do_contact->company = $company;
     $do_contact->add();
     $do_contact->addEmail($email, 'Home');
     $lastInsertedContId = $do_contact->getPrimaryKeyValue();
     //$this->setRegistry(false);
     $this->getId($iduser);
     $this->idcontact = $lastInsertedContId;
     $this->update();
     $contact_view = new ContactView();
     $contact_view->setUser($iduser);
     //$this->setRegistry(false);
     $contact_view->rebuildContactUserTable();
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:34,代码来源:User.class.php


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