<<

NAME

pf::web::custom - custom code to override pf::web's behavior

DESCRIPTION

pf::web::custom allows you to redefine subs in pf::web. It will never be overwritten when upgrading PacketFence.

WARNING

What we are doing here is a little bit tricky: We are redefining subs in pf::web.

To do so, we are messing with typeglobs installing anonymous subs in the pf::web namespace replacing earlier implementations.

SUBROUTINES

categorization sample

WARNING: The technique described below is for demonstration purposes only. Node categorization is better performed by the authentication modules under conf/authentication now. See pf::web::auth for more information.

Here if a particular session variable was set, we categorize the node as a guest and we set it's expiration to now + $GUEST_SESSION_DURATION. Then the normal registration code is called.

To set the particular session variable use the following: $session->param("usercategory", "guest");

inject variables for templates

Here's an example to make variables accessible to the templates globally.

Also remember that you can always use the $portalSession->stash to add variables from every location in the code (CGI's, pf::web, etc.). It's probably the best approach if what you want to inject depend on some state or user input.

AUTHOR

Inverse inc. <info@inverse.ca>

COPYRIGHT

Copyright (C) 2005-2015 Inverse inc.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

<<