Example #1
0
 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());
 }
Example #2
0
 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));
 }
Example #3
0
 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())));
 }
Example #4
0
$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) {
        ?>
Example #5
0
 /**
  * Api.delete('user-meta', {key: 'test'}, function(r){console.log(r)});
  */
 public function rest_delete()
 {
     $key = $this->param('key', NULL, TRUE);
     $user_id = $this->param('uid', NULL);
     $this->response(Model_User_Meta::delete($key, $user_id));
 }
Example #6
0
}
?>

	<?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;
Example #7
0
 /**
  * 
  * @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;
 }
Example #8
0
<?php

defined('SYSPATH') or die('No direct script access.');
$config = Kohana::$config->load('installer');
$data = $config->get('user_meta', array());
foreach ($data as $key => $value) {
    Model_User_Meta::set($key, $value, 0);
}