|
@@ 105-114 (lines=10) @@
|
| 102 |
|
if ($granularity == Event::BAT_HOURLY) { |
| 103 |
|
// Write Hours |
| 104 |
|
foreach ($itemized[Event::BAT_HOUR] as $year => $months) { |
| 105 |
|
foreach ($months as $month => $days) { |
| 106 |
|
foreach ($days as $day => $hours) { |
| 107 |
|
// Count required as we may receive empty hours for granular events that start and end on midnight |
| 108 |
|
if (count($hours) > 0) { |
| 109 |
|
$values = array_values($hours); |
| 110 |
|
$keys = array_keys($hours); |
| 111 |
|
$this->pdo->exec("INSERT OR REPLACE INTO $this->hour_table (unit_id, year, month, day, " . implode(', ', $keys) . ") VALUES (" . $event->getUnitId() . ", $year, $month, " . substr($day, 1) . ", " . implode(', ', $values) . ")"); |
| 112 |
|
} |
| 113 |
|
} |
| 114 |
|
} |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
// If we have minutes write minutes |
|
@@ 120-126 (lines=7) @@
|
| 117 |
|
// If we have minutes write minutes |
| 118 |
|
foreach ($itemized[Event::BAT_MINUTE] as $year => $months) { |
| 119 |
|
foreach ($months as $month => $days) { |
| 120 |
|
foreach ($days as $day => $hours) { |
| 121 |
|
foreach ($hours as $hour => $minutes) { |
| 122 |
|
$values = array_values($minutes); |
| 123 |
|
$keys = array_keys($minutes); |
| 124 |
|
$this->pdo->exec("INSERT OR REPLACE INTO $this->minute_table (unit_id, year, month, day, hour, " . implode(', ', $keys) . ") VALUES (" . $event->getUnitId() . ", $year, $month, " . substr($day, 1) . ", " . substr($hour, 1) . ", " . implode(', ', $values) . ")"); |
| 125 |
|
} |
| 126 |
|
} |
| 127 |
|
} |
| 128 |
|
} |
| 129 |
|
} |