Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.76 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.                 // Extract out PTNs to call
  3.                 $ptns = Set::extract($attendees,'{n}.User.Profile.cell_phone');
  4.  
  5.                 // Remove empty ones
  6.                 $ptns = array_unique($ptns);
  7.                 $ptns = array_filter($ptns);
  8.  
  9.                 // Send messages
  10.                 $this->Twilio =& ClassRegistry::init('Twilio');
  11.                 $this->Twilio->contain();
  12.                 $conditions = array('Twilio.event_id' => $this->EAuth->event_id,
  13.                                                         'Twilio.live' => 1);
  14.                 $twilios = $this->Twilio->find('all',compact('conditions'));
  15.                 if(empty($twilios)){
  16.                         // No phone numbers to send with
  17.                         $this->_Flash('Feed entry added, but you have no Twilio numbers registered so we did not send any SMS messages','nice','/');
  18.                 }
  19.  
  20.                 // Send a Mass SMS
  21.                 $this->Twilio->send_msg($twilios[0]['Twilio']['ptn'],$ptns,'@'.$this->DarkAuth->DA['User']['username'].': '.$body);