[Cartoweb-users] additional Text in pdfExport
Oliver Christen
oliver.christen at camptocamp.com
Mon Mar 3 08:16:20 EST 2008
Hi Christoph
if the query is statical, you can add a content block and specify the sql
directly in the configuration file:
http://www.cartoweb.org/doc_head/docbook/xhtml/user.pdf.html#user.pdf.tutorial.block.text
blocks.myText.content = "db~pgsql://user:password@localhost/dbname~select
name,
phone_number from phone_book where area_id =
12"then simply "activate" the "myText" block in the main
general.activatedBlocks parameter (usualy at the top of exportPdf.ini)
and position/style the block like any other block
but if the query is dynamic (change depending of the area or other factor)
you will need to extend the ClientExportPdf class to add a new block
handling.
see for example in function getExport(), the lines:
if (isset($this->blocks['currentuser'])) {
$sm = SecurityManager::getInstance();
$user = $sm->getUser();
$this->blocks['currentuser']->content = $user;
}
which display the current user name.
so you would need to add something like this :
if (isset($this->blocks['myText'])) {
$this->blocks['myText']->content = $getMyTextContent();
}
and
function getMyTextContent() {
// either make the sql query here or call a existing plugin to get the
content
$content = ...
return $content;
}
regards
> Hi List
>
> I'm looking for a way to print an additional text on the pdf, created by
> the pdfExport plugin (pdf rotate mode).
>
> The text is not entered by the client. It is the commune, returned by a
> sql query, in the center of the pdf map. I guess I can do that in the
> ClientExportPdf.php file. What I don't know at the moment is how to pass
> the new text/variable from ClientExportPdf.php to the exportPdf.ini. Is
> this done in the getConfiguration method?
>
> Thanks for your help.
>
> Christoph Lauber
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
More information about the Cartoweb-users
mailing list