Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/configuration/Pdf.php
<?php

if(isset($msg)){ unset($msg);}

if(isset($_SESSION['locID'])){
	$loc = $_SESSION['locID'];
	if(!isset($include)) { $include = "include/configuration/ShowLoc.php";}
	$LocName = $_SESSION['LocName'];
	}

if(!isset($buttonID)) {
	$msg= "$msg <p class=\"error\">No button ID was sent</p>"; // this shouldn't happen
}
if(!isset($msg)){

if ($buttonID=="saveconfigpdf" and !isset($_GET["template"])) {
  //GENERAL
   $opt->template_name=$_POST['template_name'];
   $opt->avery_name=$_POST['avery_name'];
   $opt->logo_path=$_POST['logo_path'];
   $opt->background_image=$_POST['background_image'];
   $opt->logo_image=$_POST['logo_image'];
  //SPECIFIC
   $opt->paper_size=$_POST['paper_size'];
   $opt->metric=$_POST['metric'];
   $opt->x_space=$_POST['x_space'];
   $opt->y_space=$_POST['y_space'];
   $opt->y_number=$_POST['y_number'];
   $opt->x_number=$_POST['x_number'];
   $opt->width=$_POST['width'];
   $opt->height=$_POST['height'];
   $opt->char_size=$_POST['char_size'];
   $opt->font_name=$_POST['font_name'];
   $opt->font_color=$_POST['font_color'];
   $opt->line_height=$_POST['line_height'];
   $opt->margin_top=$_POST['margin_top'];
   $opt->margin_left=$_POST['margin_left'];
   $opt->print_cross=$_POST['print_cross'];
   $opt->print_point=$_POST['print_point'];
   $opt->location_id=$_SESSION['locID'];
   $opt->format_text=stripslashes($_POST['format_text']);
   $opt->card_type_text=$_POST['card_type_text'];
   $opt->login_text=$_POST['login_text'];
   $opt->passwd_text=$_POST['passwd_text'];
   $opt->validity_text=$_POST['validity_text'];
   $opt->header_text=$_POST['header_text'];
   $opt->footer_text=$_POST['footer_text'];
   $opt->location_text=$_POST['location_text'];
   $opt->font_style=$_POST['font_style'];

if ($debug) print ' FORMAT TEXT '.$opt->format_text;
  $oreon->database->savepdfprintconfiguration($opt);
  $oreon->pdfprint=$oreon->database->getpdfprintconfiguration($opt->location_id);
  echo "Configuration have been saved";
}

if (isset($_POST['load_default']))
{
	$lid=-1;
	unset($_POST['load_default']);
}

else
	$lid=$_SESSION['locID'];
$tab=$oreon->database->getpdfprintconfiguration($lid);

if ($debug)
{

}
if (isset($_GET['name']))
	$tab['template_name']=$_GET['name'];

if ($tab['avery_name']=="" and !isset($_GET['type']))
	$tab['avery_name']="None";
echo "
<form action=\"phpmyprepaid.php\" method=\"post\" name=\"center\">
<big><big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Pdf configuration</span></b></big></big><br>
<hr>
<table>
<tr>
<td>Template name : </td>
<td><input name=\"template_name\" value=\"".stripslashes($tab['template_name'])."\"></td>
</tr><tr>
<td>Predefined type : </td>";
echo '<td >';
echo '<select name="avery_name"  onChange="reloadtype(this.form)">';
$tab2=split(';',$pdf_type_list);
foreach ($tab2 as $val)
if (($tab['avery_name']==$val and !isset($_GET['type'])) or (isset($_GET['type']) and $_GET['type']==$val))
echo "<option  selected=\"selected\" value=\"$val\">$val";
else
echo "<option value=\"$val\">$val";
echo '</select>';
echo "</td></tr>";



echo "<tr>
	<td>Background image: </td>
	<td><input name=\"background_image\" value=\"".$tab['background_image']."\"></td>";
echo "</tr><tr>
	<td>Logo image : </td>
	<td><input name=\"logo_image\" value=\"".$tab['logo_image']."\"></td>";
echo "
	</tr>
	</table>";

echo "<hr>
	<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Some printing option</span></big><br>
	
	<table>
	<tr>
	<td>Print cross : </td>";

if ($tab['print_cross'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"print_cross\"  value=\"1\" alt=\"Print cross\"></td>";
else
	echo "<td><INPUT type=\"checkbox\" name=\"print_cross\"   value=\"1\" alt=\"Print cross\"></td>";

echo "</tr><tr>
	<td>Print point: </td>";

if ($tab['print_point'])
	echo "<td><INPUT type=\"checkbox\" checked name=\"print_point\"   value=\"1\" alt=\"Print point\"></td>";     
else
	echo "<td><INPUT type=\"checkbox\"  name=\"print_point\"  value=\"1\" alt=\"Print point\"></td>";     

echo "<tr>
	<td >Font name : </td>";
	echo '<td><select name="font_name">';
        $tab2=split(';',$pdf_font);
	foreach ($tab2 as $val)
		if ($tab['font_name']==$val)
			echo "<option  selected=\"selected\" value=\"$val\">$val";
		else
			echo "<option value=\"$val\">$val";
	echo '</select>';
	echo "</td>";

echo "<tr>
	<td >Font style : </td>";
	echo '<td><select name="font_style">';
        $tab2=split(';',$pdf_font_style);
	foreach ($tab2 as $val)
		if ($tab['font_style']==$val)
			echo "<option  selected=\"selected\" value=\"$val\">$val";
		else
			echo "<option value=\"$val\">$val";
	echo '</select>';
	echo "</td>";

echo "<tr>
	<td >Font size : </td>
	<td ><input name=\"char_size\" size=\"5\" value=\"".$tab['char_size']."\"></td></tr>";
echo "<tr>
	<td >Font color : </td>
	<td ><input name=\"font_color\" size=\"5\" value=\"".$tab['font_color']."\"></td></tr>";
echo "<br></tr></table>";

if ($tab['avery_name']=="None" or (isset($_GET['type']) and $_GET['type']=="None") ) {
	echo "<hr>
		<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Custom value ( <small>Be careful, bad configuration can give strange result or nothing at all !)</small> </span></big><br>
		<br>
		<table style=\"text-align: left; height: 55px; width: 606px;\"  >
		<tr>
		<td >Paper size : </td>";

	echo '<td><select name="paper_size">';
	$tab2=split(';',$pdf_paper_size);
	foreach ($tab2 as $val)
		if ($tab['paper_size']==$val)
			echo "<option  selected=\"selected\" value=\"$val\">$val";
		else
			echo "<option value=\"$val\">$val";
	echo '</select>';
	echo "</td>";
	
	
	echo "</tr><tr>
		<td >Metrics : </td>";
	echo '<td><select name="metric">';
	$tab2=split(';',$pdf_metric);
	foreach ($tab2 as $val)
		if ($tab['metric']==$val)
			echo "<option  selected=\"selected\" value=\"$val\">$val";
		else
			echo "<option value=\"$val\">$val";
	echo '</select>';
	echo "</td>";

	echo "</tr><tr>
		<td >Width : </td>
		<td ><input name=\"width\" size=\"5\" value=\"".$tab['width']."\"></td>
		<td >Height : </td>
		<td ><input name=\"height\" size=\"5\" value=\"".$tab['height']."\"></td>
		</tr><tr>
		<td >Margin left : </td>
		<td ><input name=\"margin_left\" size=\"5\" value=\"".$tab['margin_left']."\"></td>
		<td >Margin top : </td>
		<td ><input name=\"margin_top\" size=\"5\" value=\"".$tab['margin_top']."\"></td>
		</tr><tr>
		<td >Horizontal space : </td>
		<td ><input name=\"x_space\" size=\"5\" value=\"".$tab['x_space']."\"></td>
		<td >Vertical space : </td>
		<td ><input name=\"y_space\" size=\"5\" value=\"".$tab['y_space']."\"></td></tr>
		<td >Horizontal number cards : </td>
		<td ><input name=\"x_number\" size=\"5\" value=\"".$tab['x_number']."\"></td>
		<td >Vertical number cards : </td>
		<td ><input name=\"y_number\" size=\"5\" value=\"".$tab['y_number']."\"></td>
		</tr>
		</table>";
}	
echo "<hr>
	<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Text field </span></big><br>
	<br>
	<small><b> Accepted value are : </b> -  \\n for ligne jump and %s for the next string value !</small>
	<br>
	<table style=\"text-align: left; height: 55px; width: 606px;\"  >
	<tr>
	<tr><td >Format text: </td>
	<td ><input name=\"format_text\" size=\"30\" value=\"".$tab['format_text']."\"></td><td>
	</td></tr>
	<tr>
	<td >Card type text: </td>
	<td ><input name=\"card_type_text\" size=\"40\" value=\"".$tab['card_type_text']."\"></td><td>
	</td>
	</tr><tr>
	<td >Login text  : </td>
	<td ><input name=\"login_text\" size=\"20\" value=\"".$tab['login_text']."\"></td><td>
	</td>
	</tr><tr>
	<td >Password text : </td>
	<td ><input name=\"passwd_text\" size=\"20\" value=\"".$tab['passwd_text']."\"></td><td> 
	</td>
	</tr><tr>
	<td >Location text : </td>
	<td ><input name=\"location_text\" size=\"20\" value=\"".$tab['location_text']."\"></td><td> 
	</td>
	</tr><tr>
	<td >Validity text : </td>
	<td ><input name=\"validity_text\" size=\"20\" value=\"".$tab['validity_text']."\"></td><td> 
	</td>
	</tr>
	<tr>
	<td >Header text : </td>
	<td ><input name=\"header_text\" size=\"50\" value=\"".$tab['header_text']."\"></td><td> 
	</td>
	</tr>
	<tr>
	<td >Footer text : </td>
	<td ><input name=\"footer_text\" size=\"50\" value=\"".$tab['footer_text']."\"></td><td> 
	</td></tr>
	</table>
	<hr>
	<table>
	<tr>
	<td>
	<input type=\"hidden\" name=\"buttonID\" value=\"saveconfigpdf\">
	<input type=\"submit\" name=\"submit\" class=\"smallButton\" value=\"Save Configuration\" >
	</form>
	</td><td>
	<form action=\"phpmyprepaid.php\" method=\"post\">
	<input type=\"hidden\" name=\"buttonID\" value=\"pdf_config\">
	<input type=\"hidden\" name=\"load_default\" value=\"pdf_config\">
	<input name=\"submit\" type=\"submit\" class=\"smallButton\" value=\"Get default configuration\" >
	</form>
	</td></tr>";
}
else echo $msg;
Return current item: phpMyPrepaid