function getDisplayName() { global $default; // The generation of the pdf is done through the PDF Converter plugin. // The PDF's are generated in the background by the document processor if (!empty($this->oDocument)) { $iDocId = $this->oDocument->iId; // Build the display name and url $sDisplayName = _kt('Generate PDF'); $sHostPath = KTUtil::kt_url(); $icon = "<img src='{$sHostPath}/resources/mimetypes/pdf.gif' alt='PDF' border=0 />"; $link = KTUtil::ktLink('action.php', 'ktstandard.pdf.generate', array('fDocumentId' => $this->oDocument->getId(), 'action' => 'pdfdownload')); $sDisplayLink = " <a href=\"{$link}\">{$icon}</a>"; // First check if the pdf has already been generated $dir = $default->pdfDirectory; $file = $dir . '/' . $iDocId . '.pdf'; if (file_exists($file)) { // Display the download link return $sDisplayName . $sDisplayLink; } // If the file does not exist, check if the document has the correct mimetype $converter = new pdfConverter(); $mimeTypes = $converter->getSupportedMimeTypes(); $docType = $this->getMimeExtension(); if ($mimeTypes === true || in_array($docType, $mimeTypes)) { // Display the download link return $sDisplayName . $sDisplayLink; } } else { // If the document is empty then we are probably in the workflow admin - action restrictions section, so we can display the name. return $sDisplayName; } return ''; /* //$cmdpath = KTUtil::findCommand('externalBinary/python'); // Check if openoffice and python are available if($cmdpath != false && file_exists($cmdpath) && !empty($cmdpath)) { $sDocType = $this->getMimeExtension(); // make sure that the selected document is of an acceptable extension foreach($this->aAcceptedMimeTypes as $acceptType){ if($acceptType == $sDocType){ // build server path $sHostPath = KTUtil::kt_url(); // create image $icon = "<img src='{$sHostPath}/resources/mimetypes/pdf.gif' alt='PDF' border=0 />"; $link = KTUtil::ktLink('action.php', 'ktstandard.pdf.generate', array( 'fDocumentId' => $this->oDocument->getId(), 'action' => 'pdfdownload')); return _kt('Generate PDF') . " <a href=\"{$link}\">{$icon}</a>"; } } // If the document is empty then we are probably in the workflow admin - action restrictions section, so we can display the name. if(empty($this->oDocument)){ return _kt('Generate PDF'); } } return ''; */ }