function displayContent($authorise, $val) { $userName = $_SESSION['userName']; $strContent = '<h3>List Bulk Case Report</h3>'; $choice = 0; $result = null; switch ($val) { case "1": if (isset($_GET['Datestart'])) { $startdate = getDateToDb($_GET['Datestart']); $enddate = getDateToDb($_GET['Dateclose']); } else { $arrDate = strtEndDateMonthDiff(); $startdate = $arrDate[0]; $enddate = $arrDate[1]; } $filterVal = "createdon between '" . $startdate . "' and '" . $enddate . "' "; $choice = 1; $strContent .= '<h4>Case Reported between ' . getDateFromDb($startdate) . ' and ' . getDateFromDb($enddate) . '</h4>'; break; case "2": $disease = $_GET['cmpDiseaseList']; $filterVal = "bulkcase.diseaseid='" . $disease . "' "; $choice = 2; $resultDis = mysql_query("SELECT name FROM disease where \n\t\t\t\tdiseaseid='" . $disease . "' ") or die(mysql_error()); $row = mysql_fetch_array($resultDis); $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>'; break; case "3": $district = $_GET['cmpDistrictList']; $filterVal = "bulkcase.districtid='" . $district . "' "; $choice = 3; $resultDist = mysql_query("SELECT name FROM district where \n\t\t\t\tdistrictid='" . $district . "' ") or die(mysql_error()); $row = mysql_fetch_array($resultDist); $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>'; break; default: $arrDate = strtEndDateMonthDiff(); $startdate = $arrDate[0]; $enddate = $arrDate[1]; $filterVal = " reportedon between '" . $startdate . "' and '" . $enddate . "' "; $choice = 1; $strContent .= '<h4>Case Reported between ' . $startdate . ' and ' . $enddate . '</h4>'; break; } if ($authorise == "GMO") { $userName = $_SESSION['userName']; $resultGmo = mysql_query("SELECT districtid FROM gmo where username='******' ") or die(mysql_error()); $rowGmo = mysql_fetch_array($resultGmo); $districtid = $rowGmo['districtid']; $result = mysql_query("SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid \n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tLEFT JOIN gmo on bulkcase.districtid=gmo.districtid \n\t\t\tWHERE gmo.districtid='" . $districtid . "' and " . $filterVal . " ") or die(mysql_error()); $paginationQuery = "SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid \n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tWHERE bulkcase.districtid='" . $districtid . "' and " . $filterVal; } else { if ($authorise == "DAO") { $resultDao = mysql_query("SELECT districtid FROM dao where username='******' "); $rowDao = mysql_fetch_array($resultDao); $districtid = $rowDao['districtid']; $result = mysql_query("SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tWHERE bulkcase.districtid='" . $districtid . "' and " . $filterVal . "") or die(mysql_error()); $paginationQuery = "SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid \n\t\t\tWHERE bulkcase.districtid='" . $districtid . "' and " . $filterVal; } else { if ($authorise == "ADMIN") { $result = mysql_query("SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid\n\t\t\tWHERE 1=1 and " . $filterVal . " ") or die(mysql_error()); $paginationQuery = "SELECT bulkcaseid, disease.name as diseasename, district.name as \n\t\t\tdistname, reportedcase, fatalcase, createdon\n\t\t\tFROM bulkcase \n\t\t\tLEFT JOIN disease on bulkcase.diseaseid=disease.diseaseid\n\t\t\tLEFT JOIN district on bulkcase.districtid=district.districtid\n\t\t\tWHERE 1=1 and " . $filterVal; } else { } } } $intResultNum = mysql_num_rows($result); if ($intResultNum > 0) { list($result, $classObj, $dispyListInfo) = classPagination($paginationQuery, $intResultNum); $listData = listCaseReport($authorise, $intResultNum, $result); $strContent .= $listData; $strContent .= '<br /><br />'; $strContent .= $dispyListInfo . '<br />'; $strContent .= $classObj->navigationBar(); } else { $strContent .= "No data is stored in the database or you are not authorised to view this data"; } return $strContent; }
function displayContent($authorise, $val) { $userName = $_SESSION['userName']; $strContent = '<h3>List Case Report</h3>'; $choice = 0; $result = null; switch ($val) { case "1": if (isset($_GET['Datestart'])) { $startdate = getDateToDb($_GET['Datestart']); $enddate = getDateToDb($_GET['Dateclose']); } else { $arrDate = strtEndDateMonthDiff(); $startdate = $arrDate[0]; $enddate = $arrDate[1]; } $filterVal = "reportedon between '" . $startdate . "' and '" . $enddate . "' "; $choice = 1; $strContent .= '<h4>Case Reported between ' . getDateFromDb($startdate) . ' and ' . getDateFromDb($enddate) . '</h4>'; break; case "2": $disease = $_GET['cmpDiseaseList']; $filterVal = "casereport.diseaseid='" . $disease . "' "; $choice = 2; $resultDis = mysql_query("SELECT name FROM disease where \n\t\t\t\tdiseaseid='" . $disease . "' ") or die(mysql_error()); $row = mysql_fetch_array($resultDis); $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>'; break; case "3": $district = $_GET['cmpDistrictList']; $filterVal = "casereport.districtid='" . $district . "' "; $choice = 3; $resultDist = mysql_query("SELECT name FROM district where \n\t\t\t\tdistrictid='" . $district . "' ") or die(mysql_error()); $row = mysql_fetch_array($resultDist); $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>'; break; case "4": $age = explode("-", $_GET['cmpAgeList']); $agest = $age[0]; $ageend = $age[1]; $filterVal = "age between '" . $agest . "' and '" . $ageend . "' "; $choice = 4; $strContent .= '<h4>Case Reported on age, between ' . $agest . ' and ' . $ageend . '</h4>'; break; case "5": $hospital = $_GET['cmpHospitalList']; $filterVal = "casereport.hospitalid='" . $hospital . "' "; $choice = 5; $resultHos = mysql_query("SELECT name FROM hospital where \n\t\t\t\thospitalid='" . $hospital . "' ") or die(mysql_error()); $row = mysql_fetch_array($resultHos); $strContent .= '<h4>Case Report of ' . $row['name'] . '</h4>'; break; default: $arrDate = strtEndDateMonthDiff(); $startdate = $arrDate[0]; $enddate = $arrDate[1]; $filterVal = " reportedon between '" . $startdate . "' and '" . $enddate . "' "; $choice = 1; $strContent .= '<h4>Case Reported between ' . $startdate . ' and ' . $enddate . '</h4>'; break; } if ($authorise == "GMO") { $resultGmo = mysql_query("SELECT districtid FROM gmo where username='******' ") or die(mysql_error()); $rowGmo = mysql_fetch_array($resultGmo); $districtid = $rowGmo['districtid']; $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal . "") or die(mysql_error()); $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\t\t\t\t\t\t\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\t\t\t\t\t\t\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal; } else { if ($authorise == "DAO") { $resultDao = mysql_query("SELECT districtid FROM dao where username='******' "); $rowDao = mysql_fetch_array($resultDao); $districtid = $rowDao['districtid']; $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal . "") or die(mysql_error()); $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\t\t\t\t\t\t\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\t\t\t\t\t\t\t\t\tWHERE casereport.districtid='" . $districtid . "' and " . $filterVal; } else { if ($authorise == "HOSPITAL") { $resultHos = mysql_query("SELECT hospitalid FROM hospital where username='******' "); $rowHos = mysql_fetch_array($resultHos); $hosId = $rowHos['hospitalid']; $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname,hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.hospitalid='" . $hosId . "' and " . $filterVal . " ") or die(mysql_error()); $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname,hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE casereport.hospitalid='" . $hosId . "' and " . $filterVal; } else { if ($authorise == "ADMIN") { $result = mysql_query("SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\tWHERE " . $filterVal . " ") or die(mysql_error()); $paginationQuery = "SELECT casereportid, casereport.name as pname, age, sex, \n\t\t\t\t\t\t\t\t\t\t\tdisease.name as dname, hospital.name as hname, casedate FROM casereport \n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN hospital on casereport.hospitalid=hospital.hospitalid\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN disease on casereport.diseaseid=disease.diseaseid \n\t\t\t\t\t\t\t\t\t\t\tWHERE " . $filterVal; } else { } } } } $intResultNum = mysql_num_rows($result); if ($intResultNum > 0) { /* function for pagination */ list($result, $classObj, $dispyListInfo) = classPagination($paginationQuery, $intResultNum); $listData = listCaseReport($authorise, $intResultNum, $result); $strContent .= $listData; $strContent .= '<br /><br />'; $strContent .= $dispyListInfo . '<br />'; $strContent .= $classObj->navigationBar(); } else { $strContent .= "No data is stored in the database or you are not authorised to view this data"; } return $strContent; }