示例#1
0
文件: data.php 项目: ZerGabriel/cms-1
 public function get_menu()
 {
     $ds_id = (int) $this->param('ds_id', NULL);
     $tree = Datasource_Data_Manager::get_tree();
     $menu = View::factory('datasource/data/menu', array('tree' => $tree, 'folders' => Datasource_Folder::get_all(), 'datasource' => DataSource_Section::load($ds_id)));
     $this->response((string) $menu);
 }
示例#2
0
文件: data.php 项目: ZerGabriel/cms-1
 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;
     }
 }
示例#3
0
文件: init.php 项目: ZerGabriel/cms-1
    Route::set('datasources', ADMIN_DIR_NAME . '/<directory>(/<controller>(/<action>(/<id>)))', array('directory' => '(datasources|' . implode('|', array_keys(Datasource_Data_Manager::types())) . ')'))->defaults(array('directory' => 'datasources', 'controller' => 'data', 'action' => 'index'));
}
Observer::observe('modules::after_load', function () {
    if (!IS_BACKEND or !Auth::is_logged_in()) {
        return;
    }
    $types = Datasource_Data_Manager::types();
    if (empty($types)) {
        return;
    }
    try {
        $ds_section = Model_Navigation::get_section('Datasources');
        $ds_section->icon = 'tasks';
        $sections_list = Datasource_Data_Manager::get_tree(array_keys($types));
        $datasource_is_empty = empty($sections_list);
        $folders = Datasource_Folder::get_all();
        $root_sections = array();
        foreach ($sections_list as $type => $sections) {
            foreach ($sections as $id => $section) {
                if ($section->show_in_root_menu()) {
                    $root_sections[] = $section;
                    unset($sections_list[$type][$id]);
                    continue;
                }
                if (array_key_exists($section->folder_id(), $folders)) {
                    $folders[$section->folder_id()]['sections'][] = $section;
                    unset($sections_list[$type][$id]);
                }
            }
        }
        if (!empty($root_sections)) {