Пример #1
0
 public function action_index()
 {
     Assets::package('jquery-ui');
     $cur_ds_id = (int) Arr::get($this->request->query(), 'ds_id', Cookie::get('ds_id'));
     $tree = Datasource_Data_Manager::get_tree();
     $cur_ds_id = Datasource_Data_Manager::exists($cur_ds_id) ? $cur_ds_id : Datasource_Data_Manager::$first_section;
     $ds = $this->section($cur_ds_id);
     $this->template->content = View::factory('datasource/content', array('content' => View::factory('datasource/data/index'), 'menu' => View::factory('datasource/data/menu', array('tree' => $tree, 'folders' => Datasource_Folder::get_all()))));
     $this->template->footer = NULL;
     $this->template->breadcrumbs = NULL;
     if ($ds instanceof Datasource_Section) {
         $this->set_title($ds->name);
         $limit = (int) Arr::get($this->request->query(), 'limit', Cookie::get('limit'));
         Cookie::set('ds_id', $cur_ds_id);
         $keyword = $this->request->query('keyword');
         if (!empty($limit)) {
             Cookie::set('limit', $limit);
             $this->section()->headline()->limit($limit);
         }
         $this->template->content->content->headline = $this->section()->headline()->render();
         $this->template->content->content->toolbar = View::factory('datasource/' . $ds->type() . '/toolbar', array('keyword' => $keyword));
         $this->template->set_global(array('datasource' => $ds));
         $this->template_js_params['DS_ID'] = $this->_section->id();
         $this->template_js_params['DS_TYPE'] = $this->_section->type();
     } else {
         $this->template->content->content = NULL;
     }
 }
Пример #2
0
 public function fetch_backend_content()
 {
     if ($this->ds_id > 0 and !Datasource_Data_Manager::exists($this->ds_id)) {
         $this->ds_id = 0;
         Widget_Manager::update($this);
     }
     return parent::fetch_backend_content();
 }