本文整理汇总了PHP中Tag::addTagAssociation方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::addTagAssociation方法的具体用法?PHP Tag::addTagAssociation怎么用?PHP Tag::addTagAssociation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::addTagAssociation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importTwitterFriend
/**
* Import a Twitter friend
*/
function importTwitterFriend($friend_data, $extra_tag = '')
{
$iduser = $_SESSION['do_User']->iduser;
$tw_user_id = $friend_data['user_id'];
$idcontact = $this->isTwFriendInContacts($iduser, $tw_user_id);
list($fname, $lname) = explode(' ', $friend_data['name'], 2);
$screen_name = $friend_data['screen_name'];
$description = $friend_data['description'];
$profile_image_url = $friend_data['profile_image_url'];
$url = $friend_data['url'];
$do_tag = new Tag();
if ($idcontact) {
//update the data
$c = new Contact();
$c->getId($idcontact);
$c->firstname = $fname;
$c->lastname = $lname;
if ($c->picture == "") {
$c->picture = $profile_image_url;
}
$c->tw_user_id = $tw_user_id;
$c->update();
$do_tag->addTagAssociation($idcontact, 'Twitter', 'contact', $iduser);
if ($extra_tag != '') {
$do_tag->addTagAssociation($idcontact, $extra_tag, 'contact', $iduser);
}
} else {
// new entry
$c = new Contact();
$c->firstname = $fname;
$c->lastname = $lname;
$c->iduser = $iduser;
$c->picture = $profile_image_url;
$c->tw_user_id = $tw_user_id;
$c->add();
$idcontact = $c->idcontact;
$w = new ContactWebsite();
$w->idcontact = $idcontact;
$w->website = 'http://twitter.com/' . $screen_name;
$w->website_type = 'Twitter';
$w->feed_auto_fetch = 'Yes';
$w->add();
if ($url != '') {
$w = new ContactWebsite();
$w->idcontact = $idcontact;
$w->website = $url;
$w->website_type = 'Personal';
$w->add();
}
$link = '<br /><a href="http://twitter.com/' . $screen_name . '" target="_blank">Back to the Source of the Article</a><br />';
$do_contact_note = new ContactNotes();
$do_contact_note->idcontact = $idcontact;
$do_contact_note->note = $description . $link;
$do_contact_note->date_added = date('Y-m-d');
$do_contact_note->iduser = $iduser;
$do_contact_note->add();
$do_tag->addTagAssociation($idcontact, 'Twitter', 'contact', $iduser);
if ($extra_tag != '') {
$do_tag->addTagAssociation($idcontact, $extra_tag, 'contact', $iduser);
}
}
}
示例2: 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);
}
//.........这里部分代码省略.........
示例3: eventImportContactsFromCsv
//.........这里部分代码省略.........
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);
}
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);
示例4: 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);
}
示例5: Contact
function add_tag()
{
$do_api_contact = new Contact();
if (!$this->idreference || $this->idreference == '') {
$this->setMessage("621", "Reference Id Missing");
return false;
} elseif ($this->tags == '') {
$this->setMessage("622", "Tag missing");
return false;
} elseif (!$do_api_contact->isContactRelatedToUser($this->idreference, $this->iduser)) {
$this->setMessage("615", "Contact does not belong to you nor shared by your Co-Worker");
return false;
} else {
$do_api_tags = new Tag();
$tags = explode(",", $this->tags);
foreach ($tags as $tag) {
$do_api_tags->addNew();
$do_api_tags->addTagAssociation($this->idreference, $tag, $this->reference, $this->iduser);
}
$this->setValues(array("msg" => "Tags Added", "stat" => "ok", "code" => "620"));
return true;
}
}
示例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
//.........这里部分代码省略.........