<?php

session_start();
require __DIR__ . '/config.php';
require_once __DIR__ . '/lib/Util/Util.php';
require_once __DIR__ . '/src/Controller/SMSController.php';
use Att\Api\Util\Util;
$controller = new SMSController();
$controller->handleRequest();
$results = $controller->getResults();
$errors = $controller->getErrors();
?>
<!DOCTYPE html>
<!-- 
Licensed by AT&T under 'Software Development Kit Tools Agreement.' 2014
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION: http://developer.att.com/sdk_agreement/
Copyright 2014 AT&T Intellectual Property. All rights reserved. http://developer.att.com
For more information contact developer.support@att.com
-->
<html lang="en"> 
  <head> 
    <title>AT&amp;T Sample Application - Basic SMS Service Application</title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <meta id="viewport" name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1">
    <link rel="stylesheet" type="text/css" href="style/common.css">
    <script src="scripts/utils.js"></script>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-33466541-1']);
        _gaq.push(['_trackPageview']);
Exemplo n.º 2
0
 public function cancelEvent()
 {
     $existing_ce = CalendarEvent::where('id', '=', Input::get('calendar_event_id'))->first();
     if ($existing_ce->type == "volunteer_time") {
         //Info required to send SMS
         $volunteer = $existing_ce->volunteerTime()->first()->volunteer()->first();
         //To get the first name
         list($volunteer_name) = explode(" ", $volunteer->name);
         $user = Volunteer::find($_SESSION['user_id']);
         list($user_name) = explode(" ", $user->name);
         //To get correctly formatted date and time
         $on_date = date("d-M", strtotime($existing_ce->start_time));
         $on_time = Input::get('start_time');
         $student = Student::find($existing_ce->student_id);
         $center_name = $student->center()->first()->name;
         //Send SMS to the volunteer informing them about the class
         $sms = new SMSController();
         switch (Input::get('reason')) {
             case 'mistaken_entry':
                 $sms->message = "Hi {$volunteer_name},\n\nYour class at {$center_name} on {$on_date} has been cancelled since it was a mistaken entry.\n\nPlease contact {$user_name}({$user->phone}) for more details.";
                 break;
             case 'volunteer_not_available':
                 $sms->message = "Hi {$volunteer_name},\n\nYour class at {$center_name} on {$on_date} has been cancelled since you are not available.\n\nPlease contact {$user_name}({$user->phone}) for more details.";
                 break;
             case 'student_not_available':
                 $sms->message = "Hi {$volunteer_name},\n\nYour class at {$center_name} on {$on_date} has been cancelled since the student is not available.\n\nPlease contact {$user_name}({$user->phone}) for more details.";
                 break;
         }
         $sms->number = $volunteer->phone;
         $sms->send();
     }
     if (Input::get('reason') == 'mistaken_entry') {
         $existing_ce->delete();
     } else {
         $existing_ce->status = 'cancelled';
         $existing_ce->save();
         $existing_cancelled_ce = CancelledCalendarEvent::where('calendar_event_id', '=', Input::get('calendar_event_id'))->first();
         if (!empty($existing_cancelled_ce)) {
             $existing_cancelled_ce->delete();
         }
         $cancelled_event = new CancelledCalendarEvent();
         $cancelled_event->calendar_event_id = $existing_ce->id;
         $cancelled_event->reason = Input::get('reason');
         $cancelled_event->comment = Input::get('comment');
         $cancelled_event->save();
     }
     //To check whether the request is coming from the child calendar or the asv calendar
     if (Request::segment(2) == 'asv') {
         return Redirect::to(URL::to('/calendar/asv/' . Input::get('volunteer_id')));
     } else {
         return Redirect::to(URL::to('/calendar/' . Input::get('wingman_id') . '/' . Input::get('student_id')));
     }
 }