private function buildHTMLForHtml($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue) { if (!$this->displayThisObject) { return ''; } if ($this->parentType == 'form') { //--not a subform $titleTableDetail = "{$TAB} <td class='selected' style='text-align:right'></td>{$CRLF}"; $tr1 = "{$TAB}<tr class='selected'>{$CRLF}"; $tr2 = "{$TAB}</tr>{$CRLF}"; $td1 = "{$TAB} <td class='selected' style='text-align:left'>{$CRLF}{$TAB} "; $td2 = "{$TAB} </td>{$CRLF}"; } else { $rowPrefix = $this->subformRowNumber; } $s = $titleTableDetail . $td1; $html = replaceHashVariablesWithValues($this->parentForm->arrayOfHashVariables, $this->objectProperty['sob_html_code']); if ($_GET['debug'] != '') { tofile('sob_html_code hash variables : debug value:' . $_GET['debug']); tofile(print_r($this->parentForm->arrayOfHashVariables, true)); tofile($html); } $s = $s . $CRLF . $CRLF . $html . $CRLF . $CRLF . $td2; return $tr1 . $s . $tr2; }
<?php /* ** File: formhelp.php ** Author: nuSoftware ** Created: 2007/04/26 ** Last modified: 2009/07/15 ** ** Copyright 2004, 2005, 2006, 2007, 2008, 2009 nuSoftware ** ** This file is part of the nuBuilder source package and is licensed under the ** GPLv3. For support on developing in nuBuilder, please visit the nuBuilder ** wiki and forums. For details on contributing a patch for nuBuilder, please ** visit the `Project Contributions' forum. ** ** Website: http://www.nubuilder.com ** Wiki: http://wiki.nubuilder.com ** Forums: http://forums.nubuilder.com */ include '../' . $_GET['dir'] . '/database.php'; include 'common.php'; $f = $_GET['f']; tofile("SELECT * FROM zzsys_form WHERE zzsys_form_id = '{$f}'"); $t = nuRunQuery("SELECT * FROM zzsys_form WHERE zzsys_form_id = '{$f}'"); $r = db_fetch_object($t); print "<html><head><title>Help for {$r->sfo_title} Screen</title></head>"; print "<body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000>"; print $r->sfo_help; print "</body></html>";
print "function goBack(){\n"; print " window.open(document.referrer,'_self');"; print "}\n"; print "\n"; print "</script>\n"; if ($stoplogin) { tofile('IN STOPLOGIN'); // 2009/07/15 - Nick changed failed login attempt to use document.referrer to go back to the login page print "<body onload='goBack();'>\n"; } else { $userID = iif($r->ID == '', 'globeadmin', $r->ID); // 2009/06/02 - Michael - added IP logging. nuRunQuery("INSERT INTO zzsys_user_log (zzsys_user_log_id, sul_zzsys_user_id, sul_ip, sul_start) VALUES ('{$id}', '{$userID}', '{$_SERVER['REMOTE_ADDR']}', '{$now}')"); // nuRunQuery("INSERT INTO zzsys_user_log (zzsys_user_log_id, sul_zzsys_user_id, sul_start) VALUES ('$id', '$userID', '$now')"); tofile("small : {$small}"); if ($small == '1') { tofile('IN SMALL = 1'); print "<body onload='document.index.submit();'>\n"; print "<form name='index' method='post' action='formsmall.php?x=1&r=-1&dir={$dir}&ses={$id}&f=index'></form>\n"; } else { tofile('IN SMALL <> 1'); print "<body onload='closeAndOpenForm();'>\n"; } } print "</body></html>\n"; tofile('cookie .. ' . $_COOKIE['security_check']); function security_check() { $GLOBALS['security_check'] = uniqid('1'); return $GLOBALS['security_check']; }
public function setValue($pRecordID, $pClone, $pValue) { $type = $this->objectProperty['sob_all_type']; if ($type == 'display') { //---replace any hashes with variables $sql = replaceVariablesInString($this->TT, $this->objectProperty['sob_display_sql'], $this->recordID); //---run sql and use the first row and colomn as the value for this field $t = nuRunQuery($sql); $r = db_fetch_row($t); return formatTextValue($r[0], $this->objectProperty['sob_display_format']); } if ($type == 'dropdown') { if ($pRecordID == '-1' or $pClone and $this->objectProperty['sob_all_clone'] != '1') { //---get default value from sob_text_default_value_sql if ($this->objectProperty['sob_dropdown_default_value_sql'] == '') { return ''; } //---replace any hashes with variables $sql = replaceVariablesInString($this->TT, $this->objectProperty['sob_dropdown_default_value_sql'], $this->recordID); //---run sql and use the first row and colomn as the default value for this field $t = nuRunQuery($sql); $r = db_fetch_row($t); return $r[0]; } return $pValue; //---return value already in record } if ($type == 'lookup') { if ($pRecordID == '-1' or $pClone and $this->objectProperty['sob_all_clone'] != '1') { //---get default value from sob_text_default_value_sql if ($this->objectProperty['sob_lookup_default_value_sql'] == '') { $this->lookupArray['id'] = ''; $this->lookupArray['code'] = ''; $this->lookupArray['description'] = ''; return ''; } $defaultValueSQL = replaceVariablesInString('', $this->objectProperty['sob_lookup_default_value_sql'], ''); $T = nuRunQuery($defaultValueSQL); $R = db_fetch_row($T); $pValue = $R[0]; } //------- //--get sql from lookup form $lookupFormID = $this->objectProperty['sob_lookup_zzsysform_id']; $t = nuRunQuery("SELECT * FROM zzsys_form WHERE zzsys_form_id = '{$lookupFormID}'"); $r = db_fetch_object($t); $TT = $this->TT; $browseTable = $TT; eval($r->sfo_custom_code_run_before_browse); $SQLwithGlobalValues = replaceVariablesInString($this->TT, $r->sfo_sql, ''); $SQLwithRecordValues = getSqlRecordValues($SQLwithGlobalValues, $this->parentForm->recordAndFieldValues); $SQL = new sqlString($SQLwithRecordValues); //------- // $SQL = new sqlString(replaceVariablesInString($this->TT,$this->objectProperty['sob_lookup_sql'], '')); tofile('sql step 1==' . $this->objectProperty['sob_lookup_sql']); $SQL->setWhere("WHERE " . $this->objectProperty['sob_lookup_id_field'] . " = '{$pValue}'"); $SQL->removeAllFields(); $SQL->addField($this->objectProperty['sob_lookup_id_field']); $SQL->addField($this->objectProperty['sob_lookup_code_field']); $SQL->addField($this->objectProperty['sob_lookup_description_field']); $T = nuRunQuery($SQL->SQL); tofile('step 111'); $R = db_fetch_row($T); $this->lookupArray['id'] = $R[0]; $this->lookupArray['code'] = $R[1]; $this->lookupArray['description'] = $R[2]; return $pValue; //---return value already in record } if ($type == 'inarray') { if ($pRecordID == '-1' or $pClone and $this->objectProperty['sob_all_clone'] != '1') { //---get default value from sob_text_default_value_sql if ($this->objectProperty['sob_inarray_default_value_sql'] == '') { return ''; } //---replace any hashes with variables $sql = replaceVariablesInString($this->TT, $this->objectProperty['sob_inarray_default_value_sql'], $this->recordID); //---run sql and use the first row and column as the default value for this field $t = nuRunQuery($sql); $r = db_fetch_row($t); return $r[0]; } return $pValue; //---return value already in record } if ($type == 'password') { return $pValue; } if ($type == 'text') { if ($pRecordID == '-1' or $pClone and $this->objectProperty['sob_all_clone'] != '1') { //---get default value from sob_text_default_value_sql if ($this->objectProperty['sob_text_default_value_sql'] == '') { return formatTextValue('', $this->objectProperty['sob_text_format']); } //---replace any hashes with variables $sql = replaceVariablesInString($this->TT, $this->objectProperty['sob_text_default_value_sql'], $this->recordID); //---run sql and use the first row and colomn as the default value for this field $t = nuRunQuery($sql); $r = db_fetch_row($t); return formatTextValue($r[0], $this->objectProperty['sob_text_format']); } return formatTextValue($pValue, $this->objectProperty['sob_text_format']); //---return value already in record } if ($type == 'textarea') { if ($pRecordID == '-1' or $pClone and $this->objectProperty['sob_all_clone'] != '1') { //---get default value from sob_text_default_value_sql if ($this->objectProperty['sob_textarea_default_value_sql'] == '') { return ''; } //---replace any hashes with variables $sql = replaceVariablesInString($this->TT, $this->objectProperty['sob_textarea_default_value_sql'], $this->recordID); //---run sql and use the first row and colomn as the default value for this field $t = nuRunQuery($sql); $r = db_fetch_row($t); return $r[0]; } return $pValue; //---return value already in record } }
function build_report($report_object) { //-- this function is called from report_object.php $page_height = $report_object->page_height; $sectionArray = $GLOBALS['nuSections']; $total_pages = $sectionArray[count($sectionArray) - 1]['the_page'] + 1; $obj = array(); $st = ''; $the_page = -1; $timestamp = date('Y-m-d H:i:s'); tofile('mid html 1: ' . date("H:i:s")); for ($G = 0; $G < count($sectionArray); $G++) { unset($section_array); unset($record); unset($controls); unset($S); $nuS = gzuncompress($sectionArray[$G]['the_section']); eval($nuS); //-- make section_array, record and controls from table record $S = new nuSection($emptySection, $new_page); //-- build a section using nothing $S->load_from_array($section_array, $record); for ($ct = 0; $ct < count($controls); $ct++) { //-- add controls to rebuilt section $S->controls[$ct] = new nuControl(null, null); $S->controls[$ct]->load_from_array($controls[$ct]); } if (!in_array($S->name, $obj)) { $style = 'position:relative;height:' . $S->height . "px"; if ($S->background_color == '#ebebeb') { $S->background_color = '#FFFFFF'; } $style .= ';background-color:' . $S->background_color . ';border-width:0px'; $st .= ' .' . $S->name . ' { ' . $style . "}\n"; $obj[] = $S->name; } for ($c = 0; $c < count($S->controls); $c++) { if (!in_array($S->controls[$c]->name, $obj)) { $name = $S->controls[$c]->name; $style = 'overflow:hidden;position:absolute;font-size:' . parseint($S->controls[$c]->font_size) . "px"; $style .= ';font-family:' . $S->controls[$c]->font_name; $style .= ';font-weight:' . $S->controls[$c]->font_weight; $style .= ';background-color:' . $S->controls[$c]->background_color; $style .= ';color:' . $S->controls[$c]->color; $style .= ';text-align:' . $S->controls[$c]->text_align; $style .= ';top:' . parseint($S->controls[$c]->top) . "px"; $style .= ';left:' . parseint($S->controls[$c]->left) . "px"; $style .= ';width:' . parseint($S->controls[$c]->width) . "px"; $style .= ';border-width:' . parseint($S->controls[$c]->border_width) . "px"; $style .= ';border-color:' . $S->controls[$c]->border_color; $style .= ';border-style:' . $S->controls[$c]->border_style; $st .= ' .' . $S->controls[$c]->name . ' { ' . $style . "}\n"; $obj[] = $S->controls[$c]->name; } } } $st1 = ""; $st1 .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"; $st1 .= "<html><!--version 3-->\n<head>\n<title></title>\n"; $st1 .= "<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\">\n"; $st1 .= "<script type='text/javascript' src='common.js'></script>\n"; $st1 .= "<style type='text/css'>\n\n\n"; print $st1 . $st . "</style>\n\n\n\n" . $report_object->javascript . "\n\n\n\n\n</head><body onload='LoadThis()' >\n\n\n\n"; for ($G = 0; $G < count($sectionArray); $G++) { unset($section_array); unset($record); unset($controls); unset($S); $nuS = gzuncompress($sectionArray[$G]['the_section']); eval($nuS); //-- make section_array, record and controls from table record $S = new nuSection($emptySection, $new_page); //-- build a section using nothing $S->load_from_array($section_array, $record); for ($ct = 0; $ct < count($controls); $ct++) { //-- add controls to rebuilt section $S->controls[$ct] = new nuControl(null, null); $S->controls[$ct]->load_from_array($controls[$ct]); } if ($sectionArray[$G]['the_page'] != $the_page) { //--end and start new page if ($the_page != -1) { //--if not first loop print "</div>\n\n"; print "<div style='position:relative;page-break-before:always;font-size:1px'>.</div>\n\n"; //15/07/09 nick: added in px } print "<div style='height:{$page_height}" . "px;'>\n"; $the_page = $sectionArray[$G]['the_page']; } if (!($S->height == '0' || $S->height == '0px')) { //--dont build it if the height is zero print " \n\n <div class='{$S->name}' style='height:{$S->height}" . "px;'>\n\n"; for ($c = 0; $c < count($S->controls); $c++) { $lineFormat = formatForPDFandHTML($S->controls[$c]->text_string[0]); //-- get any formatting stuff from the beginning of the string eg. #BOLD# $cHeight = $S->controls[$c]->height + $S->controls[$c]->extra_growth; $cSupposedToBeLine = $S->controls[$c]->height == 0 || $S->controls[$c]->height == '0'; $cName = $S->controls[$c]->name; $cTop = $S->controls[$c]->top; $data = ''; $style = $lineFormat['html']; $tags = ''; $endtags = ''; if ($lineFormat['bold'] == '1') { $tags = $tags . '<B>'; $endtags = $endtags . '</B>'; } if ($lineFormat['italic'] == '1') { $tags = $tags . '<I>'; $endtags = $endtags . '</I>'; } if ($lineFormat['underline'] == '1') { $tags = $tags . '<U>'; $endtags = $endtags . '</U>'; } for ($ts = 0; $ts < count($S->controls[$c]->text_string); $ts++) { if ($ts == 0) { $data = $data . iif($ts == 0, '', '<br />') . $lineFormat['string']; } else { $data = $data . iif($ts == 0, '', '<br />') . $S->controls[$c]->text_string[$ts]; } } $CC = $S->controls[$c]; if (!($cHeight == '0px' || $cHeight == '0') && !$cSupposedToBeLine) { $data = str_replace('#totalNumberOfPages#', $total_pages, $data); $data = str_replace('#thePageNumber#', $sectionArray[$G]['the_page'] + 1, $data); if (strtoupper($data) == '=NOW()' or strtoupper($data) == 'NOW()') { //-- set a timestamp $data = $timestamp; } print " <div class='{$cName}' style='top:{$cTop}" . "px;height:{$cHeight}{$style}" . "px'>{$tags}{$data}{$endtags}</div>\n"; } else { //what we are drawing is supposed to be a line, so set b/l/r border widths to 0 print " <div class='{$cName}' style='top:{$cTop}" . "px;height:{$cHeight}{$style}" . "px;border-left-width:0px;border-right-width:0px;border-bottom-width:0px;'>{$tags}{$data}{$endtags}</div>\n"; } } } print "\n </div>\n"; } print "</div>\n\n</html>\n\n"; }
function SplitLines($Width, $Height, $Caption, $BorderWidth, $ln, $TextAlign, $BackColor, $BackStyle, $Left, $Top, $CanGrowLines, $ControlsCount) { //$Caption = "<br>".$Caption; //$output = $this->parse($Caption); //$this->SetHTMLAttributes($Width,$Height,$output,$BorderWidth,$ln,$TextAlign,$BackColor,$BackStyle,$Left,$Top); //tofile($Caption); $Caption = str_replace("<br>", "\n", $Caption); $this->SetXY($Left, $Top); $this->MultiCell($Width + 0.1, $Height, $Caption, $BorderWidth, $TextAlign, $BackStyle); tofile("CanGrowLines: " . $CanGrowLines); if ($CanGrowLines > 0) { //$this->canGrowBy = (($Height/$this->resize) * $CanGrowLines) + ($this->toScale($this->report->Sections[0]->Height) - ($Height/$this->resize)); $this->canGrowBy = $Height / $this->resize * $CanGrowLines + ($this->toScale($this->report->Sections[0]->Height) - ($this->toScale($this->report->Controls[$ControlsCount]->Top) + $this->toScale($this->report->Controls[$ControlsCount]->Height))); $this->setCurrentLength($this->canGrowBy); } }
$SQL->setWhere(" {$SQL->where} AND ({$object->sob_lookup_id_field} = '{$rID}')"); } $SQL->removeAllFields(); $SQL->addField($object->sob_lookup_id_field); $fieldNames[] = $object->sob_all_name; $SQL->addField($object->sob_lookup_code_field); $fieldNames[] = 'code' . $object->sob_all_name; $SQL->addField($object->sob_lookup_description_field); $fieldNames[] = 'description' . $object->sob_all_name; $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[] = $r->zzsys_slo_page_field_name; } $t = nuRunQuery($SQL->SQL); $fieldArray = tableFieldNamesToArray($t); $T = nuRunQuery($SQL->SQL); $R = db_fetch_row($T); for ($i = 0; $i < count($fieldArray); $i++) { tofile("UPDATE zzsys_small_form_value SET sfv_value = '" . $R[$i] . "' WHERE sfv_form_record = '{$f}{$fr}{$ses}' AND sfv_name = '" . $fieldNames[$i] . "'"); nuRunQuery("UPDATE zzsys_small_form_value SET sfv_value = '" . $R[$i] . "' WHERE sfv_form_record = '{$f}{$fr}{$ses}' AND sfv_name = '" . $fieldNames[$i] . "'"); } $url = "formsmall.php?x=11&f={$f}&fr={$fr}&r={$rID}&dir={$dir}&ses={$ses}"; print "<html>\n<body onload=\"document.forms.lookup.submit()\">\n"; print "<form name='lookup' method='POST' action='{$url}'>\n</form>\n"; print "</body>\n</html>\n"; return; ?>
function buildFinalObject($OLP) { //-- OLP = one long page $Final_Object = new nuReport($OLP, $OLP->displayJavaScript()); $Final_Object->page_height = $OLP->page_height; $Final_Object->page_width = $OLP->page_width; $new_page = new nuPage(); $reportSectionsArray = $GLOBALS['nuSections']; unset($GLOBALS['nuSections']); for ($G = 0; $G < count($reportSectionsArray); $G++) { unset($section_array); unset($record); unset($controls); unset($S); $nuS = gzuncompress($reportSectionsArray[$G]['the_section']); eval($nuS); //-- make section_array, record and controls from table record $S = new nuSection($emptySection, $new_page); //-- build a section using nothing $S->load_from_array($section_array, $record); for ($ct = 0; $ct < count($controls); $ct++) { //-- add controls to rebuilt section $S->controls[$ct] = new nuControl(null, null); $S->controls[$ct]->load_from_array($controls[$ct]); } if ($S->original_height > $OLP->get_remaining_height()) { //====start another page because the next section won't fit $new_section = new nuSection($S, $new_page); $new_section->height = $OLP->get_remaining_height(); //-- build a blank section the size of the remaining height $new_section->name = 'Padding'; //-- name this section as 'PageBreak' buildClassCode($new_section, count($Final_Object->pages)); //==========page footer=========================== if ($S->name != "Report_Header") { $page_footer = $OLP->page_footer; $temp_section = new nuSection($page_footer, $new_page); for ($pf = 0; $pf < count($page_footer->controls); $pf++) { $temp_control = new nuControl($page_footer->controls[$pf], $S); $temp_control->text_string = formatControlValue($temp_control, $S->record, $OLP); $temp_section->controls[] = $temp_control; } $temp_section->record = $new_section->record; buildClassCode($temp_section, count($Final_Object->pages)); } //==========end page footer======================= $Final_Object->pages[] = $new_page; $new_page = new nuPage(); //-- build new page //==========page header=========================== if ($S->name != "Report_Header") { $page_header = $OLP->page_header; $temp_section = new nuSection($page_header, $new_page); for ($pf = 0; $pf < count($page_header->controls); $pf++) { $temp_control = new nuControl($page_header->controls[$pf], $S); $temp_control->text_string = formatControlValue($temp_control, $S->record, $OLP); $temp_section->controls[] = $temp_control; } $temp_section->record = $new_section->record; buildClassCode($temp_section, count($Final_Object->pages)); } //==========end page header======================= $OLP->reset_remaining_height(); } while (!$S->finished('while')) { $new_section = new nuSection($S, $new_page); for ($c = 0; $c < count($S->controls); $c++) { //-- LOOP THROUGH ALL CONTROLS if ($S->controls[$c]->top + 1 < $OLP->get_remaining_height()) { $new_control = new nuControl($S->controls[$c], $S); //-- setup control properties if ($new_control->type == 'PageBreak') { $new_section->height = $new_section->section_height(); //-- resize height to lowest control $OLP->reduce_remaining_height($new_section->height); //-- reset the remaining height of the page buildClassCode($new_section, count($Final_Object->pages)); $new_section = new nuSection($S, $new_page); $new_section->height = $OLP->get_remaining_height(); //-- build a blank section the size of the remaining height $new_section->name = 'PageBreak'; //-- name this section as 'PageBreak' break; } else { $new_control->top = $S->controls[$c]->top(); //-- set height to 0 if not first time through $usable_height = $OLP->get_remaining_height() - $new_control->top; //-- area this control has to fit in $new_control->text_string = $S->controls[$c]->get_lines($usable_height); //-- put fittable rows into the control if ($new_control->type == 'Graph') { $new_control->last_used = 0; //-- set graph as completed } $new_control->height = count($new_control->text_string) * $new_control->height; //-- resize height of this control $new_section->controls[] = $new_control; //-- add control to current section } } else { if ($OLP->get_remaining_height() > 0) { $S->controls[$c]->top = $S->controls[$c]->top - $OLP->get_remaining_height(); //-- reduce control's top for next section } } } if ($new_control->type != 'PageBreak') { $new_section->height = $new_section->section_height(); //-- resize height to lowest control } $OLP->reduce_remaining_height($new_section->height); //-- reset the remaining height of the page buildClassCode($new_section, count($Final_Object->pages)); if (!$S->finished('if') or $new_control->type == 'PageBreak') { //-- add a page break $new_section = new nuSection($S, $new_page); $new_section->height = $OLP->get_remaining_height(); //-- build a blank section the size of the remaining height $new_section->name = 'Padding'; //-- name this section as 'PageBreak' buildClassCode($new_section, count($Final_Object->pages)); //==========page footer=========================== if ($S->name != "Report_Header") { $page_footer = $OLP->page_footer; $temp_section = new nuSection($page_footer, $new_page); for ($pf = 0; $pf < count($page_footer->controls); $pf++) { $temp_control = new nuControl($page_footer->controls[$pf], $S); $temp_control->text_string = formatControlValue($temp_control, $S->record, $OLP); $temp_section->controls[] = $temp_control; } $temp_section->record = $new_section->record; buildClassCode($temp_section, count($Final_Object->pages)); } //==========end page footer======================= $Final_Object->pages[] = $new_page; $new_page = new nuPage(); //-- build new page //==========page header=========================== if ($S->name != "Report_Header") { $page_header = $OLP->page_header; $temp_section = new nuSection($page_header, $new_page); for ($pf = 0; $pf < count($page_header->controls); $pf++) { $temp_control = new nuControl($page_header->controls[$pf], $S); $temp_control->text_string = formatControlValue($temp_control, $S->record, $OLP); $temp_section->controls[] = $temp_control; } $temp_section->record = $new_section->record; buildClassCode($temp_section, count($Final_Object->pages)); } //==========end page header======================= //-- push down remaining objects by the remaining gap that couldn't be used on this page $push_down_from = $S->push_down_from(); $add_height = $OLP->get_remaining_height(); $grow_section = false; for ($pd = $push_down_from; $pd < count($S->controls); $pd++) { $S->controls[$pd]->top = $S->controls[$pd]->top + $add_height; $grow_section = true; } if ($grow_section) { $S->height = $S->height + $add_height; } $OLP->reset_remaining_height(); } } } //==========padding between report footer and page footer $new_section = new nuSection($S, $new_page); $new_section->height = $OLP->get_remaining_height(); //-- build a blank section the size of the remaining height $new_section->name = 'PageBreak'; //-- name this section as 'PageBreak' buildClassCode($new_section, count($Final_Object->pages)); //==========page footer=========================== $page_footer = $OLP->page_footer; $temp_section = new nuSection($page_footer, $new_page); $temp_section->record = $S->record; for ($pf = 0; $pf < count($page_footer->controls); $pf++) { $temp_control = new nuControl($page_footer->controls[$pf], $S); $temp_control->text_string = formatControlValue($temp_control, $S->record, $OLP); $temp_section->controls[] = $temp_control; } $temp_section->record = $new_section->record; buildClassCode($temp_section, count($Final_Object->pages)); $Final_Object->pages[] = $new_page; build_report($Final_Object); tofile('end ' . date('Y-m-d H:i:s')); }
$filename = $_FILES['uploadedfile']['tmp_name']; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); $contents = addslashes($contents); fclose($handle); $newRecord = false; if ($iid == '-1' or $iid == '') { $iid = uniqid('1'); $newRecord = true; } if ($newRecord) { nuRunQuery("INSERT INTO zzsys_image (zzsys_image_id, sim_blob) VALUES ('{$iid}','{$contents}')"); tofile('new'); } else { nuRunQuery("UPDATE zzsys_image SET sim_blob = '{$contents}' WHERE zzsys_image_id = '{$iid}'"); tofile('old'); } print "<script>\n\n"; print "function closedown(){\n"; //--- set zzsys_image_id on opener page print " window.opener.document.getElementById('recordID').value = '{$iid}';\n\n"; print " if(window.opener.nuAfterUpload){\n"; print " window.opener.nuAfterUpload('recordID');\n"; print " };\n\n"; print " self.close();\n\n"; print "}\n"; print "</script>\n"; print "<body onload=' closedown()'>\n"; } print "</body>"; print "</html>";
public function buildBody() { $percentAmount = 1; $select = ''; $dq = '"'; $this->SQL->removeAllFields(); $s = "<table >{$this->CRLF}"; $s = $s . "<tr >{$this->CRLF}"; for ($i = 0; $i < count($this->Column); $i++) { $this->SQL->addField($this->Column[$i]->sbr_display); $a = align($this->Column[$i]->sbr_align); $s = $s . "{$this->TAB}<th align='{$a}' bgcolor='lightgrey'>{$this->CRLF}"; $desc = iif($i == $this->orderBy and $this->isDescending == '', '1', ''); $s = $s . "{$this->TAB}{$this->TAB}<a href='#' onclick='newOrder({$dq}{$i}{$dq}, {$dq}{$desc}{$dq})'>" . $this->Column[$i]->sbr_title . "</a>{$this->CRLF}"; $s = $s . "{$this->TAB}</th>{$this->CRLF}"; } $s = $s . "</tr>{$this->CRLF}"; $page = ($this->PageNo - 1) * $this->pageLength; tofile("{$page} = ({$this->PageNo} -1) * {$this->pageLength}"); $this->SQL->addField($this->callingForm->sfo_primary_key); $primaryKeyNumber = count($this->SQL->fields) - 1; $t = nuRunQuery($this->SQL->SQL . " LIMIT {$page}, 9"); $top = -15; $row = 0; while ($r = db_fetch_row($t)) { $theID = $r[$primaryKeyNumber]; $rowname = 'rw' . substr('0' . $row, -2); $param = '"' . $rowname . '"'; $left = 0; $top = $top + $this->rowHeight; $s = $s . "<tr id='browse'>{$this->CRLF}"; $color = iif($color == 'Gainsboro', 'white', 'Gainsboro'); for ($i = 0; $i < count($this->Column); $i++) { $w = $this->Column[$i]->sbr_width * $percentAmount; $a = align($this->Column[$i]->sbr_align); $s = $s . "{$this->TAB}<td bgcolor='{$color}' align='{$a}'>{$this->CRLF}"; if ($i == 0) { if ($this->isLookup) { $theObject = $this->objectID; $s = $s . "{$this->TAB}{$this->TAB} <a href='formlookupsmall.php?x=1&f={$this->theFormID}&ob={$theObject}&r={$theID}&fr=" . $_GET['fr'] . "&dir=" . $_GET['dir'] . "&ses=" . $_GET['ses'] . "'>" . formatTextValue($r[$i], $this->Column[$i]->sbr_format) . "</a> {$this->CRLF}"; } else { $s = $s . "{$this->TAB}{$this->TAB} <a href='formsmall.php?x=1&f={$this->theFormID}&fr={$theID}&dir=" . $_GET['dir'] . "&ses=" . $_GET['ses'] . "'>" . formatTextValue($r[$i], $this->Column[$i]->sbr_format) . "</a> {$this->CRLF}"; } } else { $s = $s . "{$this->TAB}{$this->TAB} " . formatTextValue($r[$i], $this->Column[$i]->sbr_format) . " {$this->CRLF}"; } $s = $s . "{$this->TAB}</td>{$this->CRLF}"; } $s = $s . "{$this->TAB}</tr>{$this->CRLF}"; $row = $row + 1; } $s = $s . '</table>'; return $s; }
public function buildReport() { tofile('step 1 :' . time()); $t = nuRunQuery("SELECT * FROM {$this->TT} {$this->orderBy}"); $lastRecord = array(); $isFirstRecord = true; $counter = 0; while ($thisRecord = db_fetch_array($t)) { //tofile('step 1.5 :'.time()); $counter = $counter + 1; //=======start off with all the headers for first record================================= if ($isFirstRecord) { //---build report header and first page header $this->buildSection($this->reportHeader, false, $thisRecord); $this->buildSection($this->pageHeader, false, $thisRecord); if ($this->noData) { return; } $lastRecord = $thisRecord; } //=======loop through records============================================================ //---check if groups have changed $buildHeader = -1; for ($i = count($this->breakOn); $i >= 0; $i--) { if ($lastRecord[$this->breakOn[$i]] != $thisRecord[$this->breakOn[$i]]) { $buildHeader = $i; } } //---build footers back to group that has changed (eg. $buildHeader=9 build 9,11,13) if (!$isFirstRecord) { if ($buildHeader != -1) { for ($i = count($this->breakOn); $i >= $buildHeader; $i--) { $this->buildSection($i * 2 + 6, true, $lastRecord); } } } //---build headers forward to group that has changed (eg. $buildHeader=9 build 14,12,10) if ($isFirstRecord) { $buildHeader = 0; } if ($buildHeader != -1 or $isFirstRecord) { for ($i = $buildHeader; $i < count($this->breakOn); $i++) { $this->buildSection($i * 2 + 5, true, $thisRecord); } } //---build detail section $this->buildSection(0, true, $thisRecord); $lastRecord = $thisRecord; $isFirstRecord = false; } tofile('step 2 :' . time()); //=======finish off footers at end of report============================================ //---build last group footers for ($i = 20; $i >= 0; $i--) { $this->buildSection($this->footerNumbers[$i], true, $lastRecord); } $this->buildSection($this->reportFooter, false, $lastRecord); $spaceToEndOfPage = $this->useablePageLength - $this->thisPageLength; $s = " <div name='filler' style='position:relative;height:{$spaceToEndOfPage}'>\n </div>\n\n"; $this->addReportSection(false, $spaceToEndOfPage, $s, '-1', 'filler'); $this->buildSection($this->pageFooter, false, $lastRecord, true); }
//----------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') { print " try{if(parent.opener.document.forms[0].name=='thebrowse'){parent.opener.document.forms[0].submit();}}catch(err){}\n"; } if ($_POST['close_after_save'] == '1') { print " parent.window.close();\n";
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'; }