From 2b0b5081c17bb0d41ca73d7cdf4d862d20bf7b3b Mon Sep 17 00:00:00 2001 From: jenpaff Date: Thu, 7 Aug 2014 11:30:16 +0200 Subject: [PATCH 1/5] T6 Changes to Map Indicators * removed All Categories Options * decreased Marker Size --- application/config/map.php | 2 +- application/controllers/json.php | 12 +----------- application/i18n | 2 +- themes/default/views/main/layout.php | 6 ------ 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/application/config/map.php b/application/config/map.php index 2fed878e..b870dfec 100644 --- a/application/config/map.php +++ b/application/config/map.php @@ -9,7 +9,7 @@ * Values from 1 to 10 * Default: 4 */ -$config['marker_radius'] = "4"; +$config['marker_radius'] = "2.5"; /** diff --git a/application/controllers/json.php b/application/controllers/json.php index 165489f7..794be8ee 100644 --- a/application/controllers/json.php +++ b/application/controllers/json.php @@ -81,17 +81,7 @@ public function cluster() * @param string $type type of geojson to generate. Valid options are: 'clusters' and 'markers' **/ protected function geojson($type) - { - $color = Kohana::config('settings.default_map_all'); - $icon = ""; - $markers = FALSE; - - if (Kohana::config('settings.default_map_all_icon_id')) - { - $icon_object = ORM::factory('media')->find(Kohana::config('settings.default_map_all_icon_id')); - $icon = url::convert_uploaded_to_abs($icon_object->media_medium); - } - + { // Category ID $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; // Get the category colour diff --git a/application/i18n b/application/i18n index fc788997..d24b157d 160000 --- a/application/i18n +++ b/application/i18n @@ -1 +1 @@ -Subproject commit fc788997a2e8a16917da4f96bd9f9856c40bbcd4 +Subproject commit d24b157d3e9691cb4228ab34575fb3249d91e8e9 diff --git a/themes/default/views/main/layout.php b/themes/default/views/main/layout.php index 3f60a635..21f4438e 100755 --- a/themes/default/views/main/layout.php +++ b/themes/default/views/main/layout.php @@ -40,12 +40,6 @@ $color_css = 'class="category-icon"'; } ?> -
  • - - > - - -
  • $category_info) { From 36da1b5fd59681242fbcf644ced3b928145eeb87 Mon Sep 17 00:00:00 2001 From: jenpaff Date: Fri, 5 Sep 2014 12:12:29 +0200 Subject: [PATCH 2/5] show all markers on load test --- .gitmodules | 1 + application/controllers/json.php | 41 ++++++++++++++++++++++++++++---- application/i18n | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index d0a354e1..b3ab9bfd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "application/i18n"] path = application/i18n url = git://github.com/ushahidi/Ushahidi-Localizations.git + ignore = dirty diff --git a/application/controllers/json.php b/application/controllers/json.php index 794be8ee..e9933881 100644 --- a/application/controllers/json.php +++ b/application/controllers/json.php @@ -81,7 +81,30 @@ public function cluster() * @param string $type type of geojson to generate. Valid options are: 'clusters' and 'markers' **/ protected function geojson($type) - { + { + $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; + + if ($category_id == 0) { + $cat_ids = $db->query('SELECT id FROM category'); //ORM::factory('category', $id)->find_all(); + foreach ($cat_ids as $cat_id) { + $color = $cat_id->category_color;//Kohana::config('settings.default_map_all'); + } + } + + $icon = ""; + $markers = FALSE; + + if (Kohana::config('settings.default_map_all_icon_id')) + { + $icon_object = ORM::factory('media')->find(Kohana::config('settings.default_map_all_icon_id')); + $icon = url::convert_uploaded_to_abs($icon_object->media_medium); + } + + //get ended projects + //$this->$incident_model = new Incident_Model; + //$projects_ended = $this->$incident_model->get_finished_incidents(); + //$this->template->content-set('projects_ended', $projects_ended); + // Category ID $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; // Get the category colour @@ -89,7 +112,11 @@ protected function geojson($type) { // Get the color & icon $cat = ORM::factory('category', $category_id); - $color = $cat->category_color; + // if ($category_id == 1) { + // $color = 'f4a460';//$cat->category_color; + // } else { + $color = $cat->category_color; + // } $icon = ""; if ($cat->category_image) { @@ -216,7 +243,7 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc $link = Incident_Model::get_url($marker); } $item_name = $this->get_title($marker->incident_title, $link); - + $json_item = array(); $json_item['type'] = 'Feature'; $json_item['properties'] = array( @@ -225,6 +252,7 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc 'link' => $link, 'category' => array($category_id), 'color' => $color, + //'opacity' => $opacity, 'icon' => $icon, 'thumb' => $thumb, 'timestamp' => strtotime($marker->incident_date), @@ -509,11 +537,16 @@ public function timeline($category_id = 0) // Get Category Info $category_title = "All Categories"; $category_color = "#990000"; - if ($category_id > 0) + if ($category_id > 1) { $category = ORM::factory("category", $category_id); if ($category->loaded) { + if ($category_id == 1) + { + $category_title = $category->category_title; + $category_color = "#f4a460"; + } $category_title = $category->category_title; $category_color = "#".$category->category_color; } diff --git a/application/i18n b/application/i18n index d24b157d..e7d72e34 160000 --- a/application/i18n +++ b/application/i18n @@ -1 +1 @@ -Subproject commit d24b157d3e9691cb4228ab34575fb3249d91e8e9 +Subproject commit e7d72e347902c7ea9e8551721dc893892dcd38f8 From 5d14ca6ac508fe388744667bfbbaa0c6f2717c8f Mon Sep 17 00:00:00 2001 From: jenpaff Date: Mon, 29 Dec 2014 14:25:52 +0100 Subject: [PATCH 3/5] Revert "show all markers on load" This reverts commit 36da1b5fd59681242fbcf644ced3b928145eeb87. --- .gitmodules | 1 - application/controllers/json.php | 41 ++++---------------------------- application/i18n | 2 +- 3 files changed, 5 insertions(+), 39 deletions(-) diff --git a/.gitmodules b/.gitmodules index b3ab9bfd..d0a354e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ [submodule "application/i18n"] path = application/i18n url = git://github.com/ushahidi/Ushahidi-Localizations.git - ignore = dirty diff --git a/application/controllers/json.php b/application/controllers/json.php index e9933881..794be8ee 100644 --- a/application/controllers/json.php +++ b/application/controllers/json.php @@ -81,30 +81,7 @@ public function cluster() * @param string $type type of geojson to generate. Valid options are: 'clusters' and 'markers' **/ protected function geojson($type) - { - $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; - - if ($category_id == 0) { - $cat_ids = $db->query('SELECT id FROM category'); //ORM::factory('category', $id)->find_all(); - foreach ($cat_ids as $cat_id) { - $color = $cat_id->category_color;//Kohana::config('settings.default_map_all'); - } - } - - $icon = ""; - $markers = FALSE; - - if (Kohana::config('settings.default_map_all_icon_id')) - { - $icon_object = ORM::factory('media')->find(Kohana::config('settings.default_map_all_icon_id')); - $icon = url::convert_uploaded_to_abs($icon_object->media_medium); - } - - //get ended projects - //$this->$incident_model = new Incident_Model; - //$projects_ended = $this->$incident_model->get_finished_incidents(); - //$this->template->content-set('projects_ended', $projects_ended); - + { // Category ID $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; // Get the category colour @@ -112,11 +89,7 @@ protected function geojson($type) { // Get the color & icon $cat = ORM::factory('category', $category_id); - // if ($category_id == 1) { - // $color = 'f4a460';//$cat->category_color; - // } else { - $color = $cat->category_color; - // } + $color = $cat->category_color; $icon = ""; if ($cat->category_image) { @@ -243,7 +216,7 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc $link = Incident_Model::get_url($marker); } $item_name = $this->get_title($marker->incident_title, $link); - + $json_item = array(); $json_item['type'] = 'Feature'; $json_item['properties'] = array( @@ -252,7 +225,6 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc 'link' => $link, 'category' => array($category_id), 'color' => $color, - //'opacity' => $opacity, 'icon' => $icon, 'thumb' => $thumb, 'timestamp' => strtotime($marker->incident_date), @@ -537,16 +509,11 @@ public function timeline($category_id = 0) // Get Category Info $category_title = "All Categories"; $category_color = "#990000"; - if ($category_id > 1) + if ($category_id > 0) { $category = ORM::factory("category", $category_id); if ($category->loaded) { - if ($category_id == 1) - { - $category_title = $category->category_title; - $category_color = "#f4a460"; - } $category_title = $category->category_title; $category_color = "#".$category->category_color; } diff --git a/application/i18n b/application/i18n index e7d72e34..d24b157d 160000 --- a/application/i18n +++ b/application/i18n @@ -1 +1 @@ -Subproject commit e7d72e347902c7ea9e8551721dc893892dcd38f8 +Subproject commit d24b157d3e9691cb4228ab34575fb3249d91e8e9 From 987bf04124fa78f602525647e4a7a24c704b4adf Mon Sep 17 00:00:00 2001 From: jenpaff Date: Tue, 30 Dec 2014 00:58:49 +0100 Subject: [PATCH 4/5] test commit - revert last commit - add All-Categories Button - change colour when click on All-Categories Button --- application/controllers/json.php | 25 +++++++++++++++++++++++-- application/i18n | 2 +- themes/default/views/main/layout.php | 6 ++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/application/controllers/json.php b/application/controllers/json.php index 794be8ee..3d76cbfb 100644 --- a/application/controllers/json.php +++ b/application/controllers/json.php @@ -81,9 +81,30 @@ public function cluster() * @param string $type type of geojson to generate. Valid options are: 'clusters' and 'markers' **/ protected function geojson($type) - { + { + $color = Kohana::config('settings.default_map_all'); + $icon = ""; + $markers = FALSE; + + if (Kohana::config('settings.default_map_all_icon_id')) + { + $icon_object = ORM::factory('media')->find(Kohana::config('settings.default_map_all_icon_id')); + $icon = url::convert_uploaded_to_abs($icon_object->media_medium); + } + // Category ID $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; + + // JP: Get all category colours + if ($category_id == 0){ + $cat = ORM::factory('category', $category_id); + $color = "FBF80C";//$cat->category_color; + $icon = ""; + if ($cat->category_image) + { + $icon = url::convert_uploaded_to_abs($cat->category_image); + } + } // Get the category colour if (Category_Model::is_valid_category($category_id)) { @@ -216,7 +237,7 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc $link = Incident_Model::get_url($marker); } $item_name = $this->get_title($marker->incident_title, $link); - + $json_item = array(); $json_item['type'] = 'Feature'; $json_item['properties'] = array( diff --git a/application/i18n b/application/i18n index d24b157d..82e23c96 160000 --- a/application/i18n +++ b/application/i18n @@ -1 +1 @@ -Subproject commit d24b157d3e9691cb4228ab34575fb3249d91e8e9 +Subproject commit 82e23c96bcc7fd15511e99bc4a9235162654e39b diff --git a/themes/default/views/main/layout.php b/themes/default/views/main/layout.php index 21f4438e..3f60a635 100755 --- a/themes/default/views/main/layout.php +++ b/themes/default/views/main/layout.php @@ -40,6 +40,12 @@ $color_css = 'class="category-icon"'; } ?> +
  • + + > + + +
  • $category_info) { From 1c20da99616d6a8029f242d3e34d9129a0603cc1 Mon Sep 17 00:00:00 2001 From: jenpaff Date: Thu, 1 Jan 2015 20:04:21 +0100 Subject: [PATCH 5/5] assign color variable to function * TODO: function to assign colors for each marker --- application/controllers/json.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/application/controllers/json.php b/application/controllers/json.php index 3d76cbfb..968c14e0 100644 --- a/application/controllers/json.php +++ b/application/controllers/json.php @@ -95,16 +95,6 @@ protected function geojson($type) // Category ID $category_id = (isset($_GET['c']) AND intval($_GET['c']) > 0) ? intval($_GET['c']) : 0; - // JP: Get all category colours - if ($category_id == 0){ - $cat = ORM::factory('category', $category_id); - $color = "FBF80C";//$cat->category_color; - $icon = ""; - if ($cat->category_image) - { - $icon = url::convert_uploaded_to_abs($cat->category_image); - } - } // Get the category colour if (Category_Model::is_valid_category($category_id)) { @@ -237,7 +227,7 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc $link = Incident_Model::get_url($marker); } $item_name = $this->get_title($marker->incident_title, $link); - + if ($category_id == 0) { $color=$this->get_color($category_id); } else { $color=$color;} $json_item = array(); $json_item['type'] = 'Feature'; $json_item['properties'] = array( @@ -885,4 +875,19 @@ protected function get_title($title, $url) $item_name = str_replace(array(chr(10),chr(13)), ' ', $item_name); return $item_name; } + + /** + * Get encoded title linked to url + * @param $category_id + * @return $color1 + */ + protected function get_color($category_id) + { + if ($category_id == 0) + { + $cat = ORM::factory('category', $category_id=1); + $color = $cat->category_color; + } + return $color; + } }