Пример #1
0
 /**
  * Delete a sms client
  *
  * @access public
  * @param  int $id
  * @return void
  */
 public function delete($id)
 {
     $client = new Smsclient();
     if ($client->delete($id)) {
         Notification::set(Smsclients::SUCCESS, "Succesfully deleted the client");
     } else {
         Notification::set(Smsclients::DANGER, "Something went wrong");
     }
     redirect(base_url() . "smsclients/index");
 }
Пример #2
0
 /**
  * Cronjob that sends SMS Text messages with forecast info
  *
  * @access public
  * @return void
  */
 public function smsForecast()
 {
     log_message('error', 'Starting SMS service');
     log_message('error', 'Gathering users...');
     $sId = TWILIO_SID;
     $token = TWILIO_TOKEN;
     $twilio = new Services_Twilio($sId, $token);
     $smsClients = new Smsclient();
     $clients = $smsClients->load();
     $number = TWILIO_NUMBER;
     foreach ($clients as $client) {
         $content = file_get_contents('http://wap.weather.fi/peek?param1=' . $client->getLocation() . '&lang=en&format=text1');
         $twilio->account->messages->sendMessage($number, $client->getNumber(), $content);
         log_message('error', 'SMS send to ' . $client->getNumber());
     }
     log_message('error', 'Finished the SMS service');
     exit;
 }