/** * Get Selected Files * Called from field.js when a new file(s) is selected */ function get_selected_files() { $this->EE->load->library('javascript'); $ids = $this->EE->input->post('file_id'); $files = array(); if (!is_array($ids)) { $ids = array($ids); } foreach ($ids as $id) { $file = $this->EE->assets_lib->get_file_by_id($id); if ($file) { $files[] = $file; } } if ($files) { $vars['helper'] = $this->EE->assets_lib; $vars['field_id'] = $this->EE->input->post('field_id'); $vars['field_name'] = $this->EE->input->post('field_name'); $vars['files'] = $files; if ($this->EE->input->post('view') == 'thumbs') { $vars['thumb_size'] = $this->EE->input->post('thumb_size'); $vars['show_filenames'] = $this->EE->input->post('show_filenames') == 'y'; $output['html'] = $this->EE->load->view('thumbview/files', $vars, TRUE); } else { $vars['start_index'] = $this->EE->input->post('start_index'); $vars['cols'] = $this->EE->input->post('show_cols'); $output['html'] = $this->EE->load->view('listview/files', $vars, TRUE); } } else { $output['html'] = ''; } // Return any thumb CSS queued up by the field $output['css'] = Assets_helper::get_queued_css(); // pass back the requestId so the JS knows the response matches the request $output['requestId'] = $this->EE->input->post('requestId'); exit(Assets_helper::get_json($output)); }