FrontendController Class Reference

Frontend base class (Frontend API). More...

Inheritance diagram for FrontendController:

AppController

List of all members.

Public Member Functions

 changeLang ($lang, $forward=null)
 change language
 handleError ($eventMsg, $userMsg, $errTrace)
 (non-PHPdoc)
 sitemapXml ()
 prepare an XML containing sitemap specification view in bedita-app/views/pages/sitemap_xml.tpl
 sitemap ($xml_out=false)
 build array for sitemap
 rss ($sectionName)
 Publish RSS feed with contents inside section $sectionName.
 json ($name)
 output a json object of returned array by section or content method
 xml ($name)
 output an xml of returned array by section or content method
 xmlobject ($name)
 output an xml of returned array by loadObj/loadObjByNick method
 content ($name)
 find first section that contain content ($name) then call section method
 section ($secName, $contentName=null)
 find section and contents from section nick or section id and set template vars
 route ()
 route to section, content or another method defined in reservedWords
 search ()
 subscribe ($what="newsletter")
 public subscribe page, used for newsletter/frontend subscribe/unsubscribe
 hashjob ($service_type=null, $hash=null)
 manage hash request like newsletter/frontend subscribe/unsubscribe
 loadTags ($tplVar=null, $cloud=true, $shuffle=false, $tagShowed=null)
 load all tag
 tag ($name)
 find all objects tagged by $name and set results for view
 download ($name)
 force download of media object
 captchaImage ()
 show image for captcha
 saveComment ()
 save comment relative to an object, set 'info' flash message throw Exception in case of error and set 'error' flash message
 printme ($id=null, $printLayout=null)
 show an object in print mode with specific layout and view CakePHP layout: print (if dosen't exists in frontend app use backend print layout) use print view if not set a specific $printLayout
 getStatus ()
 return class attribute $status

Static Public Member Functions

static handleExceptions (Exception $ex)
 handle Exceptions

Public Attributes

const UNLOGGED = "unlogged"
const UNAUTHORIZED = "unauthorized"

Protected Member Functions

 checkLogin ()
 login ($backName=null)
 show login form or redirect if user is already logged
 logout ($autoRedirect=true)
 checkIsLogged ()
 check if there's an active session and try to login if user not logged
  • if "authorizedGroups" array defined in frontend.ini.php, user has to be in one of those groups
  • if "staging" is defined only backend authorized groups are permitted
    • otherwise any group is accepted

 isLogged ()
 get private logged var
 initAttributes ()
 called before action to initialize $uses & $components array don't work.
 setupLocale ()
 override AppController.setupLocale.
 checkPubblicationDate (array $obj)
 check if current date is compatible with required pubblication dates (start/end date)
 loadSectionsTree ($parentName, $loadContents=false, array $exclude_nicknames=null, $depth=10000, $flatMode=false)
 Get tree starting from specified section or area.
 loadSectionsLevels ($secName, $loadContents=false, array $exclude_nicknames=null)
 Get sections levels.
 loadPublications ($tplVar=null)
 load all publications
 loadObjByNick ($obj_nick)
 Like loadObj using nickname.
 loadAndSetObjByNick ($obj_nick, $var_name=null)
 Like loadAndSetObj using nickname.
 loadAndSetObj ($obj_id, $var_name=null)
 Load bedita Object and set view var with $var_name or object type (e.g.
 loadObj ($obj_id, $blockAccess=true)
 Returns bedita Object Throws Exception on errors.
 loadAndSetSectionObjects ($parent_id, $options=array())
 Load objects in section $parent_id and set in view vars an array for each object type (e.g.
 loadAndSetSectionObjectsByNick ($parentNick, $options=array())
 Load objects in section $parentNick and set in view vars an array for each object type.
 loadSectionObjectsByNick ($parentNick, $options=array())
 Load objects in section $parentNick.
 loadSectionObjects ($parent_id, $options=array())
 Load objects in section $parent_id.
 setSectionPath (array &$section, $sectionId)
 getPath ($object_id)
 find parent path of $object_id (excluded publication)
 getParentsObject ($object_id)
 get array of parents that contain the object specified by $object_id
 loadArchiveTree ($secName, $options=array())
 build archive tree
 loadObjectsByTag ($tag, $options=array())
 return objects for a specific tag
 loadAnnotations ($annotationType, $objectName, $options=array())
 load annotation referenced to some object
 save ($modelName=null)
 save a BEdita object.
 delete ()
 delete a BEdita object.
 showDraft ()
 add "draft" status to class attribute $status

Protected Attributes

 $checkPubDate = true
 $baseLevel = false
 $sectionOptions = array("showAllContents" => true, "itemsByType" => false, "childrenParams" => array())
 $xmlFormat = "attributes"
 $publication = ""
 $captchaOptions = array()
 $annotationOptions = array("comment" => array())
 $tagOptions = array()
 $searchOptions = array("order" => "title", "dir" => 1, "dim" => 50, "page" => 1, "filter" => false)
 $loginRedirect = "/"
 $logoutRedirect = "/"
 $showUnauthorized = false


Detailed Description

Frontend base class (Frontend API).

Version:
Revision
2524
Modified By:
LastChangedBy
ste
Last Modified: $LastChangedDate
LastChangedDate
2009-12-22 12:42:25 +0100 (mar, 22 dic 2009)

Id
frontend_controller.php 2524 2009-12-22 11:42:25Z ste

Definition at line 36 of file frontend_controller.php.


Member Function Documentation

FrontendController.checkLogin (  )  [protected]

Reimplemented from AppController.

Definition at line 151 of file frontend_controller.php.

FrontendController.login ( backName = null  )  [protected]

show login form or redirect if user is already logged

Parameters:
$backName nickname or id of section to go after login

Definition at line 160 of file frontend_controller.php.

References isLogged().

FrontendController.checkIsLogged (  )  [protected]

check if there's an active session and try to login if user not logged

  • if "authorizedGroups" array defined in frontend.ini.php, user has to be in one of those groups
  • if "staging" is defined only backend authorized groups are permitted
    • otherwise any group is accepted

Returns:
boolean

Definition at line 184 of file frontend_controller.php.

References AppController.eventInfo(), and AppController.userErrorMessage().

Referenced by initAttributes().

FrontendController.isLogged (  )  [protected]

get private logged var

Returns:
boolean

Definition at line 222 of file frontend_controller.php.

Referenced by login().

FrontendController.initAttributes (  )  [final, protected]

called before action to initialize $uses & $components array don't work.

.. (abstract class ??)

See also:
bedita-app/AppControllerinitAttributes()

Reimplemented from AppController.

Definition at line 232 of file frontend_controller.php.

References AppController.beditaBeforeFilter(), checkIsLogged(), loadObj(), and setupLocale().

FrontendController.setupLocale (  )  [protected]

override AppController.setupLocale.

Used setup specific locale

See also:
bedita-app/AppControllersetupLocale()

Reimplemented from AppController.

Definition at line 304 of file frontend_controller.php.

Referenced by initAttributes().

FrontendController.changeLang ( lang,
forward = null 
)

change language

Parameters:
string $lang
string $forward redirect action after changing language. If it's null redirect to refere
Returns:
unknown_type

Definition at line 352 of file frontend_controller.php.

FrontendController.checkPubblicationDate ( array $  obj  )  [protected]

check if current date is compatible with required pubblication dates (start/end date)

Parameters:
array $obj
Returns:
true if content may be published, false otherwise

Definition at line 390 of file frontend_controller.php.

Referenced by loadObj().

static FrontendController.handleExceptions ( Exception $  ex  )  [static]

handle Exceptions

Parameters:
Exception $ex
Returns:
unknown_type

Definition at line 409 of file frontend_controller.php.

FrontendController.handleError ( eventMsg,
userMsg,
errTrace 
)

(non-PHPdoc)

See also:
bedita-app/AppControllerhandleError()

Reimplemented from AppController.

Definition at line 445 of file frontend_controller.php.

FrontendController.loadSectionsTree ( parentName,
loadContents = false,
array $  exclude_nicknames = null,
depth = 10000,
flatMode = false 
) [protected]

Get tree starting from specified section or area.

Parameters:
integer $parentName parent nickname or id
bool $loadContents if it's true load all contents too. Default false
array $exclude_nicknames list exclude sections
integer $depth tree's depth level (default=10000 => all levels)

Definition at line 459 of file frontend_controller.php.

References getPath(), loadObj(), and loadSectionObjects().

Referenced by sitemap().

FrontendController.loadSectionsLevels ( secName,
loadContents = false,
array $  exclude_nicknames = null 
) [protected]

Get sections levels.

Find all ancestors from secName and build an array of levels Each key in array returned is a level: 0 is the first level 1 is the second level etc...

set selected = true in a section if it's an ancestor (parent) of $secName

Parameters:
$secName nickname or section id
bool $loadContents true meaning it loads all contents of each section
array $exclude_nicknames list exclude sections
Returns:
array of level selected

Definition at line 534 of file frontend_controller.php.

References loadObj(), and loadSectionObjects().

FrontendController.loadPublications ( tplVar = null  )  [protected]

load all publications

Parameters:
string $tplVar, var name for template. If not defined result will be set to "publicationsList" var

Definition at line 582 of file frontend_controller.php.

References loadObj().

FrontendController.sitemapXml (  ) 

prepare an XML containing sitemap specification view in bedita-app/views/pages/sitemap_xml.tpl

Definition at line 602 of file frontend_controller.php.

References sitemap().

FrontendController.sitemap ( xml_out = false  ) 

build array for sitemap

Parameters:
bool $xml_out
Returns:
array

Definition at line 615 of file frontend_controller.php.

References loadSectionObjects(), and loadSectionsTree().

Referenced by sitemapXml().

FrontendController.rss ( sectionName  ) 

Publish RSS feed with contents inside section $sectionName.

Parameters:
string $sectionName, section's nickname

Definition at line 692 of file frontend_controller.php.

References loadObj(), and loadObjByNick().

FrontendController.json ( name  ) 

output a json object of returned array by section or content method

Parameters:
$name 
Returns:
unknown_type $name, nickname or id

Definition at line 731 of file frontend_controller.php.

References route().

FrontendController.xml ( name  ) 

output an xml of returned array by section or content method

passing a "format" named parameters in the url obtain an xml "attributes" format or an xml "tags" format i.e. http://www.example.com/xml/nickname/format:tags output a tag style xml default is defined by class attribute xmlFormat

Parameters:
unknown_type $name, nickname or id

Definition at line 749 of file frontend_controller.php.

References route().

FrontendController.xmlobject ( name  ) 

output an xml of returned array by loadObj/loadObjByNick method

passing a "format" named parameters in the url obtain an xml "attributes" format or an xml "tags" format i.e. http://www.example.com/xmlobject/nickname/format:tags output a tag style xml default is defined by class attribute xmlFormat

Parameters:
string $name, nickname or id

Definition at line 763 of file frontend_controller.php.

References loadObj(), and loadObjByNick().

FrontendController.loadObjByNick ( obj_nick  )  [protected]

Like loadObj using nickname.

Parameters:
string $obj_nick
Returns:
array

Definition at line 799 of file frontend_controller.php.

References loadObj().

Referenced by rss(), and xmlobject().

FrontendController.loadAndSetObjByNick ( obj_nick,
var_name = null 
) [protected]

Like loadAndSetObj using nickname.

Parameters:
string $obj_nick
Returns:
array

Definition at line 809 of file frontend_controller.php.

References loadAndSetObj().

FrontendController.loadAndSetObj ( obj_id,
var_name = null 
) [protected]

Load bedita Object and set view var with $var_name or object type (e.g.

"Document", "Event"..) Returns object loaded Throws Exception on errors

Parameters:
int $obj_id
string $var_name
Returns:
array

Definition at line 822 of file frontend_controller.php.

References loadObj().

Referenced by loadAndSetObjByNick(), and route().

FrontendController.loadObj ( obj_id,
blockAccess = true 
) [protected]

Returns bedita Object Throws Exception on errors.

Parameters:
int $obj_id
bool $blockAccess true => if user is unlogged return UNLOGGED constant if user hasn't permission to access at the object return UNAUTHORIZED constant (used when load main object like in section method) false => if user unlogged dosen't block the action if user unauthorized to access at the object and $this->showUnauthorized=true load object detail setting "authorized" => false in object array (used when load objects list like in loadSectionObjects method)
Returns:
array object detail

Definition at line 842 of file frontend_controller.php.

References checkPubblicationDate(), AppController.objectRelationArray(), and AppController.setupAnnotations().

Referenced by initAttributes(), loadAndSetObj(), loadObjByNick(), loadPublications(), loadSectionObjects(), loadSectionsLevels(), loadSectionsTree(), rss(), section(), and xmlobject().

FrontendController.loadAndSetSectionObjects ( parent_id,
options = array() 
) [protected]

Load objects in section $parent_id and set in view vars an array for each object type (e.g.

in view you will have $Document => array(0 => ..., 1 => ...) $Event" => array(0 => ..., 1 => ...) )

Parameters:
int $parent_id
array $options, filter and pagination options

Definition at line 929 of file frontend_controller.php.

References loadSectionObjects().

FrontendController.loadAndSetSectionObjectsByNick ( parentNick,
options = array() 
) [protected]

Load objects in section $parentNick and set in view vars an array for each object type.

Parameters:
string $parentNick
array $options, filter and pagination options

Definition at line 942 of file frontend_controller.php.

References loadSectionObjectsByNick().

FrontendController.loadSectionObjectsByNick ( parentNick,
options = array() 
) [protected]

Load objects in section $parentNick.

Parameters:
string $parentNick
array $options, filter and pagination options
Returns:
array

Definition at line 957 of file frontend_controller.php.

References loadSectionObjects().

Referenced by loadAndSetSectionObjectsByNick().

FrontendController.loadSectionObjects ( parent_id,
options = array() 
) [protected]

Load objects in section $parent_id.

Parameters:
int $parent_id
array $options, filter and pagination options
Returns:
array

Definition at line 969 of file frontend_controller.php.

References loadObj().

Referenced by loadAndSetSectionObjects(), loadSectionObjectsByNick(), loadSectionsLevels(), loadSectionsTree(), section(), and sitemap().

FrontendController.content ( name  ) 

find first section that contain content ($name) then call section method

Parameters:
$name,id or content nickname

Definition at line 1028 of file frontend_controller.php.

References section().

Referenced by route().

FrontendController.section ( secName,
contentName = null 
)

find section and contents from section nick or section id and set template vars

Set section and: if $contentName=null set all contents in section if $contentName is defined set single content if $contentName is defined and $this->showAllContents=true set content and other contents too (default)

Execute 'sectionNickname'BeforeFilter and/or 'sectionNickName'BeforeRender if they're set in the controller (i.e. pages_controller.php)

Parameters:
string/int $secName: section nick or section id
string/int $contentName: content nick or content id

Definition at line 1061 of file frontend_controller.php.

References loadObj(), and loadSectionObjects().

Referenced by content().

FrontendController.route (  ) 

route to section, content or another method defined in reservedWords

Definition at line 1167 of file frontend_controller.php.

References content(), and loadAndSetObj().

Referenced by json(), and xml().

FrontendController.subscribe ( what = "newsletter"  ) 

public subscribe page, used for newsletter/frontend subscribe/unsubscribe

Parameters:
string $what
Returns:
unknown_type

Definition at line 1228 of file frontend_controller.php.

FrontendController.hashjob ( service_type = null,
hash = null 
)

manage hash request like newsletter/frontend subscribe/unsubscribe

Parameters:
string $service_type
string $hash
Returns:
unknown_type

Definition at line 1250 of file frontend_controller.php.

FrontendController.getPath ( object_id  )  [protected]

find parent path of $object_id (excluded publication)

Parameters:
int $object_id
Returns:
array (the keys are object's id)

Definition at line 1293 of file frontend_controller.php.

Referenced by loadSectionsTree().

FrontendController.getParentsObject ( object_id  )  [protected]

get array of parents that contain the object specified by $object_id

Parameters:
integer $object_id
Returns:
array

Definition at line 1321 of file frontend_controller.php.

FrontendController.loadArchiveTree ( secName,
options = array() 
) [protected]

build archive tree

Array( "Document" => Array( "2008" => Array( "01" => Array( 0 => document, 1 => document, ... "monthName" => month name "total" => number of document in january ), "02" => Array(...), .... "total" => numeber of document in 2008 ), "2007" => Array(...), "ShortNews" => .... )

Parameters:
unknown_type $secName section id or section nickname
Returns:
array

Definition at line 1354 of file frontend_controller.php.

FrontendController.loadTags ( tplVar = null,
cloud = true,
shuffle = false,
tagShowed = null 
)

load all tag

Parameters:
string $tplVar
bool $cloud, if true set 'class' key (possible value: smallestTag, largestTag, largeTag, mediumTag, smallTag)
bool $shuffle, if true shuffle the tags else order by label
int $tagShowed, define how much tags have to be returned (null = all tags)

Definition at line 1432 of file frontend_controller.php.

FrontendController.tag ( name  ) 

find all objects tagged by $name and set results for view

Parameters:
string $name

Definition at line 1450 of file frontend_controller.php.

FrontendController.loadObjectsByTag ( tag,
options = array() 
) [protected]

return objects for a specific tag

Parameters:
string $tag tag label array $options search options "section" => name or id section "filter" => particular filter "order", "dir", "dim", "page" used like pagination parameters
Returns:
array

Definition at line 1466 of file frontend_controller.php.

FrontendController.loadAnnotations ( annotationType,
objectName,
options = array() 
) [protected]

load annotation referenced to some object

Parameters:
string $annotationType, object type of the annotation e.g. "comment"
$objectName,reference object nickname or id
array $options, specific options (pagination, filter) that override annotationOptions attribute
Returns:
array of annotations

Definition at line 1531 of file frontend_controller.php.

FrontendController.download ( name  ) 

force download of media object

Parameters:
$name id or object nickname

Definition at line 1562 of file frontend_controller.php.

FrontendController.captchaImage (  ) 

show image for captcha

Definition at line 1629 of file frontend_controller.php.

FrontendController.saveComment (  ) 

save comment relative to an object, set 'info' flash message throw Exception in case of error and set 'error' flash message

If it's ajax request and if not empty $this->params["form"]["render"] renders it

elseif it's not ajax request then redirect to referer

Definition at line 1648 of file frontend_controller.php.

FrontendController.printme ( id = null,
printLayout = null 
)

show an object in print mode with specific layout and view CakePHP layout: print (if dosen't exists in frontend app use backend print layout) use print view if not set a specific $printLayout

Parameters:
$id 
$printLayout,the view template to use

Definition at line 1739 of file frontend_controller.php.

FrontendController.save ( modelName = null  )  [protected]

save a BEdita object.

User has to be logged

Parameters:
$modelName (Document, Event, ....). If undefined get object type from $this->data["object_type_id"]
Returns:
false on error, object_id saved on success

Definition at line 1761 of file frontend_controller.php.

FrontendController.delete (  )  [protected]

delete a BEdita object.

User has to be logged

Returns:
boolean

Definition at line 1788 of file frontend_controller.php.

FrontendController.getStatus (  ) 

return class attribute $status

Returns:
array

Definition at line 1864 of file frontend_controller.php.


The documentation for this class was generated from the following file:

Generated on Tue Jan 12 15:45:36 2010  BEditaBEdita 3.0.1 betula