/** * addTweet * Prepare all the data for the RSS feed * look for Co-Workers associated with the contact * and add the users as a feed recipient. * @note this is used in a cronjob so no session variables will works. * @param ContactNote object * @param website url * @param note_content (without the link to source) */ function addTweet($do_contact_note, $website, $note_content) { $do_contact = new Contact(); $this->idcontact = $do_contact_note->idcontact; $do_contact->getId($this->idcontact); $this->iduser = $do_contact->iduser; if (strlen($note_content) > 200) { $this->feed_content = substr($note_content, 0, 200); } else { $this->feed_content = $note_content; } $picture = $do_contact->getContactPicture(); $this->full_contact_name = $do_contact->getContactFullName($this->idcontact); //$this->task_event_type = "rss_feed_cron"; $this->cont_image_url = $picture; $this->website_url = $website; $user_relation = new ContactSharing(); $users = $user_relation->getCoWorkerByContact($this->idcontact); $users[] = $do_contact->iduser; $this->addFeed($users); }
/** * Function adds workfeed when a contact unsubscibe emails * @param object $obj, object containing the contact and user id * @param string $responder , name of the responder */ function addUnsubscribeEmailWorkfeed($obj, $responder = "") { if ($responder == "") { $this->note = _('has unsubscribed from emails'); } else { $this->note = _('has unsubscribed from the auto-responder series ') . $responder; } $this->iduser = $obj->iduser; $this->idcontact = $obj->idcontact; $user = new User(); $user->getId($this->iduser); $do_contact = new Contact(); $do_contact->getId($this->idcontact); //$this->added_by = $do_contact->getContactFullName(); $this->contact_full_name = $do_contact->getContactFullName(); $this->contact_image_url = $do_contact->getContactPicture(); $user_relation = new ContactSharing(); $user_array = $user_relation->getCoWorkerByContact($this->idcontact); @array_push($user_array, $this->iduser); $this->addFeed($user_array); }
/** * eventAddFeed * This event is triggered when the note is added in the * contact.php page. * Its the last event and assume that the ContactNoteEditSave has * a primary key from the database table. * This event action prepare all the data so no additional query is needed * in the display table. * @param EventControler */ function eventAddFeed(EventControler $evtcl) { $this->note = $_SESSION['ContactNoteEditSave']->note; $this->iduser = $_SESSION['ContactNoteEditSave']->iduser; $this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact; $this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note; $user = new User(); $user->getId($this->iduser); $this->user_full_name = $user->getFullName(); $do_contact = new Contact(); $do_contact->getId($this->idcontact); $this->contact_full_name = $do_contact->getContactFullName(); $this->contact_image_url = $do_contact->getContactPicture(); if (strlen($this->note) > 200) { $this->note = substr($this->note, 0, 200); $this->more = True; } else { $this->more = false; } $user_relation = new ContactSharing(); $this->addFeed($user_relation->getCoWorkerByContact($this->idcontact)); }
/** * eventAddFeed * This event is triggered when the note is added in the * contact.php page. * Its the last event and assume that the ContactNoteEditSave has * a primary key from the database table. * This event action prepare all the data so no additional query is needed * in the display table. * @param EventControler */ function eventAddFeed(EventControler $evtcl) { $this->note = $_SESSION['ContactNoteEditSave']->note; $this->iduser = $evtcl->iduser_for_feed; $this->idcontact = $_SESSION['ContactNoteEditSave']->idcontact; $this->idcontact_note = $_SESSION['ContactNoteEditSave']->idcontact_note; $user = new User(); $user->getId($this->iduser); $do_contact = new Contact(); $do_contact->getId($this->idcontact); if ($evtcl->added_by_cont == 'Yes') { $this->added_by = $do_contact->getContactFullName(); } else { $this->added_by = $user->getFullName(); } $this->contact_full_name = $do_contact->getContactFullName(); $this->contact_image_url = $do_contact->getContactPicture(); if (strlen($this->note) > 200) { $this->note = substr($this->note, 0, 200); $this->more = True; } else { $this->more = false; } $user_relation = new ContactSharing(); $user_array = $user_relation->getCoWorkerByContact($this->idcontact); @array_push($user_array, $this->iduser); if (!is_array($user_array) || $user_array === false) { $user_array = array($evtcl->iduser_for_feed); } //print_r($user_array);exit; $this->addFeed($user_array); }