示例#1
0
文件: fpdf.php 项目: JozefAB/neoacu
 function run()
 {
     // change some win codes, and xhtml into html
     $str = array('<br />' => '<br>', '<hr />' => '<hr>', '[r]' => '<red>', '[/r]' => '</red>', '[l]' => '<blue>', '[/l]' => '</blue>', '&#8220;' => '"', '&#8221;' => '"', '&#8222;' => '"', '&#8230;' => '...', '&#8217;' => '\'');
     foreach ($str as $_from => $_to) {
         $this->html = str_replace($_from, $_to, $this->html);
     }
     $pdf = new PDF('P', 'mm', 'A4');
     $pdf->SetDisplayMode('real');
     $pdf->AddPage();
     // html
     $pdf->WriteHTML($this->_convert(stripslashes($this->html)), $this->bi);
     // output
     $pdf->Output();
     // stop processing
     exit;
 }
示例#2
0
$pdf->SetFont('Arial', 'B', 7);
$pdf->Cell(0, 3, 'AIR-F-2', 0, 1, 'R');
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(0, 3, utf8_decode('Página No. 3 de 10'), 0, 1, 'R');
$pdf->Cell(0, 3, utf8_decode("O.T. 916I - 2015"), 0, 1, 'R');
$pdf->Ln();
$pdf->SetTextColor(0);
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(0, 5, utf8_decode('INTRODUCCIÓN'), 0, 1, 'L');
$pdf->Ln();
$pdf->SetFont('Arial', '', 10);
$pdf->MultiCell(0, 5, utf8_decode("      La iluminación industrial es uno de los principales factores ambientales de carácter microclimático, que tiene como principal finalidad facilitar la visualización de las cosas dentro del contexto espacial, de modo que el trabajo se pueda realizar en unas condiciones aceptables de eficacia, comodidad y seguridad."), 0, 'J');
$pdf->Ln();
$pdf->MultiCell(0, 5, utf8_decode("      Si se consiguen estos objetivos, las consecuencias no sólo repercuten favorablemente sobre las personas, reduciendo la fatiga, la tasa de errores y accidentes, sino que además contribuyen a aumentar la cantidad y calidad de trabajo."), 0, 'J');
$pdf->Ln();
$pdf->MultiCell(0, 5, $pdf->WriteHTML(utf8_decode("      En el presente reporte se establecen los niveles de iluminación en las diferentes áreas de la empresa <b>" . $cliente['Razon_Social'] . (strcmp($cliente['Razon_Social'], $cliente['Planta']) === 0 ? '' : ", en la " . (isset($cliente['Planta']) ? 'Planta ' . $cliente['Planta'] : '')) . "</b>, ubicada en <b>" . $cliente['Ciudad'] . ', ' . $cliente['Estado'] . "</b>, para control interno, a través de la medición directa de los mismos y su correlación con los niveles mínimos recomendados establecidos en la NOM-025-STPS-2008.")), 0, 'J');
$pdf->Ln();
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(0, 5, utf8_decode('1. JUSTIFICACIÓN'), 0, 1, 'L');
$pdf->Ln();
$pdf->SetFont('Arial', '', 10);
$pdf->MultiCell(0, 5, utf8_decode("      Según el art. 95 del Reglamento Federal de Seguridad, Higiene y Medio Ambiente, las áreas,  planos y lugares de trabajo, deberán contar con las condiciones y niveles de iluminación adecuadas al tipo de actividad que se realice."), 0, 'J');
$pdf->Ln();
$pdf->MultiCell(0, 5, utf8_decode("      De acuerdo a lo anterior, se debe efectuar el reconocimiento, evaluación y control de los niveles de iluminación en el centro de trabajo,  según lo establecido en los numerales 8, 9 y 10 de la NOM-025-STPS-2008."), 0, 'J');
$pdf->Ln();
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(0, 5, utf8_decode('2. OBJETIVO'), 0, 1, 'L');
$pdf->Ln();
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(0, 5, utf8_decode('2.1 General'), 0, 1, 'L');
$pdf->SetFont('Arial', '', 10);
function freePDF($showpage, $flypage, $product_id, $category_id, $limitstart, $limit)
{
    global $db, $sess, $auth, $my, $perm, $VM_LANG, $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset, $mosConfig_hideCreateDate, $mosConfig_hideAuthor, $mosConfig_hideModifyDate, $mm_action_url, $database, $mainframe, $mosConfig_absolute_path, $vendor_full_image, $vendor_name, $limitstart, $limit, $vm_mainframe, $keyword, $cur_template;
    while (@ob_end_clean()) {
    }
    error_reporting(0);
    ini_set("allow_url_fopen", "1");
    switch ($showpage) {
        case "shop.product_details":
            $_REQUEST['flypage'] = "shop.flypage_lite_pdf";
            $_REQUEST['product_id'] = $product_id;
            ob_start();
            include PAGEPATH . $showpage . '.php';
            $html .= ob_get_contents();
            ob_end_clean();
            $html = repairImageLinks($html);
            break;
        case "shop.browse":
            // vmInputFilter is needed for the browse page
            if (!isset($vmInputFilter) || !isset($GLOBALS['vmInputFilter'])) {
                $GLOBALS['vmInputFilter'] = $vmInputFilter = vmInputFilter::getInstance();
            }
            $_REQUEST['category_id'] = $category_id;
            ob_start();
            include PAGEPATH . $showpage . '.php';
            $html .= ob_get_contents();
            ob_end_clean();
            $html = repairImageLinks($html);
            break;
    }
    $logo = IMAGEPATH . "vendor/{$vendor_full_image}";
    $logourl = IMAGEURL . "vendor/{$vendor_full_image}";
    if (version_compare(phpversion(), '5.0') < 0 || extension_loaded('domxml') || !file_exists(CLASSPATH . "pdf/dompdf/dompdf_config.inc.php")) {
        define('FPDF_FONTPATH', CLASSPATH . 'pdf/font/');
        define('RELATIVE_PATH', CLASSPATH . 'pdf/');
        require CLASSPATH . 'pdf/html2fpdf.php';
        require CLASSPATH . 'pdf/html2fpdf_site.php';
        $pdf = new PDF();
        $pdf->AddPage();
        $pdf->SetFont('Arial', '', 11);
        $pdf->InitLogo($logo);
        $pdf->PutTitle($mosConfig_sitename);
        $pdf->PutAuthor($vendor_name);
        $html = str_replace("&amp;", "&", $html);
        $pdf->WriteHTML($html);
        $pdf->Output();
    } elseif (file_exists(CLASSPATH . "pdf/dompdf/dompdf_config.inc.php")) {
        // In this part you can use the dompdf library (http://www.digitaljunkies.ca/dompdf/)
        // Just extract the dompdf archive to /classes/pdf/dompdf
        //require_once( CLASSPATH . "pdf/dompdf/dompdf_config.inc.php" );
        //require_once( CLASSPATH . "pdf/dompdf/load_font.php" );
        //require_once( CLASSPATH . "pdf/dompdf/dompdf.php" );
        //define('DOMPDF_FONTPATH', CLASSPATH.'pdf/dompdf/lib/fonts/');
        //define( 'RELATIVE_PATH', CLASSPATH.'pdf/dompdf/' );
        $image_details = getimagesize($logo);
        $footer = '<script type="text/php">

if ( isset($pdf) ) {

  // Open the object: all drawing commands will
  // go to the object instead of the current page
  $footer = $pdf->open_object();

  $w = $pdf->get_width();
  $h = $pdf->get_height();

  // Draw a line along the bottom
  $y = $h - 2 * 12 - 24;
  $pdf->line(16, $y, $w - 16, $y, "grey", 1);

  // Add a logo
  $img_w = 2 * 72; // 2 inches, in points
  $img_h = 1 * 72; // 1 inch, in points -- change these as required
  $pdf->image("' . $logourl . '", "' . $image_details[2] . '", ($w - $img_w) / 2.0, $y - $img_h, $img_w, $img_h);

  // Close the object (stop capture)
  $pdf->close_object();
  // Add the object to every page. You can
  // also specify "odd" or "even"
  $pdf->add_object($footer, "all");

}
</script>';
        $website = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
		<head>' . $mainframe->getHead() . '
			<link rel="stylesheet" href="templates/' . $cur_template . '/css/template_css.css" type="text/css" />
			<link rel="stylesheet" href="' . VM_THEMEURL . 'theme.css" type="text/css" />
			<link rel="shortcut icon" href="' . $mosConfig_live_site . '/images/favicon.ico" />
			<meta http-equiv="Content-Type" content="text/html; ' . _ISO . '" />
			<meta name="robots" content="noindex, nofollow" />
		</head>
		<body class="contentpane">
			' . $html . '
			' . $footer . '
		</body>
	</html>';
        $website = str_replace("resized%2F", "", $website);
        $website = str_replace("&amp;", "&", $website);
        $website = str_replace("#", "", $website);
        require_once CLASSPATH . "pdf/dompdf/dompdf_config.inc.php";
        $dompdf = new DOMPDF();
        $dompdf->load_html($website);
        $dompdf->render();
        // die( htmlspecialchars($website));
        //YOU CAN EITHER UNCOMMENT THE FOLLOWING LINES AND COMMENT THIS LINE --> // $dompdf->stream( "virtue".$limitstart.".pdf", array('Attachment' => 1));
        // OR LEAVE THE FOLLOWING LINES COMMENTED WITH // AND THE $dompdf->stream( "virtue".$limitstart.".pdf", array('Attachment' => 1)); UNCOMMENTED, BOTH WORK AT LAST !!
        // $file = "virtutest1.pdf";
        // file_put_contents($file, $website);
        // $url = "dompdf.php?input_file=".  $mosConfig_live_site."/".rawurlencode($file) .
        //       "&paper=letter&output_file=" . rawurlencode("virtue".$limitstart.".pdf");
        //$url  = str_replace ("%3A", ":", $url );
        //$url  = str_replace ("%5C", "/", $url );
        //$url = str_replace ("&amp;", "&", $url);
        //header("Location: ".$mosConfig_live_site . "/administrator/components/com_virtuemart/classes/pdf/dompdf/$url");
        $dompdf->stream("virtue" . $limitstart . ".pdf", array('Attachment' => 1));
    }
}
示例#4
0
$pdf = new PDF();
$pdf->SetCreator($pdf_config['creator']);
$pdf->SetTitle($pdf_data['title']);
$pdf->SetAuthor($pdf_config['url']);
$pdf->SetSubject($pdf_data['author']);
$out = $pdf_config['url'] . ', ' . $pdf_data['author'] . ', ' . $pdf_data['title'] . ', ' . $pdf_data['subtitle'] . ', ' . $pdf_data['subsubtitle'];
$pdf->SetKeywords($out);
$pdf->SetAutoPageBreak(true, 25);
$pdf->SetMargins($pdf_config['margin']['left'], $pdf_config['margin']['top'], $pdf_config['margin']['right']);
$pdf->Open();
//First page
$pdf->AddPage();
$pdf->SetXY(24, 25);
$pdf->SetTextColor(10, 60, 160);
$pdf->SetFont($pdf_config['font']['slogan']['family'], $pdf_config['font']['slogan']['style'], $pdf_config['font']['slogan']['size']);
$pdf->WriteHTML($pdf_config['slogan'], $pdf_config['scale']);
//$pdf->Image($pdf_config['logo']['path'],$pdf_config['logo']['left'],$pdf_config['logo']['top'],$pdf_config['logo']['width'],$pdf_config['logo']['height'],'',$pdf_config['url']);
$pdf->Line(25, 30, 190, 30);
$pdf->SetXY(25, 35);
$pdf->SetFont($pdf_config['font']['title']['family'], $pdf_config['font']['title']['style'], $pdf_config['font']['title']['size']);
$pdf->WriteHTML($pdf_data['title'], $pdf_config['scale']);
if ($pdf_data['subtitle'] != '') {
    $pdf->WriteHTML($puff, $pdf_config['scale']);
    $pdf->SetFont($pdf_config['font']['subtitle']['family'], $pdf_config['font']['subtitle']['style'], $pdf_config['font']['subtitle']['size']);
    $pdf->WriteHTML($pdf_data['subtitle'], $pdf_config['scale']);
}
if ($pdf_data['subsubtitle'] != '') {
    $pdf->WriteHTML($puff, $pdf_config['scale']);
    $pdf->SetFont($pdf_config['font']['subsubtitle']['family'], $pdf_config['font']['subsubtitle']['style'], $pdf_config['font']['subsubtitle']['size']);
    $pdf->WriteHTML($pdf_data['subsubtitle'], $pdf_config['scale']);
}
示例#5
0
            $order_str = 'alliance_honor DESC';
        } elseif ($order == 'points_avg') {
            $order_str = 'alliance_rank_points_avg ASC';
        }
        $listquery = $db->query('SELECT alliance_tag, alliance_name, alliance_member, alliance_planets, alliance_honor, alliance_points FROM alliance ORDER BY ' . $order_str);
        $anfang = '<table><tr><td width="75">' . $place . '</td><td width="100">Tag:</td><td width="250">' . $name . '</td><td width="100">' . $members . '</td><td width="100">' . $planets . '</td><td width="85">' . $honor . '</td><td width="85">' . $points . '</td><td width="85">' . $pointsavg . '</td></tr>';
        $ende = '</table>';
        $pdf = new PDF();
        //$pdf->SetAuthor($game->player['user_name']);
        $pdf->SetAuthor('http://www.stfc.it');
        $pdf->SetTitle($config['site_url']);
        $pdf->AddPage(L);
        $pdf->SetFont('arial', '', 16);
        $pdf->SetTextColor(250, 0, 0);
        $pdf->Cell(0, 10, $allyrank, 'B', 1);
        $pdf->Ln(0.15);
        $pdf->SetFont('Arial', 'I', 8);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->MultiCell(0, 7, $created . date('d.m.y H:i', time()) . '', 0, 'R');
        $pdf->SetAutoPageBreak(true, 15.0);
        $pdf->SetFont('Arial', '', 12);
        $pdf->WriteHTML($anfang);
        while (($alliance = $db->fetchrow($listquery)) != false) {
            $gen = '<tr><td>' . $rang_alliance . '.</td><td>' . $alliance['alliance_tag'] . '</td><td>' . $alliance['alliance_name'] . '</td><td>' . $alliance['alliance_member'] . '</td><td>' . $alliance['alliance_planets'] . '</td><td>' . ($alliance['alliance_honor'] < 1 ? '-' : '' . $user['alliance_honor'] . '') . '</td><td>' . $alliance['alliance_points'] . '</td><td>' . round($alliance['alliance_points'] / $alliance['alliance_member']) . '</td></tr>';
            $pdf->WriteHTML($gen);
            $rang_alliance++;
        }
        $pdf->WriteHTML($ende);
        $pdf->Output();
    }
}
示例#6
0
// Siempre y cuando los datos extraídos de la BD sean UTF8 (no lo probe con otra codificación)
$nombre = html_entity_decode($nombre);
$descripcion = html_entity_decode($descripcion);
$cliente = html_entity_decode($cliente);
$codigo = html_entity_decode($codigo);
$telefono = html_entity_decode($telefono);
//Creamos una nueva instancia de la clase
$pdf = new PDF();
//Añádimos la primera página
$pdf->AddPage();
$pdf->SetFont('Helvetica', '', 20);
$pdf->Ln(12);
$pdf->Line(10, 30, 200, 30);
$pdf->SetFontSize(17);
$pdf->SetTextColor(44, 62, 80);
$pdf->WriteHTML("Online Computer Shop");
$pdf->SetTextColor(0);
$pdf->SetLeftMargin(155);
$pdf->SetFontSize(14);
$pdf->Ln(-15);
$pdf->WriteHTML("<br><br><b>Fecha:</b> " . date("d/m/Y", time() - 25200));
$pdf->WriteHTML("<br><b>Hora:</b> " . date("H:i:s", time() - 25200) . "\n\n");
$pdf->SetLeftMargin(10);
$pdf->Ln(13);
// Otra parte importante, luego de pasar las variables por la función html_entity_decode, para que se vean bien los acentos y las ñ, hay que pasarlas por otra
// función que es utf8_decode
$pdf->SetFontSize(14);
$pdf->WriteHTML(utf8_decode($nombre));
$pdf->WriteHTML("<br><br>");
$pdf->WriteHTML(utf8_decode($cliente));
$pdf->WriteHTML("<br>");
示例#7
0
        		$serie_nombre = $rs->fields["SGD_SRD_DESCRIP"];
        		$subserie_grb = $rs->fields["SGD_SBRD_CODIGO"];
        		$subserie_nombre = $rs->fields["SGD_SBRD_DESCRIP"]; **/
        $inf .= "\n<TABLE BORDER=1>\n<TR>\n\t<TD BGCOLOR='#CCCCCC' WIDTH='110'>FECHA DE RAD</TD>\n\t<TD WIDTH=200>\n\t{$radi_fech_radi}\n\t</TD>\n\t<TD BGCOLOR='#CCCCCC' WIDTH='80'>ASUNTO \n\t</TD>\n\t<TD WIDTH=360> \n\t{$ra_asun}\n</TR>\n<TR>\n<TD BGCOLOR='#CCCCCC' WIDTH=110> \n" . $tip3Nombre[1][$ent] . ".</TD>\n<TD WIDTH=200> \n{$nombret_us1}\n</td>\n<td WIDTH=80 bgcolor='#CCCCCC'>DIRECCION</td>\n<td  WIDTH=360> \n{$direccion_us1}\n({$dpto_nombre_us1} / {$muni_nombre_us1})\n</td>\n</tr>\n<TR>\n<TD WIDTH='110' bgcolor='#CCCCCC'> \n" . $tip3Nombre[2][$ent] . ".</td>\n<TD WIDTH='200'> \n{$nombret_us2}\n</TD>\n<TD BGCOLOR='#CCCCCC' width='80' >\nDIRECCION\n</TD>\n<TD WIDTH='360'> \n{$direccion_us2}\n({$dpto_nombre_us2} / {$muni_nombre_us2})\n</TD>\n</tr>\n<tr><TD WIDTH=110 bgcolor='#CCCCCC'>" . $tip3Nombre[3][$ent] . ".</td>\n<TD width='200'>{$nombret_us3}</td>\n<TD bgcolor='#CCCCCC' width='80'>DIRECCION \n</td>\n<TD  width='360'>\n{$direccion_us3} ({$dpto_nombre_us3} / {$muni_nombre_us3})\n</TD>\n</TR>\n<TR>\n<TD WIDTH='375' BGCOLOR='#CCCCCC' colspan=2><CENTER><B>Cta / Contrato</B></CENTER></TD>\n<TD WIDTH='375' BGCOLOR='#CCCCCC' colspan=2><CENTER><B>SECTOR</B></CENTER></TD>\n</TR>\n<TR>\n<TD  WIDTH='375' colspan=2>-{$cuentai}</TD>\n<TD  WIDTH='375' colspan=2><CENTER><B>-{$sector_nombre}</B></CENTER></TD>\n</TR>\n<TR>\n<TD BGCOLOR='#CCCCCC' WIDTH='500' colspan=2><CENTER><B>TRD</B></CENTER>\n</TD>\n<TD BGCOLOR='#CCCCCC' WIDTH='250' colspan=2><CENTER><B>CAUSAL</B></CENTER>\n</TD>\n</TD>\n</TR>\n<TR>\n<TD WIDTH='500' colspan=2><CENTER>{$serie_nombre} / {$subserie_nombre} / {$tpdoc_nombreTRD}</CENTER>\n</TD>\n<TD WIDTH='250' colspan=2><CENTER>{$causal_nombre} / {$dcausal_nombre}</CENTER>\n</TD>\n</TR>\n<TR>\n<TD WIDTH='500' HEIGHT='150' colspan=3><CENTER>-</CENTER>\n</TD>\n<TD WIDTH='250' HEIGHT='150' colspan=3><CENTER>-</CENTER>\n</TD>\n</TR>\n<TR><TD WIDTH='500'  colspan=3><CENTER>Firma Usuario</CENTER>\n</TD>\n<TD WIDTH='250'  colspan=3><CENTER>Firma Funcionario {$db->entidad}</CENTER>\n</TD>\n</TR>\n</TABLE>";
    } else {
        echo "<center><b><span class='eerrores'>NO TIENE AUTORIZACION PARA INGRESAR</span><BR><span class='eerrores'>\n\t<a href='login.php' target=_parent>Por Favor intente validarse de nuevo. Presione aca!</span></a>";
    }
    define(FPDF_FONTPATH, '../fpdf/font/');
    require "../fpdf/html_table.php";
    error_reporting(7);
    $espacio = "<table><tr><td>............................................................................................................................................................................................................................................................................................................................................................................</td></tr></table>";
    //$pdf = new PDF("L","mm","A4");
    $pdf = new PDF("P", "mm", "A4");
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 8);
    $pdf->WriteHTML($inf1 . $inf . $espacio . $inf1 . $inf);
    $arpdf_tmp = "../{$carpetaBodega}/pdfs/planillas/envios/{$krd}" . "_lis_IMP.pdf";
    $pdf->Output($arpdf_tmp);
    echo "<br>";
    echo $inf1 . $inf;
    ?>
<br>
	<table border=0 width=80%><tr><td>
<?php 
    echo "<center><a class=vinculos href='{$arpdf_tmp}?fechaf" . date("dmYh") . time("his") . "'>Abrir Archivo Pdf</a></center></td><td>";
    if (!trim($radi_path) and !$subirImagen) {
        echo "<center><input type=submit name=subirImagen value='COLOCAR PDF COMO IMAGEN DEL RADICADO'></center>";
    }
    ?>
	</td></tr></table>
	<?php 
示例#8
0
 function run()
 {
     // change some win codes, and xhtml into html
     $str = array('<br />' => '<br>', '<hr />' => '<hr>', '[r]' => '<red>', '[/r]' => '</red>', '[l]' => '<blue>', '[/l]' => '</blue>', '&#8220;' => '"', '&#8221;' => '"', '&#8222;' => '"', '&#8230;' => '...', '&#8217;' => '\'');
     foreach ($str as $_from => $_to) {
         $this->html = str_replace($_from, $_to, $this->html);
     }
     $pdf = new PDF('P', 'mm', 'A4', $this->title, $this->articleurl, false);
     $pdf->Open();
     $pdf->SetCompression(true);
     $pdf->SetCreator("Script by Radek HULAN, http://hulan.info/blog/");
     $pdf->SetDisplayMode('real');
     $pdf->SetTitle($this->_convert($this->title));
     $pdf->SetAuthor($this->articleurl);
     $pdf->AddPage();
     // face
     $pdf->PutMainTitle($this->_convert($this->title));
     $pdf->PutMinorHeading('Article URI');
     $pdf->PutMinorTitle($this->articleurl, $this->articleurl);
     $pdf->PutMinorHeading('Author');
     $pdf->PutMinorTitle($this->_convert($this->author));
     $pdf->PutMinorHeading("Published: " . date("F j, Y, g:i a", $this->date));
     $pdf->PutLine();
     $pdf->Ln(10);
     // html
     $pdf->WriteHTML($this->_convert(stripslashes($this->html)), $this->bi);
     //save and redirect
     $filename = $this->directory . $this->_makeFileName($this->title) . '.pdf';
     $http = $this->http . $this->_makeFileName($this->title) . '.pdf';
     $pdf->Output($filename);
     header("Location: {$http}");
     // cleanup
     $files = opendir($this->directory);
     while (false !== ($filename = readdir($files))) {
         if (!(strpos($filename, '.pdf') === false)) {
             // delete old temp files
             $time = filectime($this->directory . $filename);
             if (!($time === false) && $time > 0) {
                 if ($time + $this->delete * 60 < time()) {
                     unlink($this->directory . $filename);
                 }
             }
         }
     }
     // stop processing
     exit;
 }
示例#9
0
        fclose($fp);
        $fecha_dia = date("Ymd - H:i:s");
        $html = $htmlE;
        $html .= $btt->tabla_html;
        $html = iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $html);
        error_reporting(7);
        define(FPDF_FONTPATH, '../fpdf/font/');
        require "../fpdf/html_table.php";
        error_reporting(7);
        $pdf = new PDF("L", "mm", "A4");
        $pdf->AddPage();
        $pdf->SetFont('Arial', '', 8);
        $entidad = $db->entidad;
        $encabezado = "<table border=0>\n           <tr><center><td width=1120 height=70>{$entidad_largo}</td></center></tr>\n\t\t\t<tr><td width=1120 height=40> </td></tr>\n\t\t\t<tr><td width=1120 height=40> </td></tr>\n\t\t\t<tr><td width=1120 height=40> </td></tr>\n\t\t\t<tr><td width=1120 height=80> </td></tr> \n\t\t\t<tr><td width=1120 height=20>Dependencia              : {$depe_nomb} </td></tr>\n\t\t\t<tr><td width=1120 height=20> Usuario responsable  : " . utf8_decode($usua_nomb) . " </td></tr>\n\t\t\t<tr><td width=1120 height=20> Fecha Inicial               : {$fecha_ini} </td></tr>\n\t\t\t<tr><td width=1120 height=20> Fecha Final                : {$fecha_fin} </td></tr>\n\t\t\t<tr><td width=1120 height=20> Fecha Generado        : {$fecha_dia} </td></tr>\n\t\t\t<tr><td width=1120 height=20> Número de Registros : {$no_registros} </td></tr>\n\t\t\t<tr><td width=1120 height=40></td></tr>\n\t\t\t</table>";
        $fin = "<table border=0 >\n\t\t    <tr><td width=1120 height=40></td></tr>\n\t\t\t<tr><td width=1120 height=40 >Fecha de Entrega         ________________________________________________</td></tr>\n\t\t\t<tr><td width=560 height=40 > Funcionario que Entrega  ________________________________________________</td>\n\t\t\t<td width=560 height=30 > Funcionario que Recibe   ______________________________________________</td></tr>\n\t\t\t<tr><td width=1120 height=40 >Observaciones\t  ____________________________________________________________________________________________________________________________________________________________________</td></tr>\n\t\t\t<tr><td width=1120 height=40 >__________________________________________________________________________________________________________________________________________________________________________________</td></tr>\n\t\t\t<tr><td width=1120 height=40></td></tr>\n\t\t</table>\n\t\t<br>";
        $pdf->WriteHTML($encabezado . iconv($odt->codificacion($html), 'ISO-8859-1', $html) . $fin);
        require "{$ruta_raiz}/config.php";
        $archivo = "/tmp/lst_entrega" . date("dmY") . time("his") . ".pdf";
        $arpdf_tmp = "../{$carpetaBodega}{$archivo}";
        $pdf->Output($arpdf_tmp, 'F');
        echo "<a href='../seguridadImagen.php?fec=" . base64_encode($archivo) . "' target='" . date("dmYh") . time("his") . "' class='vinculos'>Abrir archivo pdf</a><br/>";
    }
    echo "<center><a href='{$ruta_raiz}/envios/cuerpoMarcaEnviar.php?{$phpsession}&krd={$krd}&usua_perm_impresion={$usua_perm_impresion}&carpeta=8&nomcarpeta=Documentos Para Impresion&orderTipo=desc&orderNo=3' target='mainFrame' class='vinculos'>Volver a listado de impresi&oacute;n</a></center>";
    ?>
    </form>
    <?php 
} else {
    echo "<hr><center><b><span class='alarmas'>Operacion CANCELADA</span></center></b></hr>";
}
?>
</body>
示例#10
0
            $this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
            $this->Cell($w[2], 6, number_format($row[2], 0, ',', ' '), 'LR', 0, 'R', $fill);
            $this->Cell($w[3], 6, number_format($row[3], 0, ',', ' '), 'LR', 0, 'R', $fill);
            $this->Ln();
            $fill = !$fill;
        }
        $this->Cell(array_sum($w), 0, '', 'T');
    }
}
//NL) does not work with wikka
//vérification de sécurité
if (!eregi("wakka.php", $_SERVER['PHP_SELF'])) {
    die("acc&egrave;s direct interdit");
}
if ($this->HasAccess("read")) {
    //Instanciation de la classe dérivée
    $pdf = new PDF();
    $pdf->AliasNbPages();
    $pdf->SetMargins(10, 10, 10);
    $pdf->setWikiPage($this->GetPageTag());
    $pdf->AddPage();
    $pdf->WriteHTML($this->Format($this->page["body"], "wakka"));
    $pdf->Output();
    //}
    //}
} else {
    return;
}
?>
 
示例#11
0
 if (strlen($row['syno']) > 0) {
     $pdf->MultiCell(0, 5, "Synonymes : " . $row['syno']);
 }
 $pdf->SetFont("Arial", "I", 12);
 $pdf->MultiCell(0, 5, $row['famille'], 0);
 $pdf->SetFont("Arial", "B", 10);
 if (strlen($row['nom_fr']) > 0) {
     $pdf->MultiCell(0, 5, $row['nom_fr'], 0);
 }
 $pdf->SetFont("Arial", "", 10);
 $pdf->Ln(3);
 if (strlen($row['descr']) > 0) {
     $pdf->AjouterChapitre("Description", convert_txt($row['descr']));
 }
 if (strlen($row['biolo']) > 0) {
     $pdf->WriteHTML("<b>Type biologique : </b>" . $biolo_txt[$row['biolo']] . "<br>");
 }
 if (strlen($row['cycle']) > 0) {
     $pdf->WriteHTML("<b>Cycle de vie : </b>" . $cycle_txt[$row['cycle']] . "<br>");
 }
 if (strlen($row['pheno']) > 0) {
     $pdf->WriteHTML("<b>Floraison : </b>" . $row['pheno'] . "<br>");
 }
 $pdf->Ln(3);
 $pdf->Ln(2);
 $pdf->TitreChapitre("Aire de répartition");
 if (strlen($row['choro']) > 0) {
     $pdf->WriteHTML("<b>Type chorologique : </b>" . $row['choro'] . "<br>");
 }
 if (strlen($row['repart_gl']) > 0) {
     $pdf->AjouterChapitre("Générale", convert_txt($row['repart_gl']));
示例#12
0
        }
    }
    $pdf = new PDF();
    $pdf->enableBookmarks = TRUE;
    $pdf->Open();
    $pdf->AliasNbPages();
    $pdf->SetDisplayMode("real");
    foreach ($arrContent as $key => $value) {
        $pdf->rubrik = $arrRubrik[$key];
        $pdf->thema = $arrThema[$key];
        $pdf->categories = $tree->categoryName;
        $date = $arrDatum[$key];
        $author = $arrAuthor[$key];
        $pdf->AddPage();
        $pdf->SetFont("Arial", "", 12);
        $pdf->WriteHTML(unhtmlentities($value));
    }
    $pdfFile = PMF_ROOT_DIR . "/pdf/faq.pdf";
    $pdf->Output($pdfFile);
    print "<p>" . $PMF_LANG["ad_export_full_faq"] . "<a href=\"../pdf/faq.pdf\" target=\"_blank\">" . $PMF_CONF["title"] . "</a></p>";
}
if (isset($submit[3])) {
    // XML DocBook export
    require PMF_ROOT_DIR . "/inc/docbook.php";
    $parentID = 0;
    $rubrik = 0;
    $sql = '';
    $selectString = '';
    $export = new DocBook_XML_Export($DB);
    $export->delete_file();
    // Set the FAQ title
示例#13
0
	tidak terpisahkan dari <br>
	nomor dan tanggal <br>
	surat pada agenda <br></i>
	</td>
	<td style="vertical-align: text-top;">
	<b> CATATAN </b>
	<br>
	' .$row['isi_dis']. '
	<br>
	<br>
	<center>
	Tangerang,' .$row['tgl_agen']. '
	<br>
	' .$departemen. '
	<br>
	<br>
	<br>
	<br>
	<u> ' .$nama. '</u>
	</u>
	</center>
	</td>
	</tr>
	</table>';

    if(ini_get('magic_quotes_gpc')=='1')
        $text=stripslashes($text);
    $pdf->WriteHTML($text);
    $pdf->Output();
    exit;
?>
示例#14
0
    $pdf->SetLeftMargin(25);
    $pdf->SetRightMargin(25);
    $pdf->SetFont('Arial', 'B', 12);
    $pdf->ln(22);
    $pdf->Cell(170, 2, "No. de Radicado:" . $numradicado, 0, 1, R);
    //$pdf->SetFont('Free3of9', '', 16);
    $fecha = date("Y/m/d");
    $pdf->Cell(170, 2, " ", 0, 1, R);
    $pdf->Cell(170, 2, "Fecha :  " . $fecha . "                         ", 0, 1, R);
    //$pdf->Cell(170, 10,$lugar."., ". $fecha, 0, 1, L);
    $encabezado = "{$numradicado} <br> {$lugar}," . date("Y/M/D");
    $pdf->ln(17);
    $pdf->SetFont('Arial', '', 12);
    $pdf->WriteHtml($asu);
    $pdf->ln(19);
    //$pdf->Image('http://debian/orfeo-3.8.0/logoEntidad.jpg' , 25 ,5, 160 , 25,'JPG', 'http://www.correlibre.org');
    $pdf->Image('http://debian/orfeo-3.8.0/logoEntidadPiePagina.jpg', 25, 270, 170, 20, 'JPG', 'http://www.correlibre.org');
    //$pdf->Cell(60, 5, $mensaje, 0, 1, L);
    $pdf->WriteHTML("<HTML><BODY>" . $mensaje . "</BODY></HTML>");
    //echo "<hr>$mensaje<hr> $asu";
    $pdf->ln(5);
    $pdf->MultiCell(0, 5, $reseptor, 0, J);
    $primerno = substr($numRadicadoPadre, 0, 4);
    $segundono = substr($numRadicadoPadre, 4, 3);
    $ruta = "/" . $primerno . "/" . $segundono . "/docs/" . $numradicado;
    $adjuntos = "../bodega" . $ruta;
    $pdf->Output($adjuntos . '.pdf', 'f');
    $enlace = "../bodega" . $ruta . '.pdf';
    radi_paht($db, $ruta, $numradicado);
    return $numradicado . '.pdf';
}
示例#15
0
        //array("\\r\\n", "\\n", "\\r");
        $newReport = str_replace($order, ' ', $content['newsMonth']);
        $newerReport = str_replace("\\n", '*', $newReport);
        $pdf->PrintChapter(3, '', stripslashes($newerReport));
        $pdf->Ln();
    }
}
// Blog info ######################################################
//$pdf->Ln();
$pdf->SetFont('Helvetica', '', 9);
$pdf->SetFont('', 'B');
//$pdf->WriteHTML('__________________________________________________________________________________________________________');
$pdf->PrintChapter(1, '', '_________________________________________________');
$pdf->Ln();
//$pdf->Ln();
$pdf->WriteHTML('Read more on our personal blogs');
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('Times', '', 9);
$query_getData = "SELECT nameFull, blogName, blogURL, blogDescription FROM userdata";
$result_getData = mysql_query($query_getData, $cxn) or die("Couldn't execute query 1");
// Write blog info
while ($content = mysql_fetch_assoc($result_getData)) {
    if ($content['nameFull'] != '' && $content['blogName'] != '') {
        //$pdf->SetFont('','I');
        $pdf->SetFont('', '');
        $pdf->WriteHTML('<i>' . $content['blogName'] . '</i> - by ' . $content['nameFull'] . ' - ');
        $pdf->SetFont('', '');
        $pdf->WriteHTML('<a href=' . $content['blogURL'] . '>Visit blog</a><br />');
        $pdf->WriteHTML($content['blogDescription']);
        $pdf->Ln(8);
示例#16
0
文件: pdf.php 项目: renevaessen/pim
        foreach (array('B', 'I', 'U') as $s) {
            if ($this->{$s} > 0) {
                $style .= $s;
            }
        }
        $this->SetFont('', $style);
    }
    function PutLink($URL, $txt)
    {
        //Put a hyperlink
        $this->SetTextColor(0, 0, 255);
        $this->SetStyle('U', true);
        $this->Write(5, $txt, $URL);
        $this->SetStyle('U', false);
        $this->SetTextColor(0);
    }
}
$pdf = new PDF();
foreach ($_POST['brief'] as $i => $value) {
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 16);
    if ($_POST[$i]['pdflogo']) {
        $pdf->Image($_POST[$i]['pdflogo'], 10, 12, 30, 0, '', '');
    }
    $pdf->WriteHTML($value);
}
$pdf->Output();
?>


示例#17
0
<?php

require 'fonction.inc';
require 'exportPDF.php';
$bdd = connexionDB();
session_start();
$pdf = new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 12);
$pdf->WriteHTML(suppliesStudentList($bdd));
$pdf->Output('exportPDF.pdf');
示例#18
0
$pdf->SetFont('Arial', '', 10);
$pdf->Open();
$pdf->SetDisplayMode(150, 'single');
$pdf->SetLeftMargin(15);
$pdf->SetRightMargin(15);
$pdf->SetFillColor(240, 240, 240);
$pdf->AddPage();
$pdf->Cell(0, 5, ' ', 0, 1, 'C');
$pdf->Ln();
// heading
$pdf->SetFont('Arial', '', 10);
//$pdf->Cell (0, 5, 'Simian Systems Inc.', 0, 1, 'R');
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(0, 5, appconf('company_address'), 0, 1, 'R');
$pdf->SetLeftMargin(131.5);
$pdf->WriteHTML('tel: ' . appconf('company_phone') . ', web: <a href="http://' . appconf('company_website') . '/">' . appconf('company_website') . '</a>');
$pdf->SetLeftMargin(15);
$pdf->Ln();
$pdf->Cell(0, 5, ' ', 0, 1, 'C');
$pdf->Ln();
// client info
$client = db_single('select * from siteinvoice_client where id = ?', $cgi->client);
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(0, 5, 'Client Information', 0, 1);
$pdf->SetFont('Arial', '', 10);
$pdf->MultiCell(0, 4, $client->name . "\n" . $client->address, 0, 1);
$pdf->Ln();
/*
$pdf->MultiCell (0, 4, 'Note: As per contract signed with 10Digit Communications November, 28th, 2001 for Support Fees for Sitellite' . "\n" . 'Content Management Website Software: http://www.winnipegfreepress2.com/sitellite, http://www.wfpauto.com, and resold licenses.', 0, 1);
$pdf->Ln ();
*/
示例#19
0
 public function display($modifier = null)
 {
     require_once ROOT_PATH . '/lib/common/xajax/xajax.inc.php';
     require_once ROOT_PATH . '/lib/common/xajax/xajaxElementFiller.php';
     require_once ROOT_PATH . '/language/default/lang_default_full.php';
     require_once ROOT_PATH . '/plugins/fpdf2/html2pdf.php';
     $printPdf = isset($_GET['printPdf']) && $_GET['printPdf'] == 1;
     if ($printPdf) {
         ob_start();
     }
     $lan = new Language();
     require_once $lan->getLangPath("full.php");
     $records = $this->getObj();
     if (isset($this->error)) {
         $errorFlag = true;
     }
     $styleSheet = CommonFunctions::getTheme();
     if (!empty($this->templateHeader)) {
         require_once ROOT_PATH . $this->getTemplateHeader();
     }
     require_once ROOT_PATH . $this->getTemplatePath();
     if (!empty($this->templateFooter)) {
         require_once ROOT_PATH . $this->getTemplateFooter();
     }
     if ($printPdf) {
         $html = ob_get_clean();
         $pdf = new PDF();
         $pdf->AddPage();
         $pdf->SetFont('Arial', '', 10);
         if (ini_get('magic_quotes_gpc') == '1') {
             $html = stripslashes($html);
         }
         $pdf->WriteHTML($html);
         $pdf->Output($_GET['pdfName'] . '.pdf', 'F');
         echo "<img onclick=\"history.back();\" src=\"" . $_SESSION['WPATH'] . "/themes/beyondT/pictures/btn_back.gif\" onmouseover=\"this.src='" . $_SESSION['WPATH'] . "/themes/beyondT/pictures/btn_back_02.gif';\" onmouseout=\"this.src='" . $_SESSION['WPATH'] . "/themes/beyondT/pictures/btn_back.gif';\" title=\"Back\" />";
         echo "<script>window.open('" . $_SESSION['WPATH'] . "/lib/controllers/{$_GET['pdfName']}.pdf');</script>";
     }
 }
示例#20
0
//Antes de pasar los datos al PDF, hay que pasar las variables por la función html_entity_decode para decodificar los caracteres especiales, los acentos y las ñ
// Siempre y cuando los datos extraídos de la BD sean UTF8 (no lo probe con otra codificación)
$nombre = html_entity_decode($nombre);
$descripcion = html_entity_decode($descripcion);
//Creamos una nueva instancia de la clase
$pdf = new PDF();
//Añádimos la primera página
$pdf->AddPage();
$pdf->Image('log.jpg', 8, 8, 30);
$pdf->Ln(12);
$pdf->SetFont('Helvetica', '', 20);
//$pdf->Ln(12);
$pdf->Line(10, 30, 200, 30);
$pdf->SetFontSize(17);
$pdf->SetTextColor(44, 62, 80);
$pdf->WriteHTML("Online Computer Shop");
$pdf->SetTextColor(0);
$pdf->SetLeftMargin(155);
$pdf->SetFontSize(14);
$pdf->Ln(-15);
$pdf->WriteHTML("<br><br><b>Fecha:</b> " . date("d/m/Y", time() - 25200));
$pdf->WriteHTML("<br><b>Hora:</b> " . date("H:i:s", time() - 25200) . "\n\n");
$pdf->SetLeftMargin(10);
$pdf->Ln(14);
// Otra parte importante, luego de pasar las variables por la función html_entity_decode, para que se vean bien los acentos y las ñ, hay que pasarlas por otra
// función que es utf8_decode
$pdf->SetFontSize(14);
$pdf->WriteHTML(utf8_decode($nombre));
$pdf->WriteHTML("<br>");
$pdf->WriteHTML(utf8_decode($descripcion));
//La función WriteHTML es la que creamos anteriormente para que lea las etiquetas html como <br>, <b>, <i>, <p>, etc.
示例#21
0
    }
    function PutLink($URL, $txt)
    {
        // Escribir un hiper-enlace
        $this->SetTextColor(0, 0, 255);
        $this->SetStyle('U', true);
        $this->Write(5, $txt, $URL);
        $this->SetStyle('U', false);
        $this->SetTextColor(0);
    }
}
$html = 'Ahora puede imprimir fácilmente texto mezclando diferentes estilos: <b>negrita</b>, <i>itálica</i>,
<u>subrayado</u>, o ¡ <b><i><u>todos a la vez</u></i></b>!<br><br>También puede incluir enlaces en el
texto, como <a href="http://www.fpdf.org">www.fpdf.org</a>, o en una imagen: pulse en el logotipo.';
$pdf = new PDF();
// Primera página
$pdf->AddPage();
$pdf->SetFont('Arial', '', 20);
$pdf->Write(5, 'Para saber qué hay de nuevo en este tutorial, pulse ');
$pdf->SetFont('', 'U');
$link = $pdf->AddLink();
$pdf->Write(5, 'aquí', $link);
$pdf->SetFont('');
// Segunda página
$pdf->AddPage();
$pdf->SetLink($link);
$pdf->Image('logo.png', 10, 12, 30, 0, '', 'http://www.fpdf.org');
$pdf->SetLeftMargin(45);
$pdf->SetFontSize(14);
$pdf->WriteHTML($html);
$pdf->Output();
示例#22
0
</tr>
<tr>
<td width="200" height="40">Port:</td><td width="500" height="40">' . $mailport . '</td>
</tr>
<tr>
<tr>
<td width="700" height="50"><b>Cron Job</b></td><td width="200" height="40"></td>
</tr>
<td width="700" height="40">' . $cronjoburl . '</td><td width="200" height="40"></td>
</tr>
<tr>
<td width="700" height="40">' . $expirydocurl . '</td><td width="200" height="40"></td>
</tr>
</table>';
    $pdf = new PDF();
    $pdf->SetFont('Arial', '', 12);
    $pdf->AddPage();
    if (ini_get('magic_quotes_gpc') == '1') {
        $output = stripslashes($output);
    }
    $pdf->WriteHTML($output);
    $pdf->Output('Installation.pdf', 'D');
    exit;
} else {
    header("Location: " . BASE_URL . "");
}
?>



示例#23
0
        $date = $row->datum;
        $author = $row->author;
    }
} else {
    print "Error!";
}
$pdf = new PDF($currentCategory, $thema, $tree->categoryName, $orientation = "P", $unit = "mm", $format = "A4");
$pdf->Open();
$pdf->SetAutoPageBreak(true, 2 * (40 / $pdf->k));
$pdf->SetTitle($thema);
$pdf->SetCreator($PMF_CONF["title"]);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont("Arial", "", 12);
$pdf->SetDisplayMode("real");
$pdf->WriteHTML(str_replace("../", "", $content));
$pdf->Ln();
$pdf->Ln();
$pdf->SetStyle('I', true);
$pdf->Write(5, unhtmlentities($PMF_LANG['ad_entry_solution_id']) . ': #' . $solution_id);
$pdf->SetAuthor($author);
$pdf->Ln();
$pdf->Write(5, unhtmlentities($PMF_LANG["msgAuthor"]) . $author);
$pdf->SetAuthor($author);
$pdf->Ln();
$pdf->Write(5, unhtmlentities($PMF_LANG["msgLastUpdateArticle"]) . makeDate($date));
$pdf->SetStyle('I', false);
$pdfFile = "pdf/" . $id . ".pdf";
$pdf->Output($pdfFile);
$file = basename($pdfFile);
$size = filesize($pdfFile);
示例#24
0
draw_frame_letter($certificate->bordercolor, $orientation);
print_watermark_letter($certificate->printwmark, $orientation);
print_seal($certificate->printseal, $orientation, 590, 425, '', '');
print_signature($certificate->printsignature, $orientation, 110, 450, '', '');
// Add text
$pdf->SetTextColor(0, 0, 120);
cert_printtext(150, 125, 'C', 'Helvetica', 'B', 30, utf8_decode(get_string("titleletterlandscape", "certificate")));
$pdf->SetTextColor(0, 0, 0);
cert_printtext(150, 180, 'C', 'Times', 'B', 20, utf8_decode(get_string("introletterlandscape", "certificate")));
cert_printtext(150, 230, 'C', 'Helvetica', '', 30, utf8_decode($studentname));
cert_printtext(150, 280, 'C', 'Helvetica', '', 20, utf8_decode(get_string("statementletterlandscape", "certificate")));
cert_printtext(150, 330, 'C', 'Helvetica', '', 20, utf8_decode($course->fullname));
cert_printtext(150, 380, 'C', 'Helvetica', '', 14, utf8_decode($certificatedate));
cert_printtext(150, 420, 'C', 'Times', '', 10, utf8_decode($grade));
cert_printtext(150, 431, 'C', 'Times', '', 10, utf8_decode($outcome));
cert_printtext(150, 442, 'C', 'Times', '', 10, utf8_decode($credithours));
cert_printtext(150, 500, 'C', 'Times', '', 10, utf8_decode($code));
$i = 0;
if ($certificate->printteacher) {
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    if ($teachers = get_users_by_capability($context, 'mod/certificate:printteacher')) {
        foreach ($teachers as $teacher) {
            $i++;
            cert_printtext(110, 460 + $i * 12, 'L', 'Times', '', 12, utf8_decode(fullname($teacher)));
        }
    }
}
cert_printtext(120, 470, '', '', '', '', '');
$pdf->SetLeftMargin(110);
$pdf->WriteHTML($customtext);
 <br>
	Fecha Final   <?php 
    echo $fecha_busq2 . "  23:59:59";
    ?>
 <br>
	Fecha Generado <?php 
    echo date("Ymd - H:i:s");
    ?>
 
	<?php 
    $btt->tabla_sql($query_t);
    error_reporting(7);
    $html = $btt->tabla_html;
    error_reporting(7);
    define(FPDF_FONTPATH, '../fpdf/font/');
    require "../fpdf/html_table.php";
    error_reporting(7);
    $pdf = new PDF("L", "mm", "A4");
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 7);
    $entidad = $db->entidad;
    $encabezado = "<table border=1>\n\t\t\t<tr>\n\t\t\t<td width=1120 height=30>{$entidad}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td width=1120 height=30>REPORTE DE DOCUMENTOS ENVIADOS ENTRE {$fecha_busq}   00:00:00  y {$fecha_busq2}   23:59:59 </td>\n\t\t\t</tr>\n\t\t\t</table>";
    $fin = "<table border=1 bgcolor='#FFFFFF'>\n\t\t\t<tr>\n\t\t\t<td width=1120 height=60 bgcolor='#CCCCCC'>FUNCIONARIO CORRESPONDENCIA</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td width=1120 height=60></td>\n\t\t\t</tr>\n\t\t</table>";
    $pdf->WriteHTML($encabezado . $html . $fin);
    $arpdf_tmp = "../bodega/pdfs/planillas/envios/{$dependencia_}{$krd}" . date("Ymd_hms") . "_envio.pdf";
    $pdf->Output($arpdf_tmp);
    echo "<a href='{$arpdf_tmp}' target='" . date("dmYh") . time("his") . "'>Abrir Archivo Pdf</a>";
}
?>
</form>
<HR>
示例#26
0
 public function display($modifier = null)
 {
     @ob_clean();
     require_once ROOT_PATH . '/language/default/lang_default_full.php';
     require_once ROOT_PATH . '/plugins/fpdf2/html2pdf.php';
     $printPdf = isset($_GET['printPdf']) && $_GET['printPdf'] == 1;
     if ($printPdf) {
         ob_start();
     }
     $lan = new Language();
     require_once $lan->getLangPath("full.php");
     $records = $this->getObj();
     if (isset($this->error)) {
         $errorFlag = true;
     }
     $styleSheet = CommonFunctions::getTheme();
     if (!empty($this->templateHeader)) {
         require_once ROOT_PATH . $this->getTemplateHeader();
     }
     require_once ROOT_PATH . $this->getTemplatePath();
     if (!empty($this->templateFooter)) {
         require_once ROOT_PATH . $this->getTemplateFooter();
     }
     if ($printPdf) {
         $html = ob_get_clean();
         $pdf = new PDF();
         $pdf->AddPage();
         $pdf->SetFont('Arial', '', 10);
         if (ini_get('magic_quotes_gpc') == '1') {
             $html = stripslashes($html);
         }
         $pdf->WriteHTML($html);
         $pdf->Output($_GET['pdfName'] . '.pdf', 'F');
         // TODO: Replace this with xhtml
         echo '<html>' . '<head>' . '<link href="../../themes/' . $_SESSION['styleSheet'] . '/css/style.css" type="text/css" rel="stylesheet" />' . '<style type="text/css">' . 'body { margin: 10px; }' . '</style>' . '</head>' . '<body>';
         echo '<input type="button" class="backbutton" value="' . $lang_Common_Back . '"' . ' onclick="history.back();" ' . 'onmouseover="moverButton(this)" onmouseout="moutButton(this)"  />';
         echo '</body></html>';
         echo "<script>window.open('" . $_SESSION['WPATH'] . "/lib/controllers/{$_GET['pdfName']}.pdf');</script>";
     }
 }
示例#27
0
        $this->Image('http://somosmaestros.co/images/logo.png', 50, 8, 80);
        // Arial bold 15
        $this->SetFont('Arial', 'B', 15);
        // Movernos a la derecha
        $this->Cell(80);
        $this->Ln(20);
        // Título
        $this->Write(10, $titulo);
        // Salto de línea
        $this->Ln(20);
    }
    // Pie de página
    function Footer()
    {
        // Posición: a 1,5 cm del final
        $this->SetY(-15);
        // Arial italic 8
        $this->SetFont('Arial', 'I', 8);
        // Número de página
        $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }
}
// Creación del objeto de la clase heredada
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Helvetica', '', 12);
$pdf->Image($url . $imagen, 25, 55, 150, 100);
$pdf->Ln(120);
$pdf->WriteHTML($contenido);
$pdf->Output();
示例#28
-1
文件: pdf.php 项目: Boris-de/videodb
/**
 * Export PDF document
 *
 * @param   string  $where  WHERE clause for SQL statement
 */
function pdfexport($WHERE)
{
    global $config;
    $ypos = $config['pdf_font_size'];
    // Match the font size for proper vertical offset
    $page_width = $config['pdf_page_width'];
    $margin = $config['pdf_margin'];
    $left_margin = $config['pdf_left_margin'];
    $right_margin = $config['pdf_right_margin'];
    $mediaimg_width = $config['pdf_image_media_width'];
    $font_size = $config['pdf_font_size'];
    $image_height = $config['pdf_image_height'];
    $image_width = $config['pdf_image_width'];
    $font_title = $config['pdf_font_title'];
    $font_plot = $config['pdf_font_plot'];
    $text_length = $config['pdf_text_length'];
    $tempfolder = cache_get_folder('');
    if ($config['cache_pruning']) {
        cache_prune_folder($tempfolder, 3600, false, false, 'videodb*.pdf');
    }
    $filename = $tempfolder . 'videodb' . date('His', time()) . '.pdf';
    // setup pdf class
    $pdf = new PDF();
    $pdf->Open($filename);
    $pdf->VerifyFont($font_title);
    $pdf->VerifyFont($font_title, 'B');
    $pdf->VerifyFont($font_plot);
    $pdf->AddPage();
    $pdf->SetRightMargin($right_margin);
    // add downscaling
    if ($config['pdf_scale']) {
        $pdf->Scale = $config['pdf_scale'];
        $pdf->max_width = $config['pdf_image_max_width'];
        $pdf->max_height = $config['pdf_image_max_height'];
    }
    // get data
    $result = iconv_array('utf-8', 'iso-8859-1', exportData($WHERE));
    foreach ($result as $row) {
        set_time_limit(300);
        // rise per movie execution timeout limit if safe_mode is not set in php.ini
        $title = $row['title'];
        if ($row['subtitle']) {
            $title .= ' - ' . $row['subtitle'];
        }
        if ($row['diskid'] || $row['mediatype']) {
            $title .= ' [';
            if ($row['mediatype']) {
                $title .= $row['mediatype'] . ', ';
            }
            if ($row['diskid']) {
                $title .= $row['diskid'];
            }
            $title = preg_replace('/, $/', '', $title) . ']';
        }
        // get drilldown url for image
        $imdb = $row['imdbID'];
        $link = $imdb ? engineGetContentUrl($imdb, engineGetEngine($imdb)) : '';
        // title
        $pdf->SetFont($font_title, 'B', $font_size);
        $pdf->SetXY($left_margin + $image_width + $margin, $ypos);
        $pdf->Cell(0, 0, $title, 0, 1, 'L', 0, $link);
        // [muddle] technical details
        unset($tech['V']);
        if ($row['video_width'] and $row['video_height']) {
            $vw = $row['video_width'];
            $vh = $row['video_height'];
            $tech['V'] = "Video: ";
            if ($vw > 1920) {
                $tech['V'] .= "UHD " . $vw . "x" . $vh;
            } elseif ($vw > 1280) {
                $tech['V'] .= "HD 1080p";
            } elseif ($vw == 1280 or $vh == 720) {
                $tech['V'] .= "HD 720p";
            } elseif ($vw == 720 or $vw == 704) {
                $tech['V'] .= "SD ";
                if ($vh == 480) {
                    $tech['V'] .= "NTSC";
                } elseif ($vh == 576) {
                    $tech['V'] .= "PAL";
                } else {
                    $tech['V'] .= $vw . "x" . $vh;
                }
            } else {
                $tech['V'] .= "LORES " . $vw . "x" . $vh;
            }
        }
        unset($tech['A']);
        if ($row['audio_codec']) {
            $tech['A'] = "Audio: " . $row['audio_codec'];
        }
        unset($tech['D']);
        if ($row['created']) {
            $tech['D'] = "Date: " . $row['created'];
        }
        $techinfo = implode(", ", $tech);
        $pdf->SetFont($font_title, 'B', $font_size - 3);
        $pdf->SetXY($left_margin + $image_width + $margin, $ypos + 4);
        $pdf->Cell(0, 0, $techinfo, 0, 1, 'L', 0);
        // plot
        $plot = leftString($row['plot'], $text_length);
        $pdf->SetFont($font_plot, '', $font_size - 1);
        $pdf->SetXY($left_margin + $image_width + $margin, $ypos + 3 + 3);
        $pdf->SetLeftMargin($left_margin + $image_width + $margin);
        $pdf->WriteHTML($plot);
        // image
        $file = getThumbnail($row['imgurl']);
        if (preg_match('/^img.php/', $file)) {
            $file = img();
        }
        // image file present?
        if ($file) {
            $pdf->Image($file, $left_margin, $ypos - 2, $image_width, $image_height, '', $link);
        }
        // add mediatype image
        if ($type_image = getMediaImage($row['mediatype'])) {
            $pdf->Image('./images/media/' . $type_image, $page_width - $mediaimg_width - $right_margin, $ypos - 2, $mediaimg_width, 0, '', '');
        }
        // new position
        $ypos += $margin;
        if ($file or $plot) {
            $ypos += max($image_height, $font_size);
        } else {
            $ypos += $font_size;
        }
        if ($ypos > 250) {
            $ypos = $config['pdf_font_size'];
            $pdf->AddPage();
        }
    }
    $pdf->Output('videoDB.pdf', 'D');
    // get rid of temp file
    @unlink($filename);
}
示例#29
-1
 function savepdfcertificate()
 {
     $datac = JRequest::get('post', JREQUEST_ALLOWRAW);
     include JPATH_SITE . DS . 'components' . DS . 'com_guru' . DS . 'models' . DS . 'gurutask.php';
     $background_color = "";
     $op = JRequest::getVar("op", "");
     if ($op == 9) {
         $db = JFactory::getDBO();
         $user = JFactory::getUser();
         $config = JFactory::getConfig();
         $imagename = "SELECT * FROM #__guru_certificates WHERE id=1";
         $db->setQuery($imagename);
         $db->query();
         $imagename = $db->loadAssocList();
         if ($imagename[0]["design_background"] != "") {
             $image_theme = explode("/", $imagename[0]["design_background"]);
             if (trim($image_theme[4]) == 'thumbs') {
                 $image_theme = $image_theme[5];
             } else {
                 $image_theme = $image_theme[4];
             }
         } else {
             $background_color = "background-color:" . "#" . $imagename[0]["design_background_color"];
         }
         $site_url = JURI::root();
         $coursename = JRequest::getVar('cn', '', 'get');
         $authorname = JRequest::getVar('an', '', 'get');
         $certificateid = JRequest::getVar('id', '', 'get');
         $completiondate = JRequest::getVar('cd', '', 'get');
         $course_id = JRequest::getVar('ci', '', 'get');
         $sitename = $config->get('sitename');
         $user_id = $user->id;
         $scores_avg_quizzes = @guruModelguruTask::getAvgScoresQ($user_id, $course_id);
         $avg_quizzes_cert = "SELECT avg_certc FROM #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($avg_quizzes_cert);
         $db->query();
         $avg_quizzes_cert = $db->loadResult();
         $sql = "SELECT id_final_exam FROM #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($sql);
         $result = $db->loadResult();
         $sql = "SELECT hasquiz from #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($sql);
         $resulthasq = $db->loadResult();
         $sql = "SELECT max_score FROM #__guru_quiz WHERE id=" . intval($result);
         $db->setQuery($sql);
         $result_maxs = $db->loadResult();
         // final quiz --------------------------------------------------
         $sql = "SELECT id, score_quiz FROM #__guru_quiz_question_taken_v3 WHERE user_id=" . intval($user_id) . " and quiz_id=" . intval($result) . " and pid=" . intval($course_id) . " ORDER BY id DESC LIMIT 0,1";
         $db->setQuery($sql);
         $result_q = $db->loadObject();
         $first = explode("|", @$result_q->score_quiz);
         @($res = intval($first[0] / $first[1] * 100));
         if ($resulthasq == 0 && $scores_avg_quizzes == "") {
             $avg_certc = "N/A";
         } elseif ($resulthasq != 0 && $scores_avg_quizzes == "") {
             $avg_certc = "N/A";
         } elseif ($resulthasq != 0 && isset($scores_avg_quizzes)) {
             if ($scores_avg_quizzes >= intval($avg_quizzes_cert)) {
                 $avg_certc = $scores_avg_quizzes . '%';
             } else {
                 $avg_certc = $scores_avg_quizzes . '%';
             }
         }
         // final quiz --------------------------------------------------
         // regular ----------------------------------------------
         $s = 0;
         $sql = "select mr.`media_id` from #__guru_mediarel mr, #__guru_days d where mr.`type`='dtask' and mr.`type_id`=d.`id` and d.`pid`=" . intval($course_id);
         $db->setQuery($sql);
         $db->query();
         $lessons = $db->loadColumn();
         if (!isset($lessons) || count($lessons) == 0) {
             $lessons = array("0");
         }
         $sql = "select mr.`media_id` from #__guru_mediarel mr where mr.`layout`='12' and mr.`type`='scr_m' and mr.`type_id` in (" . implode(", ", $lessons) . ")";
         $db->setQuery($sql);
         $db->query();
         $all_quizzes = $db->loadColumn();
         if (isset($all_quizzes) && count($all_quizzes) > 0) {
             foreach ($all_quizzes as $key_quiz => $quiz_id) {
                 $sql = "SELECT score_quiz FROM #__guru_quiz_question_taken_v3 WHERE user_id=" . intval($user_id) . " and quiz_id=" . intval($quiz_id) . " and pid=" . intval($course_id) . " ORDER BY id DESC LIMIT 0,1";
                 $db->setQuery($sql);
                 $db->query();
                 $result_q = $db->loadColumn();
                 $res = @$result_q["0"];
                 $s += $res;
             }
             $avg_certc1 = "N/A";
             if ($s > 0) {
                 $avg_certc1 = $s / count($all_quizzes) . "%";
             }
         }
         // regular ----------------------------------------------
         /*$sql = "SELECT id, score_quiz, time_quiz_taken_per_user  FROM #__guru_quiz_taken_v3 WHERE user_id=".intval($user_id)." and quiz_id=".intval($result)." and pid=".intval($course_id )." ORDER BY id DESC LIMIT 0,1";
         			$db->setQuery($sql);
         			$result_q = $db->loadObject();
         	
         			$first= explode("|", @$result_q->score_quiz);
         	
         			@$res = intval(($first[0]/$first[1])*100);
         	
         			if($resulthasq == 0 && $scores_avg_quizzes == ""){
         				$avg_certc1 = "N/A";
         			}
         			elseif($resulthasq != 0 && $scores_avg_quizzes == ""){
         				$avg_certc1 = "N/A";
         			}
         			elseif($resulthasq != 0 && isset($scores_avg_quizzes)){
         				if($scores_avg_quizzes >= intval($avg_quizzes_cert)){
         					$avg_certc1 =  $scores_avg_quizzes.'%'; 
         				}
         				else{
         					$avg_certc1 = $scores_avg_quizzes.'%';
         				}
         			}*/
         /*if($result !=0 && $res !="" ){
         			if( $res >= $result_maxs){
         				$avg_certc = $res.'%';
         			}
         			elseif($res < $result_maxs){
         				$avg_certc = $res.'%';
         			}
         		}
         		elseif(($result !=0 && $result !="")){
         			$avg_certc = "N/A";
         		}
         		elseif($result ==0 || $result ==""){
         			$avg_certc = "N/A";
         		}*/
         $firstnamelastname = "SELECT firstname, lastname FROM #__guru_customer WHERE id=" . intval($user_id);
         $db->setQuery($firstnamelastname);
         $db->query();
         $firstnamelastname = $db->loadAssocList();
         $coursemsg = "SELECT certificate_course_msg FROM #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($coursemsg);
         $db->query();
         $coursemsg = $db->loadResult();
         $certificate_url = JUri::base() . "index.php?option=com_guru&view=guruOrders&task=printcertificate&opt=" . $certificateid . "&cn=" . $coursename . "&an=" . $authorname . "&cd=" . $completiondate . "&id=" . $certificateid;
         $certificate_url = str_replace(" ", "%20", $certificate_url);
         $imagename[0]["templates1"] = str_replace("[SITENAME]", $sitename, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[STUDENT_FIRST_NAME]", $firstnamelastname[0]["firstname"], $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[STUDENT_LAST_NAME]", $firstnamelastname[0]["lastname"], $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[SITEURL]", $site_url, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[CERTIFICATE_ID]", $certificateid, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COMPLETION_DATE]", $completiondate, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_NAME]", $coursename, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[AUTHOR_NAME]", $authorname, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[CERT_URL]", $certificate_url, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_MSG]", $coursemsg, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_AVG_SCORE]", $avg_certc1, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_FINAL_SCORE]", $avg_certc, $imagename[0]["templates1"]);
         while (ob_get_level()) {
             ob_end_clean();
         }
         header("Content-Encoding: None", true);
         if (strlen($imagename[0]["design_text_color"]) == 3) {
             $r = hexdec(substr($imagename[0]["design_text_color"], 0, 1) . substr($imagename[0]["design_text_color"], 0, 1));
             $g = hexdec(substr($imagename[0]["design_text_color"], 1, 1) . substr($imagename[0]["design_text_color"], 1, 1));
             $b = hexdec(substr($imagename[0]["design_text_color"], 2, 1) . substr($imagename[0]["design_text_color"], 2, 1));
         } else {
             $r = hexdec(substr($imagename[0]["design_text_color"], 0, 2));
             $g = hexdec(substr($imagename[0]["design_text_color"], 2, 2));
             $b = hexdec(substr($imagename[0]["design_text_color"], 4, 2));
         }
         $background_color = explode(":", $background_color);
         @($background_color[1] = str_replace("#", "", $background_color[1]));
         if (strlen($background_color[1]) == 3) {
             $rg = hexdec(substr($background_color[1], 0, 1) . substr($background_color[1], 0, 1));
             $gg = hexdec(substr($background_color[1], 1, 1) . substr($background_color, 1, 1));
             $bg = hexdec(substr($background_color[1], 2, 1) . substr($background_color[1], 2, 1));
         } else {
             $rg = hexdec(substr($background_color[1], 0, 2));
             $gg = hexdec(substr($background_color[1], 2, 2));
             $bg = hexdec(substr($background_color[1], 4, 2));
         }
         if ($imagename[0]["library_pdf"] == 0) {
             require_once JPATH_SITE . DS . "components" . DS . "com_guru" . DS . "helpers" . DS . "fpdf.php";
             $pdf = new PDF('L', 'mm', 'A5');
             $pdf->SetFont($imagename[0]["font_certificate"], '', 12);
             $pdf->SetTextColor($r, $g, $b);
             //set up a page
             $pdf->AddPage();
             if ($image_theme != "") {
                 $pdf->Image(JUri::base() . "images/stories/guru/certificates/" . $image_theme, -4, -1, 210, 150);
                 //$pdf->Cell(0,75,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C');
             } else {
                 $pdf->SetFillColor($rg, $gg, $bg);
                 //$pdf->Cell(0,115,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C',true);
             }
             $pdf->Ln(20);
             $pdf->SetXY(100, 50);
             $pdf->WriteHTML(iconv('UTF-8', 'ISO-8859-1', $imagename[0]["templates1"]), true);
             $pdf->Output('certificate' . $certificateid . '.pdf', 'D');
         } else {
             require JPATH_SITE . DS . "components" . DS . "com_guru" . DS . "helpers" . DS . "MPDF" . DS . "mpdf.php";
             $pdf = new mPDF('utf-8', 'A4-L');
             $pdf = new mPDF('utf-8', 'A4-L', 0, strtolower($imagename[0]["font_certificate"]));
             $imagename[0]["templates1"] = '<style> body { font-family:"' . strtolower($imagename[0]["font_certificate"]) . '" ; color: rgb(' . $r . ', ' . $g . ', ' . $b . '); }</style>' . $imagename[0]["templates1"];
             //set up a page
             $pdf->AddPage('L');
             if ($image_theme != "") {
                 $pdf->Image(JPATH_BASE . "/images/stories/guru/certificates/" . $image_theme, 0, 0, 298, 210, 'jpg', '', true, false);
                 //$pdf->Cell(0,75,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C');
             } else {
                 $pdf->SetFillColor($rg, $gg, $bg);
                 //$pdf->Cell(0,115,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C',true);
             }
             //$pdf->Ln(20);
             $pdf->SetXY(100, 50);
             $pdf->SetDisplayMode('fullpage');
             $pdf->WriteHTML($imagename[0]["templates1"]);
             $pdf->Output('certificate' . $certificateid . '.pdf', 'D');
             exit;
         }
     } else {
         $db = JFactory::getDBO();
         $user = JFactory::getUser();
         $config = JFactory::getConfig();
         $imagename = "SELECT * FROM #__guru_certificates WHERE id=1";
         $db->setQuery($imagename);
         $db->query();
         $imagename = $db->loadAssocList();
         if ($imagename[0]["design_background"] != "") {
             $image_theme = explode("/", $imagename[0]["design_background"]);
             if (trim($image_theme[4]) == 'thumbs') {
                 $image_theme = $image_theme[5];
             } else {
                 $image_theme = $image_theme[4];
             }
         } else {
             $background_color = "background-color:" . "#" . $imagename[0]["design_background_color"];
         }
         $site_url = JURI::root();
         $coursename = $datac['cn'];
         $authorname = $datac['an'];
         $certificateid = $datac['id'];
         $completiondate = $datac['cd'];
         $course_id = $datac['ci'];
         $sitename = $config->get('config.sitename');
         $user_id = $user->id;
         $scores_avg_quizzes = guruModelguruTask::getAvgScoresQ($user_id, $course_id);
         $avg_quizzes_cert = "SELECT avg_certc FROM #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($avg_quizzes_cert);
         $db->query();
         $avg_quizzes_cert = $db->loadResult();
         $sql = "SELECT id_final_exam FROM #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($sql);
         $result = $db->loadResult();
         $sql = "SELECT hasquiz from #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($sql);
         $resulthasq = $db->loadResult();
         $sql = "SELECT max_score FROM #__guru_quiz WHERE id=" . intval($result);
         $db->setQuery($sql);
         $result_maxs = $db->loadResult();
         $sql = "SELECT id, score_quiz, time_quiz_taken_per_user  FROM #__guru_quiz_taken_v3 WHERE user_id=" . intval($user_id) . " and quiz_id=" . intval($result) . " and pid=" . intval($course_id) . " ORDER BY id DESC LIMIT 0,1";
         $db->setQuery($sql);
         $result_q = $db->loadObject();
         $first = explode("|", @$result_q->score_quiz);
         @($res = intval($first[0] / $first[1] * 100));
         if ($resulthasq == 0 && $scores_avg_quizzes == "") {
             $avg_certc1 = "N/A";
         } elseif ($resulthasq != 0 && $scores_avg_quizzes == "") {
             $avg_certc1 = "N/A";
         } elseif ($resulthasq != 0 && isset($scores_avg_quizzes)) {
             if ($scores_avg_quizzes >= intval($avg_quizzes_cert)) {
                 $avg_certc1 = $scores_avg_quizzes . '%';
             } else {
                 $avg_certc1 = $scores_avg_quizzes . '%';
             }
         }
         if ($result != 0 && $res != "") {
             if ($res >= $result_maxs) {
                 $avg_certc = $res . '%';
             } elseif ($res < $result_maxs) {
                 $avg_certc = $res . '%';
             }
         } elseif ($result != 0 && $result != "") {
             $avg_certc = "N/A";
         } elseif ($result == 0 || $result == "") {
             $avg_certc = "N/A";
         }
         $firstnamelastname = "SELECT firstname, lastname FROM #__guru_customer WHERE id=" . intval($user_id);
         $db->setQuery($firstnamelastname);
         $db->query();
         $firstnamelastname = $db->loadAssocList();
         $coursemsg = "SELECT certificate_course_msg FROM #__guru_program WHERE id=" . intval($course_id);
         $db->setQuery($coursemsg);
         $db->query();
         $coursemsg = $db->loadResult();
         $certificate_url = JUri::base() . "index.php?option=com_guru&view=guruOrders&task=printcertificate&opt=" . $certificateid . "&cn=" . $coursename . "&an=" . $authorname . "&cd=" . $completiondate . "&id=" . $certificateid;
         $certificate_url = str_replace(" ", "%20", $certificate_url);
         $imagename[0]["templates1"] = str_replace("[SITENAME]", $sitename, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[STUDENT_FIRST_NAME]", $firstnamelastname[0]["firstname"], $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[STUDENT_LAST_NAME]", $firstnamelastname[0]["lastname"], $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[SITEURL]", $site_url, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[CERTIFICATE_ID]", $certificateid, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COMPLETION_DATE]", $completiondate, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_NAME]", $coursename, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[AUTHOR_NAME]", $authorname, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[CERT_URL]", $certificate_url, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_MSG]", $coursemsg, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_AVG_SCORE]", $avg_certc1, $imagename[0]["templates1"]);
         $imagename[0]["templates1"] = str_replace("[COURSE_FINAL_SCORE]", $avg_certc, $imagename[0]["templates1"]);
         while (ob_get_level()) {
             ob_end_clean();
         }
         header("Content-Encoding: None", true);
         if (strlen($imagename[0]["design_text_color"]) == 3) {
             $r = hexdec(substr($imagename[0]["design_text_color"], 0, 1) . substr($imagename[0]["design_text_color"], 0, 1));
             $g = hexdec(substr($imagename[0]["design_text_color"], 1, 1) . substr($imagename[0]["design_text_color"], 1, 1));
             $b = hexdec(substr($imagename[0]["design_text_color"], 2, 1) . substr($imagename[0]["design_text_color"], 2, 1));
         } else {
             $r = hexdec(substr($imagename[0]["design_text_color"], 0, 2));
             $g = hexdec(substr($imagename[0]["design_text_color"], 2, 2));
             $b = hexdec(substr($imagename[0]["design_text_color"], 4, 2));
         }
         $background_color = explode(":", $background_color);
         $background_color[1] = str_replace("#", "", $background_color[1]);
         if (strlen($background_color[1]) == 3) {
             $rg = hexdec(substr($background_color[1], 0, 1) . substr($background_color[1], 0, 1));
             $gg = hexdec(substr($background_color[1], 1, 1) . substr($background_color, 1, 1));
             $bg = hexdec(substr($background_color[1], 2, 1) . substr($background_color[1], 2, 1));
         } else {
             $rg = hexdec(substr($background_color[1], 0, 2));
             $gg = hexdec(substr($background_color[1], 2, 2));
             $bg = hexdec(substr($background_color[1], 4, 2));
         }
         if ($imagename[0]["library_pdf"] == 0) {
             require JPATH_SITE . DS . "components" . DS . "com_guru" . DS . "helpers" . DS . "fpdf.php";
             $pdf = new PDF('L', 'mm', 'A5');
             $pdf->SetFont($imagename[0]["font_certificate"], '', 12);
             $pdf->SetTextColor($r, $g, $b);
             //set up a page
             $pdf->AddPage();
             if ($image_theme != "") {
                 $pdf->Image(JUri::base() . "images/stories/guru/certificates/" . $image_theme, -4, -1, 210, 150);
                 //$pdf->Cell(0,75,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C');
             } else {
                 $pdf->SetFillColor($rg, $gg, $bg);
                 //$pdf->Cell(0,115,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C',true);
             }
             $pdf->Ln(20);
             $pdf->SetXY(100, 50);
             $pdf->WriteHTML(iconv('UTF-8', 'ISO-8859-1', $imagename[0]["templates1"]), true);
             $pdf->Output('certificate' . $certificateid . '.pdf', 'D');
         } else {
             require JPATH_SITE . DS . "components" . DS . "com_guru" . DS . "helpers" . DS . "MPDF" . DS . "mpdf.php";
             $pdf = new mPDF('utf-8', 'A4-L');
             $imagename[0]["templates1"] = '<style> body { font-family:"' . strtolower($imagename[0]["font_certificate"]) . '" ; color: rgb(' . $r . ', ' . $g . ', ' . $b . '); }</style>' . $imagename[0]["templates1"];
             //set up a page
             $pdf->AddPage('L');
             if ($image_theme != "") {
                 $pdf->Image(JPATH_BASE . "/images/stories/guru/certificates/" . $image_theme, 0, 0, 298, 210, 'jpg', '', true, false);
                 //$pdf->Cell(0,75,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C');
             } else {
                 $pdf->SetFillColor($rg, $gg, $bg);
                 //$pdf->Cell(0,115,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C',true);
             }
             //$pdf->Ln(20);
             $pdf->SetXY(100, 50);
             $pdf->SetDisplayMode('fullpage');
             $pdf->WriteHTML($imagename[0]["templates1"]);
             $pdf->Output('certificate' . $certificateid . '.pdf', 'D');
             exit;
         }
     }
 }
示例#30
-2
文件: guruTasks.php 项目: JozefAB/qk
 function savecertificatepdf()
 {
     $datac = JRequest::get('post', JREQUEST_ALLOWRAW);
     $db = JFactory::getDBO();
     $config = JFactory::getConfig();
     $user = JFactory::getUser();
     $user_id = $user->id;
     $sql = "SELECT `name` from #__guru_program WHERE `id` =" . $datac['ci'];
     $db->setQuery($sql);
     $db->query();
     $result = $db->loadResult();
     $imagename = "SELECT * FROM #__guru_certificates WHERE id=1";
     $db->setQuery($imagename);
     $db->query();
     $imagename = $db->loadAssocList();
     $authorname = "SELECT name from #__users where id IN (SELECT author_id FROM #__guru_mycertificates WHERE user_id = " . intval($user_id) . " AND course_id =" . $datac['ci'] . " )";
     $db->setQuery($authorname);
     $db->query();
     $authorname = $db->loadResult();
     $date_completed = "SELECT datecertificate FROM #__guru_mycertificates WHERE user_id=" . intval($user_id) . " AND course_id=" . intval($datac['ci']);
     $db->setQuery($date_completed);
     $db->query();
     $date_completed = $db->loadResult();
     $format = "SELECT datetype FROM #__guru_config WHERE id=1";
     $db->setQuery($format);
     $db->query();
     $format = $db->loadResult();
     $date_completed = date($format, strtotime($date_completed));
     $completiondate = $date_completed;
     $sitename = $config->get('sitename');
     $coursename = $result;
     $site_url = JURI::root();
     $certificateid = $datac['id'];
     $coursemsg = "SELECT certificate_course_msg FROM #__guru_program WHERE id=" . intval($datac['ci']);
     $db->setQuery($coursemsg);
     $db->query();
     $coursemsg = $db->loadResult();
     $scores_avg_quizzes = guruModelguruTask::getAvgScoresQ($user_id, $course_id);
     $avg_quizzes_cert = "SELECT avg_certc FROM #__guru_program WHERE id=" . intval($datac['ci']);
     $db->setQuery($avg_quizzes_cert);
     $db->query();
     $avg_quizzes_cert = $db->loadResult();
     $sql = "SELECT id_final_exam FROM #__guru_program WHERE id=" . intval($datac['ci']);
     $db->setQuery($sql);
     $result = $db->loadResult();
     $sql = "SELECT hasquiz from #__guru_program WHERE id=" . intval($datac['ci']);
     $db->setQuery($sql);
     $resulthasq = $db->loadResult();
     $sql = "SELECT max_score FROM #__guru_quiz WHERE id=" . intval($result);
     $db->setQuery($sql);
     $result_maxs = $db->loadResult();
     $sql = "SELECT id, score_quiz, time_quiz_taken_per_user  FROM #__guru_quiz_taken WHERE user_id=" . intval($user_id) . " and quiz_id=" . intval($result) . " and pid=" . intval($datac['ci']) . " ORDER BY id DESC LIMIT 0,1";
     $db->setQuery($sql);
     $result_q = $db->loadObject();
     $first = explode("|", @$result_q->score_quiz);
     @($res = intval($first[0] / $first[1] * 100));
     if ($resulthasq == 0 && $scores_avg_quizzes == "") {
         $avg_certc1 = "N/A";
     } elseif ($resulthasq != 0 && $scores_avg_quizzes == "") {
         $avg_certc1 = "N/A";
     } elseif ($resulthasq != 0 && isset($scores_avg_quizzes)) {
         if ($scores_avg_quizzes >= intval($avg_quizzes_cert)) {
             $avg_certc1 = $scores_avg_quizzes . '%';
         } else {
             $avg_certc1 = $scores_avg_quizzes . '%';
         }
     }
     if ($result != 0 && $res != "") {
         if ($res >= $result_maxs) {
             $avg_certc = $res . '%';
         } elseif ($res < $result_maxs) {
             $avg_certc = $res . '%';
         }
     } elseif ($result != 0 && $result != "") {
         $avg_certc = "N/A";
     } elseif ($result == 0 || $result == "") {
         $avg_certc = "N/A";
     }
     $firstnamelastname = "SELECT firstname, lastname FROM #__guru_customer WHERE id=" . intval($user_id);
     $db->setQuery($firstnamelastname);
     $db->query();
     $firstnamelastname = $db->loadAssocList();
     $certificate_url = JUri::base() . "index.php?option=com_guru&view=guruOrders&task=printcertificate&opt=" . $certificateid . "&cn=" . $coursename . "&an=" . $authorname . "&cd=" . $completiondate . "&id=" . $certificateid . "&ci=" . $datac['ci'];
     $certificate_url = str_replace(" ", "%20", $certificate_url);
     $imagename[0]["templates1"] = str_replace("[SITENAME]", $sitename, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[STUDENT_FIRST_NAME]", $firstnamelastname[0]["firstname"], $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[STUDENT_LAST_NAME]", $firstnamelastname[0]["lastname"], $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[SITEURL]", $site_url, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[CERTIFICATE_ID]", $certificateid, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[COMPLETION_DATE]", $completiondate, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[COURSE_NAME]", $coursename, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[AUTHOR_NAME]", $authorname, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[CERT_URL]", $certificate_url, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[COURSE_MSG]", $coursemsg, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[COURSE_AVG_SCORE]", $avg_certc1, $imagename[0]["templates1"]);
     $imagename[0]["templates1"] = str_replace("[COURSE_FINAL_SCORE]", $avg_certc, $imagename[0]["templates1"]);
     $datac["content"] = $imagename[0]["templates1"];
     while (ob_get_level()) {
         ob_end_clean();
     }
     header("Content-Encoding: None", true);
     if (strlen($datac["color"]) == 3) {
         $r = hexdec(substr($datac["color"], 0, 1) . substr($datac["color"], 0, 1));
         $g = hexdec(substr($datac["color"], 1, 1) . substr($datac["color"], 1, 1));
         $b = hexdec(substr($datac["color"], 2, 1) . substr($datac["color"], 2, 1));
     } else {
         $r = hexdec(substr($datac["color"], 0, 2));
         $g = hexdec(substr($datac["color"], 2, 2));
         $b = hexdec(substr($datac["color"], 4, 2));
     }
     $datac["bgcolor"] = explode(":", $datac["bgcolor"]);
     $datac["bgcolor"][1] = str_replace("#", "", $datac["bgcolor"][1]);
     if (strlen($datac["bgcolor"][1]) == 3) {
         $rg = hexdec(substr($datac["bgcolor"][1], 0, 1) . substr($datac["bgcolor"][1], 0, 1));
         $gg = hexdec(substr($datac["bgcolor"][1], 1, 1) . substr($datac["bgcolor"][1], 1, 1));
         $bg = hexdec(substr($datac["bgcolor"][1], 2, 1) . substr($datac["bgcolor"][1], 2, 1));
     } else {
         $rg = hexdec(substr($datac["bgcolor"][1], 0, 2));
         $gg = hexdec(substr($datac["bgcolor"][1], 2, 2));
         $bg = hexdec(substr($datac["bgcolor"][1], 4, 2));
     }
     if ($imagename[0]["library_pdf"] == 0) {
         require JPATH_SITE . DS . "components" . DS . "com_guru" . DS . "helpers" . DS . "fpdf.php";
         $pdf = new PDF('L', 'mm', 'A5');
         $pdf->SetFont($datac["font"], '', 12);
         $pdf->SetTextColor($r, $g, $b);
         //set up a page
         $pdf->AddPage();
         if ($datac["image"] != "") {
             $pdf->Image(JUri::base() . "images/stories/guru/certificates/" . $datac["image"], -4, -1, 210, 150);
             //$pdf->Cell(0,75,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C');
         } else {
             $pdf->SetFillColor($rg, $gg, $bg);
             //$pdf->Cell(0,115,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C',true);
         }
         $pdf->Ln(20);
         $pdf->SetXY(100, 50);
         $pdf->WriteHTML(iconv('UTF-8', 'ISO-8859-1', $imagename[0]["templates1"]), true);
         $pdf->Output('certificate' . $certificateid . '.pdf', 'D');
     } else {
         require JPATH_SITE . DS . "components" . DS . "com_guru" . DS . "helpers" . DS . "MPDF" . DS . "mpdf.php";
         $pdf = new mPDF('utf-8', 'A4-L');
         $imagename[0]["templates1"] = '<style> body { font-family:"' . strtolower($datac["font"]) . '" ; color: rgb(' . $r . ', ' . $g . ', ' . $b . '); }</style>' . $imagename[0]["templates1"];
         //set up a page
         $pdf->AddPage('L');
         if ($datac["image"] != "") {
             $pdf->Image(JPATH_BASE . "/images/stories/guru/certificates/" . $datac["image"], 0, 0, 298, 210, 'jpg', '', true, false);
             //$pdf->Cell(0,75,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C');
         } else {
             $pdf->SetFillColor($rg, $gg, $bg);
             //$pdf->Cell(0,115,JText::_("GURU_CERTIFICATE_OF_COMPLETION"),0,1,'C',true);
         }
         //$pdf->Ln(20);
         $pdf->SetXY(100, 50);
         $pdf->SetDisplayMode('fullpage');
         $pdf->WriteHTML($imagename[0]["templates1"]);
         $pdf->Output('certificate' . $certificateid . '.pdf', 'D');
         exit;
     }
 }