Plugins

# Class: ClientExportPdf Source Location: /plugins/exportPdf/client/ClientExportPdf.php
### Class Overview
    PluginBase
       |
       --ClientPlugin
          |
          --ExportPlugin
             |
             --ClientExportPdf
Overall class for PDF generation management. | ### Variables $blocks $blockTemplate $charset $exportPdfState $format $general $isModeRotate $isPrintingPdf $legendIconHeight $legendIconWidth $log $mapScale $mapServerResolution $optionalInputs $smarty | ### Constants GUIMODE_CLASSIC GUIMODE_ROTATE OUTPUT_ATTACHMENT OUTPUT_INLINE OUTPUT_LINK OUTPUT_REDIRECTION TOOL_ROTATE | ### Methods addBlock createBlock createSession drawUserForm generatePdfFile getAllowedResolutions getArrayFromIni getArrayFromList getBlocks getConfiguration getCornerCoords getExport getExportMode getFilename getFormat getFormField getGeneral getGfxPath getLastBbox getLastScale getNewMapDim getOverviewShape getPdfFileUrl getQueryResult getSelectedValue getTools handleApplicationTool handleHttpGetRequest handleHttpPostRequest handleInit handleKeymapTool handleMainmapTool isModeRotate isPrintingPdf loadSession output __construct overrideProperties renderForm saveSession setAllowedFormats setFormat setGeneral setLegendBlock setMainMapDim setPdfObjects setTableBlock setTypeHeader sortBlocksBy updateMapBlock
### Inherited Constants #### Class: ClientPlugin ClientPlugin::ENABLE_LEVEL_FULL ClientPlugin::ENABLE_LEVEL_LOAD ClientPlugin::ENABLE_LEVEL_PROCESS ClientPlugin::ENABLE_LEVEL_SERVERCALL | ### Inherited Variables #### Class: ClientPlugin ClientPlugin::$cartoclient ClientPlugin::$config ClientPlugin::$enabledLevel #### Class: PluginBase PluginBase::$basePath PluginBase::$name PluginBase::$overriddenRequest | ### Inherited Methods #### Class: ExportPlugin ExportPlugin::getExport() Renders export ExportPlugin::getExportResult() Retrieves MapResult ExportPlugin::getExportUrl() Returns base export plugin URL. ExportPlugin::getLastMapRequest() Returns session-saved last MapRequest. ExportPlugin::getLastMapResult() Returns session-saved last MapResult. ExportPlugin::output() Outputs exported content. #### Class: ClientPlugin ClientPlugin::__construct() Constructor ClientPlugin::checkBool() Checks if variable $variable has a boolean (0 or 1) value $value. ClientPlugin::checkInt() Checks if variable $variable has an integer positive or zero value $value. ClientPlugin::checkNumeric() Checks if variable $variable has a numeric value $value. ClientPlugin::disable() Sets the enable level to ClientPlugin::ENABLE_LEVEL_SERVERCALL. ClientPlugin::enable() Sets the enable level to ClientPlugin::ENABLE_LEVEL_FULL. ClientPlugin::getCartoclient() ClientPlugin::getConfig() ClientPlugin::getEnabledLevel() Returns the enable level. ClientPlugin::getHttpValue() Returns the user-submitted $key data if it is set. ClientPlugin::initializeConfig() Initializes plugin configuration ClientPlugin::isEnabledAtLevel() Sets the enable level to ClientPlugin::ENABLE_LEVEL_FULL. ClientPlugin::setEnableLevel() Sets the enable level (to be used with the AJAX mode). #### Class: PluginBase PluginBase::__construct() Constructor PluginBase::account() Records an accounting message for plugins PluginBase::getBasePath() PluginBase::getExtendedName() PluginBase::getName() PluginBase::getRequest() Get plugin's request or result out of MapRequest or MapResult PluginBase::initialize() Plugin initialization (can be extended in custom plugins) PluginBase::initializeConfig() Initializes plugin PluginBase::preInitialize() Plugin pre initialization. In most cases, plugins should use PluginBase::replacePlugin() Returns name of parent plugin in case of plugin extension PluginBase::setBasePath() PluginBase::setExtendedName() PluginBase::setName()
### Class Details [line 44] Overall class for PDF generation management. [ Top ] ### Class Variables #### $blocks = array() [line 75] #### Tags:
access: | protected
Type: | array
[ Top ] #### $blockTemplate = [line 70] #### Tags:
access: | protected
Type: | PdfBlock
[ Top ] #### $charset = [line 107] #### Tags:
access: | protected
Type: | string
[ Top ] #### $exportPdfState = [line 117] #### Tags:
access: | protected
Type: | ExportPdfState
[ Top ] #### $format = [line 65] #### Tags:
access: | protected
Type: | PdfFormat
[ Top ] #### $general = [line 60] #### Tags:
access: | protected
Type: | PdfGeneral
[ Top ] #### $isModeRotate = [line 122] #### Tags:
access: | protected
Type: | boolean
[ Top ] #### $isPrintingPdf = [line 112] #### Tags:
access: | protected
Type: | boolean
[ Top ] #### $legendIconHeight = [line 102] #### Tags:
access: | protected
Type: | int
[ Top ] #### $legendIconWidth = [line 97] #### Tags:
access: | protected
Type: | int
[ Top ] #### $log = [line 50] #### Tags:
access: | private
Type: | Logger
Overrides: | Array
[ Top ] #### $mapScale = [line 87] #### Tags:
access: | protected
Type: | float
[ Top ] #### $mapServerResolution = [line 92] #### Tags:
access: | protected
Type: | int
[ Top ] #### $optionalInputs = array('title', 'note', 'scalebar', 'overview', 'queryResult', 'legend') [line 80] #### Tags:
access: | protected
Type: | array
[ Top ] #### $smarty = [line 55] #### Tags:
access: | protected
Type: | Smarty_Plugin
[ Top ] ### Class Methods ### method addBlock [line 1324]
`void addBlock( PdfWriter $pdf, PdfBlock $block)`
Draws given block. #### Tags:
access: | protected
#### Parameters:
PdfWriter | $pdf |
PdfBlock | $block |
[ Top ] ### method createBlock [line 459]
`void createBlock( array $request, stdClass $iniObjects, string $id)`
Instanciates a PdfBlock object. #### Tags:
access: | protected
#### Parameters:
array | $request |
stdClass | $iniObjects | INI object
string | $id | object id
[ Top ] ### method createSession [line 1579]
`void createSession( MapInfo $mapInfo, InitialMapState $initialMapState)`
#### Tags:
access: | public
see: | Sessionable::createSession()
[ Top ] ### method drawUserForm [line 810]
`string drawUserForm( )`
Builds PDF settings user interface. #### Tags:
return: | Smarty fetch result
access: | protected
[ Top ] ### method generatePdfFile [line 1489]
`string generatePdfFile( string $pdfBuffer)`
Writes PDF file on disk. #### Tags:
return: | filename
access: | protected
#### Parameters:
string | $pdfBuffer | PDF content
[ Top ] ### method getAllowedResolutions [line 557]
`array getAllowedResolutions( )`
Returns for each allowed format, the list of its allowed resolutions. Warning: perform allowed formats filtering first! #### Tags:
return: | array(<format> => array(<list of resolutions>))
access: | protected
[ Top ] ### method getArrayFromIni [line 258]
`array getArrayFromIni( string $name, [boolean $simple = false])`
Returns an array from a comma-separated list of a ini parameter. #### Tags:
access: | protected
#### Parameters:
string | $name | name of ini parameter
boolean | $simple | (default: false) true: returns a simplified array
[ Top ] ### method getArrayFromList [line 241]
`array getArrayFromList( array $list, [boolean $simple = false])`
Returns an array from a comma-separated list string. #### Tags:
access: | protected
#### Parameters:
array | $list |
boolean | $simple | (default: false) true: returns a simplified array
[ Top ] ### method getBlocks [line 170]
`array getBlocks( )`
#### Tags:
return: | array of activated PdfBlocks
access: | public
[ Top ] ### method getConfiguration [line 1062]
`ExportConfiguration getConfiguration( [string $keymap = 'none'], [Bbox $mapBbox = NULL])`
Builds export configuration. #### Tags:
access: | protected
#### Parameters:
string | $keymap | keymap/overview type
Bbox | $mapBbox | if set, indicates mainmap extent to outline in overview map
[ Top ] ### method getCornerCoords [line 1293]
`string getCornerCoords( PdfBlock $block, MapResult $mapResult)`
Returns (x,y) coords of given map corner using given format. #### Tags:
access: | protected
#### Parameters:
PdfBlock | $block |
[ Top ] ### method getExport [line 1353]
`ExportOutput getExport( )`
#### Tags:
return: | export result
access: | protected
see: | ExportPlugin::getExport()
Overrides ExportPlugin::getExport() (Renders export) [ Top ] ### method getExportMode [line 670]
`string getExportMode( )`
Determines what export mode matches current plugin. #### Tags:
access: | protected
[ Top ] ### method getFilename [line 227]
`string getFilename( )`
Returns PDF file name. #### Tags:
access: | protected
[ Top ] ### method getFormat [line 163]
`PdfFormat getFormat( )`
Returns formats object. #### Tags:
access: | public
[ Top ] ### method getFormField [line 904]
`string getFormField( string $fieldName, [string $default = false], [boolean $isblock = false])`
Gets value of given field from session or else from config. #### Tags:
access: | protected
#### Parameters:
string | $fieldName | fieldname
string | $default | name of default container
boolean | $isblock | if true, field is a block
[ Top ] ### method getGeneral [line 155]
`PdfGeneral getGeneral( )`
Returns general data object. #### Tags:
access: | public
[ Top ] ### method getGfxPath [line 1173]
`string getGfxPath( string $gfx)`
Returns the absolute URL of $gfx, using the ResourceHandler #### Tags:
access: | protected
#### Parameters:
string | $gfx |
[ Top ] ### method getLastBbox [line 944]
`Bbox getLastBbox( )`
#### Tags:
return: | bbox from last session-saved MapResult.
access: | protected
[ Top ] ### method getLastScale [line 956]
`float getLastScale( )`
#### Tags:
return: | scale from last session-saved MapResult.
access: | protected
[ Top ] ### method getNewMapDim [line 933]
`int getNewMapDim( float $dist)`
Returns given distance at selected printing resolution. #### Tags:
return: | distance in pixels
access: | protected
#### Parameters:
float | $dist | distance in PdfGeneral dist_unit
[ Top ] ### method getOverviewShape [line 974]
`StyledShape getOverviewShape( Bbox $mapBbox)`
Returns shape (a rectangle or a rotated rectangle) that will be drawn on overview. #### Tags:
access: | protected
#### Parameters:
Bbox | $mapBbox |
[ Top ] ### method getPdfFileUrl [line 1507]
`string getPdfFileUrl( string $filename, [boolean $filter = false])`
Returns generated PDF file URL. #### Tags:
return: | URL
access: | protected
#### Parameters:
string | $filename | filename
boolean | $filter | if true, remove special chars from URL
[ Top ] ### method getQueryResult [line 1242]
`array getQueryResult( )`
Transforms results from TableGroups into TableElements #### Tags:
return: | array of TableElement
access: | protected
[ Top ] ### method getSelectedValue [line 283]
`string getSelectedValue( string $name, array $choices, mixed $request, array $_REQUEST)`
Returns value from $_REQUEST or else from default configuration. #### Tags:
access: | protected
#### Parameters:
array | $_REQUEST |
string | $name | name of parameter
array | $choices | available values
[ Top ] ### method getTools [line 214]
`array getTools( )`
Returns PDF rotate tool. #### Tags:
return: | array of ToolDescription
access: | public
[ Top ] ### method handleApplicationTool [line 206]
`void handleApplicationTool( ToolDescription $tool)`
#### Tags:
access: | public
see: | ToolProvider::handleApplicationTool()
[ Top ] ### method handleHttpGetRequest [line 764]
`void handleHttpGetRequest( mixed $request)`
#### Tags:
access: | public
see: | GuiProvider::handleHttpGetRequest()
[ Top ] ### method handleHttpPostRequest [line 730]
`void handleHttpPostRequest( mixed $request, array $_REQUEST)`
Sets PDF settings objects based on $_REQUEST and configuration data. #### Tags:
access: | public
see: | GuiProvider::handleHttpPostRequest()
#### Parameters:
array | $_REQUEST |
[ Top ] ### method handleInit [line 177]
`void handleInit( mixed $exportPdfInit)`
#### Tags:
access: | public
see: | InitUser::handleInit()
[ Top ] ### method handleKeymapTool [line 198]
`void handleKeymapTool( ToolDescription $tool, Shape $keymapShape)`
#### Tags:
access: | public
see: | ToolProvider::handleKeymapTool()
[ Top ] ### method handleMainmapTool [line 190]
`void handleMainmapTool( ToolDescription $tool, Shape $mainmapShape)`
#### Tags:
access: | public
see: | ToolProvider::handleMainmapTool()
[ Top ] ### method isModeRotate [line 785]
`boolean isModeRotate( )`
Tells if GUI-mode is rotate. #### Tags:
access: | protected
[ Top ] ### method isPrintingPdf [line 682]
`boolean isPrintingPdf( array $request)`
Indicates if PDF printing is currently in progress. #### Tags:
access: | protected
#### Parameters:
array | $request |
[ Top ] ### method loadSession [line 1572]
`void loadSession( mixed $sessionObject)`
#### Tags:
access: | public
see: | Sessionable::loadSession()
[ Top ] ### method output [line 1529]
`void output( )`
#### Tags:
access: | public
see: | ExportPlugin::output()
Overrides ExportPlugin::output() (Outputs exported content.) [ Top ] ### constructor __construct [line 146]
`ClientExportPdf __construct( )`
Constructor #### Tags:
access: | public
Overrides ClientPlugin::__construct() (Constructor) [ Top ] ### method overrideProperties [line 270]
`void overrideProperties( object object $target, object object $from)`
Updates $target properties with values from $from ones. #### Tags:
access: | protected
#### Parameters:
object object | $target | to override
object object | $from | to copy
[ Top ] ### method renderForm [line 799]
`void renderForm( Smarty $template)`
#### Tags:
access: | public
see: | GuiProvider::renderForm()
#### Parameters:
Smarty | $template |
[ Top ] ### method saveSession [line 1586]
`void saveSession( )`
#### Tags:
access: | public
see: | Sessionable::saveSession()
[ Top ] ### method setAllowedFormats [line 535]
`void setAllowedFormats( boolean $simple)`
Updates available formats list considering allowed roles info. #### Tags:
access: | protected
#### Parameters:
boolean | $simple | if false, use general::formats keys as format ids
[ Top ] ### method setFormat [line 634]
`void setFormat( stdclass $iniObjects)`
Populates PdfFormat object with selected format info. #### Tags:
access: | protected
#### Parameters:
stdclass | $iniObjects | objects from INI file
[ Top ] ### method setGeneral [line 582]
`void setGeneral( stdclass $iniObjects, [array $request = array()])`
Populates PdfGeneral object. #### Tags:
access: | protected
#### Parameters:
stdclass | $iniObjects | objects from INI file
array | $request | user configs (usually $_REQUEST)
[ Top ] ### method setLegendBlock [line 402]
`void setLegendBlock( array $request, string $id)`
Sets a legend block. #### Tags:
access: | protected
#### Parameters:
array | $request |
string | $id | object id
[ Top ] ### method setMainMapDim [line 1222]
`void setMainMapDim( PdfWriter $pdf)`
Sets mainmap dimensions according to selected format and orientation. #### Tags:
access: | protected
#### Parameters:
PdfWriter | $pdf |
[ Top ] ### method setPdfObjects [line 695]
`void setPdfObjects( [array $request = array()])`
Sets PdfGeneral, PdfFormat and PdfBlock objects from config and from request data if any. #### Tags:
access: | protected
#### Parameters:
array | $request | request data
[ Top ] ### method setTableBlock [line 337]
`void setTableBlock( array $request, stdClass $iniObjects, string $id)`
Sets a table block. #### Tags:
access: | protected
#### Parameters:
array | $request |
stdClass | $iniObjects | INI object
string | $id | object id
[ Top ] ### method setTypeHeader [line 1522]
`void setTypeHeader( )`
Set type (PDF) and charset header. #### Tags:
access: | protected
[ Top ] ### method sortBlocksBy [line 306]
`void sortBlocksBy( string $property)`
Sorts blocks using $property criterium (in ASC order). #### Tags:
access: | protected
#### Parameters:
string | $property | name of property used to sort blocks
[ Top ] ### method updateMapBlock [line 1187]
`void updateMapBlock( MapResult $mapObj, string $name, [string $msName = ''])`
Updates Mapserver-generated maps PdfBlocks with data returned by CartoServer. #### Tags:
access: | protected
#### Parameters:
MapResult | $mapObj |
string | $name | name of PdfBlock to update
string | $msName | name of MapResult property
[ Top ] ### Class Constants #### GUIMODE_CLASSIC = 'classic' [line 127] GUI mode constants [ Top ] #### GUIMODE_ROTATE = 'rotate' [line 128] [ Top ] #### OUTPUT_ATTACHMENT = 'attachment' [line 139] [ Top ] #### OUTPUT_INLINE = 'inline' [line 138] Output constants [ Top ] #### OUTPUT_LINK = 'link' [line 140] [ Top ] #### OUTPUT_REDIRECTION = 'redirection' [line 141] [ Top ] #### TOOL_ROTATE = 'pdfrotate' [line 133] Tool constant [ Top ] Documentation generated on Fri, 21 Sep 2007 13:30:36 +0200 by phpDocumentor 1.3.0RC3