@@ 35-80 (lines=46) @@ | ||
32 | * |
|
33 | * @return int |
|
34 | */ |
|
35 | function month_of_birth($z_axis, array $z_boundaries, Stats $stats) { |
|
36 | $total = 0; |
|
37 | ||
38 | if ($z_axis === 300) { |
|
39 | $num = $stats->statsBirthQuery(false); |
|
40 | foreach ($num as $values) { |
|
41 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
42 | if ($month === $values['d_month']) { |
|
43 | fill_y_data(0, $key, $values['total']); |
|
44 | $total += $values['total']; |
|
45 | } |
|
46 | } |
|
47 | } |
|
48 | } elseif ($z_axis === 301) { |
|
49 | $num = $stats->statsBirthQuery(false, true); |
|
50 | foreach ($num as $values) { |
|
51 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
52 | if ($month === $values['d_month']) { |
|
53 | if ($values['i_sex'] === 'M') { |
|
54 | fill_y_data(0, $key, $values['total']); |
|
55 | $total += $values['total']; |
|
56 | } elseif ($values['i_sex'] === 'F') { |
|
57 | fill_y_data(1, $key, $values['total']); |
|
58 | $total += $values['total']; |
|
59 | } |
|
60 | } |
|
61 | } |
|
62 | } |
|
63 | } else { |
|
64 | $zstart = 0; |
|
65 | foreach ($z_boundaries as $boundary) { |
|
66 | $num = $stats->statsBirthQuery(false, false, $zstart, $boundary); |
|
67 | foreach ($num as $values) { |
|
68 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
69 | if ($month === $values['d_month']) { |
|
70 | fill_y_data($boundary, $key, $values['total']); |
|
71 | $total += $values['total']; |
|
72 | } |
|
73 | } |
|
74 | } |
|
75 | $zstart = $boundary + 1; |
|
76 | } |
|
77 | } |
|
78 | ||
79 | return $total; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * Month of birth of first child in a relation |
|
@@ 91-136 (lines=46) @@ | ||
88 | * |
|
89 | * @return int |
|
90 | */ |
|
91 | function month_of_birth_of_first_child($z_axis, array $z_boundaries, Stats $stats) { |
|
92 | $total = 0; |
|
93 | ||
94 | if ($z_axis === 300) { |
|
95 | $num = $stats->monthFirstChildQuery(false); |
|
96 | foreach ($num as $values) { |
|
97 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
98 | if ($month === $values['d_month']) { |
|
99 | fill_y_data(0, $key, $values['total']); |
|
100 | $total += $values['total']; |
|
101 | } |
|
102 | } |
|
103 | } |
|
104 | } elseif ($z_axis === 301) { |
|
105 | $num = $stats->monthFirstChildQuery(false, true); |
|
106 | foreach ($num as $values) { |
|
107 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
108 | if ($month === $values['d_month']) { |
|
109 | if ($values['i_sex'] === 'M') { |
|
110 | fill_y_data(0, $key, $values['total']); |
|
111 | $total += $values['total']; |
|
112 | } elseif ($values['i_sex'] === 'F') { |
|
113 | fill_y_data(1, $key, $values['total']); |
|
114 | $total += $values['total']; |
|
115 | } |
|
116 | } |
|
117 | } |
|
118 | } |
|
119 | } else { |
|
120 | $zstart = 0; |
|
121 | foreach ($z_boundaries as $boundary) { |
|
122 | $num = $stats->monthFirstChildQuery(false, false, $zstart, $boundary); |
|
123 | foreach ($num as $values) { |
|
124 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
125 | if ($month === $values['d_month']) { |
|
126 | fill_y_data($boundary, $key, $values['total']); |
|
127 | $total += $values['total']; |
|
128 | } |
|
129 | } |
|
130 | } |
|
131 | $zstart = $boundary + 1; |
|
132 | } |
|
133 | } |
|
134 | ||
135 | return $total; |
|
136 | } |
|
137 | ||
138 | /** |
|
139 | * Month of death |
|
@@ 147-192 (lines=46) @@ | ||
144 | * |
|
145 | * @return int |
|
146 | */ |
|
147 | function month_of_death($z_axis, array $z_boundaries, Stats $stats) { |
|
148 | $total = 0; |
|
149 | ||
150 | if ($z_axis === 300) { |
|
151 | $num = $stats->statsDeathQuery(false); |
|
152 | foreach ($num as $values) { |
|
153 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
154 | if ($month === $values['d_month']) { |
|
155 | fill_y_data(0, $key, $values['total']); |
|
156 | $total += $values['total']; |
|
157 | } |
|
158 | } |
|
159 | } |
|
160 | } elseif ($z_axis === 301) { |
|
161 | $num = $stats->statsDeathQuery(false, true); |
|
162 | foreach ($num as $values) { |
|
163 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
164 | if ($month === $values['d_month']) { |
|
165 | if ($values['i_sex'] === 'M') { |
|
166 | fill_y_data(0, $key, $values['total']); |
|
167 | $total += $values['total']; |
|
168 | } elseif ($values['i_sex'] === 'F') { |
|
169 | fill_y_data(1, $key, $values['total']); |
|
170 | $total += $values['total']; |
|
171 | } |
|
172 | } |
|
173 | } |
|
174 | } |
|
175 | } else { |
|
176 | $zstart = 0; |
|
177 | foreach ($z_boundaries as $boundary) { |
|
178 | $num = $stats->statsDeathQuery(false, false, $zstart, $boundary); |
|
179 | foreach ($num as $values) { |
|
180 | foreach (['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] as $key => $month) { |
|
181 | if ($month === $values['d_month']) { |
|
182 | fill_y_data($boundary, $key, $values['total']); |
|
183 | $total += $values['total']; |
|
184 | } |
|
185 | } |
|
186 | } |
|
187 | $zstart = $boundary + 1; |
|
188 | } |
|
189 | } |
|
190 | ||
191 | return $total; |
|
192 | } |
|
193 | ||
194 | /** |
|
195 | * Month of marriage |