/** * * @return array */ public function sources() { $sources_list = Datasource_Data_Manager::get_all(); $sources = array(); foreach ($sources_list as $id => $source) { $sources[$id] = $source->name; } return $sources; }
/** * * @return array */ public function options() { $datasources = Datasource_Data_Manager::get_all('hybrid'); $options = array(__('--- Not set ---')); foreach ($datasources as $value) { $options[$value['id']] = $value['name']; } return $options; }
if (empty($folder['sections'])) { continue; } $folder_section = Model_Navigation::get_section($folder['name'], $ds_section); foreach ($folder['sections'] as $id => $section) { $section->add_to_menu($folder_section); } } foreach ($sections_list as $type => $sections) { foreach ($sections as $id => $section) { $section->add_to_menu($ds_section); } } $_create_section = Model_Navigation::get_section(__('Create section'), $ds_section, 999); foreach ($types as $id => $type) { $_create_section->add_page(new Model_Navigation_Page(array('name' => $type, 'url' => Route::get('datasources')->uri(array('controller' => 'section', 'directory' => 'datasources', 'action' => 'create', 'id' => $id)), 'permissions' => $id . '.section.create'))); } unset($sections_list, $folders, $root_section); } catch (Exception $ex) { } }); Observer::observe('update_search_index', function () { $ds_ids = Datasource_Data_Manager::get_all(); foreach ($ds_ids as $ds_id => $data) { $ds = Datasource_Data_Manager::load($ds_id); if (!$ds->loaded()) { continue; } $ds->update_index(); } });
<?php defined('SYSPATH') or die('No direct access allowed.'); $datasources = Datasource_Data_Manager::get_all('hybrid'); foreach ($datasources as $id => $ds) { $datasource = Datasource_Data_Manager::load($id); if ($datasource->loaded()) { $datasource->remove(); } }
<?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;
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; }