Skip to content

Commit

Permalink
Add DHIS2 Reporting Rate chart Reports
Browse files Browse the repository at this point in the history
  • Loading branch information
MIKEINTOSHSYSTEMS committed Jul 29, 2024
1 parent ad56ae4 commit b64d610
Show file tree
Hide file tree
Showing 89 changed files with 15,505 additions and 3,132 deletions.
4 changes: 4 additions & 0 deletions app/classes/charts.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ protected function isProjectDB()
return true;
if("" == $this->chrt_array['tables'][0])
return true;
if("DHIS2_Reporting_Rate" == $this->chrt_array['tables'][0])
return true;
if("DHIS2_Reporting_Rate" == $this->chrt_array['tables'][0])
return true;
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions app/classes/crosstable_webreport.php
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,10 @@ public function isProjectDB()
$isDB = true;
if("" == $this->xml_array['tables'][0])
$isDB = true;
if("DHIS2_Reporting_Rate" == $this->xml_array['tables'][0])
$isDB = true;
if("DHIS2_Reporting_Rate" == $this->xml_array['tables'][0])
$isDB = true;
return $isDB;
}

Expand Down
4 changes: 4 additions & 0 deletions app/classes/projectsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3594,6 +3594,10 @@ function fillProjectEntites()
$projectEntitiesReverse[ "dhis2_periods" ] = "DHIS2_Periods";
$projectEntities[ "DHIS2_Reporting_Rate" ] = array( "url" => "dhis2_reporting_rate", "type" => 7 );
$projectEntitiesReverse[ "dhis2_reporting_rate" ] = "DHIS2_Reporting_Rate";
$projectEntities[ "DHIS2_Reporting_Rate_Chart" ] = array( "url" => "dhis2_reporting_rate_chart1", "type" => 11 );
$projectEntitiesReverse[ "dhis2_reporting_rate_chart1" ] = "DHIS2_Reporting_Rate_Chart";
$projectEntities[ "DHIS2_Reporting_Rate_Report" ] = array( "url" => "dhis2_reporting_rate_report1", "type" => 10 );
$projectEntitiesReverse[ "dhis2_reporting_rate_report1" ] = "DHIS2_Reporting_Rate_Report";
}

function findTable( $table ) {
Expand Down
5 changes: 5 additions & 0 deletions app/classes/xtempl_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ function __construct( $hideAddedCharts = false )
"chartName"=>"dhis2_analytics_chart",
"table"=>"DHIS2_Analytics Chart",
"ctype"=>"Combined"));
$this->assign_function("dhis2_reporting_rate_chart1_chart","xt_showchart",
array(
"chartName"=>"dhis2_reporting_rate_chart1",
"table"=>"DHIS2_Reporting_Rate_Chart",
"ctype"=>"Combined"));
}


Expand Down
2 changes: 2 additions & 0 deletions app/connections/ConnectionManager_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ protected function _setTablesConnectionIds()
$connectionsIds["DHIS2_Datasets"] = "devdhis2hispmdathispmdmerqcons";
$connectionsIds["DHIS2_Periods"] = "hispmdathispmdmerqconsultancyo";
$connectionsIds["DHIS2_Reporting_Rate"] = "devdhis2hispmdathispmdmerqcons";
$connectionsIds["DHIS2_Reporting_Rate_Chart"] = "devdhis2hispmdathispmdmerqcons";
$connectionsIds["DHIS2_Reporting_Rate_Report"] = "devdhis2hispmdathispmdmerqcons";

$this->_tablesConnectionIds = &$connectionsIds;
}
Expand Down
51 changes: 51 additions & 0 deletions app/dhis2_reporting_rate_chart1_chart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");

$requestTable = "DHIS2_Reporting_Rate_Chart";
$requestPage = "list";

require_once("include/dbcommon.php");
require_once('include/xtempl.php');
require_once('classes/chartpage.php');
require_once('classes/searchclause.php');
add_nocache_headers();

require_once("include/dhis2_reporting_rate_chart1_variables.php");

if( Security::hasLogin() ) {
if( !Security::processPageSecurity( $strtablename, 'S' ) )
return;
}

$pageMode = ChartPage::readChartModeFromRequest();
$xt = new Xtempl( $pageMode != CHART_SIMPLE );

// set params for a RunnerPage constructor
$params = array();
$params["id"] = postvalue_number("id");
$params["xt"] = &$xt;
$params["mode"] = $pageMode;
$params["tName"] = $strTableName;
$params["pageType"] = PAGE_CHART;
$params["pageName"] = postvalue("page");

$params["masterPageType"] = postvalue("masterpagetype");
$params["masterTable"] = postvalue("mastertable");
if( $params["masterTable"] )
$params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();

if( $pageMode = CHART_DASHBOARD )
{
$params["dashElementName"] = postvalue("dashelement");
$params["dashTName"] = postvalue("table");
}

$pageObject = new ChartPage( $params );
$pageObject->init();

if( $pageObject->processSaveSearch() )
exit();

$pageObject->process();
?>
70 changes: 70 additions & 0 deletions app/dhis2_reporting_rate_chart1_search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");

require_once("include/dbcommon.php");
add_nocache_headers();

require_once("classes/searchclause.php");
require_once("include/dhis2_reporting_rate_chart1_variables.php");
require_once("classes/searchcontrol.php");
require_once("classes/advancedsearchcontrol.php");
require_once("classes/panelsearchcontrol.php");




require_once('include/xtempl.php');
require_once('classes/searchpage.php');
require_once('classes/searchpage_dash.php');

$xt = new Xtempl();
$pageMode = SearchPage::readSearchModeFromRequest();

if( $pageMode == SEARCH_LOAD_CONTROL )
$layoutVersion = postvalue("layoutVersion");


$params = array();
$params['xt'] = &$xt;
$params['id'] = postvalue_number("id");
$params['mode'] = $pageMode;
$params['tName'] = $strTableName;
$params["pageName"] = postvalue("page");
$params['pageType'] = PAGE_SEARCH;
$params['chartName'] = $cname;
$params['reportName'] = $rname;
$params['templatefile'] = $templatefile;
$params['shortTableName'] = 'dhis2_reporting_rate_chart1';
$params['layoutVersion'] = $layoutVersion;

$params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
$params['ctrlField'] = postvalue('ctrlField');

$params['needSettings'] = postvalue('isNeedSettings');

if( $pageMode == SEARCH_DASHBOARD )
{
$params["dashTName"] = postvalue("table");
$params["dashElementName"] = postvalue("dashelement");
}

// e.g. crosstable params
$params["extraPageParams"] = SearchPage::getExtraPageParams();

$params["masterTable"] = postvalue("mastertable");
if( $params["masterTable"] )
$params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();


$pageObject = new SearchPage($params);

if( $pageMode == SEARCH_LOAD_CONTROL )
{
$pageObject->displaySearchControl();
return;
}

$pageObject->init();
$pageObject->process();
?>
61 changes: 61 additions & 0 deletions app/dhis2_reporting_rate_report1_print.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");
require_once("include/dbcommon.php");
require_once('classes/searchclause.php');
require_once('include/xtempl.php');

if( @$_REQUEST["format"] != "excel" && @$_REQUEST["format"] != "word" )
add_nocache_headers();

require_once("include/dhis2_reporting_rate_report1_variables.php");


if( Security::hasLogin() ) {
if( !Security::processPageSecurity( $strTableName, 'P' ) )
return;
}


require_once('classes/reportpage.php');
require_once('classes/reportprintpage.php');

$xt = new Xtempl();

// an array of ReportPrintPage constructor params
$params = array();
$params["id"] = postvalue_number("id");
$params["xt"] = &$xt;
$params["mode"] = postvalue( "pdfjson" ) ? PRINT_PDFJSON : REPORT_SIMPLE;
$params["tName"] = $strTableName;
$params["pageType"] = PAGE_RPRINT;
$params["pageName"] = postvalue("page");

$params["allPagesMode"] = postvalue("all");
$params["pdfMode"] = postvalue("pdf");

$params["format"] = postvalue("format");
$params["splitByGroups"] = postvalue("records");


//crosstable params
$params["x"] = postvalue("x");
$params["y"] = postvalue("y");
$params["dataField"] = postvalue("data");
$params["operation"] = postvalue("op");
$params["xType"] = postvalue("xtype");
$params["yType"] = postvalue("ytype");
//

$params["pdfBackgroundImage"] = postvalue("pdfBackgroundImage");

$params["masterTable"] = postvalue("mastertable");
if( $params["masterTable"] )
$params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();


$pageObject = new ReportPrintPage($params);
$pageObject->init();

$pageObject->process();
?>
72 changes: 72 additions & 0 deletions app/dhis2_reporting_rate_report1_report.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");

$requestTable = "DHIS2_Reporting_Rate_Report";
$requestPage = "list";

require_once("include/dbcommon.php");
require_once('include/xtempl.php');

add_nocache_headers();

require_once('classes/reportpage.php');
require_once('classes/searchclause.php');
require_once("include/dhis2_reporting_rate_report1_variables.php");

if( Security::hasLogin() ) {
if( !Security::processPageSecurity( $strTableName, 'S' ) ) {
return;
}
}


$pageMode = ReportPage::readReportModeFromRequest();
$xt = new Xtempl( $pageMode != REPORT_SIMPLE ); //#9607 1. Temporary fix

$gSettings = new ProjectSettings( $strTableName );
//array of params for ReportPage constructor
$params = array();
$params["id"] = postvalue_number("id");
$params["xt"] = &$xt;
$params["mode"] = $pageMode;
$params["tName"] = $strTableName;
$params["pageType"] = PAGE_REPORT;
$params["pageName"] = postvalue("page");
$params["arrRecsPerPage"] = $gSettings->getRecordsPerPageArray();
$params["arrGroupsPerPage"] = $gSettings->getGroupsPerPageArray();
$params["requestGoto"] = postvalue_number("goto");

//crosstable params
$params["x"] = postvalue("x");
$params["y"] = postvalue("y");
$params["dataField"] = postvalue("data");
$params["operation"] = postvalue("op");
$params["xType"] = postvalue("xtype");
$params["yType"] = postvalue("ytype");
$params["selectedAxis"] = postvalue("axis");

if( postvalue("crosstable_refresh") )
$params["crosstableRefresh"] = true;

$params["masterPageType"] = postvalue("masterpagetype");

$params["masterTable"] = postvalue("mastertable");
if( $params["masterTable"] )
$params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();


if( $pageMode = REPORT_DASHBOARD )
{
$params["dashElementName"] = postvalue("dashelement");
$params["dashTName"] = postvalue("table");
}

$pageObject = new ReportPage( $params );
$pageObject->init();

if( $pageObject->processSaveSearch() )
exit();

$pageObject->process();
?>
70 changes: 70 additions & 0 deletions app/dhis2_reporting_rate_report1_search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");

require_once("include/dbcommon.php");
add_nocache_headers();

require_once("classes/searchclause.php");
require_once("include/dhis2_reporting_rate_report1_variables.php");
require_once("classes/searchcontrol.php");
require_once("classes/advancedsearchcontrol.php");
require_once("classes/panelsearchcontrol.php");




require_once('include/xtempl.php');
require_once('classes/searchpage.php');
require_once('classes/searchpage_dash.php');

$xt = new Xtempl();
$pageMode = SearchPage::readSearchModeFromRequest();

if( $pageMode == SEARCH_LOAD_CONTROL )
$layoutVersion = postvalue("layoutVersion");


$params = array();
$params['xt'] = &$xt;
$params['id'] = postvalue_number("id");
$params['mode'] = $pageMode;
$params['tName'] = $strTableName;
$params["pageName"] = postvalue("page");
$params['pageType'] = PAGE_SEARCH;
$params['chartName'] = $cname;
$params['reportName'] = $rname;
$params['templatefile'] = $templatefile;
$params['shortTableName'] = 'dhis2_reporting_rate_report1';
$params['layoutVersion'] = $layoutVersion;

$params['searchControllerId'] = postvalue('searchControllerId') ? postvalue('searchControllerId') : $id;
$params['ctrlField'] = postvalue('ctrlField');

$params['needSettings'] = postvalue('isNeedSettings');

if( $pageMode == SEARCH_DASHBOARD )
{
$params["dashTName"] = postvalue("table");
$params["dashElementName"] = postvalue("dashelement");
}

// e.g. crosstable params
$params["extraPageParams"] = SearchPage::getExtraPageParams();

$params["masterTable"] = postvalue("mastertable");
if( $params["masterTable"] )
$params["masterKeysReq"] = RunnerPage::readMasterKeysFromRequest();


$pageObject = new SearchPage($params);

if( $pageMode == SEARCH_LOAD_CONTROL )
{
$pageObject->displaySearchControl();
return;
}

$pageObject->init();
$pageObject->process();
?>
Loading

0 comments on commit b64d610

Please sign in to comment.