Exemplo n.º 1
0
 public function post(\Request $request)
 {
     $factory = new Factory();
     $view = new \View\JsonView(array('success' => true));
     $response = new \Response($view);
     if (!$request->isVar('command')) {
         throw new \Exception('Bad command');
     }
     switch ($request->getVar('command')) {
         case 'save':
             $factory->postSettings();
             break;
     }
     \PHPWS_Core::reroute('tailgate/Admin/');
 }
Exemplo n.º 2
0
 private function sendEmail($subject, $student_id, $content)
 {
     $transport = $this->getSwiftTransport();
     $student = StudentFactory::getById($student_id);
     if (!is_object($student)) {
         \PHPWS_Core::log("Student #{$student_id} does not exist.", 'tailgate_error.txt');
         return;
     }
     $message = \Swift_Message::newInstance();
     $message->setSubject($subject);
     $message->setFrom(\Settings::get('tailgate', 'reply_to'));
     $message->setTo($student->getEmail());
     $message->setBody($content, 'text/html');
     $mailer = \Swift_Mailer::newInstance($transport);
     $log = "Subject: {$subject}, To: " . $student->getEmail();
     \PHPWS_Core::log($log, 'tailgate_email.log');
     $mailer->send($message);
 }