function eventExportContacts(EventControler $evtcl) { $iduser = $_SESSION['do_User']->iduser; $do_contact = new Contact(); $do_contact->getAllContactsForAUser(); $num_contacts = $do_contact->getNumRows(); $report_name = "ofuz_" . $iduser . "_report" . ".xls"; $fname = "xls_report/{$report_name}"; $workbook =& new writeexcel_workbook($fname); $worksheet =& $workbook->addworksheet('Report'); $heading =& $workbook->addformat(array('align' => 'center', 'bold' => 1, 'fg_color' => 'yellow')); $right =& $workbook->addformat(array('align' => 'right')); $left =& $workbook->addformat(array('align' => 'left')); # Create a border format $border1 =& $workbook->addformat(); $border1->set_color('magenta'); $border1->set_bold(); $border1->set_size(15); $border1->set_pattern(0x1); $border1->set_fg_color('aqua'); $border1->set_border_color('yellow'); $border1->set_top(6); $border1->set_bottom(6); $border1->set_left(6); $border1->set_align('center'); $border1->set_align('vcenter'); $border1->set_merge(); # This is the key feature # Create another border format. $border2 =& $workbook->addformat(); $border2->set_color('magenta'); $border2->set_bold(); $border2->set_size(15); $border2->set_pattern(0x1); $border2->set_fg_color('aqua'); $border2->set_border_color('yellow'); $border2->set_top(6); $border2->set_bottom(6); $border2->set_right(6); $border2->set_align('center'); $border2->set_align('vcenter'); $border2->set_merge(); # This is the key feature /* # Set the row height for row 0 (heading current date) $worksheet->set_row(0, 24); $worksheet->write (0, 0, "Welcome", $border1); $worksheet->write_blank(0, 1, $border2); $worksheet->write_blank(0, 2, $border2); */ # Set the row height for row 0 (heading current date) $worksheet->set_row(1, 24); $current_date = _("As on ") . date('m/d/Y h:i:s') . ", "; $heading_total_contacts = $current_date . _("Total Contacts : ") . $num_contacts; $worksheet->write(1, 0, $heading_total_contacts, $border1); $worksheet->write_blank(1, 1, $border2); $worksheet->write_blank(1, 2, $border2); $worksheet->write_blank(1, 3, $border2); $worksheet->write_blank(1, 4, $border2); $worksheet->write_blank(1, 5, $border2); $report_heading = array('First Name', 'Last Name', 'Company', 'Position', 'Email', 'Phone', 'Tags'); $col = 0; foreach ($report_heading as $colum) { $worksheet->write(3, $col, $colum, $heading); $col++; } $row = 4; if ($num_contacts) { while ($do_contact->next()) { $col = 0; $worksheet->write($row, $col, $do_contact->getData('firstname'), $left); $col++; $worksheet->write($row, $col, $do_contact->getData('lastname'), $left); $col++; $worksheet->write($row, $col, $do_contact->getData('company'), $left); $col++; $worksheet->write($row, $col, $do_contact->getData('position'), $left); $col++; $worksheet->write($row, $col, $do_contact->getData('email_address'), $left); $col++; $worksheet->write($row, $col, $do_contact->getData('phone_number'), $left); $col++; $worksheet->write($row, $col, $do_contact->getData('tags'), $left); $row++; } } else { } $workbook->close(); //header("Location: {$fname}"); $evtcl->setDisplayNext(new Display($fname)); }
* A cron job script for sending the autoresponders. * Will get the autoresponders with the tags and will send the email to the contacts associated with the tag_name * @see class/Autoresponder.class.php */ include_once 'config.php'; $AutoResponder = new AutoResponder(); $AutoResponder->getAutoresponders(); if ($AutoResponder->getNumRows()) { while ($AutoResponder->next()) { $User = new User(); $User->getId($AutoResponder->iduser); $User->sessionPersistent('do_User', 'contacts.php', OFUZ_TTL); $email_template = new EmailTemplate(); $email_template->bodyhtml = nl2br(stripslashes($AutoResponder->bodyhtml)); $email_template->subject = $AutoResponder->subject; $email_template->senderemail = $User->email; $email_template->sendername = $User->firstname . ' ' . $User->lastname; $resp_name = $AutoResponder->resp_name; $Contact = new Contact(); $Contact->getContactsForAutoResponder($AutoResponder->iduser, $AutoResponder->tag_name, $AutoResponder->num_days_to_send); if ($Contact->getNumRows()) { while ($Contact->next()) { $values = array("idcontact" => $Contact->idcontact, "firstname" => $Contact->firstname, "lastname" => $Contact->lastname, "position" => $Contact->position, "company" => $Contact->company, "idtag" => $Contact->idtag, "resp_name" => $resp_name, "flag" => "unsubscribe_autoresponder"); $Contact->sendMessage($email_template, $values); echo '<br /> Email Sent to :' . $Contact->email_address; } } $Contact->free(); } $AutoResponder->free(); }
if($do_contact->getNumRows()){ while($do_contact->next()){ $co_workers[] = $do_->idcoworker; $user_picture = $do_contact->picture; $contact_id = $do_contact->idcontact; } } if($user_picture ==''){ $user_pic="/images/empty_avatar.gif"; }else{ $user_pic="/dbimage/".$user_picture; } */ $do_contact = new Contact(); $do_contact->getContactPictureDetails($_SESSION['do_coworker']->idcoworker); if ($do_contact->getNumRows()) { if ($do_contact->picture != '') { $thumb_name = $_SERVER['DOCUMENT_ROOT'] . '/dbimage/thumbnail/' . $do_contact->picture; if (file_exists($thumb_name)) { $contact_picture = "/dbimage/thumbnail/" . $do_contact->picture; } else { $contact_picture = "/images/empty_avatar.gif"; } } else { $contact_picture = '/images/empty_avatar.gif'; } $contact_id = $do_contact->idcontact; } $do_user = new User(); $username = $do_user->getUserLoginId($_SESSION['do_coworker']->idcoworker); $do_user->free();
/** * Add the note to the workfeed * Select all other Co-Worker on the project and push the note to them. * Every Co-Worker in the project get the feed except the one posting the note. * @param EventControler object */ function eventAddFeed(EventControler $evtcl) { $prefix_note = $evtcl->block_unblock_flag == "Block" ? "<b>Task Block </b>" : "<b>Task Unblock </b>"; $this->idproject_task = $evtcl->ofuz_idprojecttask; $this->discuss = $prefix_note . $evtcl->block_unblock_reason; $this->iduser = $_SESSION['do_User']->iduser; $this->idproject_discuss = $evtcl->idproject_discuss; $this->idproject = $_SESSION['do_project_task']->idproject; $this->block_unblock_flag = $evtcl->block_unblock_flag; $do_project = new Project(); $do_project->getId($this->idproject); $this->project_name = $do_project->getProjectName(); $user = new User(); $user->getId($this->iduser); $this->user_full_name = $user->getFullName(); $do_contact = new Contact(); $do_contact->getContactPictureDetails($this->iduser); if ($do_contact->getNumRows()) { while ($do_contact->next()) { $this->user_picture = $do_contact->picture; $this->contact_id = $do_contact->idcontact; } } $do_proj_task_feed = new ProjectTask(); $do_proj_task_feed->getProjectTaskDetails($this->idproject_task); $this->task_description = $do_proj_task_feed->task_description; if (strlen($this->discuss) > 200) { $this->discuss = substr($this->discuss, 0, 200); $this->more = True; } else { $this->more = False; } $do_project_sharing = new ProjectSharing(); $project_users = $do_project_sharing->getCoWorkersAsArray($do_project); $project_users[] = $do_project->getProjectOwner(); $users = array(); foreach ($project_users as $project_user) { if ($_SESSION['do_User']->iduser != $project_user) { $users[] = $project_user; } } $this->addFeed($users); }
/** * Add the note to the workfeed from drop box email * Select all other Co-Worker on the project and push the note to them. * Every Co-Worker in the project get the feed except the one posting the note. * @param EventControler object */ function AddProjectDiscussFeedFromDropBox($idproject_task, $discuss, $iduser, $idproject_discuss, $idproject) { $this->idproject_task = $idproject_task; $this->discuss = $discuss; $this->iduser = $iduser; $this->idproject_discuss = $idproject_discuss; $this->idproject = $idproject; $do_project = new Project(); $do_project->getId($this->idproject); $this->project_name = $do_project->getProjectName(); $user = new User(); $user->getId($this->iduser); $this->user_full_name = $user->getFullName(); $do_contact = new Contact(); $do_contact->getContactPictureDetails($this->iduser); if ($do_contact->getNumRows()) { while ($do_contact->next()) { $co_workers[] = $do_->idcoworker; $this->user_picture = $do_contact->picture; $this->contact_id = $do_contact->idcontact; } } $do_proj_task_feed = new ProjectTask(); $do_proj_task_feed->getProjectTaskDetails($this->idproject_task); $this->task_description = $do_proj_task_feed->task_description; if (strlen($this->discuss) > 200) { $this->discuss = substr($this->discuss, 0, 200); $this->more = True; } else { $this->more = False; } $do_project_sharing = new ProjectSharing(); $project_users = $do_project_sharing->getCoWorkersAsArray($do_project); $project_users[] = $do_project->getProjectOwner(); $users = array(); foreach ($project_users as $project_user) { if ($iduser != $project_user) { $users[] = $project_user; } } $this->addFeed($users); }
</div> </div> <div class="left_menu_footer"></div> <br /><br /> <div class="left_menu_header"> <div class="left_menu_header_content"><?php echo _('People in this Company'); ?> </div> </div> <div class="left_menu"> <div class="left_menu_content"> <?php $do_comp_cont = new Contact(); $do_comp_cont->getCompanyRelatedContacts($idcompany); if ($do_comp_cont->getNumRows()) { while ($do_comp_cont->next()) { $currentpage = $_SERVER['PHP_SELF']; //$e_detail = new Event("mydb.gotoPage"); //$e_detail->addParam("goto", "contact.php"); //$e_detail->addParam("idcontact",$do_comp_cont->idcontact); //$e_detail->addParam("tablename", "contact"); //$e_detail->requestSave("eDetail_contact", $currentpage); $id_shared_owner = $do_comp_cont->isContactRelatedToUser($do_comp_cont->idcontact); ?> <span class="contact_name"> <?php if ($id_shared_owner) { ?> <a href="/Contact/<?php
public function rebuildContactUserTable($iduser = 0) { if (empty($iduser)) { $iduser = $this->iduser; } $this->setUser($iduser); //$this->sql_view_name = "userid".$iduser."_contact"; $this->query("DROP VIEW IF EXISTS " . $this->sql_view_name); $this->query("DROP TABLE IF EXISTS " . $this->sql_view_name); $this->query("CREATE TABLE `" . $this->sql_view_name . "` (\n\t\t\t`idcontact` int(10) NOT NULL default '0',\n\t\t\t`firstname` varchar(50) NOT NULL,\n\t\t\t`lastname` varchar(60) NOT NULL,\n\t\t\t`company` varchar(70) NOT NULL,\n\t\t\t`idcompany` int(10) NOT NULL,\n\t\t\t`position` varchar(60) NOT NULL,\n\t\t\t`picture` varchar(200) NOT NULL,\n\t\t\t`email_address` varchar(180),\n\t\t\t`phone_number` varchar(30),\n\t\t\t`tags` varchar(250) NOT NULL,\n\t\t\t`last_activity` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP,\n\t\t\t`last_update` timestamp NOT NULL default '0000-00-00 00:00:00',\n\t\t\t`first_created` timestamp NOT NULL default '0000-00-00 00:00:00',\n\t\t\tKEY `firstname` (`firstname`),\n\t\t\tKEY `lastname` (`lastname`),\n\t\t\tKEY `company` (`company`), \n\t\t\tKEY `tags` (`tags`), \n\t\t\tKEY `last_activity` (`last_activity`)) ENGINE=MyISAM DEFAULT CHARSET=utf8"); //echo $this->getSqlQuery(); // exit; $contacts = new Contact(); $contacts->getUserContacts($this->iduser); $this->setLog("\n importing Contacts:" . $contacts->getNumRows()); while ($contacts->next()) { $this->setLog("\n name:" . $contacts->firstname); $this->rebuildAddContact($contacts); } /** $contacts->query("SELECT contact.idcontact as idcontact, contact.firstname as firstname, contact.lastname as lastname, contact.company as company, contact.idcompany as idcompany, contact.position as position, contact.picture as picture FROM contact, contact_sharing WHERE `contact_sharing`.`idcoworker` = ".$this->iduser." AND contact.idcontact = contact_sharing.idcontact"); while($contacts->next) { $this->rebuildAddContact($contacts); } **/ /** $this->query("SELECT contact.idcontact as idcontact, contact.firstname as firstname, contact.lastname as lastname, contact.company as company, contact.idcompany as idcompany, contact.position as position, contact.picture as picture, contact_email.email_address as email_address, contact_phone.phone_number, GROUP_CONCAT(DISTINCT tag.tag_name ORDER BY tag.tag_name SEPARATOR ',') as tags, activity.when, created_date_log.created_date, updated_date_log.updatedate FROM contact LEFT JOIN contact_email ON contact.idcontact = contact_email.idcontact LEFT JOIN contact_phone ON contact.idcontact = contact_phone.idcontact LEFT JOIN tag ON (contact.idcontact = tag.idreference AND reference_type='contact' AND tag.iduser="******") LEFT JOIN activity ON (contact.idcontact = activity.idcontact) LEFT JOIN created_date_log ON (created_date_log.id = contact.idcontact AND created_date_log.table_name='contact') LEFT JOIN updated_date_log ON (updated_date_log.primarykeyvalue = contact.idcontact AND updated_date_log.tablename='contact') WHERE contact.iduser = "******" GROUP BY contact.idcontact UNION SELECT contact.idcontact as idcontact, contact.firstname as firstname, contact.lastname as lastname, contact.company as company, contact.idcompany as idcompany, contact.position as position, contact.picture as picture, contact_email.email_address as email_address, contact_phone.phone_number, GROUP_CONCAT(DISTINCT tag.tag_name ORDER BY tag.tag_name SEPARATOR ',') as tags, activity.when, created_date_log.created_date, updated_date_log.updatedate FROM contact LEFT JOIN tag ON (contact.idcontact = tag.idreference AND reference_type='contact' AND tag.iduser="******"), contact_sharing LEFT JOIN contact_email ON contact_sharing.idcontact = contact_email.idcontact LEFT JOIN contact_phone ON contact_sharing.idcontact = contact_phone.idcontact LEFT JOIN activity ON (contact_sharing.idcontact = activity.idcontact) LEFT JOIN created_date_log ON (created_date_log.id = contact_sharing.idcontact AND created_date_log.table_name='contact') LEFT JOIN updated_date_log ON (updated_date_log.primarykeyvalue = contact_sharing.idcontact AND updated_date_log.tablename='contact') WHERE `contact_sharing`.`idcoworker` = ".$iduser." AND contact.idcontact = contact_sharing.idcontact GROUP BY contact.idcontact "); $this->setLog("\n---------\n Users contact: ".$this->getSqlQuery()."\n----------\n"); $q_insert = new sqlQuery($this->getDbCon()); while($this->next()) { $q_insert->query("INSERT INTO ".$this->sql_view_name." VALUES (".$this->idcontact.", '".addslashes($this->firstname)."', '".addslashes($this->lastname)."', '".addslashes($this->company)."', ".$this->idcompany.", '".addslashes($this->position)."', '".$this->picture."', '".$this->email_address."', '".$this->phone_number."', '".addslashes($this->tags)."', '".$this->when."', '".$this->created_date."', '".$this->updatedate."')"); $this->setLog("\n ".$q_insert->getSqlQuery()); } //$this->setLog("\n Create table contact:".$this->getSqlQuery()); */ $_SESSION['refresh_contacts'] = false; $_SESSION['contact_view_name'] = $this->sql_view_name; }
<?php /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/ // Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com /** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/ /** * unsubscribe a user */ include_once "config.php"; $idcontact = (int) $_GET['idc']; $iduser = (int) trim($_GET['idu']); $do_contact = new Contact(); //$do_contact->getId($idcontact); $do_user = new User(); $do_user->getId($iduser); $do_user->sessionPersistent('user_unsub', 'unsubscribe_message.php', TTL_OFUZ); $do_contact->query("SELECT * \n FROM contact \n WHERE contact.idcontact=" . $idcontact . " AND contact.iduser = "******"SELECT contact.*\n FROM contact, contact_sharing \n WHERE `contact_sharing`.`idcoworker` = " . $iduser . "\n AND contact.idcontact = contact_sharing.idcontact\n\t\t\t\t\t\t\tAND contact.idcontact=" . $idcontact); } if ($do_contact->getNumRows() == 1 && $do_user->getNumRows() == 1) { $do_contact->email_optout = 'y'; $do_contact->update(); $do_workfeed_uns = new WorkFeedContactUnsubscibeEmails(); $do_workfeed_uns->addUnsubscribeEmailWorkfeed($do_contact); } //$do_contact->sessionPersistent('do_contact', 'unsubscribe_messaage.php', OFUZ_TTL); header("Location: /unsubscribe_message.php"); exit;