Skip to content

Commit

Permalink
T7 Inactive Button
Browse files Browse the repository at this point in the history
* FIRST commit!
* change opacity according to category_id
  • Loading branch information
jenpaff committed Aug 12, 2014
1 parent a6c6f7f commit 5468674
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 25 deletions.
45 changes: 34 additions & 11 deletions application/controllers/json.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,40 @@ protected function markers_geojson($incidents, $category_id, $color, $icon, $inc
'name' => $item_name,
'link' => $link,
'category' => array($category_id),
'color' => $color,
'color' => (if ! empty($projects_ended['project_end']))

{
if ($projects_ended['project_end'] == TRUE && $category_id=1)
{
"d043ff": $color;
}
else {
"9900CC": $color;
}
if ($projects_ended['project_end'] == TRUE && $category_id=2)
{
"004dff": $color;
}
else {
"3300FF": $color;
}
if ($projects_ended['project_end'] == TRUE && $category_id=3)
{
"b35900": $color;
}
else {
"663300": $color;
}
if ($projects_ended['project_end'] == TRUE && $category_id=4)
{
"94ff5e": $color
}
else {
"339900": $color;
}
}
return $color;

This comment has been minimized.

Copy link
@aoduor

aoduor Aug 15, 2014

This isn't the right approach. Set this chunk of code as a function, and then return a variable that you can assign to $color, then reference it as the rest are above.

Also, any specific reason we're only checking for 4 categories? What in the event that we create additional categories on this deployment? We need to make sure we account for those as well.

This comment has been minimized.

Copy link
@aoduor

aoduor Aug 15, 2014

Also, error thrown on loading home page.

screenshot

'icon' => $icon,
'thumb' => $thumb,
'timestamp' => strtotime($marker->incident_date),
Expand Down Expand Up @@ -593,16 +626,6 @@ public function timeline($category_id = 0)
$incident_id_in .= " AND i.id IN ( $query ) ";
}

// Apply status type filters
if (isset($_GET['t']) AND intval($_GET['t']) > 0)
{
$query = "SELECT id AS id FROM ".$this->table_prefix."incident"
. "WHERE incident_active = :ttype ";

$params[':ttype'] = $_GET['t'];
$id_in .= " AND i.id IN ( $query ) ";
}

// Fetch the timeline data
$query = 'SELECT UNIX_TIMESTAMP('.$select_date_text.') AS time, COUNT(i.id) AS number '
. 'FROM '.$this->table_prefix.'incident AS i '
Expand Down
2 changes: 1 addition & 1 deletion application/i18n
Submodule i18n updated from d24b15 to e7d72e
30 changes: 28 additions & 2 deletions application/models/incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public static function get_latest_report_timestamp($approved = TRUE)
return strtotime($report->incident_date);
}
}

/**
* Get the number of reports by date for dashboard chart
*
Expand Down Expand Up @@ -587,5 +586,32 @@ public function save()

parent::save();
}

/**
* return project end dates and assign to $project_end array()
*/
public static function get_finished_incidents()
{
// Table Prefix
$table_prefix = Kohana::config('database.default.table_prefix');

// Database instance
$db = new Database();

$projects_ended = array();

$current_date = "SELECT CURDATE()";

}
$sql = 'SELECT FORM_RESPONSE as project_end, incident_id as id FROM FORM_RESPONSE'
. 'INNER JOIN FORM_FIELD ON FORM_FIELD.ID=FORM_RESPONSE.FORM_FIELD_ID'
. 'WHERE (FORM_FIELD.FIELD_NAME = "Project End Date") <' .$current_date;
foreach ($db->query($sql) as $project_ended)
{
$projects_ended[$project_ended->id] = array(
$project_ended->id,
$project_ended->project_end,
);
}
return $projects_ended;
}
}
11 changes: 0 additions & 11 deletions themes/default/views/main/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,6 @@
<li><a id="media_2" href="#"><span><?php echo Kohana::lang('ui_main.video'); ?></span></a></li>
</ul>
</div>
</br >
</br >
<div class="status-filters">
<strong><?php echo Kohana::lang('ui_main.filters'); ?></strong>
<ul>
<li><a id="incident_active_" class="active" href="#"><span><?php echo Kohana::lang('ui_main.all'); ?></span></a></li>
<li><a id="incident_active_0" href="#"><span><?php echo Kohana::lang('ui_main.inactive'); ?></span></a></li>
<li><a id="incident_active_1" href="#"><span><?php echo Kohana::lang('ui_main.active'); ?></span></a></li>
</ul>
</div>
</div>


<?php
Expand Down

0 comments on commit 5468674

Please sign in to comment.