Common
[ class tree: Common ] [ index: Common ] [ all elements ]

Class: ResourceHandler

Source Location: /common/ResourceHandler.php

Class Overview


Class to manage resource accesses


Variables

Methods



Class Details

[line 30]
Class to manage resource accesses

It handles the registration of Url provider objects.




[ Top ]


Class Variables

$cartoclientBaseUrl =

[line 48]

The URL to the cartoclient base



Tags:

access:  private

Type:   string


[ Top ]

$cartoserverBaseUrl =

[line 54]

The URL to the cartoserver base.



Tags:

access:  private

Type:   string


[ Top ]

$directAccess =

[line 42]

True if the client is in direct access mode.



Tags:

access:  private

Type:   boolean


[ Top ]

$projectHandler =

[line 36]

The project handler to use for getting current project name



Tags:

access:  protected

Type:   ProjectHandler


[ Top ]



Class Methods


constructor __construct [line 62]

ResourceHandler __construct( Config $config, ProjectHandler $projectHandler)

Constructor



Tags:

access:  public


Parameters:

Config   $config   the current configuration object
ProjectHandler   $projectHandler   the current project handler.

[ Top ]

method convertXhtml [line 79]

string convertXhtml( string $url, [boolean $back = false])

Replaces some URL characters by XHTML-proof ones.



Tags:

return:  filtered URL
static:  
access:  public


Parameters:

string   $url   URL to filter
boolean   $back   if true reverts conversion: from XHTML to plain

[ Top ]

method getFinalUrl [line 102]

string getFinalUrl( string $relativeUrl, boolean $client, [boolean $forceAbsolute = false], [boolean $useXhtml = true])

Processes a relative URL to a resource, and convert it so that it is accessible on the client templates.

The relative url may be relative to the client or the server base Url. Whenever possible, the returned URL will be relative to the cartoclient. The relative URL is possible if the $forceAbsolute parameter is false and the resource is on the client or directAccess is enabled.




Tags:

return:  A relative URL to the resource if possible, or an absolute one
access:  public


Parameters:

string   $relativeUrl   The relative URL to a resource to convert
boolean   $client   True for resources on the client, false for server
boolean   $forceAbsolute   True to obtain an absolute URL in any case
boolean   $useXhtml   True to make URL XHTML-compliant

[ Top ]

method getGeneratedUrl [line 200]

string getGeneratedUrl( string $resource)

Returns an URL to access files inside the directory of generated files (like generated mapserver images, pdf files, ...) This can be used for server or client resources.



Tags:

access:  public


Parameters:

string   $resource   the resource to access (this is the resource name relative to the directory of generated files (www-data usually))

[ Top ]

method getHtdocsUrl [line 155]

string getHtdocsUrl( string $plugin, string $project, string $resource)

Returns the URL for resources in htdocs directory (may be in projects and plugins) This is only relevent for client resources.



Tags:

return:  The URL for resources in htdocs directory
access:  public


Parameters:

string   $plugin   the plugin name
string   $project   the project name
string   $resource   the resource to access. It may contain a path, like css/style.css, or gfx/my_icon.png

[ Top ]

method getIconUrl [line 186]

string getIconUrl( string $project, string $mapId, string $resource)

Returns an URL to access icon images inside icons subdirectory where the mapfile is located.

This is only relevent for server resources.




Tags:

access:  public


Parameters:

string   $project   the project name
string   $mapId   the mapId to use
string   $resource   the resource to access (icon name, without path)

[ Top ]

method getPathOrAbsoluteUrl [line 133]

string getPathOrAbsoluteUrl( string $relativeUrl, [boolean $client = false])

From a relative resource URL, returns either a path to the corresponding file on the file system, if accessible (only for client resources, or server in direct access mode). Otherwise, it will return the absolute URL to the resource.



Tags:

return:  The path to the resource file on the filesystem, if accessible, or the absolute URL to the resource
access:  public


Parameters:

string   $relativeUrl   The relative URL to a resource
boolean   $client   True for resources on the client, false for server

[ Top ]


Documentation generated on Fri, 21 Sep 2007 13:30:59 +0200 by phpDocumentor 1.3.0RC3