session_start(); $ses = $_GET['ses']; $form_ses = $_GET['form_ses']; $report = $_GET['r']; $dir = $_GET['dir']; include "../{$dir}/database.php"; include 'common.php'; if (activityPasswordNeeded($report)) { $session = nuSession($ses, false); if ($session->foundOK == '') { print 'you have been logged out..'; return; } } $formValue = getSelectionFormVariables($form_ses); $setup = nuSetup(); $T = nuRunQuery("SELECT * FROM zzsys_activity WHERE sat_all_code = '{$report}'"); $A = db_fetch_object($T); //----------allow for custom code---------------------------------------------- $globalValue = getglobalValue($ses); //----------create an array of hash variables that can be used in any "hashString" $sesVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $ses); //--session values (access level and user etc. ) $sysVariables = sysVariablesToHashArray($form_ses); //--values in sysVariables from the calling lookup page $arrayOfHashVariables = joinHashArrays($sysVariables, $sesVariables); //--join the arrays together $newFormArray = arrayToHashArray($formValue); $arrayOfHashVariables = joinHashArrays($arrayOfHashVariables, $newFormArray); //--join the arrays together eval(replaceHashVariablesWithValues($arrayOfHashVariables, $A->sat_procedure_code));
function build_report_object() { $GLOBALS['time'] = array(); $ses = $_GET['ses']; $form_ses = $_GET['form_ses']; $report = $_GET['r']; $dir = $_GET['dir']; $get_array = array(); $emailer = $_GET['emailer']; while (list($key, $value) = each($_GET)) { $get_array["#{$key}#"] = $value; } include_once "../{$dir}/database.php"; include_once 'common.php'; //--------security check------------------------------- if ($emailer != '1') { if (activityPasswordNeeded($report)) { $session = nuSession($ses, false); if ($session->foundOK == '') { print 'you have been logged out..'; return; } } } //--------------------------------------------------- $id = uniqid('1'); $thedate = date('Y-m-d H:i:s'); $dq = '"'; $setup = nuSetup(); $T = nuRunQuery("SELECT * FROM zzsys_activity WHERE sat_all_code = '{$report}'"); $activity = db_fetch_object($T); //----------allow for custom code---------------------------------------------- //--already done now.. eval($activity->sat_report_display_code); //---(Reporting Class) $displayClass = new Reporting(); $REPORT = new REPORT($displayClass, $dir, $ses); if ($activity->zzsys_activity_id == '') { print 'No Such Report...'; return; } $viewer = $session->sss_zzsys_user_id; $s = "INSERT INTO zzsys_report_log (zzsys_report_log_id, "; $s .= "srl_zzsys_activity_id, srl_date ,srl_viewer) "; $s .= "VALUES ('{$id}', '{$report}', '{$thedate}', '{$viewer}')"; nuRunQuery($s); $s = "SELECT count(*), MAX(sva_expiry_date) FROM zzsys_variable "; $s .= "WHERE sva_id = '{$form_ses}' "; $s .= "GROUP BY sva_expiry_date"; $t1 = nuRunQuery($s); $r1 = db_fetch_row($t1); $numberOfVariables = $r1[0]; $expiryDate = $r1[1]; if ($numberOfVariables == 0) { //---must have at least 1 variable print 'Report has Expired...'; return; } $s = "DELETE FROM zzsys_variable "; $s .= "WHERE sva_id = '{$form_ses}' "; $s .= "AND sva_name = 'ReportTitle'"; nuRunQuery($s); setnuVariable($form_ses, $expiryDate, 'ReportTitle', $activity->sat_all_description); $TT = TT(); //--Temp table name //----------create an array of hash variables that can be used in any "hashString" $sesVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $ses); //--session values (access level and user etc. ) $sesVariables['#dataTable#'] = $TT; $sesVariables['#TT#'] = $TT; $GLOBALS['TT'] = $TT; $dataTable = $TT; $sysVariables = sysVariablesToHashArray($form_ses); //--values in sysVariables from the calling lookup page $arrayOfHashVariables = joinHashArrays($sysVariables, $sesVariables); //--join the arrays together $formValue = array(); while (list($key, $value) = each($sesVariables)) { $formValue[substr($key, 1, -1)] = $value; } //-------------------------------build $TT with PHP---------------------------------------- $v = getSelectionFormVariables($form_ses); $hashV = arrayToHashArray($v); $arrayOfHashVariables = joinHashArrays($arrayOfHashVariables, $hashV); //--join the arrays together $REPORT->tablesUsed = getSelectionFormTempTableNames($form_ses, $v); //--temp tables to delete when finished $formValue = $v; $nuHashVariables = $arrayOfHashVariables; //--added by sc 23-07-2009 eval(replaceHashVariablesWithValues($arrayOfHashVariables, $activity->sat_report_data_code)); $REPORT->no_data = addVariablesToTT($TT, $v); nuRunQuery("ALTER TABLE `{$TT}` ADD `nu__id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST"); $REPORT->nuloopThroughRecords($TT); }
function __construct($parameters, $ACTIVITY) { $this->resize = 0.0679; //$this->resize = 1.0; $this->reportID = $ACTIVITY->zzsys_activity_id; $this->reportTitle = $ACTIVITY->sat_all_description; $this->report = new Reporting(); $this->hasReportHeader = $this->validSection($this->reportHeader); $this->hasReportFooter = $this->validSection($this->reportFooter); $this->hasPageHeader = $this->validSection($this->pageHeader); $this->hasPageFooter = $this->validSection($this->pageFooter); $this->fixControlNames(); $this->buildBreakOnArray(); $this->headerNumbers = array(5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31); $this->footerNumbers = array(6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32); $this->alignment = array('left', 'left', 'center', 'right'); $this->selectionFormVariables = getSelectionFormVariables($parameters); $hashSelectionFormVariables = arrayToHashArray($this->selectionFormVariables); $this->tablesUsed = getSelectionFormTempTableNames($parameters, $this->selectionFormVariables); $this->TT = TT(); $this->sumTT = TT(); $this->tablesUsed[] = $this->TT; $dataTable = $this->TT; $formValue = $this->selectionFormVariables; $globalValue = getglobalValue($_GET['ses']); //----------create an array of hash variables that can be used in any "hashString" $sesVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $_GET['ses']); //--session values (access level and user etc. ) $sesVariables['#dataTable#'] = $this->TT; $sysVariables = sysVariablesToHashArray($_GET['form_ses']); //--values in sysVariables from the calling lookup page $arrayOfHashVariables = joinHashArrays($sysVariables, $sesVariables); //--join the arrays together $arrayOfHashVariables = joinHashArrays($arrayOfHashVariables, $hashSelectionFormVariables); //--put temp table names for listboxes //----------allow for custom code---------------------------------------------- eval(replaceHashVariablesWithValues($arrayOfHashVariables, $ACTIVITY->sat_report_data_code)); // eval($ACTIVITY->sat_report_data_code); $this->TT = $dataTable; // BuildTable($this->selectionFormVariables, $this->TT); $this->addSelectionFormVariablesToTable($this->selectionFormVariables); $t = nuRunQuery("SELECT * FROM {$this->TT} LIMIT 0 , 1"); $this->fields = tableFieldNamesToArray($t); if ($_GET['tt'] != '') { //--- create a temp table to debug nuRunQuery("CREATE TABLE " . $_GET['tt'] . " SELECT * FROM {$this->TT}"); } $this->sumTotals(); $this->orderBy = $this->orderByClause(); $this->styleSheet = $this->buildStyleSheet(); $this->justDidPageBreak = false; }
function loadAfterConstruct($theFormID, $thePageNumber, $theOrderBy, $isDescending, $theSearchString, $subformPrefix, $dir, $ses, $form_ses, $zzsys_user_id) { $this->TT = TT(); //---temp table name $this->rowPrefix = $subformPrefix; $this->customDirectory = $dir; $this->session = $ses; $this->form_session = $form_ses; $this->PageNo = $thePageNumber; $this->orderBy = $theOrderBy; $this->isDescending = $isDescending; $this->oldFormID = $theFormID; $this->theFormID = $this->getFormID($theFormID); $this->searchString = $theSearchString; $this->pageLength = 27; $this->rowHeight = 20; $this->startTime = time(); $this->setup = nuSetup(); $this->getColumnInfo($this->theFormID); $this->form = formFields($this->theFormID); $this->defaultJSfunctions(); $this->zzsys_user_id = $zzsys_user_id; //----------create an array of hash variables that can be used in any "hashString" $sesVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $ses); //--session values (access level and user etc. ) $sesVariables['#TT#'] = $this->TT; $sesVariables['#browseTable#'] = $this->TT; $sesVariables['#formSessionID#'] = $form_ses; $sysVariables = sysVariablesToHashArray($form_ses); //--values in sysVariables from the calling lookup page $this->arrayOfHashVariables = joinHashArrays($sysVariables, $sesVariables); //--join the arrays together $nuHashVariables = $this->arrayOfHashVariables; //--added by sc 23-07-2009 //----------allow for custom code---------------------------------------------- $globalValue = getglobalValue($this->session); $browseTable = $this->TT; eval(replaceHashVariablesWithValues($this->arrayOfHashVariables, $this->form->sfo_custom_code_run_before_browse)); $this->old_sql_string = $this->form->sfo_sql; $this->new_sql_string = replaceHashVariablesWithValues($this->arrayOfHashVariables, $this->form->sfo_sql); $s = "\n/*\n old : {$this->old_sql_string} \n*/\n"; $s = $s . "\n/*\n new : {$this->new_sql_string} \n*/\n"; $this->appendJSfuntion($s); $this->SQL = new sqlString($this->new_sql_string); $this->buildWhereClause($theSearchString); $this->SQL->setWhere($this->pageWhereClause); $this->SQL->setOrderBy($this->buildOrderBy()); $this->pageBody = $this->buildBody(); $this->pageHeader = $this->buildHeader(); }