function Page_Main()
 {
     global $rs;
     global $rsgrp;
     global $Security;
     global $gsFormError;
     global $gbDrillDownInPanel;
     global $ReportBreadcrumb;
     global $ReportLanguage;
     // Aggregate variables
     // 1st dimension = no of groups (level 0 used for grand total)
     // 2nd dimension = no of fields
     $nDtls = 3;
     $nGrps = 2;
     $this->Val =& ewr_InitArray($nDtls, 0);
     $this->Cnt =& ewr_Init2DArray($nGrps, $nDtls, 0);
     $this->Smry =& ewr_Init2DArray($nGrps, $nDtls, 0);
     $this->Mn =& ewr_Init2DArray($nGrps, $nDtls, NULL);
     $this->Mx =& ewr_Init2DArray($nGrps, $nDtls, NULL);
     $this->GrandCnt =& ewr_InitArray($nDtls, 0);
     $this->GrandSmry =& ewr_InitArray($nDtls, 0);
     $this->GrandMn =& ewr_InitArray($nDtls, NULL);
     $this->GrandMx =& ewr_InitArray($nDtls, NULL);
     // Set up array if accumulation required: array(Accum, SkipNullOrZero)
     $this->Col = array(array(FALSE, FALSE), array(TRUE, FALSE), array(FALSE, FALSE));
     // Set up groups per page dynamically
     $this->SetUpDisplayGrps();
     // Set up Breadcrumb
     if ($this->Export == "") {
         $this->SetupBreadcrumb();
     }
     // Check if search command
     $this->SearchCommand = @$_GET["cmd"] == "search";
     // Load default filter values
     $this->LoadDefaultFilters();
     // Load custom filters
     $this->Page_FilterLoad();
     // Set up popup filter
     $this->SetupPopup();
     // Load group db values if necessary
     $this->LoadGroupDbValues();
     // Handle Ajax popup
     $this->ProcessAjaxPopup();
     // Extended filter
     $sExtendedFilter = "";
     // Restore filter list
     $this->RestoreFilterList();
     // Build extended filter
     $sExtendedFilter = $this->GetExtendedFilter();
     ewr_AddFilter($this->Filter, $sExtendedFilter);
     // Build popup filter
     $sPopupFilter = $this->GetPopupFilter();
     //ewr_SetDebugMsg("popup filter: " . $sPopupFilter);
     ewr_AddFilter($this->Filter, $sPopupFilter);
     // Check if filter applied
     $this->FilterApplied = $this->CheckFilter();
     // Call Page Selecting event
     $this->Page_Selecting($this->Filter);
     $this->SearchOptions->GetItem("resetfilter")->Visible = $this->FilterApplied;
     // Get sort
     $this->Sort = $this->GetSort();
     // Get total group count
     $sGrpSort = ewr_UpdateSortFields($this->getSqlOrderByGroup(), $this->Sort, 2);
     // Get grouping field only
     $sSql = ewr_BuildReportSql($this->getSqlSelectGroup(), $this->getSqlWhere(), $this->getSqlGroupBy(), $this->getSqlHaving(), $this->getSqlOrderByGroup(), $this->Filter, $sGrpSort);
     $this->TotalGrps = $this->GetGrpCnt($sSql);
     if ($this->DisplayGrps <= 0 || $this->DrillDown) {
         // Display all groups
         $this->DisplayGrps = $this->TotalGrps;
     }
     $this->StartGrp = 1;
     // Show header
     $this->ShowHeader = $this->TotalGrps > 0;
     // Set up start position if not export all
     if ($this->ExportAll && $this->Export != "") {
         $this->DisplayGrps = $this->TotalGrps;
     } else {
         $this->SetUpStartGroup();
     }
     // Set no record found message
     if ($this->TotalGrps == 0) {
         if ($this->Filter == "0=101") {
             $this->setWarningMessage($ReportLanguage->Phrase("EnterSearchCriteria"));
         } else {
             $this->setWarningMessage($ReportLanguage->Phrase("NoRecord"));
         }
     }
     // Hide export options if export
     if ($this->Export != "") {
         $this->ExportOptions->HideAllOptions();
     }
     // Hide search/filter options if export/drilldown
     if ($this->Export != "" || $this->DrillDown) {
         $this->SearchOptions->HideAllOptions();
         $this->FilterOptions->HideAllOptions();
     }
     // Get current page groups
     $rsgrp = $this->GetGrpRs($sSql, $this->StartGrp, $this->DisplayGrps);
     // Init detail recordset
     $rs = NULL;
     $this->SetupFieldCount();
 }
 function RenderRow()
 {
     global $conn, $Security, $ReportLanguage;
     // Set up summary values
     $colcnt = $this->ColCount + 1;
     $this->SummaryCellAttrs =& ewr_InitArray($colcnt, NULL);
     $this->SummaryViewAttrs =& ewr_InitArray($colcnt, NULL);
     $this->SummaryLinkAttrs =& ewr_InitArray($colcnt, NULL);
     $this->SummaryCurrentValue =& ewr_InitArray($colcnt, NULL);
     $this->SummaryViewValue =& ewr_InitArray($colcnt, NULL);
     $rowsmry = 0;
     $rowcnt = 0;
     if ($this->RowTotalType == EWR_ROWTOTAL_GRAND) {
         // Grand total
         // Aggregate SQL
         $sSql = ewr_BuildReportSql(str_replace("<DistinctColumnFields>", $this->DistinctColumnFields, $this->getSqlSelectAgg()), $this->getSqlWhere(), $this->getSqlGroupByAgg(), "", "", $this->Filter, "");
         $rsagg = $conn->Execute($sSql);
         if ($rsagg && !$rsagg->EOF) {
             $rsagg->MoveFirst();
         }
     }
     for ($i = 1; $i <= $this->ColCount; $i++) {
         if ($this->Col[$i]->Visible) {
             if ($this->RowType == EWR_ROWTYPE_DETAIL) {
                 // Detail row
                 $thisval = $this->Val[$i];
             } elseif ($this->RowTotalType == EWR_ROWTOTAL_GROUP) {
                 // Group total
                 $thisval = $this->Smry[$i][$this->RowGroupLevel];
             } elseif ($this->RowTotalType == EWR_ROWTOTAL_PAGE) {
                 // Page total
                 $thisval = $this->Smry[$i][0];
             } elseif ($this->RowTotalType == EWR_ROWTOTAL_GRAND) {
                 // Grand total
                 $thisval = $rsagg && !$rsagg->EOF ? $rsagg->fields[$i + 1 - 1] : 0;
             }
             $this->SummaryCurrentValue[$i - 1] = $thisval;
             $rowsmry = ewr_SummaryValue($rowsmry, $thisval, $this->getSummaryType());
         }
     }
     if ($this->RowTotalType == EWR_ROWTOTAL_GRAND) {
         // Grand total
         if ($rsagg) {
             $rsagg->Close();
         }
     }
     $this->SummaryCurrentValue[$this->ColCount] = $rowsmry;
     // Call Row_Rendering event
     $this->Row_Rendering();
     //
     //  Render view codes
     //
     if ($this->RowType == EWR_ROWTYPE_TOTAL) {
         // Summary row
         // University
         $this->University->GroupViewValue = $this->University->GroupOldValue();
         $this->University->CellAttrs["class"] = $this->RowGroupLevel == 1 ? "ewRptGrpSummary1" : "ewRptGrpField1";
         // Set up summary values
         $scvcnt = count($this->SummaryCurrentValue);
         for ($i = 0; $i < $scvcnt; $i++) {
             $this->SummaryViewValue[$i] = $this->SummaryCurrentValue[$i];
             $this->SummaryViewAttrs[$i]["style"] = "";
             $this->SummaryCellAttrs[$i]["style"] = "";
             $this->SummaryCellAttrs[$i]["class"] = $this->RowTotalType == EWR_ROWTOTAL_GROUP ? "ewRptGrpSummary" . $this->RowGroupLevel : "";
         }
         // University
         $this->University->HrefValue = "";
     } else {
         // University
         $this->University->GroupViewValue = $this->University->GroupValue();
         $this->University->CellAttrs["class"] = "ewRptGrpField1";
         if ($this->University->GroupValue() == $this->University->GroupOldValue() && !$this->ChkLvlBreak(1)) {
             $this->University->GroupViewValue = "&nbsp;";
         }
         // Set up summary values
         $scvcnt = count($this->SummaryCurrentValue);
         for ($i = 0; $i < $scvcnt; $i++) {
             $this->SummaryViewValue[$i] = $this->SummaryCurrentValue[$i];
             $this->SummaryViewAttrs[$i]["style"] = "";
             $this->SummaryCellAttrs[$i]["style"] = "";
             $this->SummaryCellAttrs[$i]["class"] = $this->RecCount % 2 != 1 ? "ewTableAltRow" : "ewTableRow";
         }
         // University
         $this->University->HrefValue = "";
     }
     // Call Cell_Rendered event
     if ($this->RowType == EWR_ROWTYPE_TOTAL) {
         // Summary row
         // University
         $this->CurrentIndex = 0;
         // Current index
         $CurrentValue = $this->University->GroupOldValue();
         $ViewValue =& $this->University->GroupViewValue;
         $ViewAttrs =& $this->University->ViewAttrs;
         $CellAttrs =& $this->University->CellAttrs;
         $HrefValue =& $this->University->HrefValue;
         $LinkAttrs =& $this->University->LinkAttrs;
         $this->Cell_Rendered($this->University, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue, $LinkAttrs);
         for ($i = 0; $i < $scvcnt; $i++) {
             $this->CurrentIndex = $i;
             $CurrentValue = $this->SummaryCurrentValue[$i];
             $ViewValue =& $this->SummaryViewValue[$i];
             $ViewAttrs =& $this->SummaryViewAttrs[$i];
             $CellAttrs =& $this->SummaryCellAttrs[$i];
             $HrefValue = "";
             $LinkAttrs =& $this->SummaryLinkAttrs[$i];
             $this->Cell_Rendered($this->COUNT28candidate_candStatusID29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue, $LinkAttrs);
         }
     } else {
         // University
         $this->CurrentIndex = 0;
         // Group index
         $CurrentValue = $this->University->GroupValue();
         $ViewValue =& $this->University->GroupViewValue;
         $ViewAttrs =& $this->University->ViewAttrs;
         $CellAttrs =& $this->University->CellAttrs;
         $HrefValue =& $this->University->HrefValue;
         $LinkAttrs =& $this->University->LinkAttrs;
         $this->Cell_Rendered($this->University, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue, $LinkAttrs);
         for ($i = 0; $i < $scvcnt; $i++) {
             $this->CurrentIndex = $i;
             $CurrentValue = $this->SummaryCurrentValue[$i];
             $ViewValue =& $this->SummaryViewValue[$i];
             $ViewAttrs =& $this->SummaryViewAttrs[$i];
             $CellAttrs =& $this->SummaryCellAttrs[$i];
             $HrefValue = "";
             $LinkAttrs =& $this->SummaryLinkAttrs[$i];
             $this->Cell_Rendered($this->COUNT28candidate_candStatusID29, $CurrentValue, $ViewValue, $ViewAttrs, $CellAttrs, $HrefValue, $LinkAttrs);
         }
     }
     // Call Row_Rendered event
     $this->Row_Rendered();
     $this->SetupFieldCount();
 }
Example #3
0
function &ewr_Init2DArray($len1, $len2, $value)
{
    return ewr_InitArray($len1, ewr_InitArray($len2, $value));
}