Revisión 324
Añadido por Francisco Damián Méndez Palma hace alrededor de 13 años
etiquetas-portatiles/trunk/index.php | ||
---|---|---|
sort($students);
|
||
|
||
$filter = "uid=*";
|
||
|
||
if($_POST["filter"]!=""){
|
||
// para que imprima la etiqueta en una posicion determinada de la pagina de etiquetas
|
||
//$offset = $_POST["offset"];
|
||
//$num_label = $offset - 1;
|
||
$array_filter = explode(",",$_POST["filter"]);
|
||
|
||
$filter = "(|";
|
||
... | ... | |
//$sr=ldap_search($conex, $dn, "(|(uid=*marriaza*)(uid=*arodriguez*))", $fields);
|
||
$students_tmp = ldap_get_entries($conex, $sr);
|
||
|
||
// Llenar labels con posiciones vacias, para poner offset en etiquetas y comenzar a imprimir en una det. posicion
|
||
$offset = $_POST["offset"];
|
||
for ($j=1;$j<$offset;$j++)
|
||
$labels[] = array("cn"=>"","uid"=>"","nie"=>"","foto"=>"");
|
||
|
||
for($i=0;$i<count($students_tmp);$i++){
|
||
if(in_array($students_tmp[$i]["uid"][0],$students))
|
||
$labels[] = array("cn"=>$students_tmp[$i]["cn"][0],"uid"=>$students_tmp[$i]["uid"][0],"nie"=>$students_tmp[$i]["employeenumber"][0],"foto"=>$students_tmp[$i]["jpegphoto"][0]);
|
||
//echo ">>>>>>>>>>>>>>>>".$students_tmp[$i]["jpegphoto"][0];
|
||
}
|
||
|
||
// Creamos el PDF
|
||
... | ... | |
$photoHeight=$_POST["photoHeight"];
|
||
|
||
$num_label=0;
|
||
|
||
if(!file_exists("tmp")){
|
||
mkdir("tmp");
|
||
}
|
||
... | ... | |
$x = $margenX + $j*$alto;
|
||
$y = $margenY + $i*$ancho;
|
||
|
||
$pdf->Text($x, $y+$QR_size+2, $labels[$num_label]["cn"]);
|
||
// Para control de la posicion de inicio de impresion de las etiquetas
|
||
if ($labels[$num_label]["cn"] != "") {
|
||
$pdf->Text($x, $y+$QR_size+2, $labels[$num_label]["cn"]);
|
||
|
||
if(isset($_POST["org"]))
|
||
$pdf->Text($x, $y+$QR_size+5, $_POST["org"]." - ".$labels[$num_label]["uid"]);
|
||
else
|
||
$pdf->Text($x, $y+$QR_size+5, $labels[$num_label]["uid"]);
|
||
if(isset($_POST["org"]))
|
||
$pdf->Text($x, $y+$QR_size+5, $_POST["org"]." - ".$labels[$num_label]["uid"]);
|
||
else
|
||
$pdf->Text($x, $y+$QR_size+5, $labels[$num_label]["uid"]);
|
||
|
||
$micro = explode(" ",microtime());
|
||
$id = time().$micro[0];
|
||
$micro = explode(" ",microtime());
|
||
$id = time().$micro[0];
|
||
|
||
$student_data = 'BEGIN:VCARD'.urldecode("%0A");
|
||
$student_data.= 'N:'.$labels[$num_label]["cn"].urldecode("%0A");
|
||
$student_data.= 'ROLE:Student'.urldecode("%0A");
|
||
$student_data = 'BEGIN:VCARD'.urldecode("%0A");
|
||
$student_data.= 'N:'.$labels[$num_label]["cn"].urldecode("%0A");
|
||
$student_data.= 'ROLE:Student'.urldecode("%0A");
|
||
|
||
if(isset($labels[$num_label]["nie"]))
|
||
$student_data.= 'UID:'.$labels[$num_label]["nie"].urldecode("%0A");
|
||
if(isset($labels[$num_label]["nie"]))
|
||
$student_data.= 'UID:'.$labels[$num_label]["nie"].urldecode("%0A");
|
||
|
||
if(isset($_POST["org"]))
|
||
$student_data.= 'ORG:'.$_POST["org"].urldecode("%0A");
|
||
if(isset($_POST["org"]))
|
||
$student_data.= 'ORG:'.$_POST["org"].urldecode("%0A");
|
||
|
||
if(isset($_POST["address"]))
|
||
$student_data.= 'ADR:'.$_POST["address"].urldecode("%0A");
|
||
if(isset($_POST["address"]))
|
||
$student_data.= 'ADR:'.$_POST["address"].urldecode("%0A");
|
||
|
||
if(isset($_POST["phone"]))
|
||
$student_data.= 'TEL:'.$_POST["phone"].urldecode("%0A");
|
||
if(isset($_POST["phone"]))
|
||
$student_data.= 'TEL:'.$_POST["phone"].urldecode("%0A");
|
||
|
||
if(isset($_POST["email"]))
|
||
$student_data.= 'EMAIL:'.$_POST["email"].urldecode("%0A");
|
||
if(isset($_POST["email"]))
|
||
$student_data.= 'EMAIL:'.$_POST["email"].urldecode("%0A");
|
||
|
||
if(isset($_POST["web"]))
|
||
$student_data.= 'URL:'.$_POST["web"].urldecode("%0A");
|
||
if(isset($_POST["web"]))
|
||
$student_data.= 'URL:'.$_POST["web"].urldecode("%0A");
|
||
|
||
$student_data.= 'END:VCARD';
|
||
$student_data.= 'END:VCARD';
|
||
|
||
generateQRCode($student_data,"tmp/QR".$id.".png");
|
||
generateQRCode($student_data,"tmp/QR".$id.".png");
|
||
|
||
if(file_exists("tmp/QR".$id.".png")){
|
||
$pdf->Image("tmp/QR".$id.".png",$x,$y,$QR_size);
|
||
@unlink("tmp/QR".$id.".png");
|
||
}
|
||
if(file_exists("tmp/QR".$id.".png")){
|
||
$pdf->Image("tmp/QR".$id.".png",$x,$y,$QR_size);
|
||
@unlink("tmp/QR".$id.".png");
|
||
}
|
||
|
||
if($labels[$num_label]["foto"]!=""){
|
||
$photoStudent = "tmp/Alu".$id.".png";
|
||
if($labels[$num_label]["foto"]!=""){
|
||
$photoStudent = "tmp/Alu".$id.".png";
|
||
|
||
$im = @imagepng(@imagecreatefromstring($labels[$num_label]["foto"]),$photoStudent);
|
||
$im = @imagepng(@imagecreatefromstring($labels[$num_label]["foto"]),$photoStudent);
|
||
|
||
if ($im !== false && file_exists($photoStudent))
|
||
$pdf->Image($photoStudent, $x + $QR_size, $y, $photoWidth, $photoHeight);
|
||
if ($im !== false && file_exists($photoStudent))
|
||
$pdf->Image($photoStudent, $x + $QR_size, $y, $photoWidth, $photoHeight);
|
||
|
||
@unlink($photoStudent);
|
||
}
|
||
@unlink($photoStudent);
|
||
}
|
||
}
|
||
|
||
$num_label++;
|
||
|
||
... | ... | |
<script type="text/JavaScript" language="javascript" src="jquery/jquery-1.4.2.min.js"></script>
|
||
<link rel="stylesheet" type="text/css" media="screen" href="jquery/ui/css/ui-lightness/jquery-ui-1.8.5.custom.css" />
|
||
<script type="text/JavaScript" language="javascript" src="jquery/ui/jquery-ui-1.8.5.custom.min.js"></script>
|
||
<script language="javascript">
|
||
|
||
<script languaje="javascript">
|
||
|
||
function cargaSelectOffset () {
|
||
var select = document.getElementById("offset");
|
||
for (i=1;i<=23;i++)
|
||
select.options[select.length] = new Option(i, i);
|
||
}
|
||
|
||
|
||
$(function() {
|
||
$("#sliderHeight").slider({
|
||
value:70,
|
||
... | ... | |
}
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<body onload="cargaSelectOffset()">
|
||
<h1 style="text-align:center;">Generador de etiquetas - Centros Educativos de Extremadura</h1>
|
||
<form id='form_labels' method='POST' action="index.php">
|
||
<table style="width:100%;">
|
||
... | ... | |
<label for="filter">Filtro:</label><br>
|
||
<input type="text" id="filter" name="filter" class="text ui-widget-content ui-corner-all"/> Valores separados por comas <b>(p.e. jprado, agordillo)</b>
|
||
</p>
|
||
<p>
|
||
<label for="offset">Empezar en la posición</label><br>
|
||
<select id="offset" name="offset">
|
||
</select>
|
||
</p>
|
||
<p style="text-align:center; font-weight:bold;">Parámetros por defecto para etiquetas apli24</p>
|
||
</div>
|
||
</fieldset>
|
Exportar a: Unified diff
Control posicion impresion etiquetas