Пример #1
0
 public function action_create()
 {
     $type = $this->request->param('id');
     $type = strtolower($type);
     $types = Datasource_Data_Manager::types();
     if (Arr::get($types, $type) === NULL) {
         throw new Kohana_Exception('Datasource type :type not found', array(':type' => $type));
     }
     if ($this->request->method() === Request::POST) {
         return $this->_create($type);
     }
     $this->set_title(__('Add section :type', array(':type' => Arr::get($types, $type))));
     try {
         $this->template->content = View::factory('datasource/' . $type . '/section/create', array('type' => $type, 'data' => Flash::get('post_data'), 'users' => ORM::factory('user')->find_all()->as_array('id', 'username')));
     } catch (Exception $exc) {
         $this->template->content = View::factory('datasource/section/create', array('type' => $type, 'data' => Flash::get('post_data'), 'users' => ORM::factory('user')->find_all()->as_array('id', 'username')));
     }
 }
Пример #2
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
if (IS_BACKEND) {
    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]);
Пример #3
0
<?php

$sections = Datasource_Data_Manager::types();
foreach ($sections as $type => $title) {
    if (!ACL::check($type . '.section.create')) {
        unset($sections[$type]);
    }
}
foreach ($tree as $type => $data) {
    foreach ($data as $id => $section) {
        if (array_key_exists($section->folder_id(), $folders)) {
            $folders[$section->folder_id()]['sections'][$id] = $section;
            unset($tree[$type][$id]);
        }
    }
}
$folders_status = Model_User_Meta::get('datasource_folders', array());
?>

<div class="navigation">
	<?php 
if (!empty($sections)) {
    ?>
	<div class="compose-btn">
		<div class="btn-group">
			<?php 
    echo UI::button(__('Create section'), array('href' => '#', 'class' => 'dropdown-toggle btn-primary btn-labeled btn-block', 'data-icon-append' => 'caret-down btn-label', 'data-toggle' => 'dropdown'));
    ?>
			<ul class="dropdown-menu">
			<?php 
    foreach ($sections as $type => $title) {
Пример #4
0
<?php

defined('SYSPATH') or die('No direct access allowed.');
$perms = array();
foreach (Datasource_Data_Manager::get_all() as $id => $section) {
    $actions = $section->acl_actions();
    $actions['title'] = __('Datasource :name', array(':name' => $section->name));
    $perms['ds_id.' . $id] = $actions;
}
foreach (Datasource_Data_Manager::types() as $type => $title) {
    $perms[$type . '.section'] = array('title' => 'Datasource', array('action' => 'create', 'description' => 'Create ' . $type . ' section'));
}
return $perms;
Пример #5
0
 protected function _get_sections()
 {
     $map = Datasource_Data_Manager::get_tree();
     $hds = Datasource_Data_Manager::get_all('hybrid');
     $sections = array();
     foreach (Datasource_Data_Manager::types() as $key => $value) {
         if ($key != 'hybrid' and !empty($map[$key])) {
             foreach ($map[$key] as $id => $section) {
                 $sections[$key][$id] = $section->name;
             }
         } else {
             foreach ($hds as $id => $section) {
                 $sections[$key][$id] = $section->name;
             }
         }
     }
     return $sections;
 }