예제 #1
0
 /**
  * Return the generated URL that will give us the image
  */
 public function get_thumb_url($width, $height)
 {
     // get the action IDs
     $this->EE->db->select('action_id, method')->where('class', 'Assets_mcp');
     $this->EE->db->where('method', 'view_thumbnail');
     $actions = $this->EE->db->get('actions')->result();
     if ($actions) {
         return rtrim(Assets_helper::get_site_url(), '?') . "?ACT={$actions[0]->action_id}&file_id={$this->file_id}&size={$width}x{$height}&hash=" . $this->date_modified();
     }
     return '';
 }
예제 #2
0
 /**
  * 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);
 }