$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));
private function buildHTMLForSubform($CRLF, $TAB, $fieldName, $fieldTitle, $blankRows, $objectID) { if (!$this->displayThisObject) { return ''; } else { $this->parentForm->subformNames[] = $this->objectProperty['sob_all_name']; $this->parentForm->subformTabs[] = $this->parentForm->formTabNames[$this->objectProperty['sob_all_tab_title']]; } $format = textFormatsArray(); if ($this->objectProperty['sob_all_on_change'] != '') { $OnChange = 'onchange="' . $this->objectProperty["sob_all_on_change"] . '" '; } $this->CRLF = $CRLF; $this->TAB = $TAB; $hGap = 3; //gap between fields $vHeight = 23; //row height $vTitleHeight = $this->objectProperty['sob_subform_title_height'] * 16; //row height $vTop = 10; //row height $sfDimensions = array(); $fldDimensions = array(); $t = nuRunQuery("SELECT * FROM zzsys_object WHERE sob_zzsys_form_id = '" . $this->objectProperty['zzsys_object_id'] . "' ORDER BY sob_all_column_number, sob_all_order_number"); while ($r = db_fetch_array($t)) { $objectLength = $r['sob_' . $r['sob_all_type'] . '_length']; // eg. text objects are 'sob_text_length' if ($r['sob_all_type'] == 'lookup') { $objectLength = $r['sob_lookup_code_length']; // code length if ($r['sob_lookup_no_description'] != '1') { $objectLength = $objectLength + 0.5 + $r['sob_lookup_description_length']; // description length } } if ($r['sob_all_type'] == 'text') { if ($format[$r['sob_text_format']]->type == 'date') { $objectLength = $objectLength + 1.5; // date button length } } $fldDimensions[$r['sob_all_name']]->type = $r['sob_all_type']; $fldDimensions[$r['sob_all_name']]->columnAlign = 'left'; if ($r['sob_all_type'] == 'text') { $fldDimensions[$r['sob_all_name']]->columnAlign = $r['sob_text_align']; } if ($r['sob_all_type'] == 'display') { $fldDimensions[$r['sob_all_name']]->columnAlign = $r['sob_display_align']; } $fldDimensions[$r['sob_all_name']]->columnTitle = $r['sob_all_title']; $fldDimensions[$r['sob_all_name']]->column = $r['sob_all_column_number']; $fldDimensions[$r['sob_all_name']]->leftCoordinate = round($sfDimensions[$r['sob_all_column_number']]->columnWidth); $fldDimensions[$r['sob_all_name']]->columnWidth = $objectLength * 16 + $hGap; $sfDimensions[$r['sob_all_column_number']]->columnWidth = round($sfDimensions[$r['sob_all_column_number']]->columnWidth) + $fldDimensions[$r['sob_all_name']]->columnWidth; $colHeight = round($sfDimensions[$r['sob_all_column_number']]->columnHeight); if ($colHeight == 0) { $sfDimensions[$r['sob_all_column_number']]->columnHeight = $vHeight; $colHeight = $sfDimensions[$r['sob_all_column_number']]->columnHeight; } if ($r['sob_all_type'] == 'textarea' and $colHeight < $r['sob_textarea_height'] * 16) { $sfDimensions[$r['sob_all_column_number']]->columnHeight = $r['sob_textarea_height'] * 16; } } $longest = ''; foreach ($sfDimensions as $key => $value) { // get longest row if ($value->columnWidth > $longest) { $longest = $value->columnWidth; } $rowHeight = $rowHeight + $value->columnHeight; } $prntCheckBox = $this->objectProperty['sob_subform_delete_box'] == '1' and $this->objectProperty['sob_subform_read_only'] != '1'; if ($prntCheckBox) { //add room for the delete tick box $longest = $longest + $vHeight; } else { $longest = $longest + 20; } //add scroll bar $sfWidth = $longest + 20; $sfLeft = $this->objectProperty['sob_subform_left']; //add height of subform title + column title(s) to overall height $sfHeight = $this->objectProperty['sob_subform_height'] * 16 - $this->objectProperty['sob_subform_title_height'] * 16 - 100; $sfTop = $this->objectProperty['sob_subform_top']; if ($this->objectProperty['sob_subform_width'] == 0) { $scsfWidth = $sfWidth + 10; } else { $scsfWidth = $this->objectProperty['sob_subform_width']; } $scsfHeight = $sfHeight - 20; $scsfHeight = $sfHeight - 16; //changed from -10 to -16 $s = "<div name='sf_title{$fieldName}' id='sf_title{$fieldName}' class='selected' style='text-align:left;position:absolute;height:20;top:{$sfTop};left:{$sfLeft};width:{$sfWidth};'>{$fieldTitle}</div>{$CRLF}"; $sfTop = $sfTop + 20; $s = $s . "{$TAB}<div name='{$fieldName}' id='{$fieldName}' class='selected' style='position:absolute;overflow:auto;width:{$scsfWidth};height:{$scsfHeight};top:{$sfTop};left:{$sfLeft};'>{$CRLF}"; $s = $s . "{$TAB} <div name='title{$fieldName}' id='title{$fieldName}' style='position:absolute;top:0;left:0;background:#6D7B8D'>{$CRLF}"; // build subform column titles $columnTop = 0; $columnNumber = ''; foreach ($fldDimensions as $key => $value) { if ($columnNumber != $value->column) { if ($columnNumber == '') { $columnNumber = $value->column; } } if ($columnTop == 0) { // only print headings for the first row (sob_subform_column_order) if ($columnNumber == $value->column) { $width = $value->columnWidth; $dbc = ''; if ($this->parentForm->zzsys_user_id == 'globeadmin' and $this->form->sys_setup != '1') { $dbc = " ondblclick=\"openBrowse('object', '{$objectID}', '', '" . $this->parentForm->session . "', '')\""; } $s = $s . "{$TAB} <div {$dbc} class='unselected' style='vertical-align:top;font-size:x-small;font-family:tahoma;font-weight:bold;top:0;left:{$value->leftCoordinate};width:{$width};height:{$vTitleHeight};overflow:hidden;position:absolute;text-align:" . align($value->columnAlign) . ";'>{$CRLF}"; $s = $s . "{$TAB} {$value->columnTitle}{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; $nextLeft = $value->leftCoordinate + $value->columnWidth; } } } $sfHeight = $sfHeight - $columnTop - $vHeight; // adjusting for scrollng div $this->objectName = $this->objectProperty['sob_all_name']; // set subform name //add room for the delete tick box if ($this->objectProperty['sob_subform_read_only'] != '1') { $s = $s . "{$TAB} <div class='unselected' style='top:0;left:{$nextLeft};width:50;height:{$vTitleHeight};overflow:hidden;position:absolute;align:left;'>{$CRLF}"; //align:left removed if ($prntCheckBox) { $s = $s . "{$TAB} <font style='vertical-align:top;font-size:xx-small;font-family:tahoma;font-weight:bold;'> Delete </font>{$CRLF}"; } $s = $s . "{$TAB} </div>{$CRLF}"; } //end of subform column titles //start scrolling div $sfHeight = $sfHeight - $vTitleHeight; // adjust a bit to see all of scroll bar $columnTop = $columnTop + $vTitleHeight; //added by nick 10-06-09 $grey needs to be defined before it can be used //vvvvv $grey = iif($grey == $this->objectProperty['sob_subform_odd_background_color'], $this->objectProperty['sob_subform_even_background_color'], $this->objectProperty['sob_subform_odd_background_color']); //^^^^^ $subformClass = str_replace('.', '', $this->objectProperty['sob_all_class']); $s = $s . "{$TAB} <div name='scroller{$fieldName}' class='{$subformClass}' id='scroller{$fieldName}' style='border-style:solid;border-width:2;border-color:white;position:absolute;overflow:scroll;width:{$sfWidth};height:{$sfHeight};top:{$columnTop};left:0;background:{$grey};'>{$CRLF}"; //put subform objects in an array $subformObjects = array(); $t = nuRunQuery("SELECT * FROM zzsys_object WHERE sob_zzsys_form_id = '" . $this->objectProperty['zzsys_object_id'] . "' ORDER BY sob_all_column_number, sob_all_order_number"); while ($r = db_fetch_object($t)) { $subformObjects[] = $r; } //get SQL for subform // $subformSQL = replaceVariablesInString($this->TT,$this->objectProperty['sob_subform_sql'], $this->recordID); //get SQL for subform //-- added by sc 4-feb-2009 if (is_array($this->parentForm->recordValues)) { $hVariables = arrayToHashArray($this->parentForm->recordValues); //--session values (access level and user etc. ) } $subformSQL = replaceVariablesInString($this->TT, $this->objectProperty['sob_subform_sql'], $this->recordID); if (is_array($this->parentForm->recordValues)) { $subformSQL = replaceHashVariablesWithValues($hVariables, $subformSQL); } //--------- $subformTable = nuRunQuery($subformSQL); $columnTop = $vHeight * -1 + 5; $nextTop = 0; $columnNumber = ''; //loop through subform records if ($this->parentForm->cloning == '1') { $primaryKey = ''; } else { $primaryKey = $this->objectProperty['sob_subform_primary_key']; } while ($subformRecord = mysql_fetch_array($subformTable)) { $this->recordID = $subformRecord[$this->objectProperty['sob_subform_primary_key']]; $this->nextRowNumber(); //loop through each object for this subform record $newRow = true; $grey = iif($grey == $this->objectProperty['sob_subform_odd_background_color'], $this->objectProperty['sob_subform_even_background_color'], $this->objectProperty['sob_subform_odd_background_color']); $dq = '"'; $s = $s . "{$TAB} <div id='rowdiv_{$this->subformPrefix}' onfocus='SFrowColor(this, {$dq}{$fieldName}{$dq})' style='background:{$grey};height:{$rowHeight}'>{$CRLF}"; $checkBoxDone = false; for ($i = 0; $i < count($subformObjects); $i++) { $subformFieldDiv = $fldDimensions[$subformObjects[$i]->sob_all_name]; if ($columnNumber != $subformFieldDiv->column or $i == 0) { $columnNumber = $subformFieldDiv->column; $columnTop = $nextTop; $nextTop = $columnTop + $sfDimensions[$columnNumber]->columnHeight; } //add room for the delete tick box if ($prntCheckBox and !$checkBoxDone) { $checkBoxDone = true; $s = $s . "{$TAB} <div style='position:absolute;top:{$columnTop};left:{$nextLeft}'>{$CRLF}"; $s = $s . "{$TAB} <input name='row{$this->subformPrefix}' id='row{$this->subformPrefix}' type='checkbox' {$OnChange} tabindex='-1'/>{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; } $s = $s . "{$TAB} <div name='row{$this->subformPrefix}' id='row{$this->subformPrefix}' style='background:lightgray;position:absolute;top:{$columnTop};left:{$subformFieldDiv->leftCoordinate}'>{$CRLF}"; $fieldWidth = $subformFieldDiv->columnWidth - $hGap; if ($newRow) { $s = $s . "{$TAB} <input name='{$this->subformPrefix}{$primaryKey}' id='{$this->subformPrefix}{$primaryKey}' value='{$this->recordID}' type='hidden'/>{$CRLF}"; $newRow = false; } $s = $s . "{$TAB} " . $this->buildObject($subformObjects[$i], $subformRecord) . "{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; } $rowNumber = $rowNumber + 1; $newRow = true; $s = $s . "{$TAB} </div>{$CRLF}"; } $sfRowTotal = $rowNumber + $blankRows; $columnNumber = ''; //loop through blank subform records for ($blankRecord = 0; $blankRecord < $blankRows; $blankRecord++) { $this->recordID = '-1'; $this->nextRowNumber(); //loop through each object for this subform record $grey = iif($grey == $this->objectProperty['sob_subform_odd_background_color'], $this->objectProperty['sob_subform_even_background_color'], $this->objectProperty['sob_subform_odd_background_color']); // $grey = iif($grey=='#E0E0E0 ','#F0F0F0','#E0E0E0 '); $s = $s . "{$TAB} <div style='background:{$grey};height:{$rowHeight}'>{$CRLF}"; $checkBoxDone = false; for ($i = 0; $i < count($subformObjects); $i++) { $subformFieldDiv = $fldDimensions[$subformObjects[$i]->sob_all_name]; if ($columnNumber != $subformFieldDiv->column) { $columnNumber = $subformFieldDiv->column; $columnTop = $nextTop; $nextTop = $columnTop + $sfDimensions[$columnNumber]->columnHeight; } //add room for the delete tick box if ($prntCheckBox and !$checkBoxDone) { $checkBoxDone = true; $s = $s . "{$TAB} <div style='position:absolute;top:{$columnTop};left:{$nextLeft}'>{$CRLF}"; $s = $s . "{$TAB} <input name='row{$this->subformPrefix}' id='row{$this->subformPrefix}' type='checkbox' {$OnChange} tabindex='-1' checked='checked'/>{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; } $s = $s . "{$TAB} <div name='{$this->subformPrefix}' id='{$this->subformPrefix}' style='position:absolute;top:{$columnTop};left:{$subformFieldDiv->leftCoordinate}'>{$CRLF}"; $fieldWidth = $subformFieldDiv->columnWidth - $hGap; $s = $s . "{$TAB} " . $this->buildObject($subformObjects[$i], $subformRecord) . "{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; } $rowNumber = $rowNumber + 1; $columnNumber = ''; $s = $s . "{$TAB} </div>{$CRLF}"; } $s = $s . "{$TAB} </div>{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; $s = $s . "{$TAB} </div>{$CRLF}"; $s = $s . "{$TAB} <div style='position:absolute;overflow:hidden;width:0;height:0;top:0;left:10;background:blue;'>{$CRLF}"; $sfColumns = count($fldDimensions); $s = $s . "{$TAB} <input name='subformid{$fieldName}' id='subformid{$fieldName}' value='" . $this->objectProperty['zzsys_object_id'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='rows{$fieldName}' id='rows{$fieldName}' value='{$sfRowTotal}' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='columns{$fieldName}' id='columns{$fieldName}' value='{$sfColumns}' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='table{$fieldName}' id='table{$fieldName}' value='" . $this->objectProperty['sob_subform_table'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='foreignkey{$fieldName}' id='foreignkey{$fieldName}' value='" . $this->objectProperty['sob_subform_foreign_key'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='primarykey{$fieldName}' id='primarykey{$fieldName}' value='" . $this->objectProperty['sob_subform_primary_key'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='readonly{$fieldName}' id='readonly{$fieldName}' value='" . $this->objectProperty['sob_subform_read_only'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='deletebox{$fieldName}' id='deletebox{$fieldName}' value='" . $this->objectProperty['sob_subform_delete_box'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='rowColor_{$fieldName}' id='rowColor_{$fieldName}' value='" . $this->objectProperty['sob_subform_selected_row_color'] . "' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='lastRow_{$fieldName}' id='lastRow_{$fieldName}' value='' type='hidden' />{$CRLF}"; $s = $s . "{$TAB} <input name='lastColor_{$fieldName}' id='lastColor_{$fieldName}' value='' type='hidden' />{$CRLF}"; $cNo = 0; foreach ($fldDimensions as $key => $value) { $s = $s . "{$TAB} <input name='{$fieldName}{$cNo}' id='{$fieldName}{$cNo}' value='{$key}' type='hidden' />{$CRLF}"; $cNo = $cNo + 1; } $s = $s . "{$TAB}</div>{$CRLF}"; return $s; }
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; }
$fieldNames[] = 'description' . $prefix . $object->sob_all_name; $SQL->addField($object->sob_lookup_description_field); } $t = nuRunQuery("SELECT * FROM zzsys_lookup WHERE slo_zzsys_object_id = '{$object->zzsys_object_id}'"); while ($r = db_fetch_object($t)) { $SQL->addField($r->zzsys_slo_table_field_name); $fieldNames[] = $prefix . $r->zzsys_slo_page_field_name; } $sql1 = 'old : ' . $old_sql_string; $sql2 = 'new : ' . $new_sql_string; $sql3 = 'newest : ' . $SQL->SQL; $T = nuRunQuery($SQL->SQL); $R = db_fetch_row($T); $arrayOfHashVariables['#selectedID#'] = $R[0]; //--ID of selected record eval(replaceHashVariablesWithValues($arrayOfHashVariables, $lookupForm->sfo_custom_code_run_after_browse)); $s = "<body onLoad='fillfields()'><form>\n"; for ($i = 0; $i < count($fieldNames); $i++) { $s = $s . " <textarea name='{$fieldNames[$i]}'>{$R[$i]}</textarea>\n"; update_zzsys_variables($fieldNames[$i], $R[$i], $field_array); } while (list($key, $value) = each($updateField)) { $s = $s . " <textarea name='{$key}'>{$value}</textarea>\n"; update_zzsys_variables($key, $value, $field_array); } $s = $s . " <textarea name='sql1_old'>{$sql1}</textarea>\n"; $s = $s . " <textarea name='sql2_new'>{$sql2}</textarea>\n"; $s = $s . " <textarea name='sql3_newest'>{$sql3}</textarea>\n"; $s = $s . "</form></body></html>\n"; print $s; function hasDeleteBox($pParentID)
$graphTable = TT(); $s = "SELECT * FROM zzsys_activity_graph WHERE sag_zzsys_activity_id = '{$activityID}' AND sag_graph_name = '{$graph_name}'"; $tA = nuRunQuery($s); $graphObject = db_fetch_object($tA); $s = "SELECT * FROM zzsys_graph WHERE zzsys_graph_id = '{$graphObject->sag_graph_zzsys_graph_id}'"; $tB = nuRunQuery($s); $graphType = db_fetch_object($tB); //----------create an array of hash variables that can be used in any "hashString" $arrayOfHashVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $ses); //--session values (access level and user etc. ) $arrayOfHashVariables['#id#'] = $theRecordID; //--this record's id $arrayOfHashVariables['#clone#'] = $clone; //--if it is a clone $arrayOfHashVariables['#graphTable#'] = $graphTable; //--temp table name foreach ($_GET as $key => $value) { $arrayOfHashVariables["#{$key}#"] = $value; } //-- create a temp table called $graphTable eval(replaceHashVariablesWithValues($arrayOfHashVariables, $graphObject->sag_graph_code)); //--replace hash variables then run code //-- turn $graphTable into this type of graph eval(replaceHashVariablesWithValues($arrayOfHashVariables, $graphType->sgr_graph_code)); //--replace hash variables then run code //-----------custom code end--------------------------------------------------- //-- create a temp table called $graphTable // eval($graphObject->sag_graph_code); //-- turn $graphTable into this type of graph // eval($graphType->sgr_graph_code); nuRunQuery("DROP TABLE {$graphTable}");
$dataTable = TT(); $formValue = getSelectionFormVariables($form_ses); //----------allow for custom code---------------------------------------------- $globalValue = getglobalValue($_GET['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 $sesVariables['#dataTable#'] = $dataTable; $arrayOfHashVariables = joinHashArrays($sysVariables, $sesVariables); //--join the arrays together $newFormArray = arrayToHashArray($formValue); $arrayOfHashVariables = joinHashArrays($arrayOfHashVariables, $newFormArray); //--join the arrays together eval(replaceHashVariablesWithValues($arrayOfHashVariables, $A->sat_export_data_code)); //eval($A->sat_export_data_code); $ascii = $A->sat_export_delimiter; if ($A->sat_export_use_quotes == '0') { $dq = ''; } else { $dq = '"'; } $t = nuRunQuery("SELECT * FROM {$dataTable}"); $Field = array(); $Field = tableFieldNamesToArray($t); if ($A->sat_export_header != '0') { for ($i = 0; $i < count($Field); $i++) { if ($i > 0) { print chr($ascii); }
print " parent.opener.document.forms[0].submit();\n"; $theform = formFields($sysformID); nuRunQuery("DELETE FROM {$theform->sfo_table} WHERE {$theform->sfo_primary_key} = '{$recordID}'"); $t = nuRunQuery("SELECT * FROM zzsys_object WHERE sob_zzsys_form_id = '{$sysformID}' and sob_all_type = 'subform'"); while ($r = db_fetch_object($t)) { nuRunQuery("DELETE FROM {$r->sob_subform_table} WHERE {$r->sob_subform_foreign_key} = '{$recordID}'"); } //----------create an array of hash variables that can be used in any "hashString" $arrayOfHashVariables1 = postVariablesToHashArray(); //--values of this record $arrayOfHashVariables1['#id#'] = $theRecordID; //--this record's id $arrayOfHashVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $ses); //--session values (access level and user etc. ) $arrayOfHashVariables = joinHashArrays($arrayOfHashVariables, $arrayOfHashVariables1); //--join the arrays together $nuHashVariables = $arrayOfHashVariables; //--added by sc 23-07-2009 //----------allow for custom code---------------------------------------------- eval(replaceHashVariablesWithValues($arrayOfHashVariables, $theform->sfo_custom_code_run_after_delete)); } else { print " parent.frames['main'].document.forms[0].action = 'form.php?x=1&r={$recordID}&dir={$dir}&ses={$ses}&f={$sysformID}';\n"; print " parent.frames['main'].document.forms[0].submit();\n"; } print "}\n"; print "/* ]]> */ \n"; print "</script>\n"; print "<!-- End Of Form Functions -->\n"; print "</head>\n"; print "<body onload='reload()'>\n"; print "<form name='theform' action='' method='post'>\n";
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 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(); }
//--will not update readonly subforms updateSubform($_POST, $SF, $recordID); } } //----------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 = postVariablesToHashArray(); //--values in $_POST $arrayOfHashVariables = joinHashArrays($sysVariables, $sesVariables); //--join the arrays together $arrayOfHashVariables['#newID#'] = $recordID; $nuHashVariables = $arrayOfHashVariables; //--added by sc 23-07-2009 //----------allow for custom code---------------------------------------------- $code = replaceHashVariablesWithValues($arrayOfHashVariables, $form->sfo_custom_code_run_after_save); if ($_GET['debug'] != '') { tofile('sfo_custom_code_run_after_save hash variables : debug value:' . $_GET['debug']); tofile(print_r($arrayOfHashVariables, true)); tofile($code); } eval($code); print "<html>\n"; print "<head>\n"; print "<meta http-equiv='Content-Type' content='text/html;'/>\n"; print "<title></title>\n"; print "<!-- Form Functions -->\n"; print "<script type='text/javascript'>\n"; print "/* <![CDATA[ */\n"; print "function reload(pthis){// reload form.php\n"; if ($_POST['refresh_after_save'] == '1') {
function displayCondition($pHashArray, $pSQLString) { $string = replaceHashVariablesWithValues($pHashArray, $pSQLString); if ($string == '') { return true; } if ($_GET['debug'] != '') { tofile('displayCondition hash variables : debug value:' . $_GET['debug']); tofile(print_r($pHashArray, true)); tofile($string); } if ($_GET['debug'] != '') { tofile("display Condition : {$string}"); tofile(print_r($pHashArray, true)); } $t = nuRunQuery($string); $r = db_fetch_row($t); return $r[0] == '1'; }