function run_html_report() { $parameters = $_GET['ses']; $form_ses = $_GET['form_ses']; $report = $_GET['r']; $dir = $_GET['dir']; $emailer = $_GET['emailer']; include_once "../{$dir}/database.php"; include_once 'common.php'; if ($emailer != '1') { if (activityPasswordNeeded($report)) { $session = nuSession($parameters, false); if ($session->foundOK == '') { print 'you have been logged out..'; return; } } } $setup = nuSetup(); $T = nuRunQuery("SELECT * FROM zzsys_activity WHERE sat_all_code = '{$report}'"); $A = db_fetch_object($T); //----------allow for custom code---------------------------------------------- //--already done now.. eval($A->sat_report_display_code); $id = uniqid('1'); $thedate = date('Y-m-d H:i:s'); $dq = '"'; if ($A->zzsys_activity_id != '') { //$viewer = $_SESSION['zzsys_user_id']; $viewer = $session->sss_zzsys_user_id; $s = "INSERT INTO zzsys_report_log (zzsys_report_log_id, "; $s = $s . "srl_zzsys_activity_id, srl_date ,srl_viewer) "; $s = $s . "VALUES ('{$id}', '{$report}', '{$thedate}', '{$viewer}')"; nuRunQuery($s); } else { print 'No Such Report...'; return; } $s = "SELECT count(*), MAX(sva_expiry_date) FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "GROUP BY sva_expiry_date"; $t1 = nuRunQuery($s); $r1 = db_fetch_row($t1); $numberOfVariables = $r1[0]; $expiryDate = $r1[1]; //---must have at least 1 variable if ($numberOfVariables > 0) { $s = "DELETE FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "AND sva_name = 'ReportTitle'"; nuRunQuery($s); setnuVariable($form_ses, $expiryDate, 'ReportTitle', $A->sat_all_description); MakeReport($form_ses, $A); } else { print 'Report has Expired...'; } }
function loadAfterConstruct($theFormID, $theRecordID, $clone, $delete, $runActivity, $dir, $ses, $tempObjectTable, $session) { $this->access_level = $session->sss_access_level; $this->session_id = $session->sss_session_id; $this->zzsys_user_id = $session->sss_zzsys_user_id; $this->zzsys_user_group_name = $session->sss_zzsys_user_group_name; $this->startTime = time(); $this->objectTableName = $tempObjectTable; $this->customDirectory = $dir; $this->session = $ses; $this->formsessionID = uniqid('1'); nuRunQuery("DELETE FROM zzsys_variable WHERE sva_id = '{$this->formsessionID}'"); $this->formID = $theFormID; //---Primary Key of zzsys_form Table $this->form = formFields($theFormID); $this->recordID = $theRecordID; //---ID of displayed record (-1 means a new record) setnuVariable($this->formsessionID, nuDateAddDays(Today(), 2), 'recordID', $this->recordID); $this->cloning = $clone; //---Whether this will be a new record cloned from $formID's record $this->delete = $delete; $this->setup = nuSetup(); //----------create an array of hash variables that can be used in any "hashString" if ($this->form->sfo_report_selection != '1') { $T = nuRunQuery("SELECT " . $this->form->sfo_table . ".* FROM " . $this->form->sfo_table . " WHERE " . $this->form->sfo_primary_key . " = '{$this->recordID}'"); $this->recordValues = db_fetch_array($T); $this->arrayOfHashVariables = recordToHashArray($this->form->sfo_table, $this->form->sfo_primary_key, $this->recordID); //--values of this record } $this->arrayOfHashVariables['#recordID#'] = $theRecordID; //--this record's id $this->arrayOfHashVariables['#id#'] = $theRecordID; //--this record's id $this->arrayOfHashVariables['#clone#'] = $clone; //--if it is a clone $this->arrayOfHashVariables['#formSessionID#'] = $this->formsessionID; //--form session id $sVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $ses); //--session values (access level and user etc. ) $this->arrayOfHashVariables = joinHashArrays($this->arrayOfHashVariables, $sVariables); //--join the arrays together $nuHashVariables = $this->arrayOfHashVariables; //--added by sc 23-07-2009 //----------allow for custom code---------------------------------------------- //--replace hash variables then run code $runCode = replaceHashVariablesWithValues($this->arrayOfHashVariables, $this->form->sfo_custom_code_run_before_open); if ($_GET['debug'] != '') { tofile('sfo_custom_code_run_before_open hash variables : debug value:' . $_GET['debug']); tofile(print_r($this->arrayOfHashVariables, true)); tofile($runCode); } eval($runCode); if ($newRecordID != '') { $this->recordID = $newRecordID; } //-----------custom code end--------------------------------------------------- $this->runActivity = $runActivity; //----defaultJSfunctions needs $formTabs populated first $this->defaultJSfunctions(); $this->createActionButtonsHTML(); }
function update_zzsys_variables($pField, $pValue, $field_array) { $form_ses = $_GET['form_ses']; setnuVariable($form_ses, nuDateAddDays(Today(), 2), $pField, $pValue); }
public function buildObjectHTML($CRLF, $TAB, $PREFIX) { $dq = '"'; $fieldName = $PREFIX . $this->objectProperty['sob_all_name']; $fieldTitle = htmlentities($this->objectProperty['sob_all_title']); $fieldValue = htmlentities($this->objectValue); $type = $this->objectProperty['sob_all_type']; setnuVariable($this->formsessionID, nuDateAddDays(Today(), 2), $fieldName, $this->objectValue); if ($type == 'button') { $htmlString = $this->buildHTMLForButton($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue); } if ($type == 'display') { $htmlString = $this->buildHTMLForDisplay($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue); } if ($type == 'dropdown') { $htmlString = $this->buildHTMLForDropdown($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue, $PREFIX); } if ($type == 'graph') { $htmlString = $this->buildHTMLForGraph($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue); } if ($type == 'image') { $htmlString = $this->buildHTMLForImage($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue); } if ($type == 'inarray') { $htmlString = $this->buildHTMLForInarray($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue, $PREFIX); } if ($type == 'listbox') { $htmlString = $this->buildHTMLForListbox($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue); } if ($type == 'lookup') { $htmlString = $this->buildHTMLForLookup($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue, $PREFIX); } if ($type == 'text') { $htmlString = $this->buildHTMLForText($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue, $PREFIX); } if ($type == 'textarea') { $htmlString = $this->buildHTMLForTextarea($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue, $PREFIX); } if ($type == 'words') { $htmlString = $this->buildHTMLForWords($CRLF, $TAB); } return $htmlString; }
$runphp = $_GET['runphp']; $name = $_GET['name']; $id = $_GET['id']; $ses = $_GET['ses']; print $type . ' second time through:' . $runphp . ' ' . $name; if ($runphp == 'ok') { // run second time through if ($type == 'list') { setnuList($id, nuDateAddDays(Today(), 2), $name, $_POST['TheList']); } elseif ($type == 'lookup') { $name = substr($name, 4); setnuVariable($id, nuDateAddDays(Today(), 2), $name, $_POST['TheID']); setnuVariable($id, nuDateAddDays(Today(), 2), 'code' . $name, $_POST['TheCode']); setnuVariable($id, nuDateAddDays(Today(), 2), 'description' . $name, $_POST['TheName']); } else { setnuVariable($id, nuDateAddDays(Today(), 2), $name, $_POST['TheField']); } } else { $s = "<html>\n<head>\n"; $s = $s . "<meta http-equiv='Content-Type' content='text/html;'/>\n"; $s = $s . "<script type='text/javascript'>\n"; $s = $s . "/* <![CDATA[ */\n"; if ($type == 'list') { $s = $s . "function getData(){\n"; $s = $s . " var myEle = new Object();\n"; $s = $s . " var lb = new Object(window.parent.frames[0].document.getElementById('theform').{$name});\n"; $s = $s . " for (i=0 ; i < lb.length ; i++){\n"; $s = $s . " if(lb[i].selected){\n"; $s = $s . " myEle = document.createElement('option');\n"; $s = $s . " myEle.value = lb[i].value;\n"; $s = $s . " myEle.selected = true;\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); }
return; } $s = "SELECT count(*), MAX(sva_expiry_date) FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "GROUP BY sva_expiry_date"; $t1 = nuRunQuery($s); $r1 = db_fetch_row($t1); $numberOfVariables = $r1[0]; $expiryDate = $r1[1]; //---must have at least 1 variable if ($numberOfVariables > 0) { $s = "DELETE FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "AND sva_name = 'ReportTitle'"; nuRunQuery($s); setnuVariable($form_ses, $expiryDate, 'ReportTitle', $A->sat_all_description); MakeReport($form_ses, $A); } else { print 'Report has Expired...'; } function MakeReport($parameters, $ACTIVITY) { $theReport = new reportDisplay($parameters, $ACTIVITY); $theReport->pageLength = $ACTIVITY->sat_report_page_length; $theReport->setPageLength($ACTIVITY->sat_report_page_length); $theReport->buildReport(); print $theReport->styleSheet; $pageNo = 1; //-first page start div $theReport->section[0]->html = "\n<!-- start of page -->\n<div style='height:{$theReport->pageLength}'>\n" . $theReport->section[0]->html; //-last page end div