I’m working on a plugin to add a link to download an acceptance letter for the author in PDF.
The plugin get the data of the article (Author/s, title, date of acceptance), and with that, create an url that passes the data to a php program to create the PDF file.
However, the HTML template I am using does not appear.
From base, I used the generic plugin RecommendedByAuthor; but I did not make it appear.
Recently, I did a test with a modified copy of the DevelopedBy block plugin as showed here: https://pkp.sfu.ca/wiki/index.php?title=Writing_a_Block_Plugin
and the HTML template did not appear either.
The register function
function register($category, $path){
$success = parent::register($category, $path);
if(!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) return $success;
if($success && $this->getEnabled()){
HookRegistry::register('Templates::Article::Footer::PageFooter', array($this, 'callbackTemplateArticlePageFooter'));
}
return $success;
}
The getTemplatePath function
function getTemplatePath($inCore = false){
return parent::getTemplatePath($inCore) . 'templates/';
}
The article callbackTemplateArticlePageFooter function
function callbackTemplateArticlePageFooter($hookName, $params){
$smarty =& $params[1];
$output =& $params[2];
$displayedArticle = $smarty->get_template_vars('article');
// Get Values to use in the Letter
$authors = $displayedArticle->getAuthors();
$titulo = $displayedArticle->getTitle();
$status = $displayedArticle->getStatus();
$fechaSubmit = $displayedArticle->getDateSubmited();
$fechaMod = $displayedArticle->getDateStatusModified();
$nombres = [];
foreach ($authors as $author) {
$nombres[] = $author->getFullName();
}
$resultado = array(
'titulo'=>$title,
'autores'=>$nombres,
'fechaSubmit' => $fechaSubmit,
'fechaAceptada' => $fechaMod,
'status'=>$status
);
// Visualizar
$query = base64_decode( json_encode( $resultado ) );
$url = "crearCarta.php?data=" . $query;
$smarty->assign('query', $url);
$output .= $smarty->fetch($this->getTemplatePath() . 'articleFooter.tpl');
}
By last the template: articleFooter.tpl
<div id="cartaPDF">
<h3>{translate key="plugins.generic.carta.header"}</h3>
<ul>
<li>
<a href="{$query}" target='_blank' class='pkp_button_primary'> Ver Carta de Aceptación </a>
</li>
</ul>
</div>