".htmlentities($msg['page_format'], ENT_QUOTES, $charset)."
";
$r.="
".htmlentities($msg['page_orientation'], ENT_QUOTES, $charset)."
";
$r.="";
$r.="";
$r.="";
$r.="";
$r.="";
$r.="";
$r.="";
$r.="";
$r.="";
return $r;
}
function verifLabelFormat($label_id){
global $label_fmt, $msg, $charset;
$r = "
var first_col = document.getElementById('first_col').value;
var max_col = document.getElementById('label_grid_nb_per_row').value;
if ( (first_col=='') || (max_col=='') || (isNaN(first_col)) || (isNaN(max_col)) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}
first_col = parseInt(first_col);
max_col = parseInt(max_col);
if ( (first_col < 1) || (max_col < 1) || (first_col > max_col) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var first_row = document.getElementById('first_row').value;
var max_row = document.getElementById('label_grid_nb_per_col').value;
if ( (first_row=='') || (max_row=='') || (isNaN(first_row)) || (isNaN(max_row)) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}
first_row = parseInt(first_row);
max_row = parseInt(max_row);
if ( (first_row < 1) || (max_row < 1) || (first_row > max_row) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var label_width = document.getElementById('label_width').value;
if ( (label_width=='') || (isNaN(label_width)) || (parseFloat(label_width) <= 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var label_height = document.getElementById('label_height').value;
if ( (label_height=='') || (isNaN(label_height)) || (parseFloat(label_height) <= 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var label_grid_from_top = document.getElementById('label_grid_from_top').value;
if ( (label_grid_from_top=='') || (isNaN(label_grid_from_top)) || (parseFloat(label_grid_from_top) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var label_grid_from_left = document.getElementById('label_grid_from_left').value;
if ( (label_grid_from_left=='') || (isNaN(label_grid_from_left)) || (parseFloat(label_grid_from_left) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var label_grid_h_spacing = document.getElementById('label_grid_h_spacing').value;
if ( (label_grid_h_spacing=='') || (isNaN(label_grid_h_spacing)) || (parseFloat(label_grid_h_spacing) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var label_grid_v_spacing = document.getElementById('label_grid_v_spacing').value;
if ( (label_grid_v_spacing=='') || (isNaN(label_grid_v_spacing)) || (parseFloat(label_grid_v_spacing) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
return $r;
}
function getLabelContent($label_id) {
global $label_con;
return $label_con[$label_id];
}
function displayLabelContent($label_id){
global $label_con, $msg, $charset;
$r="";
foreach($label_con[$label_id]['content_type'] as $step=>$content_type) {
eval('$r.=display_'.$content_type.'_content($label_id, $step);' );
}
return $r;
}
function display_cote_content($label_id, $step) {
global $label_fmt, $label_con, $msg, $charset;
$r = "
";
$r.= "";
$r.= "";
$r.= "";
$r.= "";
$r.= "";
$r.= "";
$r.= "
".htmlentities($msg['font_style'], ENT_QUOTES, $charset)."
";
$r.= "";
$r.= "
".htmlentities($msg['align'], ENT_QUOTES, $charset)."
";
if(!isset($label_con[$label_id]['rotation'][$step])) $label_con[$label_id]['rotation'][$step] = '0';
if(!isset($label_con[$label_id]['border_size'][$step])) $label_con[$label_id]['border_size'][$step] = '0';
$r.= "
";
return $r;
}
function display_image_content($label_id, $step) {
global $label_fmt, $label_con, $msg, $charset;
$r = "
";
$r.= "";
$r.= "";
$r.= "";
$r.= "";
$r.= "";
$r.= "";
return $r;
}
function verifLabelContent($label_id){
global $label_con, $msg, $charset;
$r="";
foreach($label_con[$label_id]['content_type'] as $step=>$content_type) {
eval('$r.=verif_'.$content_type.'_content($label_id, $step);' );
}
return $r;
}
function verif_cote_content($label_id, $step) {
global $label_fmt, $label_con, $msg, $charset;
$r = "
var width = document.getElementById('content_value[".$step."][width]').value;
if ( (width=='') || (isNaN(width)) || (parseFloat(width) <= 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var height = document.getElementById('content_value[".$step."][height]').value;
if ( (height=='') || (isNaN(height)) || (parseFloat(height) <= 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var from_top = document.getElementById('content_value[".$step."][from_top]').value;
if ( (from_top=='') || (isNaN(from_top)) || (parseFloat(from_top) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var from_left = document.getElementById('content_value[".$step."][from_left]').value;
if ( (from_left=='') || (isNaN(from_left)) || (parseFloat(from_left) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var font_size = document.getElementById('content_value[".$step."][font_size]').value;
if ( (font_size=='') || (isNaN(font_size)) || (parseInt(font_size) < 1) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var rotation = document.getElementById('content_value[".$step."][rotation]').value;
if ( (rotation=='') || (isNaN(rotation)) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var border_size = document.getElementById('content_value[".$step."][border_size]').value;
if ( (border_size=='') || (isNaN(border_size)) || (parseFloat(border_size) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
return $r;
}
function verif_image_content($label_id, $step) {
global $label_fmt, $label_con, $msg, $charset;
$r = "
var width = document.getElementById('content_value[".$step."][width]').value;
if ( (width=='') || (isNaN(width)) || (parseFloat(width) <= 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var height = document.getElementById('content_value[".$step."][height]').value;
if ( (height=='') || (isNaN(height)) || (parseFloat(height) <= 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var from_top = document.getElementById('content_value[".$step."][from_top]').value;
if ( (from_top=='') || (isNaN(from_top)) || (parseFloat(from_top) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var from_left = document.getElementById('content_value[".$step."][from_left]').value;
if ( (from_left=='') || (isNaN(from_left)) || (parseFloat(from_left) < 0) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
$r.= "
var rotation = document.getElementById('content_value[".$step."][rotation]').value;
if ( (rotation=='') || (isNaN(rotation)) ) {
alert(\"".$msg['param_err_impr']."\");
return false;
}";
return $r;
}
function get_border_print_cote(&$target, $content_value) {
$border = 0;
if(!empty($content_value['border_size'])) {
$target->SetLineWidth($content_value['border_size']);
$border = 1;
}
return $border;
}
function print_cote(&$target, $content_value, $content_src='') {
global $dbh;
$q = "select expl_cote from exemplaires where expl_id = '".$content_src."' ";
$r = pmb_mysql_query($q, $dbh);
$str_cote = "";
if (pmb_mysql_num_rows($r)) {
$row_cote = pmb_mysql_fetch_row($r);
if(!empty($content_value['character_line_break'])) {
$tab_cote = explode($content_value['character_line_break'], rtrim(ltrim($row_cote[0])));
} else {
$tab_cote = explode(" ", rtrim(ltrim($row_cote[0])));
}
$str_cote = implode("\n", $tab_cote);
}
$target->SetFont($content_value['font'],$content_value['font_style'] ,$content_value['font_size']);
$r = 0; $g=-1; $b=-1;
switch (strlen($content_value['font_color'])) {
case '6':
$r = hexdec(substr($content_value['font_color'],0,2));
$g = hexdec(substr($content_value['font_color'],2,2));
$b = hexdec(substr($content_value['font_color'],4,2));
break;
case '2':
$r = hexdec(substr($content_value['font_color'],0,2));
break;
default:
break;
}
$target->SetTextColor($r, $g, $b);
$target->SetXY($target->GetStickX()+$content_value['from_left'], $target->GetStickY()+$content_value['from_top']);
$target->Rotate($content_value['rotation'], $target->GetStickX()+$content_value['from_left'],$target->GetStickY()+$content_value['from_top'] ) ;
$target->MultiCell($content_value['width'], ($content_value['font_size']*25.4/72), $str_cote, 0, $content_value['align']);
$target->Rotate(0);
$border = get_border_print_cote($target, $content_value);
if($border) {
$target->Rect($target->GetStickX(), $target->GetStickY(), $content_value['width'], $content_value['height']); //Affiche un cadre autour de l'etiquette
$target->SetLineWidth(0.2);
}
}
function print_image(&$target, $content_value, $content_src='') {
if($content_value['source'] == '') return;
$target->Rotate($content_value['rotation'], $target->GetStickX()+$content_value['from_left'], $target->GetStickY()+$content_value['from_top'] );
$target->Image("../../../images/".$content_value['source'], $target->GetStickX()+$content_value['from_left'], $target->GetStickY()+$content_value['from_top'], $content_value['width'], $content_value['height']);
$target->Rotate(0);
}
?>