/** * @param $surveyId */ public function add_survey_hit($surveyId) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $this->surveysTable->update(array('taken' => $this->surveysTable->increment(1), 'lastTaken' => $this->now), array('surveyId' => $surveyId)); } }
/** * @param $url */ function add_featured_link_hit($url) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $query = "update `tiki_featured_links` set `hits` = `hits` + 1 where `url` = ?"; $result = $this->query($query, array($url)); } }
function add_article_hit($articleId) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $query = "update `tiki_articles` set `nbreads`=`nbreads`+1 where `articleId`=?"; $result = $this->query($query, array($articleId)); } return true; }
function getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to) { global $xAxisGraph; global $progressTrendsData; $stats = StatsLib::getDiscreteInfectionStatsWeekly($lab_config, $test_type_id, $date_from, $date_to); foreach ($stats as $key => $value) { $formattedDate = bcmul($key, 1000); if ($value[0] != 0) { $progressData[] = array($formattedDate, 100 - round($value[1] / $value[0] * 100, 2)); } else { $progressData[] = array($formattedDate, 0); } } $progressTrendsData[] = $progressData; }
# include "../includes/db_lib.php"; include "../includes/stats_lib.php"; include "../includes/page_elems.php"; LangUtil::setPageId("reports"); $page_elems = new PageElems(); $test_type_id = $_REQUEST['tt']; $date_from = $_REQUEST['df']; $date_to = $_REQUEST['dt']; $lab_config_id = $_REQUEST['l']; $date_from_js = str_replace("-", "/", $date_from); $date_to_js = str_replace("-", "/", $date_to); $lab_config = get_lab_config_by_id($lab_config_id); $gender = $_REQUEST['gender']; $type = $_REQUEST['type']; $stat_list = StatsLib::getDiscreteInfectionStatsG($lab_config, $test_type_id, $date_from, $date_to, $type); ksort($stat_list); # Build chart with time series $div_id = "placeholder_" . $test_type_id; $ylabel_id = "ylabel_" . $test_type_id; $legend_id = "legend_" . $test_type_id; ?> <script id="source" language="javascript" type="text/javascript"> $(function () { <?php $count = 0; echo "var d = [];"; foreach ($stat_list as $key => $value) { $x_val = $key;
?> | <?php } if ($date_from == $date_to) { echo LangUtil::$generalTerms['DATE'] . ": " . DateLib::mysqlToString($date_from); } else { echo LangUtil::$generalTerms['FROM_DATE'] . ": " . DateLib::mysqlToString($date_from); echo " | "; echo LangUtil::$generalTerms['TO_DATE'] . ": " . DateLib::mysqlToString($date_to); } ?> <br><br> <?php $stat_list = StatsLib::getDoctorStats($lab_config, $date_from, $date_to); /* <div id='stat_graph'> <?php # To avoid clutter on the graph, divide stat_list to chunks $chunk_size = 999; $stat_chunks = array_chunk($stat_list, $chunk_size, true); $i = 1; foreach($stat_chunks as $stat_chunk) { $div_id = "placeholder_".$i; $ylabel_id = "ylabel_".$i; $legend_id = "legend_".$i; $width_px = count($stat_chunk)*150; ?> <table>
/** * add_blog_post_hit Add a hit for the blog post $postId * * @param int $postId * @access public * @return boolean unconditionnal true */ function add_blog_post_hit($postId) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $query = "update `tiki_blog_posts` set `hits` = `hits`+1 where `postId`=?"; $result = $this->query($query, array((int) $postId)); } return true; }
$curr_cross_gender_total += $curr_total; } else { # Genderwise count required. # Create filter $disease_filter = new DiseaseSetFilter(); $disease_filter->patientAgeRange = array(0, 200); $disease_filter->measureId = getLabMeasureIdFromGlobalName($measure->name, $labConfigId); $disease_filter->rangeType = $range_type; $disease_filter->rangeValues = $range_value; ## Count for males. $disease_filter->patientGender = 'M'; $curr_total1 = StatsLib::getDiseaseFilterCount($disease_filter); $curr_male_total += $curr_total1; ## Count for females. $disease_filter->patientGender = 'F'; $curr_total2 = StatsLib::getDiseaseFilterCount($disease_filter); $curr_female_total += $curr_total2; } # Build assoc list to track genderwise totals $male_total[$range_value_count] += $curr_male_total; $female_total[$range_value_count] += $curr_female_total; $cross_gender_total[$range_value_count] += $curr_male_total + $curr_female_total; } } if ($site_settings->groupByGender == 1) { for ($i = 1; $i <= count($range_values); $i++) { $this_male_total = $male_total[$i]; $this_female_total = $female_total[$i]; $this_cross_gender_total = $this_male_total + $this_female_total; } }
function export_html() { <?php $myFile = "../../BlisSetup.html"; $fh = fopen($myFile, 'w') or die("can't open file"); $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <META HTTP-EQUIV="Refresh" CONTENT="1; URL='; $content1 = '"> </head> </html>'; $content = $content . StatsLib::get_ip() . $content1; fwrite($fh, $content); fclose($fh); ?> right_load(14, 'network_setup_div'); } function ask_to_delete_user(user_id) { var div_id = 'delete_confirm_'+user_id; $('#'+div_id).show(); } function delete_user(user_id) { var url_string = "ajax/lab_user_delete.php?uid="+user_id; var reload_url = "lab_config_home.php?id=<?php
?> | <?php if ($date_from == $date_to) { echo LangUtil::$generalTerms['DATE'] . ": " . DateLib::mysqlToString($date_from); } else { echo LangUtil::$generalTerms['FROM_DATE'] . ": " . DateLib::mysqlToString($date_from); echo " | "; echo LangUtil::$generalTerms['TO_DATE'] . ": " . DateLib::mysqlToString($date_to); } ?> <br><br> <?php DbUtil::switchToLabConfig($lab_config_id); # Cumulative summary $stat_list = StatsLib::getDiscreteInfectionStats($lab_config, $date_from, $date_to); if (count($stat_list) == 0) { ?> <div class='sidetip_nopos'> <?php echo LangUtil::$pageTerms['TIPS_NODISCRETE']; ?> </div> <?php include "includes/footer.php"; return; } /* ?> <div id='stat_graph' style='display:none;'> <?php
function get_cumul_stats($lab_config_id, $test_type_id, $date_from, $date_to) { $lab_config = LabConfig::getById($lab_config_id); $test_type = TestType::getById($test_type_id); $measure_list = $test_type->getMeasures(); $site_settings = DiseaseReport::getByKeys($lab_config->id, 0, 0); $age_group_list = $site_settings->getAgeGroupAsList(); ?> <table class='pretty_print' style='border-collapse: collapse;'> <thead> <tr valign='top'> <th><?php echo LangUtil::$generalTerms['TEST']; ?> </th> <th ><?php echo LangUtil::$generalTerms['RESULTS']; ?> </th> <?php if ($site_settings->groupByGender == 1) { echo "<th >" . LangUtil::$generalTerms['GENDER'] . "</th>"; } if ($site_settings->groupByAge == 1) { echo "<th >" . LangUtil::$pageTerms['RANGE_AGE'] . "</th>"; for ($i = 1; $i < count($age_group_list); $i++) { echo "<th >" . LangUtil::$pageTerms['RANGE_AGE'] . "</th>"; } } if ($site_settings->groupByGender == 1) { echo "<th ></th>"; } ?> <th ><?php echo LangUtil::$pageTerms['TOTAL']; ?> </th> <th ><?php echo LangUtil::$pageTerms['TOTAL_TESTS']; ?> </th> </tr> <tr> <th ></th> <th ></th> <?php if ($site_settings->groupByGender == 1) { echo "<th ></th>"; } if ($site_settings->groupByAge == 1) { foreach ($age_group_list as $age_slot) { echo "<th>{$age_slot['0']}"; if (trim($age_slot[1]) == "+") { echo "+"; } else { echo " - {$age_slot['1']}"; } echo "</th>"; } } if ($site_settings->groupByGender == 1) { echo "<th >" . LangUtil::$pageTerms['TOTAL_MF'] . "</th>"; } echo "<th ></th>"; echo "<th ></th>"; ?> <tr> </thead> <tbody> <?php StatsLib::setDiseaseSetList($lab_config, $test_type, $date_from, $date_to); $measures = $test_type->getMeasures(); foreach ($measures as $measure) { $male_total = array(); $female_total = array(); $cross_gender_total = array(); $curr_male_total = 0; $curr_female_total = 0; $curr_cross_gender_total = 0; $disease_report = DiseaseReport::getByKeys($lab_config->id, $test_type->testTypeId, $measure->measureId); if ($disease_report == null) { # TODO: Check for error control # Alphanumeric values. Hence entry not found. //continue; } $is_range_options = true; if (strpos($measure->range, "/") === false) { $is_range_options = false; } $range_values = array(); if ($is_range_options) { # Alphanumeric options $range_values = explode("/", $measure->range); } else { # Numeric ranges: Fetch ranges configured for this test-type/measure from DB $range_values = $disease_report->getMeasureGroupAsList(); } ?> <tr valign='top'> <td><?php echo $measure->getName(); ?> </td> <td> <?php foreach ($range_values as $range_value) { if ($is_range_options) { echo "{$range_value}<br>"; } else { echo "{$range_value['0']}-{$range_value['1']}<br>"; } if ($site_settings->groupByGender == 1) { echo "<br>"; } } ?> </td> <?php if ($site_settings->groupByGender == 1) { # Group by gender set to true echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { echo "M<br>F<br>"; } } if ($site_settings->groupByAge == 1) { # Group by age set to true: Fetch age slots from DB $age_slot_list = $site_settings->getAgeGroupAsList(); foreach ($age_slot_list as $age_slot) { echo "<td>"; $range_value_count = 0; foreach ($range_values as $range_value) { $range_value_count++; if (!isset($male_total[$range_value_count])) { $male_total[$range_value_count] = 0; $female_total[$range_value_count] = 0; $cross_gender_total[$range_value_count] = 0; } $curr_male_total = 0; $curr_female_total = 0; $curr_cross_gender_total = 0; $range_type = DiseaseSetFilter::$CONTINUOUS; if ($is_range_options == true) { $range_type = DiseaseSetFilter::$DISCRETE; } if ($site_settings->groupByGender == 0) { # No genderwise count required. # Create filter $disease_filter = new DiseaseSetFilter(); $disease_filter->patientAgeRange = $age_slot; $disease_filter->patientGender = null; $disease_filter->measureId = $measure->measureId; $disease_filter->rangeType = $range_type; $disease_filter->rangeValues = $range_value; $curr_total = StatsLib::getDiseaseFilterCount($disease_filter); $curr_cross_gender_total += $curr_total; echo "{$curr_total}<br>"; } else { # Genderwise count required. # Create filter $disease_filter = new DiseaseSetFilter(); $disease_filter->patientAgeRange = $age_slot; $disease_filter->measureId = $measure->measureId; $disease_filter->rangeType = $range_type; $disease_filter->rangeValues = $range_value; ## Count for males. $disease_filter->patientGender = 'M'; $curr_total1 = StatsLib::getDiseaseFilterCount($disease_filter); $curr_male_total += $curr_total1; ## Count for females. $disease_filter->patientGender = 'F'; $curr_total2 = StatsLib::getDiseaseFilterCount($disease_filter); $curr_female_total += $curr_total2; echo "{$curr_total1}<br>{$curr_total2}<br>"; } # Build assoc list to track genderwise totals $male_total[$range_value_count] += $curr_male_total; $female_total[$range_value_count] += $curr_female_total; $cross_gender_total[$range_value_count] += $curr_cross_gender_total; } echo "</td>"; } } else { # Age slots not configured: Show cumulative count for all age values $range_value_count = 0; foreach ($range_values as $range_value) { $range_value_count++; if (!isset($male_total[$range_value_count])) { $male_total[$range_value_count] = 0; $female_total[$range_value_count] = 0; $cross_gender_total[$range_value_count] = 0; } $curr_male_total = 0; $curr_female_total = 0; $curr_cross_gender_total = 0; $range_type = DiseaseSetFilter::$CONTINUOUS; if ($is_range_options == true) { $range_type = DiseaseSetFilter::$DISCRETE; } if ($site_settings->groupByGender == 0) { # No genderwise count required. # Create filter $disease_filter = new DiseaseSetFilter(); $disease_filter->patientAgeRange = array(0, 200); $disease_filter->patientGender = null; $disease_filter->measureId = $measure->measureId; $disease_filter->rangeType = $range_type; $disease_filter->rangeValues = $range_value; $curr_total = StatsLib::getDiseaseFilterCount($disease_filter); $curr_cross_gender_total += $curr_total; } else { # Genderwise count required. # Create filter $disease_filter = new DiseaseSetFilter(); $disease_filter->patientAgeRange = array(0, 200); $disease_filter->measureId = $measure->measureId; $disease_filter->rangeType = $range_type; $disease_filter->rangeValues = $range_value; ## Count for males. $disease_filter->patientGender = 'M'; $curr_total1 = StatsLib::getDiseaseFilterCount($disease_filter); $curr_male_total += $curr_total1; ## Count for females. $disease_filter->patientGender = 'F'; $curr_total2 = StatsLib::getDiseaseFilterCount($disease_filter); $curr_female_total += $curr_total2; } # Build assoc list to track genderwise totals $male_total[$range_value_count] += $curr_male_total; $female_total[$range_value_count] += $curr_female_total; $cross_gender_total[$range_value_count] += $curr_cross_gender_total; } } if ($site_settings->groupByGender == 1) { echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { $this_male_total = $male_total[$i]; $this_female_total = $female_total[$i]; echo "{$this_male_total}<br>{$this_female_total}<br>"; $this_cross_gender_total = $this_male_total + $this_female_total; } echo "</td>"; } echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { if ($site_settings->groupByGender == 1) { echo $male_total[$i] + $female_total[$i]; echo "<br><br>"; } else { echo $cross_gender_total[$i]; echo "<br>"; } } echo "</td>"; # Grand total: # TODO: Check the following function for off-by-one error //$disease_total = StatsLib::getDiseaseTotal($lab_config, $test, $date_from, $date_to); //echo "<td >$disease_total</td>"; echo "<td>"; if ($site_settings->groupByGender == 1) { echo array_sum($male_total) + array_sum($female_total); } else { echo array_sum($cross_gender_total); } echo "</td>"; ?> </tr> <?php } ?> </tbody> </table> <?php }
} } } } } # # Disease Report related functions # Called from report_disease.php # public static function getDiseaseTotal($lab_config, $test_type, $date_from, $date_to) { # Returns the total number of tests performed during the given date range $query_string = "SELECT COUNT(*) AS val FROM test t, specimen sp " . "WHERE t.test_type_id={$test_type->testTypeId} " . "AND t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}')"; $saved_db = DbUtil::switchToLabConfig($lab_config->id); $resultset = query_associative_all($query_string, $row_count); DbUtil::switchRestore($saved_db); return $resultset[0]['val']; } public static function setDiseaseSetList($lab_config, $test_type, $date_from, $date_to, $multipleCount = 0) { # Initializes diseaseSetList for capturing params if ($multipleCount == 0) { StatsLib::$diseaseSetList = array(); } $query_string = "SELECT t.result AS result_value, " . "p.sex AS patient_gender, " . "p.patient_id AS patient_id " . "FROM test t, specimen sp, patient p " . "WHERE t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND t.test_type_id={$test_type->testTypeId} " . "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "AND sp.patient_id=p.patient_id"; $saved_db = DbUtil::switchToLabConfig($lab_config->id); $resultset = query_associative_all($query_string, $row_count); $measure_list = $test_type->getMeasureIds(); if (count($resultset) == 0 || $resultset == null) { DbUtil::switchRestore($saved_db); return; } foreach ($resultset as $record) { $patient_id = $record['patient_id']; $patient = Patient::getById($patient_id); $current_set = new DiseaseSet(); $current_set->resultValues = array(); $result_csv_parts = explode(",", $record['result_value']); # Build assoc list for result values ## Format: resultValues[measure_id] = result_value for ($i = 0; $i < count($measure_list); $i++) { $result_part = $result_csv_parts[$i]; if (trim($result_part) == "") { continue; } $curr_measure_id = $measure_list[$i]; $current_set->resultValues[$curr_measure_id] = $result_part; }
/** * @param $faqId */ function add_faq_hit($faqId) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $query = "update `tiki_faqs` set `hits`=`hits`+1 where `faqId`=?"; $result = $this->query($query, array($faqId)); } }
/** * @param $categId */ function dir_add_category_hit($categId) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $query = "update `tiki_directory_categories` set `hits`=`hits`+1 where `categId`=?"; $this->query($query, array((int) $categId)); } }
<a href='javascript:view_testwise_monthly();' id='monthly_link' title='Select a test type and click to view monthly progression chart'><?php echo LangUtil::$pageTerms['PROGRESSION_M']; ?></a> <a href='javascript:view_testwise_weekly();' id='weekly_link' title='Select a test type and click to view weekly progression chart'><?php echo LangUtil::$pageTerms['PROGRESSION_W']; ?></a> <a href='javascript:view_testwise_daily();' id='daily_link' title='Select a test type and click to view daily progression chart'><?php echo LangUtil::$pageTerms['PROGRESSION_D']; ?></a> </small> */ ?> <span id='progress_spinner' style='display:none'><?php $page_elems->getProgressSpinner(LangUtil::$generalTerms['CMD_FETCHING']); ?> </span> <br><br> <?php $stat_list = StatsLib::getTatStats($lab_config, $date_from, $date_to); if (count($stat_list) == 0) { ?> <br> <div class='sidetip_nopos'> <?php echo LangUtil::$pageTerms['TIPS_NOTATTESTS']; ?> </div> <?php } ?> <div id='stats_testwise_div'></div> <div id='stats_cumul_div'> </div>
<?php // (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id$ //this script may only be included - so its better to die if called directly. $access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__)); if ($prefs['feature_referer_stats'] == 'y') { if (isset($_SERVER['HTTP_REFERER'])) { $pref = parse_url($_SERVER['HTTP_REFERER']); if (isset($pref['host']) && !strstr($_SERVER['SERVER_NAME'], $pref['host'])) { $tikilib->register_referer($pref['host'], $_SERVER['HTTP_REFERER']); } } } if (StatsLib::is_stats_hit()) { if (!isset($section) or $section != 'chat' and $section != 'livesupport') { $statslib = TikiLib::lib('stats'); $statslib->add_pageview(); } }
/** * @param $threadId * @return bool */ function comment_add_hit($threadId) { global $prefs, $user; if (StatsLib::is_stats_hit()) { require_once 'lib/search/refresh-functions.php'; $comments = $this->table('tiki_comments'); $comments->update(array('hits' => $comments->increment(1)), array('threadId' => (int) $threadId)); refresh_index("forum post", $threadId); } return true; }
} else { if ($test_type_id != 0 && count($lab_config_ids) == 1) { $lab_config = get_lab_config_by_id($lab_config_id); $test_type_id = $testIds[$lab_config->id]; $labName = $lab_config->name; $namesArray[] = $labName; $stat_list = StatsLib::getTatMonthlyProgressionStats($lab_config, $test_type_id, $date_from, $date_to, $include_pending); ksort($stat_list); $stat_lists[] = $stat_list; } else { if ($test_type_id != 0 && count($lab_config_ids) > 1) { foreach ($lab_config_ids as $key) { $lab_config = LabConfig::getById($key); $test_type_id = $testIds[$lab_config->id]; $namesArray[] = $lab_config->name; $stat_list = StatsLib::getTatMonthlyProgressionStats($lab_config, $test_type_id, $date_from, $date_to, $include_pending); ksort($stat_list); $stat_lists[] = $stat_list; unset($stat_list); } } } } } } } $progressData = array(); foreach ($stat_lists as $stat_list) { foreach ($stat_list as $key => $value) { $formattedValue = round($value[0], 2); $formattedDate = bcmul($key, 1000);
/** * @param $object * @param $type * @param null $id * @return bool */ public function stats_hit($object, $type, $id = null) { if (empty($object) || empty($type) || !StatsLib::is_stats_hit()) { return false; } list($month, $day, $year) = explode(',', $this->date_format("%m,%d,%Y")); $dayzero = $this->make_time(0, 0, 0, $month, $day, $year); if (!is_null($id)) { $object = $id . "?" . $object; } $cant = $this->getOne("select count(*) from `tiki_stats` where `object`=? and `type`=? and `day`=?", array($object, $type, (int) $dayzero)); if ($cant) { $query = "update `tiki_stats` set `hits`=`hits`+1 where `object`=? and `type`=? and `day`=?"; } else { $query = "insert into `tiki_stats` (`object`,`type`,`day`,`hits`) values(?,?,?,1)"; } return $this->query($query, array($object, $type, (int) $dayzero), -1, -1, false); }
/** * @param $pageName * @return bool */ function add_hit($pageName) { global $prefs; if (StatsLib::is_stats_hit()) { $pages = $this->table('tiki_pages'); $pages->update(array('hits' => $pages->increment(1)), array('pageName' => $pageName)); } return true; }
function getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to, $test_name = null) { global $xAxisGraph; global $progressGraphData; if ($test_name != null) { } $stats = StatsLib::getDiscreteInfectionStatsWeekly($lab_config, $test_type_id, $date_from, $date_to); foreach ($stats as $key => $value) { $xAxisGraph[] = date('Y, n, j', $key); if ($value[0] != 0) { $progressData[] = round($value[1] / $value[0] * 100, 2); } else { $progressData[] = 0; } } $progressGraphData[] = $progressData; }
?> | <?php } if ($date_from == $date_to) { echo LangUtil::$generalTerms['DATE'] . ": " . DateLib::mysqlToString($date_from); } else { echo LangUtil::$generalTerms['FROM_DATE'] . ": " . DateLib::mysqlToString($date_from); echo " | "; echo LangUtil::$generalTerms['TO_DATE'] . ": " . DateLib::mysqlToString($date_to); } ?> <br><br> <?php $stat_list = StatsLib::getSpecimenCountStats($lab_config, $date_from, $date_to); /* <div id='stat_graph'> <?php # To avoid cluttered graphs, divide stat_list to chunka $chunk_size = 999; $stat_chunks = array_chunk($stat_list, $chunk_size, true); $i = 1; foreach($stat_chunks as $stat_chunk) { $div_id = "placeholder_".$i; $ylabel_id = "ylabel_".$i; $legend_id = "legend_".$i; $width_px = count($stat_chunk)*150; ?> <table>
<?php include "../includes/db_lib.php"; include "../includes/stats_lib.php"; include "../includes/user_lib.php"; DbUtil::switchToLabConfig($lab_config_id); if (!isset($_REQUEST['yf']) || !isset($_REQUEST['mf']) || !isset($_REQUEST['df']) || !isset($_REQUEST['yt']) || !isset($_REQUEST['dt']) || !isset($_REQUEST['mt'])) { echo -2; return; } // returns total , nrgative and prev threshold //$test_type_id = $_REQUEST['test_type_id']; $date_from = $_REQUEST['yf'] . "-" . $_REQUEST['mf'] . "-" . $_REQUEST['df']; $date_to = $_REQUEST['yt'] . "-" . $_REQUEST['mt'] . "-" . $_REQUEST['dt']; //$result = API::get_prev_rates($test_type_id, $date_from, $date_to); if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) { $user = get_user_by_id($_SESSION['user_id']); $lab_config_id = $user->labConfigId; } if ($lab_config_id == null) { $lab_config_id = get_lab_config_id_admin($_SESSION['user_id']); } $lab_config_idd = array($lab_config_id); $stat_list = StatsLib::getDiscreteInfectionStatsAggregate($lab_config_idd, $date_from, $date_to, 0); $result = $stat_list; if ($result < 1) { echo $result; } else { echo json_encode($result); }
/** * @param $id * @return bool */ function add_gallery_hit($id) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $query = "update `tiki_galleries` set `hits`=`hits`+1 where `galleryId`=?"; $result = $this->query($query, array((int) $id)); } $query = "select `user` from `tiki_galleries` where `galleryId`=?"; $owner = $this->getOne($query, array((int) $id)); TikiLib::events()->trigger('tiki.imagegallery.view', array('type' => 'imagegallery', 'object' => $id, 'user' => $user, 'owner' => $owner)); return true; }
function add_file_gallery_hit($id) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $fileGalleries = $this->table('tiki_file_galleries'); $fileGalleries->update(array('hits' => $fileGalleries->increment(1)), array('galleryId' => (int) $id)); } return true; }
include "../includes/db_lib.php"; include "../includes/stats_lib.php"; include "../includes/page_elems.php"; LangUtil::setPageId("reports"); $page_elems = new PageElems(); $test_type_id = $_REQUEST['tt']; $date_from = $_REQUEST['df']; $date_to = $_REQUEST['dt']; $lab_config_id = $_REQUEST['l']; $date_from_js = str_replace("-", "/", $date_from); $date_to_js = str_replace("-", "/", $date_to); $lab_config = get_lab_config_by_id($lab_config_id); $gender = $_REQUEST['gender']; $age_s = $_REQUEST['age_s']; $age_e = $_REQUEST['age_e']; $stat_list = StatsLib::getDiscreteInfectionStatsMonthly($lab_config, $test_type_id, $date_from, $date_to, $gender); ksort($stat_list); # Build chart with time series $div_id = "placeholder_" . $test_type_id; $ylabel_id = "ylabel_" . $test_type_id; $legend_id = "legend_" . $test_type_id; ?> <script id="source" language="javascript" type="text/javascript"> $(function () { <?php $count = 0; echo "var d = [];"; foreach ($stat_list as $key => $value) { $x_val = $key;
echo $lab_config->getSiteName(); ?> | <?php if ($date_from == $date_to) { echo LangUtil::$generalTerms['DATE'] . ": " . DateLib::mysqlToString($date_from); } else { echo LangUtil::$generalTerms['FROM_DATE'] . ": " . DateLib::mysqlToString($date_from); echo " | "; echo LangUtil::$generalTerms['TO_DATE'] . ": " . DateLib::mysqlToString($date_to); } ?> <br><br> <?php $stat_list = StatsLib::getTestsDoneStats($lab_config, $date_from, $date_to); /* <div id='stat_graph'> <?php # To avoid clutter on the graph, divide stat_list to chunks $chunk_size = 999; $stat_chunks = array_chunk($stat_list, $chunk_size, true); $i = 1; foreach($stat_chunks as $stat_chunk) { $div_id = "placeholder_".$i; $ylabel_id = "ylabel_".$i; $legend_id = "legend_".$i; $width_px = count($stat_chunk)*150; ?> <table>
$curr_cross_gender_total += $curr_total; } else { # Genderwise count required. # Create filter $disease_filter = new DiseaseSetFilter(); $disease_filter->patientAgeRange = array(0, 200); $disease_filter->measureId = $measure->measureId; $disease_filter->rangeType = $range_type; $disease_filter->rangeValues = $range_value; ## Count for males. $disease_filter->patientGender = 'M'; $curr_total1 = StatsLib::getDiseaseFilterCountAggregate($disease_filter, $test, $currentMeasurecount, $lab_config_ids); $curr_male_total += $curr_total1; ## Count for females. $disease_filter->patientGender = 'F'; $curr_total2 = StatsLib::getDiseaseFilterCountAggregate($disease_filter, $test, $currentMeasurecount, $lab_config_ids); $curr_female_total += $curr_total2; } # Build assoc list to track genderwise totals $male_total[$range_value_count] += $curr_male_total; $female_total[$range_value_count] += $curr_female_total; $cross_gender_total[$range_value_count] += $curr_cross_gender_total; } } if ($site_settings->groupByGender == 1) { echo "<td>"; for ($i = 1; $i <= count($range_values); $i++) { $this_male_total = $male_total[$i]; $this_female_total = $female_total[$i]; echo "{$this_male_total}<br>{$this_female_total}<br>"; $this_cross_gender_total = $this_male_total + $this_female_total;
public function add_item_attachment_hit($id) { global $prefs, $user; if (StatsLib::is_stats_hit()) { $attachments = $this->attachments(); $attachments->update(array('hits' => $attachments->increment(1)), array('attId' => (int) $id)); } return true; }