Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once(PATH_tslib.'class.tslib_pibase.php');
- class tx_btmp_pi1 extends tslib_pibase {
- var $prefixId = 'tx_btmp_pi1'; // Same as class name
- var $scriptRelPath = 'pi1/class.tx_btmp_pi1.php'; // Path to this script relative to the extension dir.
- var $extKey = 'bt_mp'; // The extension key.
- var $pi_checkCHash = true;
- function main($content,$conf) {
- $this->conf=$conf;
- $this->pi_setPiVarDefaults();
- $this->pi_loadLL();
- if (!empty($this->piVars['submit_pdf']))
- return $this->getPdf();
- return $this->renderForm();
- }
- function renderForm() {
- //Shows Form
- }
- function getPdf() {
- require(t3lib_extMgm::extPath('bt_mp') . 'pi1/config/tcpdf_config.php');
- require(t3lib_extMgm::extPath('tcpdf') . 'class.tx_tcpdf.php');
- require(t3lib_extMgm::extPath('bt_mp') . 'pi1/class.tx_btmp_pi1_pdf.php');
- $pdf = new btmp_pdf('P', 'mm', 'A4', true, 'UTF-8', false);
- $pdf->setPDFVersion('1.6');
- if ($image = $this->uploadImage()) {
- $pdf->setSourceFile(str_replace('EXT:bt_mp',
- t3lib_extMgm::extPath('bt_mp'),
- $this->conf['pdfTemplateWithoutDummyImage']));
- } else {
- $pdf->setSourceFile(str_replace('EXT:bt_mp',
- t3lib_extMgm::extPath('bt_mp'),
- $this->conf['pdfTemplate']));
- }
- $pdf->SetImageScale(3.53);
- $pdf->AddFont('bradley');
- $pdf->SetTextColor(35,130,192);
- $pdf->SetFont('bradley', 'b', 18);
- $pdf->AddPage();
- if ($image)
- $pdf->Image($image, 32, 160);
- $pdf->SetXY(22,215);
- $pdf->Write(20, $this->piVars['firstname'] . ' ' . $this->piVars['lastname']);
- $pdf->SetXY(22,236);
- $pdf->Write(20, $this->piVars['children']);
- $pdf->SetXY(113,232);
- $pdf->Write(20, date('d.m.Y'));
- return $pdf->Output('medienpass.pdf', 'D');
- }
- function fetchLLMarkers($subpart) {
- preg_match_all("/###(LL\w+)###/", $subpart, $matches);
- $markerArray = array();
- foreach ($matches[0] as $key => $value)
- $markerArray[$value] = $this->pi_getLL(strtolower($matches[1][$key]));
- return $markerArray;
- }
- function uploadImage() {
- $pathinfo = pathinfo($_FILES['tx_btmp_pi1']['name']['image']);
- $allowedExtensions = explode(',', $this->conf['allowedImageExtensions']);
- if (!empty($_FILES['tx_btmp_pi1']['name']['image']) &&
- $pathinfo &&
- in_array($pathinfo['extension'], $allowedExtensions)) {
- $destinationPath = PATH_site . 'uploads/tx_btmp/';
- $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
- $fileName = $fileFunc->getUniqueName($_FILES['tx_btmp_pi1']['name']['image'], $destinationPath);
- t3lib_div::upload_copy_move($_FILES['tx_btmp_pi1']['tmp_name']['image'], $fileName);
- $this->conf['pdfImage.']['file.']['10.']['file'] = 'uploads/tx_btmp/' . basename($fileName);
- return $this->cObj->IMG_RESOURCE($this->conf['pdfImage.']);
- } else {
- return false;
- }
- }
- }
- if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/bt_mp/pi1/class.tx_btmp_pi1.php']) {
- include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/bt_mp/pi1/class.tx_btmp_pi1.php']);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement