Exemplo n.º 1
0
         // TODO Set App play package name address.
         // http://developer.android.com/distribute/tools/promote/linking.html#OpeningDetails
         // TODO limit to 160 characters
         $messageForSheep = "Great, you have joined the '" . $flock->getFlockName() . "' flock! Tracking will begin at " . $flock->getFlockStart() . " To suspend tracking, text 'SUSPEND' to 84433 (Texts cost 10p). " . "Now install http://play.google.com/store/apps/details?id=<package_name>. " . "Confused? Find out more at www.flockbuddy.com";
     }
     break;
 case "FLOCKMENOT":
     // User rejection message, remove sheep from database.
     $shepherd = $flock->getShepherd();
     // Check if sheep cancelling is the shepherd.
     if ($sheep->getSheepID() === $shepherd->getSheepID()) {
         $shepherdsFlock = $sheepTable->getAllSheepFromFlockID($flock->getFlockID());
         // TODO limit to 160 characters
         $messageForSheep = "Your flock has been cancelled by your shepherd - thanks for being a good sheep!" . " Confused? Find out more at www.flockbuddy.com";
         foreach ($shepherdsFlock as $sheepInFlock) {
             if ($sheepTable->deleteSheepFromTable($sheepInFlock->getSheepID())) {
                 try {
                     // Create a Clockwork object using your API key
                     $clockwork = new Clockwork('787b4673e0ac4b043aab8a4764f0205ab06dc309');
                     // Setup and send a message
                     $message = array('to' => $sheepInFlock->getSheepID(), 'message' => $messageForSheep);
                     $result = $clockwork->send($message);
                     // Check if the send was successful
                     if ($result['success']) {
                         echo 'Message sent - ID: ' . $result['id'];
                     } else {
                         echo 'Message failed - Error: ' . $result['error_message'];
                     }
                 } catch (ClockworkException $e) {
                     echo 'Exception sending SMS: ' . $e->getMessage();
                 }