} } } } } stats_end(); break; // Classifications // Classifications case "classifications": stats_title($t->translate("Contacts listed by Classifications")); $db->query("SELECT DISTINCT type, COUNT(*) AS cnt FROM categories GROUP BY type"); while ($db->next_record()) { $type = $db->f("type"); if ($db->f("cnt") > 0 && $type != "Contact") { stats_subtitle($t->translate("Contact Category") . " " . $type); $dbtot = new DB_SourceContact(); $dbtot->query("SELECT COUNT(*) FROM contact WHERE category='{$type}'"); $dbtot->next_record(); $total_number_cat = $dbtot->f("COUNT(*)"); $db2 = new DB_SourceContact(); $db2->query("SELECT class, COUNT(*) AS cnt2 FROM classifications WHERE type='{$type}' GROUP BY class"); while ($db2->next_record()) { $cnt2 = $db2->f("cnt2"); if ($cnt2 > 0) { $url = "index.php"; $urlquery = array("by" => "filter", "class" => $db2->f("class")); stats_display($db2->f("class"), $cnt2, $url, $urlquery, $total_number_cat); } } }
} stats_end(); break; // Developers by Programming Languages/Tools // Developers by Programming Languages/Tools case "prog_languages": stats_title($t->translate("Developers listed by Programming Languages/Tools")); $url = "0"; // No URL in function stats_display $urlquery = "0"; // No URL query in function stats_display $db2 = new DB_DevCounter(); $db3 = new DB_DevCounter(); $db->query("SELECT * FROM prog_languages"); while ($db->next_record()) { stats_subtitle($t->translate($db->f("language"))); $db2->query("SELECT * FROM weightings"); while ($db2->next_record()) { $db3->query("SELECT COUNT(*) FROM prog_language_values WHERE " . $db->f("colname") . "='" . $db2->f("weightid") . "'"); $db3->next_record(); $num = $db3->f("COUNT(*)"); stats_display($t->translate($db2->f("weighting")), $num, $url, $urlquery, $total_number_dev); } } stats_end(); break; // Developers by Nationality // Developers by Nationality case "nationality": stats_title($t->translate("Developers listed by Nationality")); $db->query("SELECT *,COUNT(*) AS nat_cnt FROM developers GROUP BY developers.nationality ORDER BY nat_cnt DESC");
stats_title($t->translate("Applications listed by Licenses and Developer's Email Domain")); $url = "0"; // No URL in function stats_display $urlquery = "0"; // No URL query in function stats_display $db->query("SELECT license FROM licenses"); while ($db->next_record()) { // We need a second database connection $db2 = new DB_SourceWell(); // Total number of apps with that License $license = $db->f("license"); $db2->query("SELECT COUNT(*) FROM software WHERE license='{$license}'"); $db2->next_record(); $total = $db2->f("COUNT(*)"); if ($total > $Minimum_apps_in_license) { stats_subtitle($db->f("license")); for ($i = 1; $i < sizeof($domain_country); $i++) { $like = "%." . $domain_country[$i][0]; $db2->query("SELECT COUNT(*) FROM software WHERE license='{$license}' AND email LIKE '{$like}'"); $db2->next_record(); $num = $db2->f("COUNT(*)"); if (100 * $num / $total > $MinimumLicByEmail) { stats_display($domain_country[$i][1], $num, $url, $urlquery, $total); } } } } stats_end(); break; } }