/** * Field Settings */ private function _field_settings($settings, $is_cell = FALSE) { // prep the settings $this->_prep_settings($settings); // ------------------------------------------- // Include Resources // ------------------------------------------- if (!isset($this->cache['included_resources'])) { Assets_helper::include_css('settings.css'); Assets_helper::include_js('settings.js'); // load the language file $this->EE->lang->loadfile('assets'); $this->cache['included_resources'] = TRUE; } // get all the file upload directories $filedirs = $this->EE->db->select('id, name')->from('upload_prefs')->where('site_id', $this->EE->config->item('site_id'))->order_by('name')->get()->result(); $filedir_array = array(); foreach ($filedirs as $filedir) { $filedir_array['ee:' . $filedir->id] = $filedir->name; } $sources = $this->EE->db->get('assets_sources')->result(); $source_array = array(); foreach ($sources as $source) { $source_array[$source->source_type . ':' . $source->source_id] = $source->name; } asort($source_array); $filedir_array = array_merge($filedir_array, $source_array); if (!empty($settings['filedirs']) && is_array($settings['filedirs'])) { foreach ($settings['filedirs'] as &$setting) { if (is_numeric($setting)) { $setting = 'ee:' . $setting; } } } return array(array(lang('file_upload_directories', 'assets_filedirs') . (!$is_cell ? '<br/>' . lang('file_upload_directories_info') : ''), $this->EE->load->view('field/settings-filedirs', array('data' => $settings['filedirs'], 'filedirs' => $filedir_array), TRUE)), array(lang('view_options', 'assets_view'), $this->EE->load->view('field/settings-view', array('settings' => $settings), TRUE)), array(lang('allow_multiple_selections', 'assets_multi'), form_dropdown('assets[multi]', array('y' => lang('yes'), 'n' => lang('no')), $settings['multi']))); }
/** * Edit or add a source */ public function edit_source() { if ($this->EE->session->userdata['group_id'] != 1) { $this->_forbidden(); } $this->EE->load->library('table'); $source_id = $this->EE->input->get('source_id'); $source = NULL; if (!empty($source_id) && is_numeric($source_id)) { try { $source_row = $this->EE->assets_lib->get_source_row_by_id($source_id); $source = $this->EE->assets_lib->instantiate_source_type((object) array('source_type' => $source_row->source_type, 'source_id' => $source_id)); $this->_set_page_title(lang('edit_source')); } catch (Exception $exception) { // not loaded, $source remains null } } else { $this->_set_page_title(lang('add_new_source')); } $vars = array(); $vars['is_new'] = is_null($source); $vars['source'] = $source; $vars['base'] = $this->base; $vars['source_types'] = $this->EE->assets_lib->get_all_source_types(); $vars['setting_fields'] = $this->EE->assets_lib->get_source_settings_field_list(); $js = "var Assets = {};" . Assets_helper::get_actions_js() . "\n" . 'Assets.siteUrl = "' . Assets_helper::get_site_url() . '";'; $js .= Assets_helper::get_lang_js('rs_select_region'); Assets_helper::insert_js($js); Assets_helper::include_garnish(); Assets_helper::include_js('assets.js', 'settings.js'); Assets_helper::include_css('settings.css'); return $this->EE->load->view('mcp/edit_source', $vars, TRUE); }