本文整理汇总了PHP中pdf::SetSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP pdf::SetSubject方法的具体用法?PHP pdf::SetSubject怎么用?PHP pdf::SetSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdf
的用法示例。
在下文中一共展示了pdf::SetSubject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
/**
* printanswers::view()
* View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
* @param mixed $surveyid
* @param bool $printableexport
* @return
*/
function actionView($surveyid, $printableexport = FALSE)
{
Yii::app()->loadHelper("frontend");
Yii::import('application.libraries.admin.pdf');
$iSurveyID = (int) $surveyid;
$sExportType = $printableexport;
Yii::app()->loadHelper('database');
if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
$iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
} else {
//die('Invalid survey/session');
}
// Get the survey inforamtion
// Set the language for dispay
if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
$sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
} elseif (Survey::model()->findByPk($iSurveyID)) {
$sLanguage = Survey::model()->findByPk($iSurveyID)->language;
} else {
$iSurveyID = 0;
$sLanguage = Yii::app()->getConfig("defaultlang");
}
$clang = SetSurveyLanguage($iSurveyID, $sLanguage);
$aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
//SET THE TEMPLATE DIRECTORY
if (!isset($aSurveyInfo['templatedir']) || !$aSurveyInfo['templatedir']) {
$aSurveyInfo['templatedir'] = Yii::app()->getConfig('defaulttemplate');
}
$sTemplate = validateTemplateDir($aSurveyInfo['templatedir']);
//Survey is not finished or don't exist
if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
doFooter();
exit;
}
//Fin session time out
$sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
//I want to see the answers with this id
//Ensure script is not run directly, avoid path disclosure
//if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
if ($aSurveyInfo['printanswers'] == 'N') {
die;
//Die quietly if print answers is not permitted
}
//CHECK IF SURVEY IS ACTIVATED AND EXISTS
$sSurveyName = $aSurveyInfo['surveyls_title'];
$sAnonymized = $aSurveyInfo['anonymized'];
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
//SHOW HEADER
$sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
if ($sExportType == 'pdf') {
//require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
Yii::import('application.libraries.admin.pdf', true);
Yii::import('application.helpers.pdfHelper');
$aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
$oPDF = new pdf();
$oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
$oPDF->SetSubject($sSurveyName);
$oPDF->SetDisplayMode('fullpage', 'two');
$oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
$oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
$oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
$oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
$oPDF->AddPage();
$oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
}
$sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p> \n";
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
$printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
$aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
//Get the fieldmap @TODO: do we need to filter out some fields?
if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
unset($aFullResponseTable['submitdate']);
} else {
unset($aFullResponseTable['id']);
}
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
$sOutput .= "<table class='printouttable' >\n";
foreach ($aFullResponseTable as $sFieldname => $fname) {
if (substr($sFieldname, 0, 4) == 'gid_') {
$sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
} elseif (substr($sFieldname, 0, 4) == 'qid_') {
//.........这里部分代码省略.........
示例2: generate_statistics
//.........这里部分代码省略.........
if ($q2show == 'all') {
$summary[] = $myField;
}
//$allfields[]=$myField;
}
} else {
// This gets all the 'to be shown questions' from the POST and puts these into an array
if (!is_array($q2show)) {
$summary = returnGlobal('summary');
} else {
$summary = $q2show;
}
//print_r($_POST);
//if $summary isn't an array we create one
if (isset($summary) && !is_array($summary)) {
$summary = explode("+", $summary);
}
}
/**
* pdf Config
*/
if ($outputType == 'pdf') {
//require_once('classes/tcpdf/mypdf.php');
Yii::import('application.libraries.admin.pdf', true);
Yii::import('application.helpers.pdfHelper');
$aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($language);
// create new PDF document
$this->pdf = new pdf();
$surveyInfo = getSurveyInfo($surveyid, $language);
// set document information
$this->pdf->SetCreator(PDF_CREATOR);
$this->pdf->SetAuthor('LimeSurvey');
$this->pdf->SetTitle(sprintf(gT("Statistics survey %s"), $surveyid));
$this->pdf->SetSubject($surveyInfo['surveyls_title']);
$this->pdf->SetKeywords('LimeSurvey,' . gT("Statistics") . ', ' . sprintf(gT("Survey %s"), $surveyid));
$this->pdf->SetDisplayMode('fullpage', 'two');
$this->pdf->setLanguageArray($aPdfLanguageSettings['lg']);
// set header and footer fonts
$this->pdf->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
$this->pdf->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
// set default header data
// Since png crashes some servers (and we can not try/catch that) we use .gif (or .jpg) instead
$headerlogo = 'statistics.gif';
$this->pdf->SetHeaderData($headerlogo, 10, gT("Quick statistics", 'unescaped'), gT("Survey") . " " . $surveyid . " '" . flattenText($surveyInfo['surveyls_title'], false, true, 'UTF-8') . "'");
$this->pdf->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
// set default monospaced font
$this->pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
}
if ($outputType == 'xls') {
/**
* Initiate the Spreadsheet_Excel_Writer
*/
require_once APPPATH . '/third_party/pear/Spreadsheet/Excel/Xlswriter.php';
if ($pdfOutput == 'F') {
$sFileName = $sTempDir . '/statistic-survey' . $surveyid . '.xls';
$this->workbook = new Xlswriter($sFileName);
} else {
$this->workbook = new Xlswriter();
}
$this->workbook->setVersion(8);
// Inform the module that our data will arrive as UTF-8.
// Set the temporary directory to avoid PHP error messages due to open_basedir restrictions and calls to tempnam("", ...)
$this->workbook->setTempDir($sTempDir);
// Inform the module that our data will arrive as UTF-8.
// Set the temporary directory to avoid PHP error messages due to open_basedir restrictions and calls to tempnam("", ...)
if (!empty($sTempDir)) {
示例3: pdf
$fontfamily = PDF_FONT_NAME_MAIN;
}
/**
* Extend the standard PDF class to get access to some protected values we want to display
* at the test page.
*
* @copyright 2009 David Mudrak <david.mudrak@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if ($getpdf) {
$doc = new pdf();
$doc->SetTitle('Moodle PDF library test');
$doc->SetAuthor('Moodle ' . $CFG->release);
$doc->SetCreator('lib/tests/other/pdflibtestpage.php');
$doc->SetKeywords('Moodle, PDF');
$doc->SetSubject('This has been generated by Moodle as its PDF library test page');
$doc->SetMargins(15, 30);
$doc->setPrintHeader(true);
$doc->setHeaderMargin(10);
$doc->setHeaderFont(array($fontfamily, 'b', 10));
$doc->setHeaderData('pix/moodlelogo-med-white.gif', 40, $SITE->fullname, $CFG->wwwroot);
$doc->setPrintFooter(true);
$doc->setFooterMargin(10);
$doc->setFooterFont(array($fontfamily, '', 8));
$doc->AddPage();
$doc->SetTextColor(255, 255, 255);
$doc->SetFillColor(255, 203, 68);
$doc->SetFont($fontfamily, 'B', 24);
$doc->Cell(0, 0, 'Moodle PDF library test', 0, 1, 'C', 1);
$doc->SetFont($fontfamily, '', 12);
$doc->Ln(6);
示例4: create_pdf_object
/**
* Create PDF object using parameters
*
* @return PDF
*/
protected function create_pdf_object()
{
//Default orientation is Landescape
$orientation = 'L';
if ($this->get_instance()->height > $this->get_instance()->width) {
$orientation = 'P';
}
// Remove commas to avoid a bug in TCPDF where a string containing a commas will result in two strings.
$keywords = get_string('keywords', 'simplecertificate') . ',' . format_string($this->get_instance()->coursename, true);
$keywords = str_replace(",", " ", $keywords);
// Replace commas with spaces.
$keywords = str_replace(" ", " ", $keywords);
// Replace two spaces with one.
$pdf = new pdf($orientation, 'mm', array($this->get_instance()->width, $this->get_instance()->height), true, 'UTF-8');
$pdf->SetTitle($this->get_instance()->name);
$pdf->SetSubject($this->get_instance()->name . ' - ' . $this->get_instance()->coursename);
$pdf->SetKeywords($keywords);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(false, 0);
$pdf->setFontSubsetting(true);
$pdf->SetMargins(0, 0, 0, true);
return $pdf;
}
示例5: pdf
<?php
require_once 'config.php';
define('ID_LANG', 1);
if (isset($_GET['id'])) {
$booking = Booking::byId($_GET['id']);
$user = User::byId($booking->id_user);
$room = Room::byId($booking->id_room);
// HEADER
// create a PDF object
$pdf = new pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document (meta) information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Hotel Plaza Nueva');
$pdf->SetTitle('Hotel Plaza Nueva');
$pdf->SetSubject('Hotel Plaza Nueva');
$pdf->SetKeywords('hotel, plaza, nueva, granada');
// add a page
$pdf->AddPage();
// create address box
$pdf->CreateTextBox($user->name, 0, 55, 80, 10, 10, 'B');
$pdf->CreateTextBox($user->email, 0, 60, 80, 10, 10);
$pdf->CreateTextBox($user->phone, 0, 65, 80, 10, 10);
//$pdf->CreateTextBox('Zip, city name', 0, 70, 80, 10, 10);
// invoice title / number
$pdf->CreateTextBox('Factura #' . $booking->id, 0, 90, 120, 20, 16);
// date, order ref
$date = date_create($booking->date_booking);
$pdf->CreateTextBox('Fecha: ' . date_format($date, "d/m/Y H:i:s"), 0, 100, 0, 10, 10, '', 'R');
$pdf->CreateTextBox('Order ref.: #' . $booking->id, 0, 105, 0, 10, 10, '', 'R');
// ROWS