Esempio n. 1
0
function sec2hms($sec, $padHours = FALSE)
{
    $hours_min_secs = "";
    $hours = INTVAL(INTVAL($sec) / 3600);
    $hours_min_secs .= $padHours ? STR_PAD($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':';
    $minutes = INTVAL($sec / 60 % 60);
    $hours_min_secs .= STR_PAD($minutes, 2, "0", STR_PAD_LEFT) . ':';
    $seconds = INTVAL($sec % 60);
    $hours_min_secs .= STR_PAD($seconds, 2, "0", STR_PAD_LEFT);
    return $hours_min_secs;
}
Esempio n. 2
0
 function SetFormButton($bb, $hh, $name, $value, $type, $title = '', $flags = array(), $checked = false, $disabled = false, $background_col = false, $border_col = false, $noprint = false)
 {
     $this->formn++;
     if (!preg_match('/^[a-zA-Z0-9_:\\-]+$/', $name)) {
         $this->mpdf->Error("Field [" . $name . "] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)");
     }
     if (!$this->mpdf->onlyCoreFonts) {
         if (isset($this->mpdf->CurrentFont['subset'])) {
             $this->mpdf->UTF8StringToArray($title, true);
             // Add characters to font subset
             $this->mpdf->UTF8StringToArray($value, true);
             // Add characters to font subset
         }
         $title = $this->mpdf->UTF8ToUTF16BE($title, true);
         if ($type == 'checkbox') {
             $uvalue = $this->mpdf->UTF8ToUTF16BE($value, true);
         } else {
             if ($type == 'radio') {
                 $uvalue = $this->mpdf->UTF8ToUTF16BE($value, true);
                 $value = mb_convert_encoding($value, 'Windows-1252', 'UTF-8');
             } else {
                 $value = $this->mpdf->UTF8ToUTF16BE($value, true);
                 $uvalue = $value;
             }
         }
     } else {
         $title = $this->Win1252ToPDFDocEncoding($title);
         $value = $this->Win1252ToPDFDocEncoding($value);
         //// ??? not needed
         $uvalue = mb_convert_encoding($value, 'UTF-8', 'Windows-1252');
         $uvalue = $this->mpdf->UTF8ToUTF16BE($uvalue, true);
     }
     if ($type == 'radio' || $type == 'checkbox') {
         if (!preg_match('/^[a-zA-Z0-9_:\\-\\.]+$/', $value)) {
             $this->mpdf->Error("Field '" . $name . "' must have a value, which can only contain letters, numbers, colon(:), undersore(_), hyphen(-) or period(.)");
         }
     }
     if ($type == 'radio') {
         if (!isset($this->form_radio_groups[$name])) {
             $this->form_radio_groups[$name] = array('page' => $this->mpdf->page, 'kids' => array());
         }
         $this->form_radio_groups[$name]['kids'][] = array('n' => $this->formn, 'V' => $value, 'OPT' => $uvalue, 'disabled' => $disabled);
         if ($checked) {
             $this->form_radio_groups[$name]['on'] = $value;
         }
         // Disable the whole radio group if one is disabled, because of inconsistency in PDF readers
         if ($disabled) {
             $this->form_radio_groups[$name]['disabled'] = true;
         }
     }
     if ($type == 'checkbox') {
         $this->form_checkboxes = true;
     }
     if ($checked) {
         $activ = 1;
     } else {
         $activ = 0;
     }
     if ($background_col) {
         $bg_c = $this->mpdf->SetColor($background_col, 'CodeOnly');
     } else {
         $bg_c = $this->form_button_background_color;
     }
     if ($border_col) {
         $bc_c = $this->mpdf->SetColor($border_col, 'CodeOnly');
     } else {
         $bc_c = $this->form_button_border_color;
     }
     $f = array('n' => $this->formn, 'typ' => 'Bt', 'page' => $this->mpdf->page, 'subtype' => $type, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y, 'w' => $bb, 'h' => $hh, 'T' => $name, 'V' => $value, 'OPT' => $uvalue, 'TU' => $title, 'FF' => $flags, 'CA' => $this->form_button_text, 'RC' => $this->form_button_text_over, 'AC' => $this->form_button_text_click, 'BS_W' => $this->form_button_border_width, 'BS_S' => $this->form_button_border_style, 'BC_C' => $bc_c, 'BG_C' => $bg_c, 'activ' => $activ, 'disabled' => $disabled, 'noprint' => $noprint, 'style' => array('font' => $this->mpdf->FontFamily, 'fontsize' => $this->mpdf->FontSizePt, 'fontcolor' => $this->mpdf->TextColor));
     if ($this->mpdf->keep_block_together) {
         $this->mpdf->ktForms[] = $f;
     } else {
         if ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) {
             $this->mpdf->HTMLheaderPageForms[] = $f;
         } else {
             if ($this->mpdf->ColActive) {
                 $this->mpdf->columnbuffer[] = array('s' => 'ACROFORM', 'col' => $this->mpdf->CurrCol, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y, 'h' => $hh);
                 $this->mpdf->columnForms[$this->mpdf->CurrCol][INTVAL($this->mpdf->x)][INTVAL($this->mpdf->y)] = $this->formn;
             }
             $this->forms[$this->formn] = $f;
         }
     }
     if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
         $this->form_fonts[] = $this->mpdf->FontFamily;
         $this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
     }
     $this->form_button_text = NULL;
     $this->form_button_text_over = NULL;
     $this->form_button_text_click = NULL;
 }
Esempio n. 3
0
function printcolumnbuffer() {
   // Columns ended (but page not ended) -> try to match all columns - unless disabled by using a custom column-break
   if (!$this->ColActive && $this->ColumnAdjust && !$this->keepColumns) {
	// Calculate adjustment to add to each column to calculate rel_y value
	$this->ColDetails[0]['add_y'] = 0;
	$last_col = 0;
	// Recursively add previous column's height
	for($i=1;$i<$this->NbCol;$i++) { 
		if (isset($this->ColDetails[$i]['bottom_margin']) && $this->ColDetails[$i]['bottom_margin']) { // If any entries in the column
			$this->ColDetails[$i]['add_y'] = ($this->ColDetails[$i-1]['bottom_margin'] - $this->y0) + $this->ColDetails[$i-1]['add_y'];
			$last_col = $i; 	// Last column actually printed
		}
	}

	// Calculate value for each position sensitive entry as though for one column
	foreach($this->columnbuffer AS $key=>$s) { 
		$t = $s['s'];
		if ($t == 'ACROFORM') {
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
			$this->columnbuffer[$key]['s'] = '';
		}
		else if (preg_match('/BT \d+\.\d\d+ (\d+\.\d\d+) Td/',$t)) {
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
		}
		else if (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/',$t)) {
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
		}
		else if (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) m/',$t)) {
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
		}
		else if (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) l/',$t)) {
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
		}
		else if (preg_match('/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/',$t)) { 
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
		}
		else if (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/',$t)) {
			$this->columnbuffer[$key]['rel_y'] = $s['y'] + $this->ColDetails[$s['col']]['add_y'] - $this->y0;
		}
	}
	foreach($this->internallink AS $key => $f) {
	  if (is_array($f) && isset($f['col'])) {
		$this->internallink[$key]['rel_y'] = $f['Y'] + $this->ColDetails[$f['col']]['add_y'] - $this->y0;
	  }
	}

	$breaks = array();
	foreach($this->breakpoints AS $c => $bpa) { 
		foreach($bpa AS $rely) {
			$breaks[] = $rely + $this->ColDetails[$c]['add_y'] - $this->y0;
		}
	}

	if (isset($this->ColDetails[$last_col]['bottom_margin'])) { $lcbm = $this->ColDetails[$last_col]['bottom_margin']; }
	else { $lcbm = 0; }
	$sum_h = $this->ColDetails[$last_col]['add_y'] + $lcbm - $this->y0;
	//$sum_h = max($this->ColDetails[$last_col]['add_y'] + $this->ColDetails[$last_col]['bottom_margin'] - $this->y0, end($breaks));
	$target_h = ($sum_h / $this->NbCol);

	$cbr = array();
	for($i=1;$i<$this->NbCol;$i++) { 
		$th = ($sum_h * $i / $this->NbCol);
		foreach($breaks AS $bk=>$val) {
			if ($val > $th) {
				if (($val-$th) < ($th-$breaks[$bk-1])) { $cbr[$i-1] = $val; }
				else  { $cbr[$i-1] = $breaks[$bk-1]; }
				break;
			}
		}
	}
	$cbr[($this->NbCol-1)] = $sum_h;

	// Now update the columns - divide into columns of approximately equal value
	$last_new_col = 0; 
	$yadj = 0;	// mm
	$xadj = 0;
	$last_col_bottom = 0;
	$lowest_bottom_y = 0;
	$block_bottom = 0;
	$newcolumn = 0;
	foreach($this->columnbuffer AS $key=>$s) { 
	  if (isset($s['rel_y'])) {	// only process position sensitive data
		if ($s['rel_y'] >= $cbr[$newcolumn]) {
			$newcolumn++;
		}
		else {
			$newcolumn = $last_new_col ;
		}


		$block_bottom = max($block_bottom,($s['rel_y']+$s['h']));

		if ($this->directionality == 'rtl') {	// *RTL*
			$xadj = -(($newcolumn - $s['col']) * ($this->ColWidth + $this->ColGap));	// *RTL*
		}	// *RTL*
		else {	// *RTL*
			$xadj = ($newcolumn - $s['col']) * ($this->ColWidth + $this->ColGap);
		}	// *RTL*

		if ($last_new_col != $newcolumn) {	// Added new column
			$last_col_bottom = $this->columnbuffer[$key]['rel_y'];
			$block_bottom = 0;
		}
		$yadj = ($s['rel_y'] - $s['y']) - ($last_col_bottom)+$this->y0;
		// callback function
		$t = $s['s'];
		$t = preg_replace('/BT (\d+\.\d\d+) (\d+\.\d\d+) Td/e',"\$this->columnAdjustAdd('Td',_MPDFK,$xadj,$yadj,'\\1','\\2')",$t);
		$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) ([\-]{0,1}\d+\.\d\d+) re/e',"\$this->columnAdjustAdd('re',_MPDFK,$xadj,$yadj,'\\1','\\2','\\3','\\4')",$t);
		$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) l/e',"\$this->columnAdjustAdd('l',_MPDFK,$xadj,$yadj,'\\1','\\2')",$t);
		$t = preg_replace('/q (\d+\.\d\d+) 0 0 (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) cm \/(I|FO)/e',"\$this->columnAdjustAdd('img',_MPDFK,$xadj,$yadj,'\\1','\\2','\\3','\\4','\\5')",$t); 
		$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) m/e',"\$this->columnAdjustAdd('draw',_MPDFK,$xadj,$yadj,'\\1','\\2')",$t);
		$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) c/e',"\$this->columnAdjustAdd('bezier',_MPDFK,$xadj,$yadj,'\\1','\\2','\\3','\\4','\\5','\\6')",$t);

		$this->columnbuffer[$key]['s'] = $t;
		$this->columnbuffer[$key]['newcol'] = $newcolumn;
		$this->columnbuffer[$key]['newy'] = $s['y'] + $yadj;
		$last_new_col = $newcolumn;
		$clb = $s['y'] + $yadj + $s['h'] ;	// bottom_margin of current
		if ((isset($this->ColDetails[$newcolumn]['max_bottom']) && $clb > $this->ColDetails[$newcolumn]['max_bottom']) || (!isset($this->ColDetails[$newcolumn]['max_bottom']) && $clb)) { $this->ColDetails[$newcolumn]['max_bottom'] = $clb; }
		if ($clb > $lowest_bottom_y) { $lowest_bottom_y = $clb; }
		// Adjust LINKS
		if (isset($this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->PageLinks[$this->page][$ref][0] += ($xadj*_MPDFK);
			$this->PageLinks[$this->page][$ref][1] -= ($yadj*_MPDFK);
			unset($this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		}
		// Adjust FORM FIELDS
		if (isset($this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->form->forms[$ref]['x'] += ($xadj);
			$this->form->forms[$ref]['y'] += ($yadj);
			unset($this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		}
/*-- ANNOTATIONS --*/
		if (isset($this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			if ($this->PageAnnots[$this->page][$ref]['x'] < 0) {
				 $this->PageAnnots[$this->page][$ref]['x'] -= ($xadj);
			}
			else {
				 $this->PageAnnots[$this->page][$ref]['x'] += ($xadj);
			}
			$this->PageAnnots[$this->page][$ref]['y'] += ($yadj);	// unlike PageLinks, Page annots has y values from top in mm
			unset($this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		}
/*-- END ANNOTATIONS --*/
	  }
	}

/*-- BOOKMARKS --*/
	// Adjust Bookmarks
	foreach($this->col_BMoutlines AS $v) {
		$this->BMoutlines[]=array('t'=>$v['t'],'l'=>$v['l'],'y'=>$this->y0,'p'=>$v['p']);
	}
/*-- END BOOKMARKS --*/

/*-- INDEX --*/
	// Adjust Reference (index)
	foreach($this->col_Reference AS $v) {
		$Present=0;
		//Search the reference (AND Ref/PageNo) in the array
		for ($i=0;$i<count($this->Reference);$i++){
			if ($this->Reference[$i]['t']==$v['t']){
				$Present=1;
				if (!in_array($v['op'],$this->Reference[$i]['p'])) {
					$this->Reference[$i]['p'][] = $v['op'];
				}
			}
		}
		if ($Present==0) {
			$this->Reference[]=array('t'=>$v['t'],'p'=>array($v['op']));
		}
	}
/*-- END INDEX --*/

/*-- TOC --*/
	 
	 // Adjust ToC
	 foreach($this->col_toc AS $v) {
		$this->tocontents->_toc[]=array('t'=>$v['t'],'l'=>$v['l'],'p'=>$v['p'],'link'=>$v['link'],'toc_id'=>$v['toc_id']);
		$this->links[$v['link']][1] = $this->y0; 
	 }
/*-- END TOC --*/

	// Adjust column length to be equal
	if ($this->colvAlign == 'J') {
	 foreach($this->columnbuffer AS $key=>$s) { 
	   if (isset($s['rel_y'])) {	// only process position sensitive data
	    // Set ratio to expand y values or heights
	    if (isset($this->ColDetails[$s['newcol']]['max_bottom']) && $this->ColDetails[$s['newcol']]['max_bottom']  && $this->ColDetails[$s['newcol']]['max_bottom']!=$this->y0) {
		$ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s['newcol']]['max_bottom'] - ($this->y0));
	    }
	    else { $ratio = 1; }
	    if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
		$yadj = ($s['newy'] - $this->y0) * ($ratio - 1);

		// Adjust LINKS
		if (isset($this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->PageLinks[$this->page][$ref][1] -= ($yadj*_MPDFK);	// y value
			$this->PageLinks[$this->page][$ref][3] *= $ratio;	// height
			unset($this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		}
		// Adjust FORM FIELDS
		if (isset($this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->form->forms[$ref]['x'] += ($xadj);
			$this->form->forms[$ref]['y'] += ($yadj);
			unset($this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		}
/*-- ANNOTATIONS --*/
		if (isset($this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->PageAnnots[$this->page][$ref]['y'] += ($yadj);
			unset($this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		}
/*-- END ANNOTATIONS --*/
	    }
	  }
	 }
	foreach($this->internallink AS $key => $f) {
	  if (is_array($f) && isset($f['col'])) {
		$last_col_bottom = 0;
		for ($nbc=0; $nbc<$this->NbCol; $nbc++) {
			if ($f['rel_y'] >= $cbr[$nbc]) { $last_col_bottom = $cbr[$nbc]; }
		}
		$yadj = ($f['rel_y'] - $f['Y']) - $last_col_bottom + $this->y0;
		$f['Y'] += $yadj;
		unset($f['col']);
		unset($f['rel_y']);
		$this->internallink[$key] = $f;
	  }
	}

	 $last_col = -1;
	 $trans_on = false;
	 foreach($this->columnbuffer AS $key=>$s) { 
		if (isset($s['rel_y'])) {	// only process position sensitive data
			// Set ratio to expand y values or heights
			if (isset($this->ColDetails[$s['newcol']]['max_bottom']) && $this->ColDetails[$s['newcol']]['max_bottom']  && $this->ColDetails[$s['newcol']]['max_bottom']!=$this->y0) { 
				$ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s['newcol']]['max_bottom'] - ($this->y0));
			}
			else { $ratio = 1; }
			if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
				//Start Transformation
				$this->pages[$this->page] .= $this->StartTransform(true)."\n";
				$this->pages[$this->page] .= $this->transformScale(100, $ratio*100, $x='', $this->y0, true)."\n";
				$trans_on = true;
			}
		}
		// Now output the adjusted values
		$this->pages[$this->page] .= $s['s']."\n"; 
		if (isset($s['rel_y']) && ($ratio > 1) && ($ratio <= $this->max_colH_correction)) {	// only process position sensitive data
			//Stop Transformation
			$this->pages[$this->page] .= $this->StopTransform(true)."\n";
	 		$trans_on = false;
		}
	 }
	 if ($trans_on) { $this->pages[$this->page] .= $this->StopTransform(true)."\n"; }
	}
	else {	// if NOT $this->colvAlign == 'J' 
		// Now output the adjusted values
		foreach($this->columnbuffer AS $s) { 
			$this->pages[$this->page] .= $s['s']."\n"; 
		}
	}
	if ($lowest_bottom_y > 0) { $this->y = $lowest_bottom_y ; }
   }

   // Columns not ended but new page -> align columns (can leave the columns alone - just tidy up the height)
   else if ($this->colvAlign == 'J' && $this->ColumnAdjust && !$this->keepColumns)  {
	// calculate the lowest bottom margin
	$lowest_bottom_y = 0;
	foreach($this->columnbuffer AS $key=>$s) { 
	   // Only process output data
	   $t = $s['s'];
	   if ($t == 'ACROFORM' || (preg_match('/BT \d+\.\d\d+ (\d+\.\d\d+) Td/',$t)) || (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/',$t)) ||
		(preg_match('/\d+\.\d\d+ (\d+\.\d\d+) l/',$t)) || 
		(preg_match('/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/',$t)) || 
		(preg_match('/\d+\.\d\d+ (\d+\.\d\d+) m/',$t)) || 
		(preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/',$t)) ) { 

		$clb = $s['y'] + $s['h'];
		if ((isset($this->ColDetails[$s['col']]['max_bottom']) && $clb > $this->ColDetails[$s['col']]['max_bottom']) || !isset($this->ColDetails[$s['col']]['max_bottom'])) { $this->ColDetails[$s['col']]['max_bottom'] = $clb; }
		if ($clb > $lowest_bottom_y) { $lowest_bottom_y = $clb; }
		$this->columnbuffer[$key]['rel_y'] = $s['y'];	// Marks position sensitive data to process later
		if ($t == 'ACROFORM') { $this->columnbuffer[$key]['s'] = ''; }
	   }
	}
	// Adjust column length equal
	 foreach($this->columnbuffer AS $key=>$s) { 
	    // Set ratio to expand y values or heights
	    if (isset($this->ColDetails[$s['col']]['max_bottom']) && $this->ColDetails[$s['col']]['max_bottom']) { 
		$ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s['col']]['max_bottom'] - ($this->y0));
	    }
	    else { $ratio = 1; }
	    if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
		$yadj = ($s['y'] - $this->y0) * ($ratio - 1);

		// Adjust LINKS
		if (isset($s['rel_y'])) {	// only process position sensitive data
		   // otherwise triggers for all entries in column buffer (.e.g. formatting) and makes below adjustments more than once
		   if (isset($this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->PageLinks[$this->page][$ref][1] -= ($yadj*_MPDFK);	// y value
			$this->PageLinks[$this->page][$ref][3] *= $ratio;	// height
			unset($this->columnLinks[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);	
		   }
		   // Adjust FORM FIELDS
		   if (isset($this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->form->forms[$ref]['x'] += ($xadj);
			$this->form->forms[$ref]['y'] += ($yadj);
			unset($this->columnForms[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		   }
/*-- ANNOTATIONS --*/
		   if (isset($this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])])) {
			$ref = $this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])];
			$this->PageAnnots[$this->page][$ref]['y'] += ($yadj);
			unset($this->columnAnnots[$s['col']][INTVAL($s['x'])][INTVAL($s['y'])]);
		   }
/*-- END ANNOTATIONS --*/
		}
	    }
	 }

/*-- BOOKMARKS --*/

	// Adjust Bookmarks
	foreach($this->col_BMoutlines AS $v) {
		$this->BMoutlines[]=array('t'=>$v['t'],'l'=>$v['l'],'y'=>$this->y0,'p'=>$v['p']);
	}
/*-- END BOOKMARKS --*/

/*-- INDEX --*/

	// Adjust Reference (index)
	foreach($this->col_Reference AS $v) {
		$Present=0;
		//Search the reference (AND Ref/PageNo) in the array
		for ($i=0;$i<count($this->Reference);$i++){
			if ($this->Reference[$i]['t']==$v['t']){
				$Present=1;
				if (!in_array($v['op'],$this->Reference[$i]['p'])) {
					$this->Reference[$i]['p'][] = $v['op'];
				}
			}
		}
		if ($Present==0) {
			$this->Reference[]=array('t'=>$v['t'],'p'=>array($v['op']));
		}
	}
/*-- END INDEX --*/

/*-- TOC --*/
	 
	 // Adjust ToC
	 foreach($this->col_toc AS $v) {
		$this->tocontents->_toc[]=array('t'=>$v['t'],'l'=>$v['l'],'p'=>$v['p'],'link'=>$v['link'],'toc_id'=>$v['toc_id']);
		$this->links[$v['link']][1] = $this->y0; 
	 }
/*-- END TOC --*/
	 $trans_on = false;
	 foreach($this->columnbuffer AS $key=>$s) { 
		if (isset($s['rel_y'])) {	// only process position sensitive data
			// Set ratio to expand y values or heights
			if ($this->ColDetails[$s['col']]['max_bottom']) { 
				$ratio = ($lowest_bottom_y - ($this->y0)) / ($this->ColDetails[$s['col']]['max_bottom'] - ($this->y0));
			}
			else { $ratio = 1; }
			if (($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
				//Start Transformation
				$this->pages[$this->page] .= $this->StartTransform(true)."\n";
				$this->pages[$this->page] .= $this->transformScale(100, $ratio*100, $x='', $this->y0, true)."\n";
	 			$trans_on = true;
			}
		}
		// Now output the adjusted values
		$this->pages[$this->page] .= $s['s']."\n"; 
		if (isset($s['rel_y']) && ($ratio > 1) && ($ratio <= $this->max_colH_correction)) {
			//Stop Transformation
			$this->pages[$this->page] .= $this->StopTransform(true)."\n";
	 		$trans_on = false;	// mPDF 5.1.001
		}
	 }
	 if ($trans_on) { $this->pages[$this->page] .= $this->StopTransform(true)."\n"; }

	if ($lowest_bottom_y > 0) { $this->y = $lowest_bottom_y ; }
   }


   // Just reproduce the page as it was
   else {
	// If page has not ended but height adjustment was disabled by custom column-break - adjust y
	$lowest_bottom_y = 0;
	if (!$this->ColActive && (!$this->ColumnAdjust || $this->keepColumns)) {
		// calculate the lowest bottom margin
		foreach($this->columnbuffer AS $key=>$s) { 
		   // Only process output data
		   $t = $s['s'];
		   if ($t == 'ACROFORM' || (preg_match('/BT \d+\.\d\d+ (\d+\.\d\d+) Td/',$t)) || (preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ [\-]{0,1}\d+\.\d\d+ re/',$t)) ||
			(preg_match('/\d+\.\d\d+ (\d+\.\d\d+) l/',$t)) || 
			(preg_match('/q \d+\.\d\d+ 0 0 \d+\.\d\d+ \d+\.\d\d+ (\d+\.\d\d+) cm \/(I|FO)\d+ Do Q/',$t)) || 
			(preg_match('/\d+\.\d\d+ (\d+\.\d\d+) m/',$t)) || 
			(preg_match('/\d+\.\d\d+ (\d+\.\d\d+) \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ \d+\.\d\d+ c/',$t)) ) { 

			$clb = $s['y'] + $s['h'];
			if ($clb > $this->ColDetails[$s['col']]['max_bottom']) { $this->ColDetails[$s['col']]['max_bottom'] = $clb; }
			if ($clb > $lowest_bottom_y) { $lowest_bottom_y = $clb; }
		   }
		}
	}
	foreach($this->columnbuffer AS $key=>$s) { 
		if ($s['s'] != 'ACROFORM') 
			$this->pages[$this->page] .= $s['s']."\n"; 
	}
	if ($lowest_bottom_y > 0) { $this->y = $lowest_bottom_y ; }
/*-- INDEX --*/

	// Output Reference (index)
	foreach($this->col_Reference AS $v) {
		$Present=0;
		for ($i=0;$i<count($this->Reference);$i++){
			if ($this->Reference[$i]['t']==$v['t']){
				$Present=1;
				if (!in_array($v['op'],$this->Reference[$i]['p'])) {
					$this->Reference[$i]['p'][] = $v['op'];
				}
			}
		}
		if ($Present==0) {
			$this->Reference[]=array('t'=>$v['t'],'p'=>array($v['op']));
		}
     }
/*-- END INDEX --*/
/*-- BOOKMARKS --*/
      // Output Bookmarks
      foreach($this->col_BMoutlines AS $v) {
		$this->BMoutlines[]=array('t'=>$v['t'],'l'=>$v['l'],'y'=>$v['y'],'p'=>$v['p']);
      }
/*-- END BOOKMARKS --*/
/*-- TOC --*/
      // Output ToC
      foreach($this->col_toc AS $v) {
		$this->tocontents->_toc[]=array('t'=>$v['t'],'l'=>$v['l'],'p'=>$v['p'],'link'=>$v['link'],'toc_id'=>$v['toc_id']);
      }
/*-- END TOC --*/
   }
   foreach($this->internallink AS $key => $f) {
	if (isset($this->internallink[$key]['col'])) unset($this->internallink[$key]['col']);
	if (isset($this->internallink[$key]['rel_y'])) unset($this->internallink[$key]['rel_y']);
   }

   $this->columnbuffer = array();
   $this->ColDetails = array();
   $this->columnLinks = array();
   $this->columnAnnots = array();
   $this->columnForms = array();
   
   $this->col_Reference = array();
   $this->col_BMoutlines = array();
   $this->col_toc = array();
   $this->breakpoints = array();
}
Esempio n. 4
0
<?php

include_once 'sql_cls.php';
$sql = new sql_cls();
$where = array();
$w = "";
foreach ($_POST["Search_restrictions"] as $key => $val) {
    if ($key == "Platform") {
        if ($val != "NA") {
            ARRAY_PUSH($where, " b.consolePcName = '" . $val . "' ");
        }
    }
}
if (!empty($where)) {
    $w = "WHERE ";
    foreach ($where as $val) {
        $w .= $val;
    }
}
$result = $sql->query("\n\t\tSELECT l.gameName AS 'Game Name', b.consolePcName AS 'Console'\n\t\tFROM gameName l\n\t\tINNER JOIN consolePc b\n\t\tON l.gameId = b.gameId\n\t\t{$w}\n\t\tORDER BY l." . str_replace(" ", "", $_POST["Order_By"]["Feild"]) . " " . $_POST["Order_By"]["Order"] . "\n\t\tLIMIT " . INTVAL($_POST["Page_Size"]) * (INTVAL($_POST["Page"]) - 1) . " , " . $_POST["Page_Size"] . ";\n\t\t\n\t");
if ($result != NULL && $result->num_rows > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        echo "<tr class='feild_find'>\n\t\t\t\t<td class='game_name'>\n\t\t\t\t\t" . $row["Game Name"] . "\n\t\t\t\t</td>\n\t\t\t\t<td class='game_platform'>\n\t\t\t\t\t" . $row["Console"] . "\n\t\t\t\t</td>\t\t\t\t\t\t\n\t\t\t</tr>";
    }
}
Esempio n. 5
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arFilter = array("ACTIVE" => "Y");
if (!empty($_GET["MUSIC"])) {
    $arFilter["PROPERTY_MUSIC"] = INTVAL($_GET["MUSIC"]);
}
if (!empty($_GET["KIND_CLUB"])) {
    $arFilter["PROPERTY_TYPE_FACILITY"] = INTVAL($_GET["KIND_CLUB"]);
}
$arParams['GET'] = $_GET;
if ($this->StartResultCache()) {
    switch ($_GET["STOCKS"]) {
        case "true":
            $arFilter["ID"] = Club::getListHaveStocks();
            break;
        case "false":
            $arFilter["!ID"] = Club::getListHaveStocks();
            break;
        default:
            break;
    }
    switch ($_GET["EVENT"]) {
        case "true":
            $EVENT_ID_LIST = is_array($arFilter["ID"]) ? $arFilter["ID"] : array();
            $arFilter["ID"] = array_merge($EVENT_ID_LIST, Club::getListHaveEvent());
            break;
        case "false":
            $EVENT_ID_LIST = is_array($arFilter["!ID"]) ? $arFilter["!ID"] : array();
Esempio n. 6
0
function COLUMN_SIZE($NODE, $BGC, $FGC)
{
    global $encabezado;
    /*
    This function write the data in the column size of the dirtreeview table.
    There are 5 modes of visualization depends on the value of the SUPERGLOBAL
    variable $_SESSION['Display_Size']
    */
    if (empty($BGC)) {
        $BGC = "#cdf8f8";
    }
    if (empty($FGC)) {
        $FGC = "BLUE";
    }
    ?>
   <Td BGCOLOR="<?php 
    echo $BGC;
    ?>
">&nbsp</Td>
   <Td BGCOLOR="<?php 
    echo $BGC;
    ?>
" ALIGN="right" VALIGN="top" valign=center><Font COLOR="<?php 
    echo $FGC;
    ?>
">
   <?php 
    // filesize
    $DATO = $_SESSION['Numbytes'][$NODE];
    if ($DATO > 0) {
        switch ($_SESSION['Display_Size']) {
            case 4:
                if ($_SESSION['Folder_Type'][$NODE] == "File") {
                    if ($_SESSION['Maxfilesize'] > 0) {
                        $Y = $DATO * 100 / $_SESSION['Numbytes'][0];
                        echo "</Font><Font COLOR='RED'>";
                    }
                } else {
                    if ($_SESSION['Maxfoldersize'] > 0) {
                        $Y = $DATO * 100 / $_SESSION['Numbytes'][0];
                        echo "</Font><Font COLOR='BLACK'>";
                    }
                }
                echo NUMBER_FORMAT($Y, 4, ',', '.') . "</FONT>";
                $DES_BYTES = "%";
                break;
            case 3:
                if ($_SESSION['Folder_Type'][$NODE] == "File") {
                    if ($_SESSION['Maxfilesize'] > 0) {
                        $Y = INTVAL($DATO * (800 / $_SESSION['Width'] * 40) / $_SESSION['Maxfilesize']);
                        echo "</Font><Font COLOR='RED'>";
                    }
                } else {
                    if ($_SESSION['Maxfoldersize'] > 0) {
                        $Y = INTVAL($DATO * (800 / $_SESSION['Width'] * 40) / $_SESSION['Maxfoldersize']);
                        echo "</Font><Font COLOR='BLACK'>";
                    }
                }
                if ($NODE != 0) {
                    echo STR_REPEAT(chr(124), $Y) . "</FONT>";
                } else {
                    echo "&nbsp" . "</FONT>";
                }
                $DES_BYTES = "";
                break;
            case 2:
                echo NUMBER_FORMAT($DATO / (1024 * 1024), 2, ',', '.');
                $DES_BYTES = "mb";
                break;
            case 1:
                echo NUMBER_FORMAT($DATO / 1024, 1, ',', '.');
                $DES_BYTES = "kb";
                break;
            default:
                echo NUMBER_FORMAT($DATO, 0, ',', '.');
                $DES_BYTES = "bytes";
        }
        // switch
    } else {
        echo "&nbsp";
        $DES_BYTES = "";
    }
    ?>
   </Td>
   <Td BGCOLOR="<?php 
    echo $BGC;
    ?>
">&nbsp</Td>
   <Td BGCOLOR="<?php 
    echo $BGC;
    ?>
" ALIGN="left" valign=top><Font COLOR="<?php 
    echo $FGC;
    ?>
"><?php 
    echo $DES_BYTES;
    ?>
</Td>
   <Td BGCOLOR="<?php 
    echo $BGC;
    ?>
" ALIGN="right"><Font COLOR="<?php 
    echo $FGC;
    ?>
">&nbsp</Td>
   <?php 
}