本文整理汇总了PHP中Misc::FileDownloadHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::FileDownloadHeader方法的具体用法?PHP Misc::FileDownloadHeader怎么用?PHP Misc::FileDownloadHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::FileDownloadHeader方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
unset($column, $column_data);
}
$rows[] = $row_columns;
unset($row_columns);
}
}
}
//var_dump($rows);
foreach ($filter_data['column_ids'] as $column_key) {
$filter_columns[Misc::trimSortPrefix($column_key)] = $columns[$column_key];
}
if ($action == 'export') {
if (isset($rows) and isset($filter_columns)) {
Debug::Text('Exporting as CSV', __FILE__, __LINE__, __METHOD__, 10);
$data = Misc::Array2CSV($rows, $filter_columns);
Misc::FileDownloadHeader('report.csv', 'application/csv', strlen($data));
echo $data;
} else {
echo TTi18n::gettext("No Data To Export!") . "<br>\n";
}
} else {
$smarty->assign_by_ref('generated_time', TTDate::getTime());
$smarty->assign_by_ref('pay_period_options', $pay_period_options);
$smarty->assign_by_ref('filter_data', $filter_data);
$smarty->assign_by_ref('columns', $filter_columns);
$smarty->assign_by_ref('rows', $rows);
$smarty->display('report/TimesheetSummaryReport.tpl');
}
break;
case 'delete':
case 'save':
示例2: str_replace
}
//var_dump($tmp_rows);
}
//}
if ($action == 'export') {
if (isset($rows) and isset($gle) and isset($filter_data['export_type'])) {
if ($gle->compile() == TRUE) {
$data = $gle->getCompiledData();
Debug::Text('Exporting as: ' . $filter_data['export_type'], __FILE__, __LINE__, __METHOD__, 10);
if ($filter_data['export_type'] == 'simply') {
$file_name = 'general_ledger_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.txt';
} else {
$file_name = 'general_ledger_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.csv';
}
//Misc::FileDownloadHeader('general_ledger.csv', 'application/csv', strlen($data) );
Misc::FileDownloadHeader($file_name, 'application/text', strlen($data));
echo $data;
} else {
echo "One or more journal entries did not balance!<br>\n";
//Debug::Display();
}
} else {
echo TTi18n::gettext('No Data To Export!') . "<br>\n";
}
} else {
$smarty->assign_by_ref('generated_time', TTDate::getTime());
$smarty->assign_by_ref('pay_period_options', $pay_period_options);
$smarty->assign_by_ref('filter_data', $filter_data);
$smarty->assign_by_ref('columns', $filter_columns);
$smarty->assign_by_ref('rows', $rows);
$smarty->display('report/GeneralLedgerSummaryReport.tpl');
示例3: strlen
$pdf->setXY(82, 244);
$pdf->Cell(75, 6, $current_company->getName(), $border, 0, 'L');
$pdf->setXY(82, 253);
$pdf->Cell(45, 6, $current_company->getAddress1() . ' ' . $current_company->getAddress2(), $border, 0, 'L');
$pdf->setXY(82, 261);
$pdf->Cell(45, 6, $current_company->getCity() . ', ' . $current_company->getProvince() . ' ' . $current_company->getPostalCode(), $border, 0, 'L');
$pdf->setXY(157, 234);
$pdf->Cell(35, 6, Misc::getBeforeDecimal(Misc::MoneyFormat($lines_arr['total']['p1_6'], FALSE)), $border, 0, 'R');
$pdf->setXY(193, 234);
$pdf->Cell(6, 6, Misc::getAfterDecimal(Misc::MoneyFormat($lines_arr['total']['p1_6'], FALSE)), $border, 0, 'L');
}
$output = $pdf->Output('', 'S');
if (Debug::getVerbosity() == 11) {
Debug::Display();
} else {
Misc::FileDownloadHeader('f940ez.pdf', 'application/pdf', strlen($output));
echo $output;
}
exit;
}
}
break;
case 'delete':
case 'save':
Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10);
$generic_data['id'] = UserGenericDataFactory::reportFormDataHandler($action, $filter_data, $generic_data, URLBuilder::getURL(NULL, $_SERVER['SCRIPT_NAME']));
unset($generic_data['name']);
default:
BreadCrumb::setCrumb($title);
$ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), $_SERVER['SCRIPT_NAME']);
if ($ugdlf->getRecordCount() > 0) {
示例4: str_replace
Misc::FileDownloadHeader('checks_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.pdf', 'application/pdf', strlen($output));
} else {
//Include file creation number in the exported file name, so the user knows what it is without opening the file,
//and can generate multiple files if they need to match a specific number.
$ugdlf = TTnew('UserGenericDataListFactory');
$ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), 'PayStubFactory', TRUE);
if ($ugdlf->getRecordCount() > 0) {
$ugd_obj = $ugdlf->getCurrent();
$setup_data = $ugd_obj->getData();
}
if (isset($setup_data)) {
$file_creation_number = $setup_data['file_creation_number']++;
} else {
$file_creation_number = 0;
}
Misc::FileDownloadHeader('eft_' . $file_creation_number . '_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.txt', 'application/text', strlen($output));
}
echo $output;
//Debug::Display();
Debug::writeToLog();
exit;
} else {
Debug::Display();
}
} else {
echo TTi18n::gettext("ERROR: No Data to Export!") . "<br>\n";
exit;
}
}
break;
case 'add':
示例5: exec
//echo "FileName: $filename<br>\n";
if (file_put_contents($filename . '.html', $data) > 0) {
//echo "Writing file successfull<Br>\n";
} else {
//echo "Error writing file<Br>\n";
exit;
}
}
//Convert to PDF
$cmd = 'htmldoc --no-title --footer . --left 20mm --right 20mm --bottom 5mm --top 5mm -f ' . $dir . 'out.pdf --webpage ' . $dir . '*.html';
//echo "Cmd: $cmd<br>\n";
exec($cmd, $output, $retval);
unset($output);
//echo "Retval: $retval<br>\n";
//Open PDF and display
$pdf = file_get_contents($dir . 'out.pdf');
if ($pdf === FALSE) {
//echo "Error reading PDF<br>\n";
exit;
}
Misc::FileDownloadHeader('pay_stub.pdf', 'application/pdf', strlen($pdf));
echo $pdf;
//Delete tmp files.
foreach (glob($dir . '*') as $filename) {
unlink($filename);
}
rmdir($dir);
} else {
echo TTi18n::gettext("ERROR: No Items Selected!") . "<br>\n";
}
//Debug::Display();
示例6: displayPDF
function displayPDF()
{
$output = $this->getPDF();
if (Debug::getVerbosity() == 11) {
Debug::Display();
} else {
Misc::FileDownloadHeader($this->getFileName(), 'application/pdf', strlen($output));
echo $output;
exit;
}
}
示例7: extract
$smarty->assign('title', TTi18n::gettext($title = 'Employee Pay Stub'));
// See index.php
BreadCrumb::setCrumb($title);
/*
* Get FORM variables
*/
extract(FormVariables::GetVariables(array('action', 'page', 'sort_column', 'sort_order', 'hide_employer_rows', 'id', 'ids', 'export_type')));
$export_type = strtolower($export_type);
switch ($action) {
default:
if (isset($id) and !isset($ids)) {
$ids = array($id);
}
if (count($ids) > 0) {
$pslf = new PayStubListFactory();
if ($permission->Check('pay_stub', 'view')) {
$pslf->getByCompanyIdAndId($current_company->getId(), $ids);
} else {
$pslf->getByUserIdAndId($current_user->getId(), $ids);
$hide_employer_rows = TRUE;
}
$output = $pslf->exportPayStub($pslf, $export_type);
if (Debug::getVerbosity() < 11) {
Misc::FileDownloadHeader('checks_' . str_replace(array('/', ',', ' '), '_', TTDate::getDate('DATE', time())) . '.pdf', 'application/pdf', strlen($output));
echo $output;
exit;
}
}
break;
}
//Debug::Display();
示例8: foreach
$barcode_y = $pdf->getY() + 5;
if (in_array('barcode', $filter_data['column_ids'])) {
$pdf->setXY($barcode_x, $barcode_y);
$barcode_file_name = $dir . 'SUBMIT.png';
if (Misc::writeBarCodeFile($barcode_file_name, 'SUBMIT') == TRUE) {
$pdf->Image($barcode_file_name, $barcode_x, $barcode_y, NULL, 25);
}
}
//Delete tmp files.
foreach (glob($dir . '*') as $filename) {
unlink($filename);
}
rmdir($dir);
$output = $pdf->Output('', 'S');
//Debug::Display();
Misc::FileDownloadHeader('employee_barcodes.pdf', 'application/pdf', strlen($output));
echo $output;
exit;
} else {
echo TTi18n::gettext('Sorry, no items match your criteria.') . "<br>\n";
}
exit;
break;
case 'delete':
case 'save':
Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10);
$generic_data['id'] = UserGenericDataFactory::reportFormDataHandler($action, $filter_data, $generic_data, URLBuilder::getURL(NULL, $_SERVER['SCRIPT_NAME']));
unset($generic_data['name']);
default:
BreadCrumb::setCrumb($title);
if ($action == 'load') {
示例9: TTnew
$filter_data['show_days'] = 4;
}
if (!isset($filter_data['group_schedule'])) {
$filter_data['group_schedule'] = FALSE;
}
$filter_data['start_date'] = TTDate::getBeginWeekEpoch(TTDate::getBeginDayEpoch($filter_data['start_date']), $current_user_prefs->getStartWeekDay());
Debug::Text('Start Date: ' . TTDate::getDate('DATE+TIME', $filter_data['start_date']), __FILE__, __LINE__, __METHOD__, 10);
$filter_data['end_date'] = $filter_data['start_date'] + ($filter_data['show_days'] * 7 * 86400 - 3601);
$sf = TTnew('ScheduleFactory');
$output = $sf->getSchedule($filter_data, $current_user_prefs->getStartWeekDay(), $filter_data['group_schedule']);
//print_r($output);
if ($output == FALSE) {
echo TTi18n::getText('No Schedule to print!') . "<br>\n";
} else {
if (Debug::getVerbosity() < 11) {
Misc::FileDownloadHeader('schedule.pdf', 'application/pdf', strlen($output));
echo $output;
} else {
Debug::Display();
}
}
exit;
break;
case 'filter':
if ($filter_start_date != '' and $filter_show_days != '') {
$start_date = $filter_start_date = TTDate::getBeginDayEpoch($filter_start_date);
$end_date = $start_date + ($filter_show_days * 86400 - 3600);
}
case 'delete':
case 'save':
Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10);
示例10: elseif
if ($i == 1) {
$pdf->setXY(Misc::AdjustXY(152, $adjust_x), Misc::AdjustXY(28, $adjust_y));
} elseif (in_array($i, array(2, 4, 5))) {
$pdf->setXY(Misc::AdjustXY(151, $adjust_x), Misc::AdjustXY(28, $adjust_y));
}
$pdf->Cell(10, 7, date('y', $filter_data['transaction_end_date']), $border, 0, 'C', 1);
$pdf->SetFont('freeserif', '', 10);
}
}
}
//Finish off PDF
$output = $pdf->Output('', 'S');
if (Debug::getVerbosity() == 11) {
Debug::Display();
} else {
Misc::FileDownloadHeader('f1099misc.pdf', 'application/pdf', strlen($output));
echo $output;
}
exit;
}
} else {
echo TTi18n::gettext('No Employees Match Your Criteria!') . "br>\n";
}
break;
case 'delete':
case 'save':
Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10);
$generic_data['id'] = UserGenericDataFactory::reportFormDataHandler($action, $filter_data, $generic_data, URLBuilder::getURL(NULL, $_SERVER['SCRIPT_NAME']));
unset($generic_data['name']);
default:
BreadCrumb::setCrumb($title);