private function buildHTMLForText($CRLF, $TAB, $fieldName, $fieldTitle, $fieldValue, $PREFIX)
 {
     if ($this->displayThisObject) {
         if ($this->objectProperty['sob_text_password'] == '1') {
             $inputType = 'password';
         } else {
             $inputType = 'text';
             $textFormat = $this->objectProperty['sob_text_format'];
         }
     } else {
         $inputType = 'hidden';
         $fieldTitle = '';
     }
     if ($this->parentType == 'form') {
         //--not a subform
         $titleTableDetail = "{$TAB}  <td class='selected' bgcolor='{$this->bgcolor}' style='text-align:right'>{$fieldTitle}</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;
     }
     if ($PREFIX != '') {
         $untick = "untick('{$PREFIX}');";
     }
     $style = $this->addStyle('width', $this->objectProperty['sob_text_length'] * 16);
     $style = $style . $this->addStyle('text-align', align($this->objectProperty['sob_text_align']));
     $s = $titleTableDetail . $td1;
     $s = $s . "<input ";
     $s = $s . $this->addProperty('type', $inputType);
     $s = $s . $this->addProperty('accept', $textFormat);
     $s = $s . $this->addProperty('name', $this->subformPrefix . $fieldName);
     $s = $s . $this->addProperty('id', $this->subformPrefix . $fieldName);
     $s = $s . $this->addProperty('value', $fieldValue);
     $s = $s . $this->addProperty('accesskey', $this->objectProperty['sob_all_access_key']);
     if ($inputType == 'text') {
         if ($this->objectProperty['sob_all_class'] == '') {
             $s = $s . $this->addProperty('class', 'objects');
         } else {
             $s = $s . $this->addProperty('class', $this->objectProperty['sob_all_class']);
         }
         $s = $s . $this->addProperty('style', $style);
         //			$s = $s . $this->addProperty('onchange'       , $untick."uDBsmall(this,'text');".$this->objectProperty['sob_all_on_change']);
         $s = $s . $this->addProperty('onchange', $untick . "nuFormat(this);" . $this->objectProperty['sob_all_on_change']);
         $s = $s . $this->addProperty('onblur', $this->objectProperty['sob_all_on_blur']);
         $s = $s . $this->addProperty('onfocus', $this->objectProperty['sob_all_on_focus']);
         $s = $s . $this->addProperty('onkeypress', $this->objectProperty['sob_all_on_keypress']);
         $s = $s . $this->addProperty('ondblclick', $this->objectProperty['sob_all_on_doubleclick']);
     }
     if ($this->objectProperty['sob_text_read_only'] == '1') {
         $s = $s . " readonly='readonly' ";
     }
     $s = $s . "/>{$CRLF}";
     $format = textFormatsArray();
     $s = $s . $td2;
     return $tr1 . $s . $tr2;
 }
 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;'>&nbsp;Delete&nbsp;</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 calcFunction($nuFunction, $pControl, $pRecord, $pGroup, $pReport)
{
    $FieldList = array();
    $strip_out = array('=', 'SUM', 'PERCENT', 'sum', 'precent', 'Sum', 'Percent', '(', ')', '[', ']', ' ');
    //--strings to strip out of source
    if ($nuFunction == 1 or $nuFunction == 2) {
        //--sum or percent function
        if ($pReport->no_data) {
            return 0;
        }
        $field_list = str_replace($strip_out, '', $pControl->source);
        $fields = explode(',', $field_list);
        if ($nuFunction == 1) {
            $selectFields = "SUM(" . $fields[0] . "_Sum) as answerA ";
        } else {
            $selectFields = "SUM(" . $fields[0] . "_Sum) as answerA, SUM(" . $fields[1] . "_Sum) as answerB ";
        }
        $groupSQL = $pReport->getGroupBySql($pReport->sectionLevel($pControl->section), $selectFields, $pRecord);
        $t = nuRunQuery($groupSQL);
        $r = mysql_fetch_row($t);
        if ($nuFunction == 1) {
            return formatTextValue($r[0], $pControl->format);
        } else {
            if ($r[0] == 0) {
                return formatTextValue(0, $pControl->format);
            } else {
                return formatTextValue($r[0] / $r[1], $pControl->format);
            }
        }
    }
    if ($nuFunction == 3 or $nuFunction == 4) {
        //--date or now function
        $formats = textFormatsArray();
        $n = date("H:i:s");
        $d = date($formats[$pControl->format]->phpdate);
        if ($nuFunction == 4) {
            //--now function
            $d = "{$d} {$n}";
        }
        return $d;
    }
}
**   Forums:   http://forums.nubuilder.com
*/
session_start();
$target = $_GET['target'];
$theFormat = $_GET['theFormat'];
$theDay = $_GET['theDay'];
$dir = $_GET['dir'];
$ses = $_GET['ses'];
$f = $_GET['f'];
$r = $_GET['r'];
$c = $_GET['c'];
$delete = $_GET['delete'];
include "../{$dir}/database.php";
include 'common.php';
print "<html>\n<body>\n<form id='theform' action='' method='post'>\n";
$formatArray = textFormatsArray();
$returnDateFormat = convertToPhpDateFormat($formatArray[$theFormat]->format);
$returnDateFormat6 = convertToPhpDateFormat($formatArray[6]->format);
$dayFirst = substr($formatArray[$theFormat]->format, 0, 1) == 'd';
$dq = '"';
$dateButton = array();
for ($i = 0; $i < 42; $i++) {
    $dateButton[$i]->tag = '';
    $dateButton[$i]->title = '.';
}
// set date to yyyy-mm-dd
if ($theDay == '') {
    //		$theDay                     = nuDateFormat(Today(),$returnDateFormat);
    $theDay = nuDateFormat(Today(), $returnDateFormat6);
    //tofile("theDay  $theDay");
}
 function __construct($pObject)
 {
     $this->obj = $pObject;
     $this->tag = $GLOBALS['controlType'][$this->obj->ControlType];
     $this->font_weight = $this->obj->FontWeight;
     $this->font_family = $this->obj->FontName;
     $alignment = array('left', 'left', 'center', 'right');
     $this->text_align = $alignment[$this->obj->TextAlign];
     if ($this->text_align == '') {
         $this->text_align = $this->obj->TextAlign;
     }
     $this->value = $this->obj->Value;
     if ($this->tag == 'Label') {
         $this->value = $this->obj->Caption;
     }
     if ($this->tag == 'Field') {
         $this->value = $this->obj->ControlSource;
     }
     if ($this->tag == 'Graph') {
         $this->obj->BackColor = 'black';
     }
     if ($this->tag == 'Graph') {
         $this->obj->ForeColor = 'white';
     }
     if ($this->tag == 'Graph') {
         $this->obj->FontSize = '10px';
     }
     if ($this->tag == 'PageBreak') {
         $this->obj->BorderColor = 'black';
     }
     if ($this->tag == 'PageBreak') {
         $this->obj->borderWidth = '4px';
     }
     if ($this->tag == 'PageBreak') {
         $this->obj->height = 4 * resize() . "px";
     }
     //Nick 21/07/09 added ."px"
     if ($this->tag == 'PageBreak') {
         $this->obj->width = 44 * resize() . "px";
     }
     //Nick 21/07/09 added ."px"
     if ($this->tag == 'PageBreak') {
         $this->obj->left = 0 * resize() . "px";
     }
     //Nick 21/07/09 added ."px"
     $this->name = $this->obj->Name;
     if (isNB()) {
         //-- is nuBuilder
         if ($this->tag == 'Graph') {
             $this->value = $this->obj->Value;
         }
         if ($this->tag == 'Graph') {
             $this->graph = $this->obj->Graph;
         }
         $this->font_size = parseInt($this->obj->FontSize) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->top = parseInt($this->obj->Top) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->left = parseInt($this->obj->Left) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->width = parseInt($this->obj->Width) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->height = parseInt($this->obj->Height) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
     } else {
         if ($this->tag == 'Graph') {
             $this->value = $this->obj->Tag;
         }
         if ($this->tag == 'Graph') {
             $this->graph = $this->obj->Name;
         }
         if ($this->font_family == 'Arial') {
             $this->font_size = floor(parseInt($this->obj->FontSize) * 1.3) . "px";
             //Nick 21/07/09 added ."px"
         } else {
             $this->font_size = floor(parseInt($this->obj->FontSize) * 1.5) . "px";
             //Nick 21/07/09 added ."px"
         }
         $this->top = parseInt($this->obj->Top * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->left = parseInt($this->obj->Left * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->width = parseInt($this->obj->Width * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
         $this->height = parseInt($this->obj->Height * resize()) . "px";
         //Nick 21/07/09 wrapped in parseInt()."px"
     }
     $this->color = $this->obj->ForeColor;
     $this->back_ground_color = $this->obj->BackColor;
     $this->border_width = parseInt($this->obj->BorderWidth) . "px";
     //Nick 21/07/09 wrapped in parseInt()."px"
     $this->border_color = $this->obj->BorderColor;
     $this->border_style = $this->obj->BorderStyle;
     $this->can_grow = $this->obj->CanGrow;
     $textFormat = textFormatsArray();
     $this->format = $this->obj->Format;
     $this->HTML = $this->buildHTML();
 }
function formatSQLWhereCriteria($pBrowseObject)
{
    if ($pBrowseObject->sbr_format == '') {
        return $pBrowseObject->sbr_display;
    } else {
        //-- get number and date format array
        $sFormat = textFormatsArray();
        return str_replace("??", $pBrowseObject->sbr_display, $sFormat[$pBrowseObject->sbr_format]->sql);
    }
}
function reformatField($pValue, $pFormat, $addSingleQuotes = true)
{
    // reformats value ready for insertion into database table
    //originally formatted via rules in textFormatsArray()
    $FORMAT = textFormatsArray();
    $sq = "";
    if ($FORMAT[$pFormat]->type == 'date' and $pValue == '') {
        return 'NULL';
    }
    //--save null to a date field
    if ($addSingleQuotes) {
        $sq = "'";
    }
    if ($pFormat == '' or $pValue == '') {
        return $sq . $pValue . $sq;
    }
    // not a text field or nothing to format
    if ($pFormat == '6') {
        // dd-mmm-yyyy
        return $sq . substr($pValue, -4) . '-' . monthNumber(substr($pValue, 3, 3)) . '-' . substr($pValue, 0, 2) . $sq;
    }
    if ($pFormat == '7') {
        // dd-mm-yyyy
        return $sq . substr($pValue, -4) . '-' . substr($pValue, 3, 2) . '-' . substr($pValue, 0, 2) . $sq;
    }
    if ($pFormat == '8') {
        // mmm-dd-yyyy
        return $sq . substr($pValue, -4) . '-' . monthNumber(substr($pValue, 0, 3)) . '-' . substr($pValue, 4, 2) . $sq;
    }
    if ($pFormat == '9') {
        // mm-dd-yyyy
        return $sq . substr($pValue, -4) . '-' . substr($pValue, 0, 2) . '-' . substr($pValue, 3, 2) . $sq;
    }
    if ($pFormat == '10') {
        // dd-mmm-yy
        return $sq . addCentury(substr($pValue, -2)) . '-' . monthNumber(substr($pValue, 3, 3)) . '-' . substr($pValue, 0, 2) . $sq;
    }
    if ($pFormat == '11') {
        // dd-mm-yy
        return $sq . addCentury(substr($pValue, -2)) . '-' . substr($pValue, 3, 2) . '-' . substr($pValue, 0, 2) . $sq;
    }
    if ($pFormat == '12') {
        // mmm-dd-yy
        return $sq . addCentury(substr($pValue, -2)) . '-' . monthNumber(substr($pValue, 0, 3)) . '-' . substr($pValue, 4, 2) . $sq;
    }
    if ($pFormat == '13') {
        // mm-dd-yy
        return $sq . addCentury(substr($pValue, -2)) . '-' . substr($pValue, 0, 2) . '-' . substr($pValue, 3, 2) . $sq;
    }
    if (in_array($pFormat, array('14', '15', '16', '17', '18', '19'))) {
        //---number with commas
        return $sq . str_replace(',', '', $pValue) . $sq;
    }
    return $sq . $pValue . $sq;
}