Source for file TPage.php
Documentation is available at TPage.php
namespace
Adianti \
Control ;
* Page Controller Pattern: used as container for all elements inside a page and also as a page controller
* @author Pablo Dall'Oglio
* @copyright Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
* @license http://www.adianti.com.br/framework-license
private static $loadedjs ;
private static $loadedcss ;
private static $registeredcss ;
$this -> constructed =
TRUE ;
$rc =
new ReflectionClass ( $this ) ;
return $rc -> getShortName ( ) ;
* Set target container for page content
$this -> setProperty ( 'adianti_target_container' , $container ) ;
$this -> { 'class' } =
'container-part' ;
unset
( $this -> { 'adianti_target_container' } ) ;
unset
( $this -> { 'page_name' } ) ;
* Return target container
return $this -> { 'adianti_target_container' } ;
* Interprets an action based at the URL parameters
$class = isset
( $_GET [ 'class' ] ) ?
$_GET [ 'class' ] :
NULL ;
$method = isset
( $_GET [ 'method' ] ) ?
$_GET [ 'method' ] :
NULL ;
$object =
( $class ==
get_class ( $this )) ?
$this :
new $class ;
* Include a specific JavaScript function to this page
* @param $js JavaScript location
self :: $loadedjs [ $js ] =
TRUE ;
* Include a specific Cascading Stylesheet to this page
* @param $css Cascading Stylesheet
self :: $loadedcss [ $css ] =
TRUE ;
* Register a specific Cascading Stylesheet to this page
* @param $cssname Cascading Stylesheet Name
* @param $csscode Cascading Stylesheet Code
self :: $registeredcss [ $cssname ] =
$csscode ;
public static function openFile ( $file , $basename =
null )
TScript :: create ( " __adianti_download_file('{$file } ', '{$basename } ') " ) ;
* Return the loaded Cascade Stylesheet files
* @ignore-autocomplete on
$csc =
self :: $registeredcss ;
foreach ( $css as $cssfile =>
$bool )
$css_text .=
" <link rel='stylesheet' type='text/css' media='screen' href='$cssfile '/>\n " ;
$css_text .=
" <style type='text/css' media='screen'>\n" ;
foreach ( $csc as $cssname =>
$csscode )
$css_text .=
" </style>\n" ;
* Return the loaded JavaScript files
* @ignore-autocomplete on
public static function getLoadedJS ( )
foreach ( $js as $jsfile =>
$bool )
$js_text .=
" <script language='JavaScript' src='$jsfile '></script>\n " ;;
* Discover if the browser is mobile device
public static function isMobile ( )
if ( isset
( $_SERVER [ 'HTTP_X_WAP_PROFILE' ] ) or isset
( $_SERVER [ 'HTTP_PROFILE' ] ))
$mobiBrowsers =
array ( 'android' , 'audiovox' , 'blackberry' , 'epoc' ,
'ericsson' , ' iemobile' , 'ipaq' , 'iphone' , 'ipad' ,
'ipod' , 'j2me' , 'midp' , 'mmp' ,
'mobile' , 'motorola' , 'nitro' , 'nokia' ,
'opera mini' , 'palm' , 'palmsource' , 'panasonic' ,
'phone' , 'pocketpc' , 'samsung' , 'sanyo' ,
'series60' , 'sharp' , 'siemens' , 'smartphone' ,
'sony' , 'symbian' , 'toshiba' , 'treo' ,
'up.browser' , 'up.link' , 'wap' , 'wap' ,
foreach ( $mobiBrowsers as $mb )
* Intercepts whenever someones assign a new property's value
* @param $name Property Name
* @param $value Property Value
public function __set ( $name , $value )
parent :: __set ( $name , $value ) ;
* Decide wich action to take and show the page
// just execute run() from toplevel TPage's, not nested ones