Esempio n. 1
0
function ewrpt_SetupDistinctValuesFromFilter(&$ar, $af)
{
    if (is_array($af)) {
        foreach ($af as $value) {
            ewrpt_SetupDistinctValues($ar, $value[0], $value[1], FALSE);
        }
    }
}
 function SetupPopup()
 {
     global $conn, $ReportLanguage;
     global $Report16;
     // Initialize popup
     // Build distinct values for paper_name
     $bNullValue = FALSE;
     $bEmptyValue = FALSE;
     $sSql = ewrpt_BuildReportSql($Report16->paper_name->SqlSelect, $Report16->SqlWhere(), $Report16->SqlGroupBy(), $Report16->SqlHaving(), $Report16->paper_name->SqlOrderBy, $this->Filter, "");
     $rswrk = $conn->Execute($sSql);
     while ($rswrk && !$rswrk->EOF) {
         $Report16->paper_name->setDbValue($rswrk->fields[0]);
         if (is_null($Report16->paper_name->CurrentValue)) {
             $bNullValue = TRUE;
         } elseif ($Report16->paper_name->CurrentValue == "") {
             $bEmptyValue = TRUE;
         } else {
             $Report16->paper_name->ViewValue = $Report16->paper_name->CurrentValue;
             ewrpt_SetupDistinctValues($Report16->paper_name->ValueList, $Report16->paper_name->CurrentValue, $Report16->paper_name->ViewValue, FALSE);
         }
         $rswrk->MoveNext();
     }
     if ($rswrk) {
         $rswrk->Close();
     }
     if ($bEmptyValue) {
         ewrpt_SetupDistinctValues($Report16->paper_name->ValueList, EWRPT_EMPTY_VALUE, $ReportLanguage->Phrase("EmptyLabel"), FALSE);
     }
     if ($bNullValue) {
         ewrpt_SetupDistinctValues($Report16->paper_name->ValueList, EWRPT_NULL_VALUE, $ReportLanguage->Phrase("NullLabel"), FALSE);
     }
     // Build distinct values for grade
     $bNullValue = FALSE;
     $bEmptyValue = FALSE;
     $sSql = ewrpt_BuildReportSql($Report16->grade->SqlSelect, $Report16->SqlWhere(), $Report16->SqlGroupBy(), $Report16->SqlHaving(), $Report16->grade->SqlOrderBy, $this->Filter, "");
     $rswrk = $conn->Execute($sSql);
     while ($rswrk && !$rswrk->EOF) {
         $Report16->grade->setDbValue($rswrk->fields[0]);
         if (is_null($Report16->grade->CurrentValue)) {
             $bNullValue = TRUE;
         } elseif ($Report16->grade->CurrentValue == "") {
             $bEmptyValue = TRUE;
         } else {
             $Report16->grade->ViewValue = $Report16->grade->CurrentValue;
             ewrpt_SetupDistinctValues($Report16->grade->ValueList, $Report16->grade->CurrentValue, $Report16->grade->ViewValue, FALSE);
         }
         $rswrk->MoveNext();
     }
     if ($rswrk) {
         $rswrk->Close();
     }
     if ($bEmptyValue) {
         ewrpt_SetupDistinctValues($Report16->grade->ValueList, EWRPT_EMPTY_VALUE, $ReportLanguage->Phrase("EmptyLabel"), FALSE);
     }
     if ($bNullValue) {
         ewrpt_SetupDistinctValues($Report16->grade->ValueList, EWRPT_NULL_VALUE, $ReportLanguage->Phrase("NullLabel"), FALSE);
     }
     // Process post back form
     if (ewrpt_IsHttpPost()) {
         $sName = @$_POST["popup"];
         // Get popup form name
         if ($sName != "") {
             $cntValues = is_array(@$_POST["sel_{$sName}"]) ? count($_POST["sel_{$sName}"]) : 0;
             if ($cntValues > 0) {
                 $arValues = ewrpt_StripSlashes($_POST["sel_{$sName}"]);
                 if (trim($arValues[0]) == "") {
                     // Select all
                     $arValues = EWRPT_INIT_VALUE;
                 }
                 $_SESSION["sel_{$sName}"] = $arValues;
                 $_SESSION["rf_{$sName}"] = ewrpt_StripSlashes(@$_POST["rf_{$sName}"]);
                 $_SESSION["rt_{$sName}"] = ewrpt_StripSlashes(@$_POST["rt_{$sName}"]);
                 $this->ResetPager();
             }
         }
         // Get 'reset' command
     } elseif (@$_GET["cmd"] != "") {
         $sCmd = $_GET["cmd"];
         if (strtolower($sCmd) == "reset") {
             $this->ClearSessionSelection('paper_name');
             $this->ClearSessionSelection('grade');
             $this->ResetPager();
         }
     }
     // Load selection criteria to array
     // Get paper name selected values
     if (is_array(@$_SESSION["sel_Report16_paper_name"])) {
         $this->LoadSelectionFromSession('paper_name');
     } elseif (@$_SESSION["sel_Report16_paper_name"] == EWRPT_INIT_VALUE) {
         // Select all
         $Report16->paper_name->SelectionList = "";
     }
     // Get grade selected values
     if (is_array(@$_SESSION["sel_Report16_grade"])) {
         $this->LoadSelectionFromSession('grade');
     } elseif (@$_SESSION["sel_Report16_grade"] == EWRPT_INIT_VALUE) {
         // Select all
         $Report16->grade->SelectionList = "";
     }
 }