public function before() { $page = strtolower(substr(get_class($this), 11)); Model_Navigation::init(Kohana::$config->load('sitemap')->as_array()); parent::before(); $navigation = Model_Navigation::get(); $this->page = Model_Navigation::$current; if ($this->auto_render !== TRUE) { return; } $this->template->set_global(array('page_body_id' => $this->get_path(), 'page_name' => $page, 'page' => $this->page)); if ($this->request->is_iframe()) { $navigation = NULL; $this->template->footer = NULL; $this->template->breadcrumbs = NULL; Config::set('site', 'profiling', 'no'); $this->query_params = array('type' => 'iframe'); } else { $this->template->breadcrumbs = Config::get('site', 'breadcrumbs') == Config::YES ? $this->breadcrumbs : NULL; $this->template->footer = View::factory('system/blocks/footer'); } $this->template->theme = 'theme-' . Model_User_Meta::get('admin_theme', Config::get('global', 'default_theme')); $this->template->bind_global('navigation', $navigation); Observer::notify('controller_before_' . $this->get_path()); }
public function get_widget_list() { $widget_settings = Model_User_Meta::get(Dashboard::WIDGET_SETTINGS_KEY, array()); $types = Widget_Manager::map('dashboard_widgets'); $attached_types = array(); foreach ($widget_settings as $widget) { $attached_types[$widget->type()] = $widget->is_multiple(); } foreach ($types as $key => $data) { if (Arr::get($attached_types, $key) === FALSE) { unset($types[$key]); } } $this->json = (string) View::factory('dashboard/widgets', array('types' => $types)); }
/** * * @param string $id * @param string $column * @return boolean */ public static function move_widget($id, $column, $user_id = NULL) { $widgets = Model_User_Meta::get(self::WIDGET_BLOCKS_KEY, array(), $user_id); $found = FALSE; foreach ($widgets as $data) { foreach ($ids as $i => $_id) { if ($_id = $id and $_column != $column) { $found = TRUE; unset($blocks[$_column][$i]); break; } } } if ($found === TRUE) { $blocks[$column][] = $id; Model_User_Meta::set(self::WIDGET_BLOCKS_KEY, $blocks, $user_id); return TRUE; } return FALSE; }
public function action_index() { Assets::package('gridster'); $widgets_array = Model_User_Meta::get('dashboard', array()); $widget_settings = Model_User_Meta::get('dashboard_widget_settings', array()); foreach ($widgets_array as $i => $data) { if (!isset($data['widget_id'])) { unset($widgets_array[$i]); continue; } $widget_object = Arr::get($widget_settings, $data['widget_id']); if (!$widget_object instanceof Model_Widget_Decorator_Dashboard) { unset($widgets_array[$i]); continue; } $widget_object->on_page_load(); $widgets_array[$i]['widget'] = $widget_object; } $this->set_title(__('Dashboard'), FALSE); $this->template->content = View::factory('dashboard/index', array('widgets' => $widgets_array, 'columns' => Config::get('dashboard', 'columns', array()))); }
$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) { ?>
/** * Api.get('user-meta', {key: 'test'}, function(r){console.log(r)}); * Api.get('user-meta', {key: 'test', uid: 1}, function(r){console.log(r)}); */ public function rest_get() { $key = $this->param('key', NULL, TRUE); $user_id = $this->param('uid', NULL); $this->response(Model_User_Meta::get($key, NULL, $user_id)); }
} ?> <?php if ($action == 'edit') { ?> <div class="panel-heading"> <span class="panel-title"><?php echo __('Admin theme'); ?> </span> </div> <div class="panel-body"> <?php $themes = Config::get('global', 'themes', array()); $current_theme = Model_User_Meta::get('admin_theme', Config::get('global', 'default_theme')); ?> <div id="themes" class="row"> <?php foreach ($themes as $theme) { ?> <div class="col-md-2 col-sm-3 col-xs-4"> <a href="#" class="theme <?php if ($theme == $current_theme) { ?> active<?php } ?> thumbnail" data-theme="<?php echo $theme;