本文整理汇总了PHP中pdf::delete_html方法的典型用法代码示例。如果您正苦于以下问题:PHP pdf::delete_html方法的具体用法?PHP pdf::delete_html怎么用?PHP pdf::delete_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdf
的用法示例。
在下文中一共展示了pdf::delete_html方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayResults
/**
* displayResults builds html output to display the actual results from a survey
*
* @param mixed $outputs
* @param INT $results The number of results being displayed overall
* @param mixed $rt
* @param mixed $outputType
* @param mixed $surveyid
* @param mixed $sql
* @param mixed $usegraph
*/
protected function displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $sLanguage)
{
/* Set up required variables */
$TotalCompleted = 0;
//Count of actually completed answers
$statisticsoutput = "";
$sDatabaseType = Yii::app()->db->getDriverName();
$tempdir = Yii::app()->getConfig("tempdir");
$tempurl = Yii::app()->getConfig("tempurl");
$firstletter = substr($rt, 0, 1);
$astatdata = array();
if ($usegraph == 1) {
//for creating graphs we need some more scripts which are included here
require_once APPPATH . '/third_party/pchart/pchart/pChart.class';
require_once APPPATH . '/third_party/pchart/pchart/pData.class';
require_once APPPATH . '/third_party/pchart/pchart/pCache.class';
$MyCache = new pCache($tempdir . '/');
}
switch ($outputType) {
case 'xls':
$xlsTitle = sprintf(gT("Field summary for %s"), html_entity_decode($outputs['qtitle'], ENT_QUOTES, 'UTF-8'));
$xlsDesc = html_entity_decode($outputs['qquestion'], ENT_QUOTES, 'UTF-8');
$this->xlsRow++;
$this->xlsRow++;
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $xlsTitle);
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $xlsDesc);
$footXLS = array();
break;
case 'pdf':
$sPDFQuestion = flattenText($outputs['qquestion'], false, true);
$pdfTitle = $this->pdf->delete_html(sprintf(gT("Field summary for %s"), html_entity_decode($outputs['qtitle'], ENT_QUOTES, 'UTF-8')));
$titleDesc = $sPDFQuestion;
$this->pdf->AddPage('P', 'A4');
$this->pdf->Bookmark($sPDFQuestion, 1, 0);
$this->pdf->titleintopdf($pdfTitle, $sPDFQuestion);
$tablePDF = array();
$footPDF = array();
break;
case 'html':
//output
$statisticsoutput .= "<table class='statisticstable'>\n" . "\t<thead><tr><th colspan='4' align='center'><strong>" . sprintf(gT("Field summary for %s"), $outputs['qtitle']) . "</strong>" . "</th></tr>\n" . "\t<tr><th colspan='4' align='center'><strong>" . $outputs['qquestion'] . "</strong></th></tr>\n" . "\t<tr>\n\t\t<th width='50%' align='center' >";
break;
default:
break;
}
//loop though the array which contains all answer data
$ColumnName_RM = array();
foreach ($outputs['alist'] as $al) {
//picks out answer list ($outputs['alist']/$al)) that come from the multiple list above
if (isset($al[2]) && $al[2]) {
//handling for "other" option
if ($al[0] == gT("Other")) {
if ($outputs['qtype'] == '!' || $outputs['qtype'] == 'L') {
// It is better for single choice question types to filter on the number of '-oth-' entries, than to
// just count the number of 'other' values - that way with failing Javascript the statistics don't get messed up
/* This query selects a count of responses where "other" has been selected */
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName(substr($al[2], 0, strlen($al[2]) - 5)) . "='-oth-'";
} else {
//get data - select a count of responses where no answer is provided
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " != ''" : "NOT (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE '')";
}
} elseif ($outputs['qtype'] == "U" || $outputs['qtype'] == "T" || $outputs['qtype'] == "S" || $outputs['qtype'] == "Q" || $outputs['qtype'] == ";") {
$sDatabaseType = Yii::app()->db->getDriverName();
//free text answers
if ($al[0] == "Answer") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " != ''" : "NOT (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE '')";
} elseif ($al[0] == "NoAnswer") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ( ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " = '')" : " (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE ''))";
}
} elseif ($outputs['qtype'] == "O") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ( ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " <> '')" : " (" . Yii::app()->db->quoteColumnName($al[2]) . " NOT LIKE ''))";
// all other question types
} else {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName($al[2]) . " =";
//ranking question?
if (substr($rt, 0, 1) == "R") {
$query .= " '{$al['0']}'";
} else {
$query .= " 'Y'";
}
}
} else {
if ($al[0] != "") {
//.........这里部分代码省略.........
示例2: generate_statistics
//.........这里部分代码省略.........
}
//get me some data Scotty
$result = Yii::app()->db->createCommand($query)->query();
//put all results into $results
$row = $result->read();
$results = reset($row);
if ($total) {
$percent = sprintf("%01.2f", $results / $total * 100);
}
switch ($outputType) {
case "xls":
$this->xlsRow = 0;
$this->sheet->write($this->xlsRow, 0, $statlang->gT("Number of records in this query:", 'unescaped'));
$this->sheet->write($this->xlsRow, 1, $results);
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $statlang->gT("Total records in survey:", 'unescaped'));
$this->sheet->write($this->xlsRow, 1, $total);
if ($total) {
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $statlang->gT("Percentage of total:", 'unescaped'));
$this->sheet->write($this->xlsRow, 1, $percent . "%");
}
break;
case 'pdf':
// add summary to pdf
$array = array();
//$array[] = array($statlang->gT("Results"),"");
$array[] = array($statlang->gT("Number of records in this query:", 'unescaped'), $results);
$array[] = array($statlang->gT("Total records in survey:", 'unescaped'), $total);
if ($total) {
$array[] = array($statlang->gT("Percentage of total:", 'unescaped'), $percent . "%");
}
$this->pdf->AddPage('P', ' A4');
$this->pdf->Bookmark($this->pdf->delete_html($statlang->gT("Results", 'unescaped')), 0, 0);
$this->pdf->titleintopdf($statlang->gT("Results", 'unescaped'), $statlang->gT("Survey", 'unescaped') . " " . $surveyid);
$this->pdf->tableintopdf($array);
$this->pdf->AddPage('P', 'A4');
break;
case 'html':
$statisticsoutput .= "<br />\n<table class='statisticssummary' >\n" . "\t<thead><tr><th colspan='2'>" . $statlang->gT("Results") . "</th></tr></thead>\n" . "\t<tr><th >" . $statlang->gT("Number of records in this query:") . '</th>' . "<td>{$results}</td></tr>\n" . "\t<tr><th>" . $statlang->gT("Total records in survey:") . '</th>' . "<td>{$total}</td></tr>\n";
//only calculate percentage if $total is set
if ($total) {
$percent = sprintf("%01.2f", $results / $total * 100);
$statisticsoutput .= "\t<tr><th align='right'>" . $statlang->gT("Percentage of total:") . '</th>' . "<td>{$percent}%</td></tr>\n";
}
$statisticsoutput .= "</table>\n";
break;
default:
break;
}
//put everything from $selects array into a string connected by AND
//This string ($sql) can then be passed on to other functions so you can
//browse these results
if (isset($selects) && $selects) {
$sql = implode(" AND ", $selects);
} elseif (!empty($newsql)) {
$sql = $newsql;
}
if (!isset($sql) || !$sql) {
$sql = "NULL";
}
//only continue if we have something to output
if ($results > 0) {
if ($outputType == 'html' && $browse === true) {
//add a buttons to browse results
$statisticsoutput .= CHtml::form(array("admin/responses/sa/browse/surveyid/{$surveyid}"), 'post', array('target' => '_blank')) . "\n" . "\t\t<p>" . "\t\t\t<input type='submit' value='" . $statlang->gT("Browse") . "' />\n" . "\t\t\t<input type='hidden' name='sid' value='{$surveyid}' />\n" . "\t\t\t<input type='hidden' name='sql' value=\"{$sql}\" />\n" . "\t\t\t<input type='hidden' name='subaction' value='all' />\n" . "\t\t</p>" . "\t\t</form>\n";
示例3: displayResults
/**
* displayResults builds html output to display the actual results from a survey
*
* @param mixed $outputs
* @param INT $results The number of results being displayed overall
* @param mixed $rt
* @param mixed $outputType
* @param mixed $surveyid
* @param mixed $sql
* @param mixed $usegraph
*
*
*/
protected function displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $sLanguage)
{
/* Set up required variables */
$TotalCompleted = 0;
//Count of actually completed answers
$statisticsoutput = "";
$sDatabaseType = Yii::app()->db->getDriverName();
$tempdir = Yii::app()->getConfig("tempdir");
$tempurl = Yii::app()->getConfig("tempurl");
$firstletter = substr($rt, 0, 1);
$astatdata = array();
if ($usegraph == 1 && $outputType != 'html') {
//for creating graphs we need some more scripts which are included here
require_once APPPATH . '/third_party/pchart/pchart/pChart.class';
require_once APPPATH . '/third_party/pchart/pchart/pData.class';
require_once APPPATH . '/third_party/pchart/pchart/pCache.class';
$MyCache = new pCache($tempdir . '/');
}
switch ($outputType) {
case 'xls':
$xlsTitle = sprintf(gT("Field summary for %s"), html_entity_decode($outputs['qtitle'], ENT_QUOTES, 'UTF-8'));
$xlsDesc = html_entity_decode($outputs['qquestion'], ENT_QUOTES, 'UTF-8');
$this->xlsRow++;
$this->xlsRow++;
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $xlsTitle);
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $xlsDesc);
$footXLS = array();
break;
case 'pdf':
$sPDFQuestion = flattenText($outputs['qquestion'], false, true);
$pdfTitle = $this->pdf->delete_html(sprintf(gT("Field summary for %s"), html_entity_decode($outputs['qtitle'], ENT_QUOTES, 'UTF-8')));
$titleDesc = $sPDFQuestion;
$this->pdf->AddPage('P', 'A4');
$this->pdf->Bookmark($sPDFQuestion, 1, 0);
$this->pdf->titleintopdf($pdfTitle, $sPDFQuestion);
$tablePDF = array();
$footPDF = array();
break;
case 'html':
// output now generated in subview _statisticsoutuput_header
break;
default:
break;
}
//loop though the array which contains all answer data
$ColumnName_RM = array();
//echo '<pre>'; var_dump($outputs['alist']); echo '</pre>';die;
foreach ($outputs['alist'] as $al) {
//picks out answer list ($outputs['alist']/$al)) that come from the multiple list above
if (isset($al[2]) && $al[2]) {
//handling for "other" option
if ($al[0] == gT("Other")) {
if ($outputs['qtype'] == '!' || $outputs['qtype'] == 'L') {
// It is better for single choice question types to filter on the number of '-oth-' entries, than to
// just count the number of 'other' values - that way with failing Javascript the statistics don't get messed up
/* This query selects a count of responses where "other" has been selected */
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName(substr($al[2], 0, strlen($al[2]) - 5)) . "='-oth-'";
} else {
//get data - select a count of responses where no answer is provided
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " != ''" : "NOT (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE '')";
}
} elseif ($outputs['qtype'] == "U" || $outputs['qtype'] == "T" || $outputs['qtype'] == "S" || $outputs['qtype'] == "Q" || $outputs['qtype'] == ";") {
$sDatabaseType = Yii::app()->db->getDriverName();
//free text answers
if ($al[0] == "Answer") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " != ''" : "NOT (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE '')";
} elseif ($al[0] == "NoAnswer") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ( ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " = '')" : " (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE ''))";
}
} elseif ($outputs['qtype'] == "O") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ( ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " <> '')" : " (" . Yii::app()->db->quoteColumnName($al[2]) . " NOT LIKE ''))";
// all other question types
} else {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName($al[2]) . " =";
//ranking question?
if (substr($rt, 0, 1) == "R") {
$query .= " '{$al['0']}'";
} else {
$query .= " 'Y'";
}
}
//.........这里部分代码省略.........
示例4: displayResults
/**
* displayResults builds html output to display the actual results from a survey
*
* @param mixed $outputs
* @param INT $results The number of results being displayed overall
* @param mixed $rt
* @param mixed $outputType
* @param mixed $surveyid
* @param mixed $sql
* @param mixed $usegraph
*
*
*/
protected function displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $sLanguage)
{
/* Set up required variables */
$TotalCompleted = 0;
//Count of actually completed answers
$statisticsoutput = "";
$sDatabaseType = Yii::app()->db->getDriverName();
$tempdir = Yii::app()->getConfig("tempdir");
$tempurl = Yii::app()->getConfig("tempurl");
$firstletter = substr($rt, 0, 1);
$astatdata = array();
if ($usegraph == 1) {
//for creating graphs we need some more scripts which are included here
require_once APPPATH . '/third_party/pchart/pchart/pChart.class';
require_once APPPATH . '/third_party/pchart/pchart/pData.class';
require_once APPPATH . '/third_party/pchart/pchart/pCache.class';
$MyCache = new pCache($tempdir . '/');
}
switch ($outputType) {
case 'xls':
$xlsTitle = sprintf(gT("Field summary for %s"), html_entity_decode($outputs['qtitle'], ENT_QUOTES, 'UTF-8'));
$xlsDesc = html_entity_decode($outputs['qquestion'], ENT_QUOTES, 'UTF-8');
$this->xlsRow++;
$this->xlsRow++;
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $xlsTitle);
$this->xlsRow++;
$this->sheet->write($this->xlsRow, 0, $xlsDesc);
$footXLS = array();
break;
case 'pdf':
$sPDFQuestion = flattenText($outputs['qquestion'], false, true);
$pdfTitle = $this->pdf->delete_html(sprintf(gT("Field summary for %s"), html_entity_decode($outputs['qtitle'], ENT_QUOTES, 'UTF-8')));
$titleDesc = $sPDFQuestion;
$this->pdf->AddPage('P', 'A4');
$this->pdf->Bookmark($sPDFQuestion, 1, 0);
$this->pdf->titleintopdf($pdfTitle, $sPDFQuestion);
$tablePDF = array();
$footPDF = array();
break;
case 'html':
//output
$statisticsoutput .= "<table class='statisticstable table table-bordered'>\n" . "\t<thead><tr class='success'><th colspan='4' align='center' style='text-align: center; '><strong>" . sprintf(gT("Field summary for %s"), $outputs['qtitle']) . "</strong>" . "</th></tr>\n" . "\t<tr><th colspan='4' align='center' style='text-align: center; '><strong>" . $outputs['qquestion'] . "</strong></th></tr>\n" . "\t<tr>\n\t\t<th width='50%' align='center' >";
break;
default:
break;
}
//loop though the array which contains all answer data
$ColumnName_RM = array();
foreach ($outputs['alist'] as $al) {
//picks out answer list ($outputs['alist']/$al)) that come from the multiple list above
if (isset($al[2]) && $al[2]) {
//handling for "other" option
if ($al[0] == gT("Other")) {
if ($outputs['qtype'] == '!' || $outputs['qtype'] == 'L') {
// It is better for single choice question types to filter on the number of '-oth-' entries, than to
// just count the number of 'other' values - that way with failing Javascript the statistics don't get messed up
/* This query selects a count of responses where "other" has been selected */
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName(substr($al[2], 0, strlen($al[2]) - 5)) . "='-oth-'";
} else {
//get data - select a count of responses where no answer is provided
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " != ''" : "NOT (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE '')";
}
} elseif ($outputs['qtype'] == "U" || $outputs['qtype'] == "T" || $outputs['qtype'] == "S" || $outputs['qtype'] == "Q" || $outputs['qtype'] == ";") {
$sDatabaseType = Yii::app()->db->getDriverName();
//free text answers
if ($al[0] == "Answer") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " != ''" : "NOT (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE '')";
} elseif ($al[0] == "NoAnswer") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ( ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " = '')" : " (" . Yii::app()->db->quoteColumnName($al[2]) . " LIKE ''))";
}
} elseif ($outputs['qtype'] == "O") {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE ( ";
$query .= $sDatabaseType == "mysql" ? Yii::app()->db->quoteColumnName($al[2]) . " <> '')" : " (" . Yii::app()->db->quoteColumnName($al[2]) . " NOT LIKE ''))";
// all other question types
} else {
$query = "SELECT count(*) FROM {{survey_{$surveyid}}} WHERE " . Yii::app()->db->quoteColumnName($al[2]) . " =";
//ranking question?
if (substr($rt, 0, 1) == "R") {
$query .= " '{$al['0']}'";
} else {
$query .= " 'Y'";
}
}
//.........这里部分代码省略.........