Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $this->session = Session::instance();
     if (!$this->auth->logged_in('login')) {
         url::redirect('login');
     }
     // Check if user has the right to see the user dashboard
     if (!$this->auth->has_permission('member_ui')) {
         // This user isn't allowed in the admin panel
         url::redirect('/');
     }
     // Themes Helper
     $this->themes = new Themes();
     $this->themes->admin = TRUE;
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     $this->template->admin_name = $this->user->name;
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->themes->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->themes->map_enabled = FALSE;
     $this->themes->flot_enabled = FALSE;
     $this->themes->treeview_enabled = FALSE;
     $this->themes->protochart_enabled = FALSE;
     $this->themes->colorpicker_enabled = FALSE;
     $this->themes->editor_enabled = FALSE;
     $this->themes->tablerowsort_enabled = FALSE;
     $this->themes->autocomplete_enabled = FALSE;
     $this->themes->json2_enabled = FALSE;
     $this->themes->js = '';
     $this->template->form_error = FALSE;
     // Initialize some variables for raphael impact charts
     $this->themes->raphael_enabled = FALSE;
     $this->themes->impact_json = '';
     // Generate main tab navigation list.
     $this->template->main_tabs = members::main_tabs();
     $this->template->this_page = "";
     // Header Nav
     $header_nav = new View('header_nav');
     $this->template->header_nav = $header_nav;
     $this->template->header_nav->loggedin_user = FALSE;
     if (isset(Auth::instance()->get_user()->id)) {
         // Load User
         $this->template->header_nav->loggedin_role = Auth::instance()->get_user()->dashboard();
         $this->template->header_nav->loggedin_user = Auth::instance()->get_user();
     }
     $this->template->header_nav->site_name = Kohana::config('settings.site_name');
     Event::add('ushahidi_filter.view_pre_render.members_layout', array($this, '_pre_render'));
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $this->session = Session::instance();
     if (!$this->auth->logged_in('login') or !$this->auth->logged_in('member')) {
         url::redirect('login');
     }
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     // Get Session Information
     $this->user = new User_Model($_SESSION['auth_user']->id);
     $this->template->admin_name = $this->user->name;
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->template->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->template->map_enabled = FALSE;
     $this->template->flot_enabled = FALSE;
     $this->template->treeview_enabled = FALSE;
     $this->template->protochart_enabled = FALSE;
     $this->template->colorpicker_enabled = FALSE;
     $this->template->editor_enabled = FALSE;
     $this->template->tablerowsort_enabled = FALSE;
     $this->template->autocomplete_enabled = FALSE;
     $this->template->json2_enabled = FALSE;
     $this->template->js = '';
     $this->template->form_error = FALSE;
     // Initialize some variables for raphael impact charts
     $this->template->raphael_enabled = FALSE;
     $this->template->impact_json = '';
     // Generate main tab navigation list.
     $this->template->main_tabs = members::main_tabs();
     $this->template->this_page = "";
     // Load profiler
     // $profiler = new Profiler;
     // Header Nav
     $header_nav = new View('header_nav');
     $this->template->header_nav = $header_nav;
     $this->template->header_nav->loggedin_user = FALSE;
     if (isset(Auth::instance()->get_user()->id)) {
         // Load User
         $this->template->header_nav->loggedin_role = Auth::instance()->logged_in('member') ? "members" : "admin";
         $this->template->header_nav->loggedin_user = Auth::instance()->get_user();
     }
     $this->template->header_nav->site_name = Kohana::config('settings.site_name');
 }