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


PHP Contact::addPhone方法代码示例

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


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

示例1: copy

	function import_from_vcard() {
		if (logged_user()->isGuest()) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}
		@set_time_limit(0);
		ini_set('auto_detect_line_endings', '1');
		if (isset($_GET['from_menu']) && $_GET['from_menu'] == 1) unset($_SESSION['go_back']);
		if (isset($_SESSION['go_back'])) {
			unset($_SESSION['go_back']);
			ajx_current("start");
		} else {
                
                    if(!Contact::canAdd(logged_user(), active_context())) {
                            flash_error(lang('no access permissions'));
                            ajx_current("empty");
                            return;
                    } 

                    $this->setTemplate('vcard_import');
                    tpl_assign('import_type', 'contact');                

                    $filedata = array_var($_FILES, 'vcard_file');
                    if (is_array($filedata)) {
                            $filename = ROOT.'/tmp/'.logged_user()->getId().'temp.vcf';
                            copy($filedata['tmp_name'], $filename);
                            $result = $this->read_vcard_file($filename);
                            unlink($filename);
                            $import_result = array('import_ok' => array(), 'import_fail' => array());

                            foreach ($result as $contact_data) {
                                    try {
                                            DB::beginWork();
                                            if (isset($contact_data['photo_tmp_filename'])) {
                                                $file_id = FileRepository::addFile($contact_data['photo_tmp_filename'], array('public' => true));
                                                $contact_data['picture_file'] = $file_id;
                                                unlink($contact_data['photo_tmp_filename']);
                                                unset($contact_data['photo_tmp_filename']);
                                            }
                                            if (isset($contact_data['company_name'])) {
                                                $company = Contacts::findOne(array("conditions" => "`first_name` = '".mysql_real_escape_string($contact_data['company_name'])."'"));
                                                if ($company == null) {                                                        
                                                        $company = new Contact();
                                                        $company->setObjectName($contact_data['company_name']);
                                                        $company->setIsCompany(1);
                                                        $company->save();                                                        
                                                        ApplicationLogs::createLog($company, null, ApplicationLogs::ACTION_ADD);
                                                }
                                                $contact_data['company_id'] = $company->getObjectId();
                                                unset($contact_data['company_name']);
                                            }

                                            $contact_data['import_status'] = '('.lang('updated').')';
                                            $fname = DB::escape(array_var($contact_data, "first_name"));
                                            $lname = DB::escape(array_var($contact_data, "surname"));
                                            $email_cond = array_var($contact_data, "email") != '' ? " OR email_address = '".array_var($contact_data, "email")."'" : "";
                                            $contact = Contacts::findOne(array(
                                                "conditions" => "first_name = ".$fname." AND surname = ".$lname." $email_cond",
                                                'join' => array(
                                                        'table' => ContactEmails::instance()->getTableName(),
                                                        'jt_field' => 'contact_id',
                                                        'e_field' => 'object_id',
                                                )));                                                        
                                            $log_action = ApplicationLogs::ACTION_EDIT;
                                            if (!$contact) {
                                                    $contact = new Contact();
                                                    $contact_data['import_status'] = '('.lang('new').')';
                                                    $log_action = ApplicationLogs::ACTION_ADD;
                                                    $can_import = active_project() != null ? $contact->canAdd(logged_user(), active_project()) : can_manage_contacts(logged_user());
                                            } else {
                                                    $can_import = $contact->canEdit(logged_user());
                                            }

                                            if ($can_import) {
                                                    $comp_name = DB::escape(array_var($contact_data, "company_id"));
                                                    if ($comp_name != '') {
                                                            $company = Contacts::findOne(array("conditions" => "first_name = $comp_name AND is_company = 1"));
                                                            if ($company) {
                                                                    $contact_data['company_id'] = $company->getId();
                                                            } 
                                                            $contact_data['import_status'] .= " " . lang("company") . " $comp_name";
                                                    } else {
                                                            $contact_data['company_id'] = 0;
                                                    }
                                                    $contact_data['birthday'] = $contact_data["o_birthday"];
                                                    $contact_data['name'] = $contact_data['first_name']." ".$contact_data['surname'];
                                                    $contact->setFromAttributes($contact_data);
                                                    $contact->save();

                                                    //Home form
                                                    if($contact_data['h_address'] != "")
                                                        $contact->addAddress($contact_data['h_address'], $contact_data['h_city'], $contact_data['h_state'], $contact_data['h_country'], $contact_data['h_zipcode'], 'home');
                                                    if($contact_data['h_phone_number'] != "") $contact->addPhone($contact_data['h_phone_number'], 'home', true);
                                                    if($contact_data['h_phone_number2'] != "") $contact->addPhone($contact_data['h_phone_number2'], 'home');
                                                    if($contact_data['h_mobile_number'] != "") $contact->addPhone($contact_data['h_mobile_number'], 'mobile');
                                                    if($contact_data['h_fax_number'] != "") $contact->addPhone($contact_data['h_fax_number'], 'fax');
                                                    if($contact_data['h_pager_number'] != "") $contact->addPhone($contact_data['h_pager_number'], 'pager');
                                                    if($contact_data['h_web_page'] != "") $contact->addWebpage($contact_data['h_web_page'], 'personal');

//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:ContactController.class.php

示例2: edit


//.........这里部分代码省略.........
         				evt_add("handle edit concurrence", array(
         					"updatedon" => $contact->getUpdatedOn()->getTimestamp(),
         					"genid" => array_var($_POST,'genid')
         				));
         				return;
         			}
         			if (array_var($_POST,'merge-changes') == 'true')
         			{					
         				$this->setTemplate('card');
         				$new_contact = Contacts::findById($contact->getId());
         				ajx_set_panel(lang ('tab name',array('name'=>$new_contact->getObjectName())));
         				ajx_extra_data(array("title" => $new_contact->getObjectName(), 'icon'=>'ico-contact'));
         				ajx_set_no_toolbar(true);
         				return;
         			}
         			*/
         try {
             DB::beginWork();
             $contact_data['email'] = trim($contact_data['email']);
             Contacts::validate($contact_data, get_id());
             $newCompany = false;
             if (array_var($contact_data, 'isNewCompany') == 'true' && is_array(array_var($_POST, 'company'))) {
                 $company_data = array_var($_POST, 'company');
                 Contacts::validate($company_data);
                 $company = new Contact();
                 $company->setFromAttributes($company_data);
                 $company->setIsCompany(true);
                 $company->setObjectName();
                 $company->save();
                 if ($company_data['address'] != "") {
                     $company->addAddress($company_data['address'], $company_data['city'], $company_data['state'], $company_data['country'], $company_data['zipcode'], 'work', true);
                 }
                 if ($company_data['phone_number'] != "") {
                     $company->addPhone($company_data['phone_number'], 'work', true);
                 }
                 if ($company_data['fax_number'] != "") {
                     $company->addPhone($company_data['fax_number'], 'fax', true);
                 }
                 if ($company_data['homepage'] != "") {
                     $company->addWebpage($company_data['homepage'], 'work');
                 }
                 if ($company_data['email'] != "") {
                     $company->addEmail($company_data['email'], 'work', true);
                 }
                 ApplicationLogs::createLog($company, ApplicationLogs::ACTION_ADD);
                 $newCompany = true;
             }
             $contact_data['birthday'] = getDateValue($contact_data["birthday"]);
             if (isset($contact_data['specify_username'])) {
                 if ($contact_data['user']['username'] != "") {
                     $contact_data['name'] = $contact_data['user']['username'];
                 } else {
                     $contact_data['name'] = $contact_data['first_name'] . " " . $contact_data['surname'];
                 }
             } else {
                 $contact_data['name'] = $contact_data['first_name'] . " " . $contact_data['surname'];
             }
             $contact->setFromAttributes($contact_data);
             if ($newCompany) {
                 $contact->setCompanyId($company->getId());
             }
             //telephones
             $mainPone = $contact->getPhone('work', true);
             if ($mainPone) {
                 $mainPone->editNumber($contact_data['w_phone_number']);
             } else {
开发者ID:rorteg,项目名称:fengoffice,代码行数:67,代码来源:ContactController.class.php

示例3: eventImportContactsFromCsv


//.........这里部分代码省略.........
             $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);
             }
             if ($contact_email_wk != "") {
                 $do_contact->addEmail($contact_email_wk, $contact_email_wk_type);
             }
             if ($contact_email_ot != "") {
                 $do_contact->addEmail($contact_email_ot, $contact_email_ot_type);
             }
             if ($contact_phone_hm != "") {
                 $do_contact->addPhone($contact_phone_hm, $contact_phone_hm_type);
             }
             if ($contact_phone_wk != "") {
                 $do_contact->addPhone($contact_phone_wk, $contact_phone_wk_type);
             }
             if ($contact_phone_ot != "") {
                 $do_contact->addPhone($contact_phone_ot, $contact_phone_ot_type);
             }
             if ($contact_phone_mb != "") {
                 $do_contact->addPhone($contact_phone_mb, $contact_phone_mb_type);
             }
             if ($contact_phone_fx != "") {
                 $do_contact->addPhone($contact_phone_fx, $contact_phone_fx_type);
             }
             if ($contact_website_comp != "") {
                 $do_contact->addWebsite($contact_website_comp, $contact_website_comp_type);
             }
             if ($contact_website_blog != "") {
                 $do_contact->addWebsite($contact_website_blog, $contact_website_blog_type);
             }
             if ($contact_website_ot != "") {
                 $do_contact->addWebsite($contact_website_ot, $contact_website_ot_type);
             }
             if ($contact_website_personal != "") {
                 $do_contact->addWebsite($contact_website_personal, $contact_website_personal_type);
             }
             if ($contact_website_twitter != "") {
                 $do_contact->addWebsite($contact_website_twitter, $contact_website_twitter_type);
             }
             if ($contact_website_linkedin != "") {
                 $do_contact->addWebsite($contact_website_linkedin, $contact_website_linkedin_type);
             }
             if ($contact_website_fb != "") {
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:67,代码来源:ContactImport.class.php

示例4: 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

示例5: 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

示例6: 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


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