/** * Adds all the events to the main Ushahidi application */ public function add() { // Add a Sub-Nav Link Event::add('ushahidi_action.nav_admin_reports', array($this, '_report_link')); // Only add the events if we are on that controller if (Router::$current_uri == "admin/reports") { plugin::add_stylesheet('analysis/views/css/buttons'); // Add Buttons to the report List Event::add('ushahidi_action.report_extra_admin', array($this, '_reports_list_buttons')); } elseif (Router::$controller == 'analysis') { plugin::add_javascript('analysis/views/js/ui.dialog'); plugin::add_javascript('analysis/views/js/ui.draggable'); plugin::add_javascript('analysis/views/js/ui.resizable'); plugin::add_stylesheet('analysis/views/css/main'); } elseif (strripos(Router::$current_uri, "admin/reports/edit") !== false) { plugin::add_stylesheet('analysis/views/css/report'); plugin::add_javascript('analysis/views/js/jquery.copy.min'); Event::add('ushahidi_action.report_pre_form_admin', array($this, '_reports_list_analysis')); Event::add('ushahidi_action.header_scripts_admin', array($this, '_save_analysis_js')); Event::add('ushahidi_action.report_edit', array($this, '_save_analysis')); } elseif (strripos(Router::$current_uri, "reports/submit") !== false) { //Add dropdown fields to the submit form Event::add('ushahidi_action.report_form', array($this, '_submit_form')); //Save the contents of the dropdown Event::add('ushahidi_action.report_submit', array($this, '_handle_post_data')); Event::add('ushahidi_action.report_add', array($this, '_save_submit_form')); } }
public function __construct() { parent::__construct(); // Set Table Prefix $this->table_prefix = Kohana::config('database.default.table_prefix'); // Load Header & Footer $this->template->header = new View('keitai/header'); $this->template->footer = new View('keitai/footer'); $this->template->header->site_name = Kohana::config('settings.site_name'); $this->template->header->site_tagline = Kohana::config('settings.site_tagline'); plugin::add_javascript('keitai/views/js/jquery'); plugin::add_javascript('keitai/views/js/jquery.treeview'); plugin::add_javascript('keitai/views/js/expand'); plugin::add_stylesheet('keitai/views/css/styles'); plugin::add_stylesheet('keitai/views/css/jquery.treeview'); $this->template->header->show_map = FALSE; $this->template->header->js = ""; $this->template->header->breadcrumbs = ""; // Google Analytics $google_analytics = Kohana::config('settings.google_analytics'); $this->template->footer->google_analytics = $this->_google_analytics($google_analytics); $this->template->header->latlong = (isset($_GET['latlong'])) ? $_GET['latlong'] : ""; $this->template->footer->latlong = (isset($_GET['latlong'])) ? $_GET['latlong'] : ""; }
/** * Adds all the events to the main Ushahidi application */ public function add() { // Add a Sub-Nav Link Event::add('ushahidi_action.nav_admin_settings', array($this, '_settings_link')); Event::add('ushahidi_action.nav_main_top', array($this, '_top_nav_link')); // Only add the events if we are on the main controller if (Router::$controller == 'main') { switch (Router::$method) { // Hook into the main dashboard case 'index': plugin::add_stylesheet('flickrwijit/media/css/style'); plugin::add_stylesheet('../media/css/picbox/picbox'); plugin::add_javascript('../media/js/picbox'); Event::add('ushahidi_action.main_sidebar', array($this, '_display_flickrwiji')); break; } } elseif (Router::$controller == 'flickrwijit') { // Add Flickrwijit to settings page switch (Router::$method) { case 'index': //Hook js and css files into flickrwijit page plugin::add_stylesheet('flickrwijit/media/css/style'); plugin::add_stylesheet('../media/css/picbox/picbox'); plugin::add_javascript('../media/js/picbox'); break; } } }
public static function setup_adminmap($map_controller, $map_view = "adminmap/mapview", $map_css = "adminmap/css/adminmap") { //set the CSS for this plugin::add_stylesheet($map_css); plugin::add_javascript("adminmap/js/jquery.flot"); plugin::add_javascript("adminmap/js/excanvas.min"); plugin::add_javascript("adminmap/js/timeline"); $map_controller->template->content = new View($map_view); // Get Default Color $map_controller->template->content->default_map_all = Kohana::config('settings.default_map_all'); }
/** * Adds all the events to the main Ushahidi application */ public function add() { // Only add the events if we are on that controller if (Router::$controller == 'main') { plugin::add_javascript('fullscreenmap/views/js/jquery.colorbox'); #plugin::add_javascript('fullscreenmap/views/js/ui.draggable'); plugin::add_stylesheet('fullscreenmap/views/css/fullscreenmap'); plugin::add_stylesheet('fullscreenmap/views/css/colorbox'); Event::add('ushahidi_action.header_scripts', array($this, '_main_js')); Event::add('ushahidi_action.map_main_filters', array($this, '_button')); } }
/** * Adds all the events to the main Ushahidi application */ public function add() { //Just in case we need this Event::add('ushahidi_action.nav_main_top', array($this, '_add_big_map_tab')); //adds the big map tab Event::add('ushahidi_action.nav_admin_main_top', array($this, '_admin_nav_tab')); //adds the admin map tab if (Router::$controller == "main") { Event::add('ushahidi_action.map_main_filters', array($this, '_add_big_map_main_button')); //adds the big map tab //use sneaky JS plugin::add_javascript("adminmap/js/embedd_setup"); plugin::add_stylesheet("adminmap/css/embedd_setup"); Event::add('ushahidi_action.main_sidebar', array($this, '_add_embedd')); } //if dealing with the if (Router::$controller == "reports") { Event::add('ushahidi_filter.fetch_incidents_set_params', array($this, '_add_logical_operator_filter')); Event::add('ushahidi_action.report_filters_ui', array($this, '_add_report_filter_ui')); Event::add('ushahidi_action.header_scripts', array($this, '_add_report_filter_js')); } }
/** * Adds all the events to the main Ushahidi application */ public function add() { // Only add the events if we are on that controller if (Router::$controller == 'reports') { switch (Router::$method) { // Hook into the Report Add/Edit Form in Admin case 'edit': plugin::add_stylesheet('locationhighlightlite/media/css/locationhighlightlite'); plugin::add_javascript('locationhighlightlite/media/js/locationhighlightlite'); break; //Hook into frontend Submit View //Hook into frontend Submit View case 'submit': plugin::add_stylesheet('locationhighlightlite/media/css/locationhighlightlite'); plugin::add_javascript('locationhighlightlite/media/js/locationhighlightlite'); break; default: break; } //end of switch } //end of if reports }
public function index($width = 400) { $this->template->header->this_page = 'bigmap'; $this->template->content = new View('adminmap/iframe_mapview'); $this->template->content->site_name = $this->template->header->site_name; //set the CSS for this plugin::add_stylesheet("adminmap/css/iframe_adminmap"); plugin::add_stylesheet("adminmap/css/jquery.hovertip-1.0"); //make sure the right java script files are used. //plugin::add_javascript("adminmap/js/jquery.address-1.4.min.js"); plugin::add_javascript("adminmap/js/jquery.flot"); plugin::add_javascript("adminmap/js/excanvas.min"); plugin::add_javascript("adminmap/js/timeline"); plugin::add_javascript("adminmap/js/jquery.hovertip-1.0"); // Cacheable Main Controller $this->is_cachable = TRUE; // Map and Slider Blocks $div_timeline = new View('adminmap/iframe_main_timeline'); // Filter::map_timeline - Modify Main Map Block Event::run('ushahidi_filter.map_timeline', $div_timeline); $this->template->content->div_timeline = $div_timeline; $this->template->content->width = $width; // Get locale $l = Kohana::config('locale.language.0'); // Get all active top level categories $parent_categories = array(); foreach (ORM::factory('category')->where('category_visible', '1')->where('parent_id', '0')->find_all() as $category) { // Get The Children $children = array(); foreach ($category->children as $child) { // Check for localization of child category $translated_title = Category_Lang_Model::category_title($child->id, $l); if ($translated_title) { $display_title = $translated_title; } else { $display_title = $child->category_title; } $children[$child->id] = array($display_title, $child->category_color, $child->category_image); if ($child->category_trusted) { // Get Trusted Category Count $trusted = ORM::factory("incident")->join("incident_category", "incident.id", "incident_category.incident_id")->where("category_id", $child->id); if (!$trusted->count_all()) { unset($children[$child->id]); } } } // Check for localization of parent category $translated_title = Category_Lang_Model::category_title($category->id, $l); if ($translated_title) { $display_title = $translated_title; } else { $display_title = $category->category_title; } // Put it all together $parent_categories[$category->id] = array($display_title, $category->category_color, $category->category_image, $children); if ($category->category_trusted) { // Get Trusted Category Count $trusted = ORM::factory("incident")->join("incident_category", "incident.id", "incident_category.incident_id")->where("category_id", $category->id); if (!$trusted->count_all()) { unset($parent_categories[$category->id]); } } } $this->template->content->categories = $parent_categories; // Get all active Layers (KMZ/KML) $layers = array(); $config_layers = Kohana::config('map.layers'); // use config/map layers if set if ($config_layers == $layers) { foreach (ORM::factory('layer')->where('layer_visible', 1)->find_all() as $layer) { $layers[$layer->id] = array($layer->layer_name, $layer->layer_color, $layer->layer_url, $layer->layer_file); } } else { $layers = $config_layers; } $this->template->content->layers = $layers; // Get all active Shares $shares = array(); foreach (ORM::factory('sharing')->where('sharing_active', 1)->find_all() as $share) { $shares[$share->id] = array($share->sharing_name, $share->sharing_color); } $this->template->content->shares = $shares; // Get Default Color $this->template->content->default_map_all = Kohana::config('settings.default_map_all'); // Get The START, END and Incident Dates $startDate = ""; $endDate = ""; $display_startDate = 0; $display_endDate = 0; $db = new Database(); // Next, Get the Range of Years $query = $db->query('SELECT DATE_FORMAT(incident_date, \'%Y-%c\') AS dates FROM ' . $this->table_prefix . 'incident WHERE incident_active = 1 GROUP BY DATE_FORMAT(incident_date, \'%Y-%c\') ORDER BY incident_date'); $first_year = date('Y'); $last_year = date('Y'); $first_month = 1; $last_month = 12; $i = 0; foreach ($query as $data) { $date = explode('-', $data->dates); $year = $date[0]; $month = $date[1]; // Set first year if ($i == 0) { $first_year = $year; $first_month = $month; } // Set last dates $last_year = $year; $last_month = $month; $i++; } $show_year = $first_year; $selected_start_flag = TRUE; while ($show_year <= $last_year) { $startDate .= "<optgroup label=\"" . $show_year . "\">"; $s_m = 1; if ($show_year == $first_year) { // If we are showing the first year, the starting month may not be January $s_m = $first_month; } $l_m = 12; if ($show_year == $last_year) { // If we are showing the last year, the ending month may not be December $l_m = $last_month; } for ($i = $s_m; $i <= $l_m; $i++) { if ($i < 10) { // All months need to be two digits $i = "0" . $i; } $startDate .= "<option value=\"" . strtotime($show_year . "-" . $i . "-01") . "\""; if ($selected_start_flag == TRUE) { $display_startDate = strtotime($show_year . "-" . $i . "-01"); $startDate .= " selected=\"selected\" "; $selected_start_flag = FALSE; } $startDate .= ">" . date('M', mktime(0, 0, 0, $i, 1)) . " " . $show_year . "</option>"; } $startDate .= "</optgroup>"; $endDate .= "<optgroup label=\"" . $show_year . "\">"; for ($i = $s_m; $i <= $l_m; $i++) { if ($i < 10) { // All months need to be two digits $i = "0" . $i; } $endDate .= "<option value=\"" . strtotime($show_year . "-" . $i . "-" . date('t', mktime(0, 0, 0, $i, 1)) . " 23:59:59") . "\""; if ($i == $l_m and $show_year == $last_year) { $display_endDate = strtotime($show_year . "-" . $i . "-" . date('t', mktime(0, 0, 0, $i, 1)) . " 23:59:59"); $endDate .= " selected=\"selected\" "; } $endDate .= ">" . date('M', mktime(0, 0, 0, $i, 1)) . " " . $show_year . "</option>"; } $endDate .= "</optgroup>"; // Show next year $show_year++; } Event::run('ushahidi_filter.active_startDate', $display_startDate); Event::run('ushahidi_filter.active_endDate', $display_endDate); Event::run('ushahidi_filter.startDate', $startDate); Event::run('ushahidi_filter.endDate', $endDate); $this->template->content->div_timeline->startDate = $startDate; $this->template->content->div_timeline->endDate = $endDate; // Javascript Header $this->themes->map_enabled = true; $this->themes->main_page = true; // Map Settings $clustering = Kohana::config('settings.allow_clustering'); $marker_radius = Kohana::config('map.marker_radius'); $marker_opacity = Kohana::config('map.marker_opacity'); $marker_stroke_width = Kohana::config('map.marker_stroke_width'); $marker_stroke_opacity = Kohana::config('map.marker_stroke_opacity'); // pdestefanis - allows to restrict the number of zoomlevels available $numZoomLevels = Kohana::config('map.numZoomLevels'); $minZoomLevel = Kohana::config('map.minZoomLevel'); $maxZoomLevel = Kohana::config('map.maxZoomLevel'); // pdestefanis - allows to limit the extents of the map $lonFrom = Kohana::config('map.lonFrom'); $latFrom = Kohana::config('map.latFrom'); $lonTo = Kohana::config('map.lonTo'); $latTo = Kohana::config('map.latTo'); $this->themes->js = new View('adminmap/iframe_mapview_js'); $this->themes->js->json_url = $clustering == 1 ? "bigmap_json/cluster" : "bigmap_json"; $this->themes->js->marker_radius = $marker_radius >= 1 && $marker_radius <= 10 ? $marker_radius : 5; $this->themes->js->marker_opacity = $marker_opacity >= 1 && $marker_opacity <= 10 ? $marker_opacity * 0.1 : 0.9; $this->themes->js->marker_stroke_width = $marker_stroke_width >= 1 && $marker_stroke_width <= 5 ? $marker_stroke_width : 2; $this->themes->js->marker_stroke_opacity = $marker_stroke_opacity >= 1 && $marker_stroke_opacity <= 10 ? $marker_stroke_opacity * 0.1 : 0.9; // pdestefanis - allows to restrict the number of zoomlevels available $this->themes->js->numZoomLevels = $numZoomLevels; $this->themes->js->minZoomLevel = $minZoomLevel; $this->themes->js->maxZoomLevel = $maxZoomLevel; // pdestefanis - allows to limit the extents of the map $this->themes->js->lonFrom = $lonFrom; $this->themes->js->latFrom = $latFrom; $this->themes->js->lonTo = $lonTo; $this->themes->js->latTo = $latTo; $this->themes->js->default_map = Kohana::config('settings.default_map'); $this->themes->js->default_zoom = Kohana::config('settings.default_zoom'); $this->themes->js->latitude = Kohana::config('settings.default_lat'); $this->themes->js->longitude = Kohana::config('settings.default_lon'); $this->themes->js->default_map_all = Kohana::config('settings.default_map_all'); // $this->themes->js->active_startDate = $display_startDate; $this->themes->js->active_endDate = $display_endDate; //$myPacker = new javascriptpacker($js , 'Normal', false, false); //$js = $myPacker->pack(); // Rebuild Header Block $this->template->header->header_block = $this->themes->header_block(); }
public function index($group_id, $width = 400) { $group = ORM::factory('simplegroups_groups', $group_id)->find($group_id); $this->template->header->this_page = 'bigmap'; $this->template->content = new View('adminmap/iframe_mapview'); $this->template->content->site_name = $group->name; //set the CSS for this plugin::add_stylesheet("adminmap/css/iframe_adminmap"); plugin::add_stylesheet("adminmap/css/jquery.hovertip-1.0"); //make sure the right java script files are used. //plugin::add_javascript("adminmap/js/jquery.address-1.4.min.js"); plugin::add_javascript("adminmap/js/jquery.flot"); plugin::add_javascript("adminmap/js/excanvas.min"); plugin::add_javascript("adminmap/js/timeline"); plugin::add_javascript("adminmap/js/jquery.hovertip-1.0"); // Cacheable Main Controller $this->is_cachable = TRUE; // Map and Slider Blocks $div_timeline = new View('adminmap/iframe_main_timeline'); // Filter::map_timeline - Modify Main Map Block Event::run('ushahidi_filter.map_timeline', $div_timeline); $this->template->content->div_timeline = $div_timeline; $this->template->content->width = $width; // Get locale $l = Kohana::config('locale.language.0'); // Get all active top level categories //$parent_categories = array(); adminmap_helper::set_categories($this, false, $group); //$this->template->content->categories = $parent_categories; // Get all active Layers (KMZ/KML) $layers = array(); $config_layers = Kohana::config('map.layers'); // use config/map layers if set if ($config_layers == $layers) { foreach (ORM::factory('layer')->where('layer_visible', 1)->find_all() as $layer) { $layers[$layer->id] = array($layer->layer_name, $layer->layer_color, $layer->layer_url, $layer->layer_file); } } else { $layers = $config_layers; } $this->template->content->layers = $layers; // Get all active Shares $shares = array(); foreach (ORM::factory('sharing')->where('sharing_active', 1)->find_all() as $share) { $shares[$share->id] = array($share->sharing_name, $share->sharing_color); } $this->template->content->shares = $shares; // Get Default Color $this->template->content->default_map_all = Kohana::config('settings.default_map_all'); // Get The START, END and most ACTIVE Incident Dates $startDate = ""; $endDate = ""; $active_month = 0; $active_startDate = 0; $active_endDate = 0; $db = new Database(); // First Get The Most Active Month $query = $db->query('SELECT incident_date, count(*) AS incident_count FROM ' . $this->table_prefix . 'incident WHERE incident_active = 1 GROUP BY DATE_FORMAT(incident_date, \'%Y-%m\') ORDER BY incident_count DESC LIMIT 1'); foreach ($query as $query_active) { $active_month = date('n', strtotime($query_active->incident_date)); $active_year = date('Y', strtotime($query_active->incident_date)); $active_startDate = strtotime($active_year . "-" . $active_month . "-01"); $active_endDate = strtotime($active_year . "-" . $active_month . "-" . date('t', mktime(0, 0, 0, $active_month, 1)) . " 23:59:59"); } //run some custom events for the timeline plugin Event::run('ushahidi_filter.active_startDate', $active_startDate); Event::run('ushahidi_filter.active_endDate', $active_endDate); Event::run('ushahidi_filter.active_month', $active_month); // Next, Get the Range of Years $query = $db->query('SELECT DATE_FORMAT(incident_date, \'%Y\') AS incident_date FROM ' . $this->table_prefix . 'incident WHERE incident_active = 1 GROUP BY DATE_FORMAT(incident_date, \'%Y\') ORDER BY incident_date'); foreach ($query as $slider_date) { $years = $slider_date->incident_date; $startDate .= "<optgroup label=\"" . $years . "\">"; for ($i = 1; $i <= 12; $i++) { if ($i < 10) { $i = "0" . $i; } $startDate .= "<option value=\"" . strtotime($years . "-" . $i . "-01") . "\""; if ($active_month && (int) $i == $active_month - 1) { $startDate .= " selected=\"selected\" "; } $startDate .= ">" . date('M', mktime(0, 0, 0, $i, 1)) . " " . $years . "</option>"; } $startDate .= "</optgroup>"; $endDate .= "<optgroup label=\"" . $years . "\">"; for ($i = 1; $i <= 12; $i++) { if ($i < 10) { $i = "0" . $i; } $endDate .= "<option value=\"" . strtotime($years . "-" . $i . "-" . date('t', mktime(0, 0, 0, $i, 1)) . " 23:59:59") . "\""; // Focus on the most active month or set December as month of endDate if ($active_month && (int) $i == $active_month + 1 || $i == 12 && preg_match('/selected/', $endDate) == 0) { $endDate .= " selected=\"selected\" "; } $endDate .= ">" . date('M', mktime(0, 0, 0, $i, 1)) . " " . $years . "</option>"; } $endDate .= "</optgroup>"; } //run more custom events for the timeline plugin Event::run('ushahidi_filter.startDate', $startDate); Event::run('ushahidi_filter.endDate', $endDate); $this->template->content->div_timeline->startDate = $startDate; $this->template->content->div_timeline->endDate = $endDate; // Javascript Header $this->themes->map_enabled = true; $this->themes->main_page = true; // Map Settings $clustering = Kohana::config('settings.allow_clustering'); $marker_radius = Kohana::config('map.marker_radius'); $marker_opacity = Kohana::config('map.marker_opacity'); $marker_stroke_width = Kohana::config('map.marker_stroke_width'); $marker_stroke_opacity = Kohana::config('map.marker_stroke_opacity'); // pdestefanis - allows to restrict the number of zoomlevels available $numZoomLevels = Kohana::config('map.numZoomLevels'); $minZoomLevel = Kohana::config('map.minZoomLevel'); $maxZoomLevel = Kohana::config('map.maxZoomLevel'); // pdestefanis - allows to limit the extents of the map $lonFrom = Kohana::config('map.lonFrom'); $latFrom = Kohana::config('map.latFrom'); $lonTo = Kohana::config('map.lonTo'); $latTo = Kohana::config('map.latTo'); $this->themes->js = new View('adminmap/iframe_mapview_js'); $this->themes->js->json_url = $clustering == 1 ? "simplegroupmap_json/cluster/{$group_id}" : "simplegroupmap_json/index/{$group_id}"; $this->themes->js->marker_radius = $marker_radius >= 1 && $marker_radius <= 10 ? $marker_radius : 5; $this->themes->js->marker_opacity = $marker_opacity >= 1 && $marker_opacity <= 10 ? $marker_opacity * 0.1 : 0.9; $this->themes->js->marker_stroke_width = $marker_stroke_width >= 1 && $marker_stroke_width <= 5 ? $marker_stroke_width : 2; $this->themes->js->marker_stroke_opacity = $marker_stroke_opacity >= 1 && $marker_stroke_opacity <= 10 ? $marker_stroke_opacity * 0.1 : 0.9; // pdestefanis - allows to restrict the number of zoomlevels available $this->themes->js->numZoomLevels = $numZoomLevels; $this->themes->js->minZoomLevel = $minZoomLevel; $this->themes->js->maxZoomLevel = $maxZoomLevel; // pdestefanis - allows to limit the extents of the map $this->themes->js->lonFrom = $lonFrom; $this->themes->js->latFrom = $latFrom; $this->themes->js->lonTo = $lonTo; $this->themes->js->latTo = $latTo; $this->themes->js->default_map = Kohana::config('settings.default_map'); $this->themes->js->default_zoom = Kohana::config('settings.default_zoom'); $this->themes->js->latitude = Kohana::config('settings.default_lat'); $this->themes->js->longitude = Kohana::config('settings.default_lon'); $this->themes->js->default_map_all = Kohana::config('settings.default_map_all'); // $this->themes->js->active_startDate = $active_startDate; $this->themes->js->active_endDate = $active_endDate; //$myPacker = new javascriptpacker($js , 'Normal', false, false); //$js = $myPacker->pack(); // Rebuild Header Block $this->template->header->header_block = $this->themes->header_block(); }
/** * Function: index * * Description: This controller calls the helper functions to create and assemble the various components * needed to make a working map * * Views: enhancedmap/print_mapview, enhancedmap/print_map_header * * Results: User gets a map that they can interact with */ public function index() { //////////////////////////////////////////////////////////////////////////////////////////////// // custom JS that the print map needs plugin::add_javascript("enhancedmap/js/jquery.address-1.4.min.js"); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Setup the map enhancedmap_helper::setup_enhancedmap($this, "enhancedmap/print_mapview", "enhancedmap/css/print_enhancedmap"); //ARE WE CLUSTERING? $clustering = cookie::get('clustering', Kohana::config('settings.allow_clustering')); ///////////////////////////////////////////////////////////////////////////////////////////////////////// //get the CATEGORIES ///////////////////////////////////////////////////////////////////////////////////////////////////////// if (isset($this->group_id) && $this->group_id) { $group_id = $this->group_id; $group = ORM::factory('simplegroups_groups', $this->group_id)->find($this->group_id); $this->template->content->div_categories_filter = enhancedmap_helper::set_categories(false, $group); $urlParams = array('sgid' => $group_id); } else { //get the categories $this->template->content->div_categories_filter = enhancedmap_helper::set_categories(); $urlParams = array(); } //status filter $this->template->content->div_status_filter = enhancedmap_helper::get_status_filter(); //boolean filter $this->template->content->div_boolean_filter = enhancedmap_helper::get_boolean_filter(); //dot size selector $this->template->content->div_dotsize_selector = enhancedmap_helper::get_dotsize_selector(); //clustering selector $this->template->content->div_clustering_selector = enhancedmap_helper::get_clustering_selector(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //setup the map ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// $json_url = $clustering == 1 ? "bigmap_json/cluster" : "bigmap_json"; $json_timeline_url = "bigmap_json/timeline/"; enhancedmap_helper::set_map($this->template, $this->themes, $json_url, $json_timeline_url, 'enhancedmap/print_mapview_js', 'enhancedmap/big_main_map', 'enhancedmap/print_main_timeline', $urlParams); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //setup the overlays and shares ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //layers $this->template->content->div_layers_filter = enhancedmap_helper::set_layers(); //shares $this->template->content->div_shares_filter = enhancedmap_helper::set_shares(false, false); plugin::add_stylesheet("enhancedmap/css/jquery.hovertip-1.0"); plugin::add_javascript("enhancedmap/js/jquery.hovertip-1.0"); $this->template->header = new View('enhancedmap/print_map_header'); $this->template->header->site_name = $this->site_name; $this->template->header->this_page = "printmap"; // Rebuild Header Block $this->template->header->header_block = $this->themes->header_block(); }
public function index() { //////////////////////////////////////////////////////////////////////////////////////////////// // custom JS that the print map needs plugin::add_javascript("adminmap/js/jquery.address-1.4.min.js"); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Setup the map adminmap_helper::setup_adminmap($this, "adminmap/print_mapview", "adminmap/css/print_adminmap"); //ARE WE CLUSTERING? $clustering = Kohana::config('settings.allow_clustering'); ///////////////////////////////////////////////////////////////////////////////////////////////////////// //get the CATEGORIES ///////////////////////////////////////////////////////////////////////////////////////////////////////// if (isset($this->group_id) && $this->group_id) { $group_id = $this->group_id; $group = ORM::factory('simplegroups_groups', $this->group_id)->find($this->group_id); //get the categories adminmap_helper::set_categories($this, false, $group); $json_url = $clustering == 1 ? "simplegroupmap_json/cluster/{$group_id}" : "simplegroupmap_json/index/{$group_id}"; $json_timeline_url = "simplegroupmap_json/timeline/{$group_id}/"; } else { //get the categories adminmap_helper::set_categories($this, false); $json_url = $clustering == 1 ? "bigmap_json/cluster" : "bigmap_json"; $json_timeline_url = "bigmap_json/timeline/"; } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //setup the map ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// adminmap_helper::set_map($this->template, $this->themes, $json_url, $json_timeline_url, 'adminmap/print_mapview_js', 'adminmap/big_main_map', 'adminmap/print_main_timeline'); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //setup the overlays and shares ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// adminmap_helper::set_overlays_shares($this); plugin::add_stylesheet("adminmap/css/jquery.hovertip-1.0"); plugin::add_javascript("adminmap/js/jquery.hovertip-1.0"); $this->template->header = new View('adminmap/print_map_header'); $this->template->header->site_name = $this->site_name; $this->template->header->this_page = ""; // Rebuild Header Block $this->template->header->header_block = $this->themes->header_block(); }
/** * Function: index * * Description: This controller calls the helper functions to create and assemble the various components * needed to make a working map * * @param int $width - Width of the iframe * * Views: enhancedmap/iframe_mapview, * * Results: User gets a map that they can interact with */ public function index($width = 400) { //set the title of the page $this->template->header->this_page = 'bigmap'; //javascript for the big map special features /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Setup the map enhancedmap_helper::setup_enhancedmap($this, "enhancedmap/iframe_mapview", "enhancedmap/css/iframe_adminmap"); //set the site name $this->template->content->site_name = $this->template->header->site_name; //set the width of the map $this->template->content->width = $width; //ARE WE CLUSTERING? $clustering = cookie::get('clustering', Kohana::config('settings.allow_clustering')); ///////////////////////////////////////////////////////////////////////////////////////////////////////// //get the CATEGORIES ///////////////////////////////////////////////////////////////////////////////////////////////////////// //get the categories enhancedmap_helper::set_categories($this, false); $json_url = $clustering == 1 ? "iframemap_json/cluster" : "iframemap_json"; $json_timeline_url = "bigmap_json/timeline/"; //boolean filter $this->template->content->div_boolean_filter = enhancedmap_helper::get_boolean_filter(); //boolean filter $this->template->content->div_categories_filter = enhancedmap_helper::set_categories(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //setup the map ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// enhancedmap_helper::set_map($this->template, $this->themes, $json_url, $json_timeline_url, 'enhancedmap/adminmap_js', 'enhancedmap/big_main_map', 'enhancedmap/iframe_main_timeline'); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //setup the overlays and shares ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //layers $this->template->content->div_layers_filter = enhancedmap_helper::set_layers(); //shares $this->template->content->div_shares_filter = enhancedmap_helper::set_shares(false, false); plugin::add_stylesheet("enhancedmap/css/jquery.hovertip-1.0"); plugin::add_javascript("enhancedmap/js/jquery.hovertip-1.0"); // Rebuild Header Block $this->template->header->header_block = $this->themes->header_block(); }
/** * Function: add * * Description: Adds all the events to the main Ushahidi application * * Views: * * Results: This plugin has registered for all the events that it wants to know about */ public function add() { //Just in case we need this Event::add('ushahidi_action.nav_main_top', array($this, '_add_big_map_tab')); //adds the big map tab Event::add('ushahidi_action.nav_admin_main_top', array($this, '_admin_nav_tab')); //adds the admin map tab if (Router::$controller == "main") { Event::add('ushahidi_action.map_main_filters', array($this, '_add_big_map_main_button')); //adds the big map tab //use sneaky JS if (ORM::factory('enhancedmap_settings')->where('key', 'enable_iframemap')->find()->value == "true") { plugin::add_javascript("enhancedmap/js/embedd_setup"); plugin::add_stylesheet("enhancedmap/css/embedd_setup"); Event::add('ushahidi_action.main_sidebar', array($this, '_add_embedd')); } plugin::add_stylesheet("enhancedmap/css/printmap_link"); Event::add('ushahidi_filter.map_main', array($this, '_add_printmap')); } //if dealing with the if (Router::$controller == "reports") { Event::add('ushahidi_action.report_filters_ui', array($this, '_add_report_filter_ui')); Event::add('ushahidi_action.header_scripts', array($this, '_add_report_filter_js')); } //always filter the fetch incidents params, well don't use it if the high performance version is at play if (Router::$controller != "hpbigmap_json" and Router::$controller != "hpiframemap_json" and Router::$controller != "hpadminmap_json") { plugin::add_javascript("enhancedmap/js/LoadingPanel"); Event::add('ushahidi_filter.fetch_incidents_set_params', array($this, '_add_logical_operator_filter')); } if (Router::$controller == "adminmap") { plugin::add_javascript("enhancedmap/js/LoadingPanel"); //hide the content div Event::add('ushahidi_action.header_scripts_admin', array($this, '_hide_content_for_adminmap')); } //adds the ability to see all approved and unapproved reports Event::add('ushahidi_filter.fetch_incidents_set_params', array($this, '_add_all_reports_filter')); }