/** * shows the details of the entry as pdf * * @return string pdf-string */ private function topdf() { // check cid and pid given if ($this->get('cid') !== false && $this->get('pid') !== false) { // check cid and pid exists if (Calendar::check_id($this->get('cid')) && Preset::check_preset($this->get('pid'), 'calendar')) { // check if announcement has values if (Calendar::check_ann_value($this->get('cid'))) { // prepare return $return = ''; // get preset $preset = new Preset($this->get('pid'), 'calendar', $this->get('cid')); // smarty $sA = new JudoIntranetSmarty(); // get calendar $calendar = new Calendar($this->get('cid')); // prepare marker-array $announcement = array('version' => date('dmy')); // add calendar-fields to array $calendar->add_marks($announcement); // add field-names and -values to array $preset->add_marks($announcement); // smarty $sA->assign('a', $announcement); // check marks in values foreach ($announcement as $k => $v) { if (preg_match('/\\{\\$a\\..*\\}/U', $v)) { $announcement[$k] = $sA->fetch('string:' . $v); } } // smarty $sA->assign('a', $announcement); $pdf_out = $sA->fetch($preset->get_path()); // get HTML2PDF-object $pdf = new HTML2PDF('P', 'A4', 'de', true, 'UTF-8', array(0, 0, 0, 0)); // convert $pdf->writeHTML($pdf_out, false); // output $pdf_filename = $this->replace_umlaute(html_entity_decode($sA->fetch('string:' . $preset->get_filename()), ENT_XHTML, 'ISO-8859-1')); $pdf->Output($pdf_filename, 'D'); // return return $return; } else { // error $errno = $GLOBALS['Error']->error_raised('AnnNotExists', 'entry:' . $this->get('cid') . '|' . $this->get('pid'), $this->get('cid') . '|' . $this->get('pid')); $GLOBALS['Error']->handle_error($errno); return $GLOBALS['Error']->to_html($errno); } } else { // error $errno = $GLOBALS['Error']->error_raised('WrongParams', 'entry:cid_or_pid', 'cid_or_pid'); $GLOBALS['Error']->handle_error($errno); return $GLOBALS['Error']->to_html($errno); } } else { // error $errno = $GLOBALS['Error']->error_raised('MissingParams', 'entry:cid_or_pid', 'cid_or_pid'); $GLOBALS['Error']->handle_error($errno); return $GLOBALS['Error']->to_html($errno); } }