| @@ 102-119 (lines=18) @@ | ||
| 99 | ||
| 100 | if ($granularity == Event::BAT_HOURLY) { |
|
| 101 | // Write Hours |
|
| 102 | foreach ($itemized[Event::BAT_HOUR] as $year => $months) { |
|
| 103 | foreach ($months as $month => $days) { |
|
| 104 | foreach ($days as $day => $hours) { |
|
| 105 | // Count required as we may receive empty hours for granular events that start and end on midnight |
|
| 106 | if (count($hours) > 0) { |
|
| 107 | db_merge($this->hour_table) |
|
| 108 | ->key(array( |
|
| 109 | 'unit_id' => $event->unit_id, |
|
| 110 | 'year' => $year, |
|
| 111 | 'month' => $month, |
|
| 112 | 'day' => substr($day, 1) |
|
| 113 | )) |
|
| 114 | ->fields($hours) |
|
| 115 | ->execute(); |
|
| 116 | } |
|
| 117 | } |
|
| 118 | } |
|
| 119 | } |
|
| 120 | ||
| 121 | //If we have minutes write minutes |
|
| 122 | foreach ($itemized[Event::BAT_MINUTE] as $year => $months) { |
|
| @@ 123-138 (lines=16) @@ | ||
| 120 | ||
| 121 | //If we have minutes write minutes |
|
| 122 | foreach ($itemized[Event::BAT_MINUTE] as $year => $months) { |
|
| 123 | foreach ($months as $month => $days) { |
|
| 124 | foreach ($days as $day => $hours) { |
|
| 125 | foreach ($hours as $hour => $minutes) { |
|
| 126 | db_merge($this->minute_table) |
|
| 127 | ->key(array( |
|
| 128 | 'unit_id' => $event->unit_id, |
|
| 129 | 'year' => $year, |
|
| 130 | 'month' => $month, |
|
| 131 | 'day' => substr($day, 1), |
|
| 132 | 'hour' => substr($hour, 1) |
|
| 133 | )) |
|
| 134 | ->fields($minutes) |
|
| 135 | ->execute(); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | } |
|
| 139 | } |
|
| 140 | } |
|
| 141 | } |
|