示例#1
0
 function check_if_recording_is_finished()
 {
     $json = array('error' => false, 'message' => '');
     $audio_file_id = $this->input->post('id');
     if (strlen($audio_file_id) == 0) {
         $json['error'] = true;
         $json['message'] = "Missing 'id' parameter.";
     } else {
         $newAudioFile = VBX_Audio_File::get($audio_file_id);
         if ($newAudioFile == null) {
             trigger_error("We were given an id for an audio_file, but we can't find the record.\t That's odd.  And, by odd I really mean it should *never* happen.");
         } else {
             if (strlen($newAudioFile->url) > 0) {
                 $json['finished'] = true;
                 $json['url'] = $newAudioFile->url;
                 // We return the label so that this upload can be added the library UI without
                 // refreshing the page.
                 $json['label'] = $newAudioFile->label;
             } else {
                 $json['finished'] = false;
             }
         }
     }
     $data = array();
     $data['json'] = $json;
     $this->response_type = 'json';
     $this->respond('', null, $data);
 }