function eventAjaxNumOfFeedsInWebPage(EventControler $evctl) { $do_contact_website = new ContactWebsite(); $do_contact_website->getId($evctl->idcontact_website); $website_type = $do_contact_website->website_type; $uri = $do_contact_website->website; if ($website_type == "RSS Feed") { //Feed from xml $feed = Zend_Feed::import($uri); $feed_count = $feed->count(); $this->updateFeedStatus($feed_count, $evctl->idcontact_website); $evctl->addOutputValue($feed_count); } else { //Feed from webpage $uri = (substr(ltrim($uri), 0, 7) != 'http://' ? 'http://' : '') . $uri; $arr_feeds = Zend_Feed::findFeeds($uri); $this->num_feeds = count($arr_feeds); $this->updateFeedStatus($this->num_feeds, $evctl->idcontact_website); $evctl->addOutputValue(count($arr_feeds)); } }
function eventAjaxEditTaskCategoryForm(EventControler $evctl) { $form = '<div class="taskbox1a"><div class="taskbox1b"><div class="taskbox1c">'; $this->getId($evctl->id); $this->sessionPersistent("TaskCategoryEdit", "index.php", 120); $e_task = new Event("TaskCategoryEdit->eventValuesFromForm"); $e_task->setLevel(1999); $e_task->addEventAction("TaskCategoryEdit->eventUpdate", 2000); $form .= $e_task->getFormHeader(); $form .= $e_task->getFormEvent(); $_SESSION['TaskCategoryEdit']->setRegistry("task_category"); $_SESSION['TaskCategoryEdit']->setApplyRegistry(true, "Form"); $form .= $_SESSION['TaskCategoryEdit']->name . '<br /><br />'; $form .= $_SESSION['TaskCategoryEdit']->iduser; $form .= $e_task->getFormFooter("Update this Category"); $form .= '<div class="cancellink">or <a href="#" onclick="fnCancelEdit(' . $evctl->id . ');">' . _('cancel') . '</a></div>'; $form .= '</div></div></div>'; $evctl->addOutputValue($form); }
function eventAjaxEnterEmailForm(EventControler $evctl) { $form = '<div class="taskbox1a"><div class="taskbox1b"><div class="taskbox1c">'; // use $evctl->referer value to generate the form header for diff post values if ($evctl->referrer == 'gmail') { if ($evctl->act == '2') { $form .= '<form method="post" action="google_import.php">'; $form .= _('Email : ') . '<input type="text" name="email" style="width: 200px;" />'; $form .= '<input type ="hidden" name = "action" value = "import">'; $form .= '<input type="submit" name="usubmit" value = "' . _('Import') . '">'; } elseif ($evctl->act == '1') { $form .= '<form method="post" action="google_export.php">'; $form .= _('Email : ') . '<input type="text" name="email" style="width: 200px;" />'; $form .= '<input type ="hidden" name = "action" value = "export">'; $form .= '<input type="submit" name="usubmit" value = "' . _('Export') . '">'; } } $form .= '</form></div></div></div>'; $evctl->addOutputValue($form); }
function eventAjaxToggleAutoFetch(EventControler $evctl) { $idcontact_website = $evctl->idcontact_website; $this->getId($idcontact_website); if ($this->feed_auto_fetch == 'Yes') { $this->feed_auto_fetch = 'No'; $icon = "/images/feed-icon-12x12-orange.gif"; } else { $idcontact = $this->idcontact; $website = $this->website; $this->insertNotes($idcontact, $website, $idcontact_website); $this->feed_auto_fetch = 'Yes'; $icon = "/images/feed-icon-12x12-green.png"; } $this->update(); $evctl->addOutputValue($icon); }
/** * this method is called by the ajax_evctl.php as an event action * and return a new form entry to add a value to the phone_contact table. * * @param EventControler */ function eventAjaxFormEntry(EventControler $evctl) { $new_phone_count = $evctl->count; $form = ' <div id="new' . $this->getPrefix() . 'C' . $new_phone_count . '">'; $form .= $this->getNewFormFields($new_phone_count); $form .= '<a href="#" id="deleteAdd' . $this->getPrefix() . $new_phone_count . '" title="' . _("Delete this fields") . '"> <img src="images/delete.gif"> </a> </div> <script type="text/javascript"> //<![CDATA[ $("#deleteAdd' . $this->getPrefix() . $new_phone_count . '").click( function () { $("#new' . $this->getPrefix() . 'C' . $new_phone_count . '").hide(1000).empty(); return false; }); //]]> </script> '; $evctl->addOutputValue($form); }
/** * Function to generate the Ajax suggestion for the invoice * line item. * Return the HTML containing the items * @param $evtcl -- Object */ function eventAjaxItemSuggestion(EventControler $evtcl) { $html = ''; if (strlen($evtcl->text) > 0) { $q = new sqlQuery($this->getDbCon()); $q->query("SELECT distinct item \r\n FROM invoiceline\r\n LEFT JOIN invoice ON invoiceline.idinvoice = invoice.idinvoice\r\n WHERE invoice.iduser ="******" AND item like '" . $evtcl->text . "%'\r\n Order by item"); if ($q->getNumRows()) { while ($q->fetch()) { $html .= '<option value="0" style="padding: 8px; background-color: #f7f7fa; border-bottom: solid 1px #dddddd;">' . $q->getData("item") . '</option>'; } $evtcl->addOutputValue($html); } else { $evtcl->addOutputValue('No'); } } else { $evtcl->addOutputValue('No'); } }
/** * Get the task discussion with the Ajax call * @param $event_controler -- Object */ function eventAjaxProjectTaskDiscussion(EventControler $event_controler) { $this->getId((int) $event_controler->idnote); //$this->query("select discuss from project_discuss where idproject_discuss = ".$idnote." and idproject_task = ". $_SESSION['do_project_task']->idproject_task); $event_controler->addOutputValue($this->formatNoteDisplayFull($this->discuss)); }
/** * this method is called by the ajax_evctl.php as an event action * and returns a new form entry to add a row to the invoiceline table. * * @param EventControler */ function eventAjaxInvoiceFormEntry(EventControler $evctl) { $invoice_form = $this->getNewFormFields($evctl->count); $evctl->addOutputValue($invoice_form); }
/** Event method to get address for the contact. Used in the invoice address for a selected contact. Returns the HTML data with the address detail. */ function eventAjaxGetInvoiceAddress(EventControler $evtcl) { $idcontact = $evtcl->idcontact; $html = ''; if ($idcontact) { $html = $this->ajaxGetInvoiceAddress($idcontact); } $evtcl->addOutputValue($html); }
function eventAjaxGetEditForm(EventControler $evtcl) { $Parsedown = new Parsedown(); $_SESSION['ContactNoteEditSave']->setApplyRegistry(false, "Form"); $html = ''; $curdiv = $evtcl->curdiv; $this->getId($evtcl->idnote); $vis_user = $this->note_visibility == 'user' ? 'checked' : ''; $vis_user_cw = $this->note_visibility == 'user coworker' ? 'checked' : ''; $vis_user_cont = $this->note_visibility == 'user contact' ? 'checked' : ''; $vis_user_cw_cont = $this->note_visibility == 'user coworker contact' ? 'checked' : ''; $do_cont = new Contact(); $contact_fullname = $do_cont->getContactName($evtcl->idcontact); if ($this->iduser == $_SESSION['do_User']->iduser) { $note_val = $this->note; $e_edit = new Event("ContactNoteEditSave->eventUpdate"); $e_edit->setLevel(110); $e_edit->addEventAction("mydb.gotoPage", 111); $e_edit->addEventAction("ContactNoteEditSave->eventHTMLCleanUp", 109); $e_edit->setGotFile(true); $html .= $e_edit->getFormHeader(); $html .= $e_edit->getFormEvent(); $_SESSION['ContactNoteEditSave']->setRegistry("ofuz_add_contact_note"); $_SESSION['ContactNoteEditSave']->setApplyRegistry(true, "Form"); $html .= '<br />' . _('Note :') . '<br /><textarea id="note_edit" name = "fields[note]" rows="3" cols="110">' . $Parsedown->text($note_val) . '</textarea><br />'; $html .= '<div width="100%">'; $html .= '<div id="edit_note_more" style="position:relative;float:left;text-align:left;width:50%"><a href="#" onclick ="fnEditNoteMoreOpts();return false;">' . _('More Options') . '</a></div>'; $html .= '<div style="position:relative;float:left;text-align:left;width:50%"><a href="javascript:;" onclick="showProjectList();">' . _('Attached to a project') . '</a>'; $html .= '<div id="cp_prj_list" style="position:relative;display:none;">'; $do_prjs = new Project(); $do_prjs->getAllProjects("open"); $num_prjs = $do_prjs->getNumRows(); $html .= '<select name="cpy_prjs" id="cpy_prjs" onchange="populateTasks();">'; if ($num_prjs > 0) { $html .= '<option value="">' . _('Select Project') . '</option>'; } else { $html .= '<option value="">' . _('You do not have Project.') . '</option>'; } while ($do_prjs->next()) { $html .= '<option value="' . $do_prjs->getData("idproject") . '">' . $do_prjs->getData("name") . '</option>'; } $html .= '</select>'; $html .= '</div>'; $html .= '<div id="cp_prj_tasks"></div>'; $html .= '</div></div>'; $html .= '<div class="div_right" id="edit_note_more_opts" style="display: none;"> '; $html .= 'File : ' . $_SESSION['ContactNoteEditSave']->document . '<br /><br />'; $html .= '</div>'; $html .= '<div id="edit_note_more_opts_vis" style="text-align: left; width: 50%;display: none;"> '; $html .= _('Who can view this note:') . '<br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user" ' . $vis_user . '> ' . _('Just me') . ' <br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user coworker" ' . $vis_user_cw . '> ' . _('My Co-Workers and I') . '<br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user contact" ' . $vis_user_cont . '> ' . $contact_fullname . _(' and I') . '<br />'; $html .= '<input type="radio" name="fields[note_visibility]" value="user coworker contact" ' . $vis_user_cw_cont . '> ' . _('Me, Co-Workers and ') . $contact_fullname; $html .= '</div>'; $html .= '<div style="text-align:right">'; $html .= '<input type="submit" name="Save" value = "' . _('Save') . '"> <a href="#" onclick = "fnCancelEdit(\'' . $curdiv . '\',' . $evtcl->idnote . ');return false;">' . _('close') . '</a>'; $html .= '</div>'; $html .= '</form>'; $evtcl->addOutputValue($html); } else { $msg = new Message(); $msg->getMessage("unauthorized_note_edit"); $html .= $msg->content . '<br /><br />'; $html .= '<a href="#" onclick = "fnCancelEdit(\'' . $curdiv . '\',' . $evtcl->idnote . ');return false;">' . _('close') . '</a>'; $evtcl->addOutputValue($html); } }
/** * eventAjaxAddTagAssociation * ajax eventaction to add a tag to a contact using an ajax request * with tag name and idcontact as parameters. * it returns the idtag of the newly inserted tag. */ function eventAjaxAddTagAssociation(EventControler $event_controler) { $idreference = $event_controler->idcontact; $tag_name = trim($event_controler->tag_name); if (!empty($tag_name)) { $reference_type = "contact"; $iduser = $_SESSION['iduser']->iduser; $this->addTagAssociationShared($idreference, $tag_name, $reference_type, $iduser); if (!$this->isTagAssociationExists($tag_name, $idreference, $reference_type, $iduser)) { $this->addTagAssociation($idreference, $tag_name, $reference_type, $iduser); $event_controler->addOutputValue($this->getInsertId($this->getTable(), $this->getPrimaryKey())); } else { $event_controler->addOutputValue(0); } } $_SESSION['last_tag_refresh'] = true; }
/** * Receives new sort order and writes it to the DB task table */ function eventAjaxPrioritySort(EventControler $event_controler) { $due_dt = $event_controler->due_date; $dropped_idtask = $event_controler->dropped_idtask; switch ($due_dt) { case "overdue": $due_date = "Overdue"; $due_date_dateformat = date("Y-m-d", strtotime("-1 days")); break; case "today": $due_date = "Today"; $due_date_dateformat = date("Y-m-d"); break; case "tomorrow": $due_date = "Tomorrow"; $due_date_dateformat = date("Y-m-d", strtotime("+1 days")); break; case "thisweek": $due_date = "This week"; $due_date_dateformat = date("Y-m-d", strtotime("next Friday")); break; case "nextweek": $due_date = "Next week"; $due_date_dateformat = date("Y-m-d", strtotime("next Friday", strtotime("+1 week"))); break; case "thismonth": $due_date = "This month"; $due_date_dateformat = date('Y-m-d', strtotime('-1 second', strtotime('+1 month', strtotime(date('m') . '/01/' . date('Y') . ' 00:00:00')))); break; case "later": $due_date = "Later"; $due_date_dateformat = '0000-00-00'; break; } $q = new sqlQuery($this->getDbCon()); foreach ($event_controler->pt as $priority => $idtask) { $sql_due_date_dateformat = ""; if ($idtask == $dropped_idtask) { $sql_due_date_dateformat = ",due_date_dateformat='{$due_date_dateformat}'"; } $sql = "UPDATE {$this->table} SET priority = {$priority}, due_date = '{$due_date}'" . $sql_due_date_dateformat . " WHERE idtask = {$idtask}"; $q->query($sql); } //echo $sql; $event_controler->addOutputValue(true); }
/** * Receives progress bar % value and writes to the DB */ function eventAjaxUpdateProgress(EventControler $event_controler) { $q = new sqlQuery($this->getDbCon()); $q->query("UPDATE project_task SET progress = '{$event_controler->progress}' WHERE idproject_task = {$event_controler->idproject_task}"); $WorkFeedProjectTask = new WorkFeedProjectTask(); $evctl = new EventControler(); $evctl->addParam('task_event_type', 'task_progress'); $evctl->addParam('progress', $event_controler->progress); $WorkFeedProjectTask->eventAddFeed($evctl); $event_controler->addOutputValue(true); }
function eventAjaxSendFeedback(EventControler $event_controler) { $subject = 'Ofuz User Feedback: ' . $event_controler->url; //$headers = 'From: "Ofuz User Feedback" <*****@*****.**>'."\n\n"; $headers = 'From: "' . $_SESSION['do_User']->firstname . ' ' . $_SESSION['do_User']->lastname . '" <' . $_SESSION['do_User']->email . '>' . "\n\n"; mail('*****@*****.**', $subject, $event_controler->text, $headers); $event_controler->addOutputValue(true); }
function eventAjaxGetEventKey(EventControler $event_controler) { $e_ajax = new Event(); $key = $e_ajax->getSecureKey(); $event_controler->addOutputValue($key); }