예제 #1
0
 function validate_file_cmpiterator($val, $key, $field, $type, $dimension)
 {
     $r = smartcmp($val, $key);
     $eq = $type == 0 ? 'равна' : 'равен';
     if ($r == 'COMPILES') {
         return '';
     }
     if ($r == 'NOTCOMPILES') {
         return $field . ' изображения не ' . $eq . ' ' . parseint($key) . ' ' . $dimension . '.';
     }
     if ($r == 'GREATER') {
         return $field . ' изображения превосходит ' . parseint($key) . ' ' . $dimension . '.';
     }
     if ($r == 'LESS') {
         return $field . ' изображения меньше ' . parseint($key) . ' ' . $dimension . '.';
     }
 }
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";
}
예제 #3
0
파일: 07CDCFile.php 프로젝트: Nazg-Gul/gate
 function Comporator($val, $key, $field, $type, $dimension)
 {
     $r = smartcmp($val, $key);
     $eq = $type == 0 ? 'равна' : 'равен';
     if ($r == 'COMPILES') {
         return '';
     }
     if ($r == 'NOTCOMPILES') {
         return $field . ' файла не ' . $eq . ' ' . parseint($key) . ' ' . $dimension . '.';
     }
     if ($r == 'GREATER') {
         return $field . ' файла превосходит ' . parseint($key) . ' ' . $dimension . '.';
     }
     if ($r == 'LESS') {
         return $field . ' файла меньше ' . parseint($key) . ' ' . $dimension . '.';
     }
 }