public function execute() { $guestAlert = new SJB_GuestAlert(array()); $guestAlert->addSubscriptionDateProperty(); $guestAlert->addStatusProperty(); $search_form_builder = new SJB_SearchFormBuilder($guestAlert); $criteria_saver = new SJB_GuestAlertCriteriaSaver(); $criteria = $search_form_builder->extractCriteriaFromRequestData($criteria_saver->getCriteria(), $guestAlert); $sortingField = SJB_Request::getVar('sorting_field', 'subscription_date'); $sortingOrder = SJB_Request::getVar('sorting_order', 'DESC'); $searcher = new SJB_GuestAlertSearcher(false, $sortingField, $sortingOrder); $foundGuestAlerts = $searcher->getObjectsSIDsByCriteria($criteria); foreach ($foundGuestAlerts as $id => $guestAlertSID) { $foundGuestAlerts[$id] = SJB_GuestAlertManager::getGuestAlertInfoBySID($guestAlertSID); } $type = SJB_Request::getVar('type', 'csv'); $fileName = 'guest_alerts_' . date('Y-m-d'); SJB_StatisticsExportController::createExportDirectory(); switch ($type) { case 'csv': $ext = 'csv'; SJB_StatisticsExportController::makeCSVExportFile($foundGuestAlerts, $fileName . '.' . $ext, 'Guest Alerts'); break; default: case 'xls': $ext = 'xls'; SJB_StatisticsExportController::makeXLSExportFile($foundGuestAlerts, $fileName . '.' . $ext, 'Guest Alerts'); break; } SJB_StatisticsExportController::archiveAndSendExportFile($fileName, $ext); }
public function execute() { $guestAlert = new SJB_GuestAlert($_REQUEST); $guestAlert->addDataProperty(serialize($this->criteriaData)); $tp = SJB_System::getTemplateProcessor(); try { $guestAlertSID = SJB_GuestAlertManager::getGuestAlertSIDByEmail($guestAlert->getAlertEmail()); $guestAlert->setSID($guestAlertSID); $guestAlert->update(); } catch (Exception $e) { $tp->assign('error', $e->getMessage()); } $tp->display('alert_replaced.tpl'); }
/** * @param string $key * @return array * @throws Exception */ public static function getGuestAlertInfoFromKey($key) { $dataFromKey = SJB_GuestAlert::getDataFromKey($key); if (!SJB_Array::get($dataFromKey, 'sid') || !SJB_Array::get($dataFromKey, 'key')) { throw new Exception('PARAMETERS_MISSED'); } return $dataFromKey; }
/** * @param SJB_GuestAlert $guestAlert * @param SJB_TemplateProcessor $tp */ public function saveNewGuestAlert(SJB_GuestAlert $guestAlert, SJB_TemplateProcessor $tp) { $guestAlert->addDataProperty(serialize($this->criteriaData)); $guestAlert->addListingTypeIDProperty($this->listingTypeID); $guestAlert->save(); $listingTypeSID = SJB_ListingTypeManager::getListingTypeSIDByID($this->listingTypeID); SJB_GuestAlertStatistics::saveEventSubscribed($listingTypeSID, $guestAlert->getSID()); SJB_Notifications::sendConfirmationEmailForGuest($guestAlert); $tp->assign('email', $guestAlert->getAlertEmail()); $this->template = 'alert_created.tpl'; }
/** * @param SJB_GuestAlert $guestAlert * @return mixed */ public static function sendGuestAlertWelcomeEmail(SJB_GuestAlert $guestAlert) { $data = array('key' => $guestAlert->getVerificationKeyForEmail()); $email = SJB_EmailTemplateEditor::getEmail($guestAlert->getAlertEmail(), self::GUEST_ALERT_WELCOME_EMAIL_SID, $data); return $email->send('Guest Alert Welcome'); }
/** * @param SJB_GuestAlert $guestAlert */ public function delete(SJB_GuestAlert $guestAlert) { SJB_GuestAlertManager::deleteGuestAlertBySID($guestAlert->getSID()); }