本文整理汇总了PHP中Cezpdf::closeObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Cezpdf::closeObject方法的具体用法?PHP Cezpdf::closeObject怎么用?PHP Cezpdf::closeObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cezpdf
的用法示例。
在下文中一共展示了Cezpdf::closeObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dofreePDF
function dofreePDF()
{
global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset;
global $mainframe, $database, $my;
$id = intval(mosGetParam($_REQUEST, 'id', 1));
$gid = $my->gid;
$now = _CURRENT_SERVER_TIME;
$nullDate = $database->getNullDate();
// query to check for state and access levels
$query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $id . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
$database->setQuery($query);
$row = NULL;
if ($database->loadObject($row)) {
/*
* check whether category is published
*/
if (!$row->cat_pub && $row->catid) {
mosNotAuth();
return;
}
/*
* check whether section is published
*/
if (!$row->sec_pub && $row->sectionid) {
mosNotAuth();
return;
}
/*
* check whether category access level allows access
*/
if ($row->cat_access > $gid && $row->catid) {
mosNotAuth();
return;
}
/*
* check whether section access level allows access
*/
if ($row->sec_access > $gid && $row->sectionid) {
mosNotAuth();
return;
}
include 'includes/class.ezpdf.php';
$params = new mosParameters($row->attribs);
$params->def('author', !$mainframe->getCfg('hideAuthor'));
$params->def('createdate', !$mainframe->getCfg('hideCreateDate'));
$params->def('modifydate', !$mainframe->getCfg('hideModifyDate'));
$row->fulltext = pdfCleaner($row->fulltext);
$row->introtext = pdfCleaner($row->introtext);
$pdf = new Cezpdf('a4', 'P');
//A4 Portrait
$pdf->ezSetCmMargins(2, 1.5, 1, 1);
$pdf->selectFont('./fonts/Helvetica.afm');
//choose font
$all = $pdf->openObject();
$pdf->saveState();
$pdf->setStrokeColor(0, 0, 0, 1);
// footer
$pdf->addText(250, 822, 6, $mosConfig_sitename);
$pdf->line(10, 40, 578, 40);
$pdf->line(10, 818, 578, 818);
$pdf->addText(30, 34, 6, $mosConfig_live_site);
$pdf->addText(250, 34, 6, _PDF_POWERED);
$pdf->addText(450, 34, 6, _PDF_GENERATED . ' ' . date('j F, Y, H:i', time() + $mosConfig_offset * 60 * 60));
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all, 'all');
$pdf->ezSetDy(30);
$txt1 = $row->title;
$pdf->ezText($txt1, 14);
$txt2 = AuthorDateLine($row, $params);
$pdf->ezText($txt2, 8);
$txt3 = $row->introtext . "\n" . $row->fulltext;
$pdf->ezText($txt3, 10);
$pdf->ezStream();
} else {
mosNotAuth();
return;
}
}
示例2: array
$titlet = array('total' => '<b>Total</b>');
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titlef, '', $options);
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titles, '', $options);
$pdf->ezText("\n", 10);
$pdf->addText(50, 700, 12, "<b>Atendio: </b>\n");
$pdf->addText(100, 700, 12, $emp);
$pdf->addText(50, 680, 12, "<b>Cliente: </b>\n");
$pdf->addText(100, 680, 12, $datos);
//RECUPERANDO DETALLE DE VENTA
$sql = mysql_query("select dv.cantidad,p.nombre,dv.precio,dv.subtotal \n \t\tfrom detalle_venta dv\n \t\tinner join platillos p on p.id_platillo = dv.clave_producto \n \t\twhere folio = '" . $folio . "' ");
while ($row = mysql_fetch_array($sql)) {
$dat[] = array_merge($row);
}
$optionsdv = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 500, 'fontSize' => 10, 'xPos' => 'center', 'cols' => array('cantidad' => array('justification' => 'center'), 'nombre' => array('justification' => 'center'), 'precio' => array('justification' => 'center'), 'subtotal' => array('justification' => 'center')));
$titledv = array('cantidad' => '<b>Cantidad</b>', 'nombre' => '<b>Descripción</b>', 'precio' => '<b>Precio</b>', 'subtotal' => '<b>SubTotal</b>');
$pdf->ezTable($dat, $titledv, '', $optionsdv);
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titlet, '', $options);
//cabecera del pdf (objeto para todas las páginas)
$all = $pdf->openObject();
$pdf->saveState();
$pdf->addText(200, 790, 12, "<b>Restaurante Familiar </b>\n");
$pdf->addText(230, 770, 12, "<i>!The Mexican Food is the Better! </i>\n");
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all, 'all');
$pdf->ezSetCmMargins(4, 3, 3, 3);
ob_end_clean();
$pdf->ezStream();
示例3: array
/**
* Creates a PDF document and sends this pricelist to the client
*
* Unfortunately, ezpdf does not return anything after printing the
* document, so there's no way to tell whether it has succeeded.
* Thus, you should not rely on the return value, except when it is
* false -- in that case, loading of some data failed.
* @return boolean False on failure, true on supposed success
*/
function send_as_pdf()
{
global $objInit, $_ARRAYLANG;
if (!$this->load()) {
return \Message::error($_ARRAYLANG['TXT_SHOP_PRICELIST_ERROR_LOADING']);
}
$objPdf = new \Cezpdf('A4');
$objPdf->setEncryption('', '', array('print'));
$objPdf->selectFont(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseLibraryPath() . '/ezpdf/fonts/' . $this->font);
$objPdf->ezSetMargins(0, 0, 0, 0);
// Reset margins
$objPdf->setLineStyle(0.5);
$marginTop = 30;
$biggerCountTop = $biggerCountBottom = 0;
$arrHeaderLeft = $arrHeaderRight = $arrFooterLeft = $arrFooterRight = array();
if ($this->header) {
// header should be shown
$arrHeaderLeft = explode("\n", $this->header_left);
$arrHeaderRight = explode("\n", $this->header_right);
$countLeft = count($arrHeaderLeft);
$countRight = count($arrHeaderRight);
$biggerCountTop = $countLeft > $countRight ? $countLeft : $countRight;
$marginTop = $biggerCountTop * 14 + 36;
}
// Bottom margin
$marginBottom = 20;
$arrFooterRight = array();
if ($this->footer) {
// footer should be shown
// Old, obsolete:
$this->footer_left = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left);
$this->footer_right = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right);
// New:
$this->footer_left = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left);
$this->footer_right = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right);
$arrFooterLeft = explode("\n", $this->footer_left);
$arrFooterRight = explode("\n", $this->footer_right);
$countLeft = count($arrFooterLeft);
$countRight = count($arrFooterRight);
$biggerCountBottom = $countLeft > $countRight ? $countLeft : $countRight;
$marginBottom = $biggerCountBottom * 20 + 20;
}
// Borders
if ($this->border) {
$linesForAllPages = $objPdf->openObject();
$objPdf->saveState();
$objPdf->setStrokeColor(0, 0, 0, 1);
$objPdf->rectangle(10, 10, 575.28, 821.89);
$objPdf->restoreState();
$objPdf->closeObject();
$objPdf->addObject($linesForAllPages, 'all');
}
// Header
$headerArray = array();
$startpointY = 0;
if ($this->header) {
$objPdf->ezSetY(830);
$headerForAllPages = $objPdf->openObject();
$objPdf->saveState();
for ($i = 0; $i < $biggerCountTop; ++$i) {
$headerArray[$i] = array('left' => isset($arrHeaderLeft[$i]) ? $arrHeaderLeft[$i] : '', 'right' => isset($arrHeaderRight[$i]) ? $arrHeaderRight[$i] : '');
}
$tempY = $objPdf->ezTable($headerArray, '', '', array('showHeadings' => 0, 'fontSize' => $this->font_size_header, 'shaded' => 0, 'width' => 540, 'showLines' => 0, 'xPos' => 'center', 'xOrientation' => 'center', 'cols' => array('right' => array('justification' => 'right'))));
$tempY -= 5;
if ($this->border) {
$objPdf->setStrokeColor(0, 0, 0);
$objPdf->line(10, $tempY, 585.28, $tempY);
}
$startpointY = $tempY - 5;
$objPdf->restoreState();
$objPdf->closeObject();
$objPdf->addObject($headerForAllPages, 'all');
}
// Footer
$pageNumbersX = $pageNumbersY = $pageNumbersFont = 0;
if ($this->footer) {
$footerForAllPages = $objPdf->openObject();
$objPdf->saveState();
$tempY = $marginBottom - 5;
if ($this->border) {
$objPdf->setStrokeColor(0, 0, 0);
$objPdf->line(10, $tempY, 585.28, $tempY);
}
// length of the longest word
$longestWord = 0;
foreach ($arrFooterRight as $line) {
if ($longestWord < strlen($line)) {
$longestWord = strlen($line);
}
}
for ($i = $biggerCountBottom - 1; $i >= 0; --$i) {
//.........这里部分代码省略.........
示例4: pdfLaudos
/**
* gera um pdf dos laudos
*
* @param array $r
*/
function pdfLaudos($rs){
//error_reporting(E_ALL);
set_time_limit(1800);
include 'lib/php/classes/class.ezpdf.php';
$pdf = new Cezpdf('a4','portrait');
$pdf -> ezSetMargins(50,70,50,50);
$all = $pdf->openObject();
$pdf->saveState();
$pdf->setStrokeColor(0,0,0,1);
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all,'all');
$mainFont = './fonts/Courier.afm';
$codeFont = './fonts/Courier.afm';
$pdf->selectFont($mainFont);
$n_rows = sizeof($rs);
$c = 0;
$t=945;
$fator = 25;
foreach($rs as $id => $r){
$o = new Interpretacao($r["int_id"]);
$hos = new Hospital($o->get("hos_id"));
$hos_nome = $hos->get("hos_nome");
$con = new Convenio($o->get("con_id"));
$con_nome = $con->get("con_nome");
$exa = new Exame($o->get("exa_id"));
$exa_nome = $exa->get("exa_nome");
$pdf->ezText($hos_nome,18,array('justification'=>'center'));
$pdf->ezText(" ",20,array('justification'=>'left'));
$pdf->ezText("PACIENTE : ".$r["int_paciente_prontuario"]." ".$r["int_paciente_nome"],10,array('justification'=>'left'));
if ($r["int_paciente_nascimento"] == "0000-00-00")
$pdf->ezText("NASCIMENTO : SEXO: ".$r["int_paciente_sexo"],10,array('justification'=>'left'));
else
$pdf->ezText("NASCIMENTO : ".Formatacao::formatBrData($r["int_paciente_nascimento"])." SEXO: ".$r["int_paciente_sexo"],10,array('justification'=>'left'));
$pdf->ezText("CONVÊNIO : ".$con_nome,10,array('justification'=>'left'));
$pdf->ezText("EXAME : ".$exa_nome,10,array('justification'=>'left'));
$pdf->ezText(" ",20,array('justification'=>'left'));
$pdf->ezText(" DATA: ".Formatacao::formatBrDataHoraminSeg($r["int_data_interpretacao"]),10,array('justification'=>'left'));
$pdf->ezText("N DO EXAME : ".$r["int_opcional"],10,array('justification'=>'left'));
$pdf->ezText("MÉDICO REQUISITANTE : ".$r["int_requisitante"],10,array('justification'=>'left'));
$pdf->ezText("EXAME INTERPRETADO POR : 9679 Ernesto Sousa Nunes",10,array('justification'=>'left'));
$pdf->ezText("TÉCNICO RX : ".$r["int_tecnico_rx"],10,array('justification'=>'left'));
$pdf->ezText(" ",20,array('justification'=>'left'));
$pdf->ezText("I N T E R P R E T A Ç Ã O",18,array('justification'=>'center'));
$pdf->ezText(" ",20,array('justification'=>'left'));
$vet_txt = split("\n",$r["int_texto"]);
$pdf->ezText("============================================================================",10,array('justification'=>'left'));
$pdf->ezText(" ",8,array('justification'=>'left'));
foreach($vet_txt as $linha){
$pdf->ezText(" ".$linha,10,array('justification'=>'left'));
}
$pdf->ezText(" ",8,array('justification'=>'left'));
$pdf->ezText("============================================================================",10,array('justification'=>'left'));
$pdf->ezText(" Exame interpretado por: 9676 - Dr. Ernesto Sousa Nunes",10,array('justification'=>'left'));
$pdf->addJpegFromFile('ass.jpg',250, 0);
$pdf->openHere('Fit');
if ($c+1 < $n_rows)
$pdf->ezNewPage();
$c++;
$o->informaImpressao();
//$sql = "update laudo set LAU_DATA_EXPORTACAO = now() where LAU_ID = ".$r["LAU_ID"]." LIMIT 1";
//$up = mysql_query($sql, $db) or die(mysql_error());
}
$pdfcode = $pdf->Output();
//$pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode));
//$cont = trim($pdfcode);
$fh = fopen("laudos_prontos.pdf", 'w+');
fwrite($fh, $pdfcode);
fclose($fh);
?><script language="javascript">document.location.href="laudos_prontos.pdf";</script><?
}
示例5: strEzPdf
$pdf->ezNewPage();
}
$skip_page++;
$page_header = $pdf->openObject();
$pdf->selectFont("{$font_dir}/Helvetica-Bold.afm");
$ypos = $pdf->ez['pageHeight'] - (30 + $pdf->getFontHeight(12));
$doc_title = strEzPdf($projects[$project_id]['project_name'], UI_OUTPUT_RAW);
$pwidth = $pdf->ez['pageWidth'];
$xpos = round(($pwidth - $pdf->getTextWidth(12, $doc_title)) / 2, 2);
$pdf->addText($xpos, $ypos, 12, $doc_title);
$pdf->selectFont("{$font_dir}/Helvetica.afm");
$date = new w2p_Utilities_Date();
$xpos = round($pwidth - $pdf->getTextWidth(10, $date->format($df)) - $pdf->ez['rightMargin'], 2);
$doc_date = strEzPdf($date->format($df));
$pdf->addText($xpos, $ypos, 10, $doc_date);
$pdf->closeObject($page_header);
$pdf->addObject($page_header, 'all');
$gpdfkey = W2P_BASE_DIR . '/modules/tasks/images/ganttpdf_key.png';
$gpdfkeyNM = W2P_BASE_DIR . '/modules/tasks/images/ganttpdf_keyNM.png';
$pdf->ezStartPageNumbers(802, 30, 10, 'left', 'Page {PAGENUM} of {TOTALPAGENUM}');
for ($i = 0; $i < count($ganttfile); $i++) {
$gf = $ganttfile[$i];
$pdf->ezColumnsStart(array('num' => 1, 'gap' => 0));
$pdf->ezImage($gf, 0, 765, 'width', 'left');
// No pad, width = 800px, resize = 'none' (will go to next page if image height > remaining page space)
if ($showNoMilestones == '1') {
$pdf->ezImage($gpdfkeyNM, 0, 765, 'width', 'left');
} else {
$pdf->ezImage($gpdfkey, 0, 765, 'width', 'left');
}
$pdf->ezColumnsStop();
示例6: citeRecords
function citeRecords($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $citeStyle, $citeOrder, $citeType, $orderBy, $headerMsg, $userID, $viewType)
{
global $officialDatabaseName;
// these variables are defined in 'ini.inc.php'
global $databaseBaseURL;
global $contentTypeCharset;
global $pdfPageSize;
global $client;
// The array '$transtab_refbase_pdf' contains search & replace patterns for conversion from refbase markup to PDf markup & entities
global $transtab_refbase_pdf;
// defined in 'transtab_refbase_pdf.inc.php'
// Initialize array variables:
$yearsArray = array();
$typeTitlesArray = array();
// Define inline text markup to be used by the 'citeRecord()' function:
$markupPatternsArray = array("bold-prefix" => "<b>", "bold-suffix" => "</b>", "italic-prefix" => "<i>", "italic-suffix" => "</i>", "underline-prefix" => "<u>", "underline-suffix" => "</u>", "endash" => "¦", "emdash" => "©", "ampersand" => "&", "double-quote" => '"', "double-quote-left" => "ª", "double-quote-right" => "¬", "single-quote" => "'", "single-quote-left" => "®", "single-quote-right" => "¶", "less-than" => "<", "greater-than" => ">", "newline" => "\n");
// Defines search & replace 'actions' that will be applied upon PDF output to all those refbase fields that are listed
// in the corresponding 'fields' element:
$pdfSearchReplaceActionsArray = array(array('fields' => array("title", "publication", "abbrev_journal", "address", "keywords", "abstract", "orig_title", "series_title", "abbrev_series_title", "notes"), 'actions' => $transtab_refbase_pdf));
// For CLI queries, we'll allow paging thru the result set, i.e. we honour the values of the CLI options '-S|--start' ('$rowOffset')
// and '-R|--rows' ('$showRows') ('$rowOffset' and '$showRows' are re-assigned in function 'seekInMySQLResultsToOffset()' in 'include.inc.php')
if (preg_match("/^cli/i", $client)) {
// if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0")
$showMaxRows = $showRows;
} else {
$showMaxRows = $rowsFound;
}
// otherwise show all rows
// Setup the basic PDF document structure (PDF functions defined in 'class.ezpdf.php'):
$pdf = new Cezpdf($pdfPageSize, 'portrait');
// initialize PDF object
if (!empty($headerMsg)) {
// adjust upper page margin if a custom header message was given
$pageMarginTop = "70";
} else {
$pageMarginTop = "50";
}
$pdf->ezSetMargins($pageMarginTop, 70, 50, 50);
// set document margins (top, bottom, left, right)
// Set fonts:
$headingFont = 'includes/classes/org/pdf-php/fonts/Helvetica.afm';
$textBodyFont = 'includes/classes/org/pdf-php/fonts/Times-Roman.afm';
// Re-map character numbers from the 0->255 range to a named character, i.e. replace an (unused) character for any other PostScript char;
// see the PDF reference for a list of supported PostScript/PDF character names: <http://www.adobe.com/devnet/pdf/pdf_reference.html>;
// for the decimal code numbers of the ISO-8859-1 character set, see e.g.: <http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html>
$diff = array(166 => 'endash', 169 => 'emdash', 170 => 'quotedblleft', 172 => 'quotedblright', 174 => 'quoteleft', 182 => 'quoteright');
// Select a font:
$pdf->selectFont($textBodyFont, array('encoding' => 'WinAnsiEncoding', 'differences' => $diff));
$pdf->openHere('Fit');
// Put a footer (and optionally a header) on all the pages:
$all = $pdf->openObject();
// start an independent object; all further writes to a page will actually go into this object, until a 'closeObject()' call is made
$pdf->saveState();
$pdf->setStrokeColor(0, 0, 0, 1);
// set line color
$pdf->setLineStyle(0.5);
// set line width
// - print header line and header message at the specified x/y position:
if (!empty($headerMsg)) {
// Remove any colon (":") from end of header message:
$headerMsg = trimTextPattern($headerMsg, ":", false, true);
// function 'trimTextPattern()' is defined in 'include.inc.php'
// Decode any HTML entities:
// (these may occur in the header message e.g. if the user's preferred display language is not English but German or French, etc)
$headerMsg = decodeHTML($contentTypeCharset, $headerMsg);
// function 'decodeHTML()' is defined in 'include.inc.php', and '$contentTypeCharset' is defined in 'ini.inc.php'
// Convert refbase markup in the header message into appropriate PDF markup & entities:
$headerMsg = searchReplaceText($transtab_refbase_pdf, $headerMsg, true);
// function 'searchReplaceText()' is defined in 'include.inc.php'
if ($pdfPageSize == 'a4') {
$pdf->line(20, 800, 575, 800);
$pdf->addText(50, 805, 10, $headerMsg);
} elseif ($pdfPageSize == 'letter') {
$pdf->line(20, 750, 592, 750);
$pdf->addText(50, 755, 10, $headerMsg);
}
}
// - print footer line and footer text at the specified x/y position:
if ($pdfPageSize == 'a4') {
$pdf->line(20, 40, 575, 40);
$pdf->addText(50, 28, 10, $officialDatabaseName . ' ¦ ' . $databaseBaseURL);
// w.r.t. the endash, see notes at '$markupPatternsArray' and '$diff' above
} elseif ($pdfPageSize == 'letter') {
$pdf->line(20, 40, 592, 40);
$pdf->addText(50, 28, 10, $officialDatabaseName . ' ¦ ' . $databaseBaseURL);
}
$pdf->restoreState();
$pdf->closeObject();
// close the currently open object; further writes will now go to the current page
$pdf->addObject($all, 'all');
// note that object can be told to appear on just odd or even pages by changing 'all' to 'odd' or 'even'
// Start printing page numbers:
if ($pdfPageSize == 'a4') {
$pdf->ezStartPageNumbers(550, 28, 10, '', '', 1);
} elseif ($pdfPageSize == 'letter') {
$pdf->ezStartPageNumbers(567, 28, 10, '', '', 1);
}
// LOOP OVER EACH RECORD:
// Fetch one page of results (or less if on the last page)
// (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
//.........这里部分代码省略.........
示例7: BuildPDFReport
function BuildPDFReport($userid)
{
$GLOBALS["SartON"] = time();
$q = new mysql();
$sql = "SELECT * FROM quarantine_report_users WHERE userid='{$userid}' and `type`=1 and `enabled`=1";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if ($ligne["enabled"] == 0) {
return;
}
$params = unserialize(base64_decode($ligne["parameters"]));
$days = $params["days"];
$subject = $params["subject"];
$subject = str_replace("{", "", $subject);
$subject = str_replace("}", "", $subject);
$session = md5($user->password);
if ($days < 1) {
$days = 2;
}
$user = new user($userid);
while (list($num, $ligne) = each($user->HASH_ALL_MAILS)) {
$recipient_sql[] = "mailto='{$ligne}'";
}
$date = date('Y-m-d');
$recipients = implode(" OR ", $recipient_sql);
$sql = "SELECT mailfrom,zDate,MessageID,DATE_FORMAT(zdate,'%W %D %H:%i') as tdate,subject FROM quarantine\n\tWHERE (zDate>DATE_ADD('{$date}', INTERVAL -{$days} DAY)) AND ({$recipients}) ORDER BY zDate DESC;";
if ($GLOBALS["VERBOSE"]) {
echo "{$sql}\n";
}
$datepdf = date('Y-m-d');
$results = $q->QUERY_SQL($sql, "artica_backup");
$num_rows = mysql_num_rows($results);
if (!$q->ok) {
send_email_events("Build SMTP quarantine report failed for {$uid}", "{$sql}\n{$q->mysql_error}", "postfix");
return null;
}
if ($num_rows == 0) {
return;
}
$pdf = new Cezpdf('a4', 'portrait');
$pdf->ezSetMargins(50, 70, 50, 50);
$all = $pdf->openObject();
$pdf->saveState();
//$pdf->setStrokeColor(0,0,0,1);
$pdf->line(20, 40, 578, 40);
$pdf->line(20, 822, 578, 822);
$pdf->addText(50, 34, 6, $date);
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all, 'all');
$mainFont = dirname(__FILE__) . "/ressources/fonts/Helvetica.afm";
$codeFont = dirname(__FILE__) . "/ressources/fonts/Courier.afm";
$pdf->selectFont($mainFont);
$pdf->ezText("{$user->DisplayName}\n", 30, array('justification' => 'centre'));
$pdf->ezText("{$subject}\n", 20, array('justification' => 'centre'));
$pdf->ezText("{$date} ({$num_rows} message(s))", 18, array('justification' => 'centre'));
$pdf->ezStartPageNumbers(100, 30, 12, "left", "Page {PAGENUM}/{TOTALPAGENUM}");
$pdf->ezNewPage();
$options = array('showLines' => 2, 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.8, 0.8, 0.8), 'fontSize' => 11, 'textCol' => array(0, 0, 0), 'textCol2' => array(1, 1, 1), 'titleFontSize' => 16, 'titleGap' => 8, 'rowGap' => 5, 'colGap' => 10, 'lineCol' => array(1, 1, 1), 'xPos' => 'left', 'xOrientation' => 'right', 'width' => 500, 'maxWidth' => 500);
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$mail_subject = $ligne["subject"];
$from = trim($ligne["mailfrom"]);
$zDate = $ligne["tdate"];
$MessageID = $ligne["MessageID"];
if ($from == null) {
$from = "unknown";
}
$domain = "unknown";
if (preg_match("#(.+?)@(.+)#", $from, $re)) {
$domain = $re[2];
}
$mail_subject = str_replace("{", "", $mail_subject);
$mail_subject = str_replace("}", "", $mail_subject);
$uri = "<c:alink:{{$params["URI"]}/user.quarantine.query.php?uid={$user->uid}&session={$session}&mail={$MessageID}>{$mail_subject}</c:alink>";
$data[] = array($zDate, $from, $uri);
}
$pdf->ezTable($data, $cols, $subject, $options);
$pdfcode = $pdf->output();
$fname = "/tmp/" . date('Ymdhi') . "-{$user->mail}-quarantines.pdf";
if ($GLOBALS["VERBOSE"]) {
echo "{$pdf->messages}\nbuilding {$fname}\n";
}
@unlink($fname);
if ($GLOBALS["VERBOSE"]) {
echo "Building {$fname}\n";
}
$fp = fopen($fname, 'w');
fwrite($fp, $pdfcode);
fclose($fp);
if (preg_match("#(.+?)@(.+)#", $user->mail, $re)) {
$domain = $re[2];
}
$PostmasterAdress = "no-reply-quarantine@{$domain}";
$ini = new Bs_IniHandler("/etc/artica-postfix/smtpnotif.conf");
if ($ini->_params["SMTP"]["smtp_sender"] != null) {
$PostmasterAdress = $ini->_params["SMTP"]["smtp_sender"];
}
if (file_exists('/etc/artica-postfix/settings/Daemons/PostfixPostmaster')) {
$PostmasterAdress = trim(@file_get_contents('/etc/artica-postfix/settings/Daemons/PostfixPostmaster'));
}
$unix = new unix();
//.........这里部分代码省略.........
示例8: array
function b_header(Cezpdf &$pdf, $partner_typ, $partner_id, $orientation = 'portrait', $font_file, $f_size, $logo_file = '')
{
$diff = array(196 => 'Adieresis', 228 => 'adieresis', 214 => 'Odieresis', 246 => 'odieresis', 220 => 'Udieresis', 252 => 'udieresis', 223 => 'germandbls');
$pdf->selectFont('Helvetica', array('encoding' => 'WinAnsiEncoding', 'differences' => $diff));
$all = $pdf->openObject();
$pdf->saveState();
$pdf->setStrokeColor(0, 0, 0, 1);
if ($orientation == 'portrait') {
$pdf->ezSetMargins(135, 70, 50, 50);
if (!isset($_REQUEST['no_logo'])) {
if ($logo_file == '') {
$logo_file = BERLUS_PATH . "/print_css/{$partner_typ}/{$partner_id}" . "_logo.png";
}
if (file_exists("{$logo_file}")) {
$pdf->addPngFromFile("{$logo_file}", 200, 730, 200, 80);
$pdf->line(43, 725, 545, 725);
$pdf->line(42, 50, 550, 50);
}
} else {
$logo_file = BERLUS_PATH . "/print_css/{$partner_typ}/{$partner_id}" . "_logo.png";
}
$pdf->setLineStyle(0.5);
$this->footer_info($partner_typ, $partner_id);
$pdf->addText(43, 718, $f_size, "{$this->header_zeile}");
$pdf->ezStartPageNumbers(545, 715, $f_size, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1);
$pdf->setLineStyle(0.5);
if (!isset($_REQUEST['no_logo'])) {
$pdf->addText($pdf->ez['pageWidth'] / 2, 42, $f_size, "{$this->zeile1}", 0, 'center');
$pdf->addText($pdf->ez['pageWidth'] / 2, 35, $f_size, "{$this->zeile2}", 0, 'center');
}
} else {
$pdf->ezSetMargins(120, 40, 30, 30);
$logo_file = BERLUS_PATH . "/print_css/{$partner_typ}/{$partner_id}" . "_logo.png";
if (file_exists("{$logo_file}")) {
$pdf->addPngFromFile("{$logo_file}", 320, 505, 200, 80);
} else {
$pdf->addText(370, 505, $f_size, "Vorschau / Druckansicht ");
}
$pdf->setLineStyle(0.5);
$this->footer_info($partner_typ, $partner_id);
$pdf->line(43, 500, 785, 500);
$pdf->addText(43, 493, $f_size, "{$this->header_zeile}");
$pdf->ezStartPageNumbers(783, 493, $f_size, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1);
$pdf->setLineStyle(0.5);
$pdf->line(42, 30, 785, 30);
$pdf->addText($pdf->ez['pageWidth'] / 2, 23, $f_size, "{$this->zeile1}", 0, 'center');
$pdf->addText($pdf->ez['pageWidth'] / 2, 16, $f_size, "{$this->zeile2}", 0, 'center');
}
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all, 'all');
}