Code Duplication    Length = 50-50 lines in 8 locations

statisticsplot.php 8 locations

@@ 867-916 (lines=50) @@
864
case '4':
865
	echo $stats->chartDistribution(array(Filter::get('chart_shows'), 'marriage_distribution_chart'));
866
	break;
867
case '11':
868
	$monthdata = array();
869
	for ($i = 0; $i < 12; ++$i) {
870
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
871
	}
872
	$xgiven            = true;
873
	$zgiven            = false;
874
	$title             = I18N::translate('Month of birth');
875
	$xtitle            = I18N::translate('month');
876
	$ytitle            = I18N::translate('numbers');
877
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
878
	$xdata             = $monthdata;
879
	$xmax              = 12;
880
	if ($z_axis !== 300 && $z_axis !== 301) {
881
		calculate_legend($boundaries_z_axis);
882
	}
883
	$percentage = false;
884
	if ($y_axis === 201) {
885
		$percentage = false;
886
		$ytitle     = I18N::translate('Individuals');
887
	} elseif ($y_axis === 202) {
888
		$percentage = true;
889
		$ytitle     = I18N::translate('percentage');
890
	}
891
	$male_female = false;
892
	if ($z_axis === 300) {
893
		$zgiven          = false;
894
		$legend[0]       = 'all';
895
		$zmax            = 1;
896
		$z_boundaries[0] = 100000;
897
	} elseif ($z_axis === 301) {
898
		$male_female = true;
899
		$zgiven      = true;
900
		$legend[0]   = I18N::translate('Male');
901
		$legend[1]   = I18N::translate('Female');
902
		$zmax        = 2;
903
		$xtitle      = $xtitle . I18N::translate(' per gender');
904
	} elseif ($z_axis === 302) {
905
		$xtitle = $xtitle . I18N::translate(' per time period');
906
	}
907
	//-- reset the data array
908
	for ($i = 0; $i < $zmax; $i++) {
909
		for ($j = 0; $j < $xmax; $j++) {
910
			$ydata[$i][$j] = 0;
911
		}
912
	}
913
	$total = month_of_birth($z_axis, $z_boundaries, $stats);
914
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
915
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
916
	break;
917
case '12':
918
	$monthdata = array();
919
	for ($i = 0; $i < 12; ++$i) {
@@ 917-966 (lines=50) @@
914
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
915
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
916
	break;
917
case '12':
918
	$monthdata = array();
919
	for ($i = 0; $i < 12; ++$i) {
920
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
921
	}
922
	$xgiven            = true;
923
	$zgiven            = false;
924
	$title             = I18N::translate('Month of death');
925
	$xtitle            = I18N::translate('month');
926
	$ytitle            = I18N::translate('numbers');
927
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
928
	$xdata             = $monthdata;
929
	$xmax              = 12;
930
	if ($z_axis !== 300 && $z_axis !== 301) {
931
		calculate_legend($boundaries_z_axis);
932
	}
933
	$percentage = false;
934
	if ($y_axis === 201) {
935
		$percentage = false;
936
		$ytitle     = I18N::translate('Individuals');
937
	} elseif ($y_axis === 202) {
938
		$percentage = true;
939
		$ytitle     = I18N::translate('percentage');
940
	}
941
	$male_female = false;
942
	if ($z_axis === 300) {
943
		$zgiven          = false;
944
		$legend[0]       = 'all';
945
		$zmax            = 1;
946
		$z_boundaries[0] = 100000;
947
	} elseif ($z_axis === 301) {
948
		$male_female = true;
949
		$zgiven      = true;
950
		$legend[0]   = I18N::translate('Male');
951
		$legend[1]   = I18N::translate('Female');
952
		$zmax        = 2;
953
		$xtitle      = $xtitle . I18N::translate(' per gender');
954
	} elseif ($z_axis === 302) {
955
		$xtitle = $xtitle . I18N::translate(' per time period');
956
	}
957
	//-- reset the data array
958
	for ($i = 0; $i < $zmax; $i++) {
959
		for ($j = 0; $j < $xmax; $j++) {
960
			$ydata[$i][$j] = 0;
961
		}
962
	}
963
	$total = month_of_death($z_axis, $z_boundaries, $stats);
964
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
965
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
966
	break;
967
case '13':
968
	$monthdata = array();
969
	for ($i = 0; $i < 12; ++$i) {
@@ 1021-1070 (lines=50) @@
1018
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1019
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1020
	break;
1021
case '14':
1022
	$monthdata = array();
1023
	for ($i = 0; $i < 12; ++$i) {
1024
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1025
	}
1026
	$xgiven            = true;
1027
	$zgiven            = false;
1028
	$title             = I18N::translate('Month of birth of first child in a relation');
1029
	$xtitle            = I18N::translate('month');
1030
	$ytitle            = I18N::translate('numbers');
1031
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1032
	$xdata             = $monthdata;
1033
	$xmax              = 12;
1034
	if ($z_axis !== 300 && $z_axis !== 301) {
1035
		calculate_legend($boundaries_z_axis);
1036
	}
1037
	$percentage = false;
1038
	if ($y_axis === 201) {
1039
		$percentage = false;
1040
		$ytitle     = I18N::translate('Children');
1041
	} elseif ($y_axis === 202) {
1042
		$percentage = true;
1043
		$ytitle     = I18N::translate('percentage');
1044
	}
1045
	$male_female = false;
1046
	if ($z_axis === 300) {
1047
		$zgiven          = false;
1048
		$legend[0]       = 'all';
1049
		$zmax            = 1;
1050
		$z_boundaries[0] = 100000;
1051
	} elseif ($z_axis === 301) {
1052
		$male_female = true;
1053
		$zgiven      = true;
1054
		$legend[0]   = I18N::translate('Male');
1055
		$legend[1]   = I18N::translate('Female');
1056
		$zmax        = 2;
1057
		$xtitle      = $xtitle . I18N::translate(' per gender');
1058
	} elseif ($z_axis === 302) {
1059
		$xtitle = $xtitle . I18N::translate(' per time period');
1060
	}
1061
	//-- reset the data array
1062
	for ($i = 0; $i < $zmax; $i++) {
1063
		for ($j = 0; $j < $xmax; $j++) {
1064
			$ydata[$i][$j] = 0;
1065
		}
1066
	}
1067
	$total = month_of_birth_of_first_child($z_axis, $z_boundaries, $stats);
1068
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1069
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1070
	break;
1071
case '15':
1072
	$monthdata = array();
1073
	for ($i = 0; $i < 12; ++$i) {
@@ 1125-1174 (lines=50) @@
1122
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalFamilies();
1123
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1124
	break;
1125
case '17':
1126
	$monthdata = array();
1127
	for ($i = 0; $i < 12; ++$i) {
1128
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1129
	}
1130
	$xgiven            = false;
1131
	$zgiven            = false;
1132
	$title             = I18N::translate('Age related to birth year');
1133
	$xtitle            = I18N::translate('age');
1134
	$ytitle            = I18N::translate('numbers');
1135
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1136
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1137
	calculate_axis($boundaries_x_axis);
1138
	if ($z_axis !== 300 && $z_axis !== 301) {
1139
		calculate_legend($boundaries_z_axis);
1140
	}
1141
	$percentage = false;
1142
	if ($y_axis === 201) {
1143
		$percentage = false;
1144
		$ytitle     = I18N::translate('Individuals');
1145
	} elseif ($y_axis === 202) {
1146
		$percentage = true;
1147
		$ytitle     = I18N::translate('percentage');
1148
	}
1149
	$male_female = false;
1150
	if ($z_axis === 300) {
1151
		$zgiven          = false;
1152
		$legend[0]       = 'all';
1153
		$zmax            = 1;
1154
		$z_boundaries[0] = 100000;
1155
	} elseif ($z_axis === 301) {
1156
		$male_female = true;
1157
		$zgiven      = true;
1158
		$legend[0]   = I18N::translate('Male');
1159
		$legend[1]   = I18N::translate('Female');
1160
		$zmax        = 2;
1161
		$xtitle      = $xtitle . I18N::translate(' per gender');
1162
	} elseif ($z_axis === 302) {
1163
		$xtitle = $xtitle . I18N::translate(' per time period');
1164
	}
1165
	//-- reset the data array
1166
	for ($i = 0; $i < $zmax; $i++) {
1167
		for ($j = 0; $j < $xmax; $j++) {
1168
			$ydata[$i][$j] = 0;
1169
		}
1170
	}
1171
	$total = lifespan_by_birth_year($z_axis, $z_boundaries, $stats);
1172
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1173
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1174
	break;
1175
case '18':
1176
	$monthdata = array();
1177
	for ($i = 0; $i < 12; ++$i) {
@@ 1175-1224 (lines=50) @@
1172
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1173
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1174
	break;
1175
case '18':
1176
	$monthdata = array();
1177
	for ($i = 0; $i < 12; ++$i) {
1178
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1179
	}
1180
	$xgiven            = false;
1181
	$zgiven            = false;
1182
	$title             = I18N::translate('Age related to death year');
1183
	$xtitle            = I18N::translate('age');
1184
	$ytitle            = I18N::translate('numbers');
1185
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages');
1186
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1187
	calculate_axis($boundaries_x_axis);
1188
	if ($z_axis !== 300 && $z_axis !== 301) {
1189
		calculate_legend($boundaries_z_axis);
1190
	}
1191
	$percentage = false;
1192
	if ($y_axis === 201) {
1193
		$percentage = false;
1194
		$ytitle     = I18N::translate('Individuals');
1195
	} elseif ($y_axis === 202) {
1196
		$percentage = true;
1197
		$ytitle     = I18N::translate('percentage');
1198
	}
1199
	$male_female = false;
1200
	if ($z_axis === 300) {
1201
		$zgiven          = false;
1202
		$legend[0]       = 'all';
1203
		$zmax            = 1;
1204
		$z_boundaries[0] = 100000;
1205
	} elseif ($z_axis === 301) {
1206
		$male_female = true;
1207
		$zgiven      = true;
1208
		$legend[0]   = I18N::translate('Male');
1209
		$legend[1]   = I18N::translate('Female');
1210
		$zmax        = 2;
1211
		$xtitle      = $xtitle . I18N::translate(' per gender');
1212
	} elseif ($z_axis === 302) {
1213
		$xtitle = $xtitle . I18N::translate(' per time period');
1214
	}
1215
	//-- reset the data array
1216
	for ($i = 0; $i < $zmax; $i++) {
1217
		for ($j = 0; $j < $xmax; $j++) {
1218
			$ydata[$i][$j] = 0;
1219
		}
1220
	}
1221
	$total = lifespan_by_death_year($z_axis, $z_boundaries, $stats);
1222
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1223
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1224
	break;
1225
case '19':
1226
	$monthdata = array();
1227
	for ($i = 0; $i < 12; ++$i) {
@@ 1225-1274 (lines=50) @@
1222
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1223
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1224
	break;
1225
case '19':
1226
	$monthdata = array();
1227
	for ($i = 0; $i < 12; ++$i) {
1228
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1229
	}
1230
	$xgiven            = false;
1231
	$zgiven            = false;
1232
	$title             = I18N::translate('Age in year of marriage');
1233
	$xtitle            = I18N::translate('age');
1234
	$ytitle            = I18N::translate('numbers');
1235
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1236
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1237
	calculate_axis($boundaries_x_axis);
1238
	if ($z_axis !== 300 && $z_axis !== 301) {
1239
		calculate_legend($boundaries_z_axis);
1240
	}
1241
	$percentage = false;
1242
	if ($y_axis === 201) {
1243
		$percentage = false;
1244
		$ytitle     = I18N::translate('Individuals');
1245
	} elseif ($y_axis === 202) {
1246
		$percentage = true;
1247
		$ytitle     = I18N::translate('percentage');
1248
	}
1249
	$male_female     = false;
1250
	$z_boundaries[0] = 100000;
1251
	if ($z_axis === 300) {
1252
		$zgiven          = false;
1253
		$legend[0]       = 'all';
1254
		$zmax            = 1;
1255
	} elseif ($z_axis === 301) {
1256
		$male_female = true;
1257
		$zgiven      = true;
1258
		$legend[0]   = I18N::translate('Male');
1259
		$legend[1]   = I18N::translate('Female');
1260
		$zmax        = 2;
1261
		$xtitle      = $xtitle . I18N::translate(' per gender');
1262
	} elseif ($z_axis === 302) {
1263
		$xtitle = $xtitle . I18N::translate(' per time period');
1264
	}
1265
	//-- reset the data array
1266
	for ($i = 0; $i < $zmax; $i++) {
1267
		for ($j = 0; $j < $xmax; $j++) {
1268
			$ydata[$i][$j] = 0;
1269
		}
1270
	}
1271
	$total = age_at_marriage($z_axis, $z_boundaries, $stats);
1272
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1273
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1274
	break;
1275
case '20':
1276
	$monthdata = array();
1277
	for ($i = 0; $i < 12; ++$i) {
@@ 1275-1324 (lines=50) @@
1272
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1273
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1274
	break;
1275
case '20':
1276
	$monthdata = array();
1277
	for ($i = 0; $i < 12; ++$i) {
1278
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1279
	}
1280
	$xgiven            = false;
1281
	$zgiven            = false;
1282
	$title             = I18N::translate('Age in year of first marriage');
1283
	$xtitle            = I18N::translate('age');
1284
	$ytitle            = I18N::translate('numbers');
1285
	$boundaries_x_axis = Filter::get('x-axis-boundaries-ages_m');
1286
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1287
	calculate_axis($boundaries_x_axis);
1288
	if ($z_axis !== 300 && $z_axis !== 301) {
1289
		calculate_legend($boundaries_z_axis);
1290
	}
1291
	$percentage = false;
1292
	if ($y_axis === 201) {
1293
		$percentage = false;
1294
		$ytitle     = I18N::translate('Individuals');
1295
	} elseif ($y_axis === 202) {
1296
		$percentage = true;
1297
		$ytitle     = I18N::translate('percentage');
1298
	}
1299
	$male_female = false;
1300
	if ($z_axis === 300) {
1301
		$zgiven          = false;
1302
		$legend[0]       = 'all';
1303
		$zmax            = 1;
1304
		$z_boundaries[0] = 100000;
1305
	} elseif ($z_axis === 301) {
1306
		$male_female = true;
1307
		$zgiven      = true;
1308
		$legend[0]   = I18N::translate('Male');
1309
		$legend[1]   = I18N::translate('Female');
1310
		$zmax        = 2;
1311
		$xtitle      = $xtitle . I18N::translate(' per gender');
1312
	} elseif ($z_axis === 302) {
1313
		$xtitle = $xtitle . I18N::translate(' per time period');
1314
	}
1315
	//-- reset the data array
1316
	for ($i = 0; $i < $zmax; $i++) {
1317
		for ($j = 0; $j < $xmax; $j++) {
1318
			$ydata[$i][$j] = 0;
1319
		}
1320
	}
1321
	$total = age_at_first_marriage($z_axis, $z_boundaries, $stats);
1322
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1323
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1324
	break;
1325
case '21':
1326
	$monthdata = array();
1327
	for ($i = 0; $i < 12; ++$i) {
@@ 1325-1374 (lines=50) @@
1322
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
1323
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1324
	break;
1325
case '21':
1326
	$monthdata = array();
1327
	for ($i = 0; $i < 12; ++$i) {
1328
		$monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
1329
	}
1330
	$xgiven            = false;
1331
	$zgiven            = false;
1332
	$title             = I18N::translate('Number of children');
1333
	$xtitle            = I18N::translate('children');
1334
	$ytitle            = I18N::translate('numbers');
1335
	$boundaries_x_axis = Filter::get('x-axis-boundaries-numbers');
1336
	$boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
1337
	calculate_axis($boundaries_x_axis);
1338
	if ($z_axis !== 300 && $z_axis !== 301) {
1339
		calculate_legend($boundaries_z_axis);
1340
	}
1341
	$percentage = false;
1342
	if ($y_axis === 201) {
1343
		$percentage = false;
1344
		$ytitle     = I18N::translate('Families');
1345
	} elseif ($y_axis === 202) {
1346
		$percentage = true;
1347
		$ytitle     = I18N::translate('percentage');
1348
	}
1349
	$male_female = false;
1350
	if ($z_axis === 300) {
1351
		$zgiven          = false;
1352
		$legend[0]       = 'all';
1353
		$zmax            = 1;
1354
		$z_boundaries[0] = 100000;
1355
	} elseif ($z_axis === 301) {
1356
		$male_female = true;
1357
		$zgiven      = true;
1358
		$legend[0]   = I18N::translate('Male');
1359
		$legend[1]   = I18N::translate('Female');
1360
		$zmax        = 2;
1361
		$xtitle      = $xtitle . I18N::translate(' per gender');
1362
	} elseif ($z_axis === 302) {
1363
		$xtitle = $xtitle . I18N::translate(' per time period');
1364
	}
1365
	//-- reset the data array
1366
	for ($i = 0; $i < $zmax; $i++) {
1367
		for ($j = 0; $j < $xmax; $j++) {
1368
			$ydata[$i][$j] = 0;
1369
		}
1370
	}
1371
	$total = number_of_children($z_axis, $z_boundaries, $stats);
1372
	$hstr  = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalChildren();
1373
	my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
1374
	break;
1375
default:
1376
	echo '<i class="icon-loading-large"></i>';
1377
	break;