public function render($data = array())
 {
     $hasValue = empty($this->mode) ? false : true;
     $this->load =& load_class('Loader');
     $this->load->model('vbx_audio_file');
     $this->load->model('vbx_device');
     // Get a list of all previously recorded items so we can populate the library
     $ci =& get_instance();
     $ci->db->where('url IS NOT NULL');
     $ci->db->where('tag', $this->tag);
     $ci->db->where('tenant_id', $ci->tenant->id);
     $ci->db->from('audio_files');
     $ci->db->order_by('created DESC');
     $results = $ci->db->get()->result();
     foreach ($results as $i => $result) {
         $results[$i] = new VBX_Audio_File($result);
     }
     // Pre-fill the record text field with the the first device phone number we
     // find for the current user that is active.
     $ci =& get_instance();
     $user = VBX_User::get($ci->session->userdata('user_id'));
     $user_phone = '';
     if (count($user->devices)) {
         foreach ($user->devices as $device) {
             if ($device->is_active) {
                 $user_phone = format_phone($device->value);
                 break;
             }
         }
     }
     // set the caller id for recording via the phone
     $caller_id = '';
     $ci->load->model('vbx_incoming_numbers');
     try {
         $numbers = $ci->vbx_incoming_numbers->get_numbers(false);
         foreach ($numbers as $number) {
             // find the first number that has voice enabled
             // yes, this is a rather paranoid check
             if (isset($number->capabilities->voice) && $number->capabilities->voice > 0) {
                 $caller_id = normalize_phone_to_E164($number->phone);
                 break;
             }
         }
     } catch (VBX_IncomingNumberException $e) {
         // fail silently, for better or worse
         error_log($e->getMessage());
     }
     $data = array_merge(array('name' => $this->name, 'hasValue' => $hasValue, 'mode' => $this->mode, 'say' => $this->say_value, 'play' => $this->play_value, 'tag' => $this->tag, 'library' => $results, 'first_device_phone_number' => $user_phone, 'caller_id' => $caller_id), $data);
     return parent::render($data);
 }
 public function render($data = array())
 {
     $hasValue = empty($this->mode) ? false : true;
     $this->load =& load_class('Loader');
     $this->load->model('vbx_audio_file');
     $this->load->model('vbx_device');
     // Get a list of all previously recorded items so we can populate the library
     $ci =& get_instance();
     $ci->db->where('url IS NOT NULL');
     $ci->db->where('tag', $this->tag);
     $ci->db->where('tenant_id', $ci->tenant->id);
     $ci->db->from('audio_files');
     $ci->db->order_by('created DESC');
     $results = $ci->db->get()->result();
     foreach ($results as $i => $result) {
         $results[$i] = new VBX_Audio_File($result);
     }
     // Pre-fill the record text field with the the first device phone number we
     // find for the current user that is active.
     $ci =& get_instance();
     $first_phone_number = $ci->db->where('user_id', $ci->session->userdata('user_id'))->where('is_active', 1)->from('numbers')->order_by('sequence')->limit(1)->get()->result();
     $data = array_merge(array('name' => $this->name, 'hasValue' => $hasValue, 'mode' => $this->mode, 'say' => $this->say_value, 'play' => $this->play_value, 'tag' => $this->tag, 'library' => $results, 'first_device_phone_number' => count($first_phone_number) == 0 ? "" : format_phone($first_phone_number[0]->value)), $data);
     return parent::render($data);
 }
 public function render($data = array())
 {
     $defaults = array('name' => $this->name, 'label' => $this->label, 'owner_id' => $this->owner_id, 'owner_type' => $this->owner_type);
     $data = array_merge($defaults, $data);
     return parent::render($data);
 }
Esempio n. 4
0
 public function render($data = array())
 {
     $defaults = array('name' => $this->name, 'from' => $this->from, 'to' => $this->to);
     $data = array_merge($defaults, $data);
     return parent::render($data);
 }
Esempio n. 5
0
 public function render($data = array())
 {
     $defaults = array('name' => $this->name, 'label' => $this->label, 'value' => $this->value, 'type' => $this->applet, 'applet' => $this->applet, 'icon_url' => $this->icon_url);
     $data = array_merge($defaults, $data);
     return parent::render($data);
 }