function _populateIntroTextFields(&$data, $fieldname) { if (!isset($data[$fieldname])) { return false; } $introtext_id = $data[$fieldname]; if (!$introtext_id) { return false; } require_once 'AMP/System/Introtext.inc.php'; $introtext = new AMPSystem_IntroText(AMP_Registry::getDbcon(), $introtext_id); $data[$fieldname . '_title'] = $introtext->getTitle(); $data[$fieldname . '_text'] = $introtext->getBody(); return $data[$fieldname]; }
function save($data) { $options = $this->getOptions(); if (!isset($this->udm->uid)) { $this->udm->errorMessage("Invalid Contact Info"); return false; } if (!(isset($data['action_id']) && $data['action_id'])) { $this->udm->errorMessage("No Appointment Selected"); return; } $schedule = new Schedule($this->dbcon, $options['schedule_id']); if (!$schedule->makeAppointment($this->udm->uid, $data['action_id'])) { $this->udm->errorMessage("The requested schedule time is not avaiable"); return false; } $item =& $schedule->getScheduleItem($data['action_id']); $appt_contact_data = $this->udm->getData(); $recipients = array(); if (isset($options['email_contact_schedule']) && $options['email_contact_schedule']) { $recipients['schedule'] = $item->getOwnerEmail(); } if (isset($options['email_contact_appointment']) && $options['email_contact_appointment']) { $recipients['appointment'] = $appt_contact_data['Email']; } if (empty($recipients)) { return true; } $item_data = $item->getData(); $item_data['schedule_contact_name'] = $item->getOwnerName(); $item_data['schedule_contact_email'] = $item->getOwnerEmail(); $item_data['schedule_start_time_text'] = $item->getTimeText(); $item_data = array_merge($item_data, $this->getAppointmentContactData()); foreach ($recipients as $which_contact => $email) { $text_id = $options['email_contact_' . $which_contact]; $text = new AMPSystem_IntroText($this->dbcon, $text_id); $sch_email = new AMPSystem_Email(); $sch_email->setSubject($text->getTitle()); $sch_email->setRecipient($email); $sch_email->setMessage($text->mergeBodyFields($item_data)); if (!$sch_email->execute()) { trigger_error(sprintf(AMP_ERROR_SCHEDULE_APPOINTMENT_EMAIL_NOT_SENT, $email)); } } return true; }
/** * Sets global values for intro_id, MM_title, MM_type * * @param AMPSystem_IntroText $introtext The IntroText whose values will be globalized */ function _globalizeIntroVars(&$introtext) { $GLOBALS['intro_id'] = $introtext->id; $this->_registry->setEntry(AMP_REGISTRY_CONTENT_INTRO_ID, $introtext->id); if ($title = $introtext->getTitle()) { $GLOBALS['MM_title'] = $GLOBALS['mod_name'] = $title; } if ($section_id = $introtext->getSection()) { $GLOBALS['MM_type'] = $section_id; } }