function run()
 {
     try {
         $manager = new JobRegistrationRequestManager(new SapphireJobRegistrationRequestRepository(), new SapphireJobRepository(), new SapphireJobAlertEmailRepository(), new JobFactory(), new JobsValidationFactory(), new SapphireJobPublishingService(), SapphireTransactionManager::getInstance());
         $manager->makePurge();
         return 'OK';
     } catch (Exception $ex) {
         SS_Log::log($ex, SS_Log::ERR);
         echo $ex->getMessage();
     }
 }
 function run()
 {
     try {
         $batch_size = 15;
         if (isset($_GET['batch_size'])) {
             $batch_size = intval(trim(Convert::raw2sql($_GET['batch_size'])));
         }
         $manager = new JobRegistrationRequestManager(new SapphireJobRegistrationRequestRepository(), new SapphireJobRepository(), new SapphireJobAlertEmailRepository(), new JobFactory(), new JobsValidationFactory(), new SapphireJobPublishingService(), SapphireTransactionManager::getInstance());
         $manager->makeDigest($batch_size, NEW_JOBS_REGISTRATION_REQUEST_EMAIL_ALERT_TO, Director::absoluteURL('sangria/ViewJobsDetails'));
         return 'OK';
     } catch (Exception $ex) {
         SS_Log::log($ex, SS_Log::ERR);
         echo $ex->getMessage();
     }
 }
 function saveJobRegistrationRequest($data, Form $form)
 {
     try {
         $this->manager->registerJobRegistrationRequest($data);
         Session::clear("FormInfo.Form_JobRegistrationRequestForm.data");
         return $this->redirect($this->Link('?saved=1'));
     } catch (EntityValidationException $ex1) {
         $messages = $ex1->getMessages();
         $msg = $messages[0];
         $form->addErrorMessage('Title', $msg['message'], 'bad');
         SS_Log::log($msg['message'], SS_Log::ERR);
         // Load errors into session and post back
         Session::set("FormInfo.Form_JobRegistrationRequestForm.data", $data);
         return $this->redirectBack();
     } catch (Exception $ex) {
         $form->addErrorMessage('Title', 'Server Error', 'bad');
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         // Load errors into session and post back
         Session::set("FormInfo.Form_JobRegistrationRequestForm.data", $data);
         return $this->redirectBack();
     }
 }
 /**
  * @return SS_HTTPResponse
  */
 public function rejectJobRegistrationRequest()
 {
     try {
         $data = $this->getJsonRequest();
         if (!$data) {
             return $this->serverError();
         }
         $request_id = (int) $this->request->param('REQUEST_ID');
         $this->manager->rejectJobRegistration($request_id, $data, Director::absoluteURL('community/jobs/'));
         return $this->updated();
     } catch (NotFoundEntityException $ex1) {
         SS_Log::log($ex1, SS_Log::ERR);
         return $this->notFound($ex1->getMessage());
     } catch (EntityValidationException $ex2) {
         SS_Log::log($ex2, SS_Log::NOTICE);
         return $this->validationError($ex2->getMessages());
     } catch (Exception $ex) {
         SS_Log::log($ex, SS_Log::ERR);
         return $this->serverError();
     }
 }