Beispiel #1
0
 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);
 }
Beispiel #2
0
 /**
  * @param int $guestAlertSID
  * @return SJB_GuestAlert
  * @throws Exception
  */
 public static function getObjectBySID($guestAlertSID)
 {
     $guestAlertInfo = self::getGuestAlertInfoBySID($guestAlertSID);
     if (empty($guestAlertInfo)) {
         throw new Exception('No such Guest Alert found');
     }
     $guestAlert = new SJB_GuestAlert($guestAlertInfo);
     $guestAlert->setSID($guestAlertSID);
     $guestAlert->addConfirmationKeyProperty(SJB_Array::get($guestAlertInfo, 'confirmation_key'));
     $guestAlert->addStatusProperty(SJB_Array::get($guestAlertInfo, 'status'));
     return $guestAlert;
 }
Beispiel #3
0
 public function showSearchForm()
 {
     $guestAlert = new SJB_GuestAlert(array());
     $guestAlert->addSubscriptionDateProperty();
     $guestAlert->addStatusProperty();
     $searchFormBuilder = new SJB_SearchFormBuilder($guestAlert);
     $this->criteriaSaver = new SJB_GuestAlertCriteriaSaver();
     if (isset($_REQUEST['restore'])) {
         $_REQUEST = array_merge($_REQUEST, $this->criteriaSaver->getCriteria());
     }
     $this->criteria = $searchFormBuilder->extractCriteriaFromRequestData($_REQUEST, $guestAlert);
     $searchFormBuilder->setCriteria($this->criteria);
     $searchFormBuilder->registerTags($this->tp);
     $this->tp->display('search_form.tpl');
 }