Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Layout Class Reference

Layout is a template generator. More...

+ Collaboration diagram for Layout:

Public Member Functions

 __construct ($caneva="", $action=null, $template="[OUT]")
 
 setBlockCorresp ($p_nom_block, $p_nom_modele, $p_nom=NULL)
 
 eSetBlockData ($p_nom_block, $data=NULL)
 
 setBlockData ($p_nom_block, $data=NULL)
 
 getBlockData ($p_nom_block)
 
 setEncoding ($enc)
 
 set ($tag, $val)
 
 rSet ($tag, $val)
 
 xSet ($tag, $val)
 
 eSet ($tag, $val)
 
 get ($tag)
 
 GenJsCode ($showlog, $onlylog=false)
 
 gen ()
 

Data Fields

 $encoding = ""
 
 $noparse = false
 
 $action = null
 

Protected Member Functions

 SetBlock ($name, $block)
 
 ParseBlock (&$out)
 
 TestIf ($name, $block, $not=false)
 
 ParseIf (&$out)
 
 ParseZone (&$out)
 
 ParseKey (&$out)
 
 execute ($appname, $actionargn)
 
 ParseRef (&$out)
 
 ParseText (&$out)
 
 Text ($s)
 
 GenJsRef ()
 
 ParseJs (&$out)
 
 GenCssRef ($oldCompatibility=true)
 
 GenCssCode ()
 
 ParseCss (&$out)
 
 parseApplicationParameters (&$out, $addIf)
 
 getRecursionCount ($class, $function)
 
 printRecursionCountError ($class, $function, $count)
 

Protected Attributes

 $corresp
 
 $data = null
 
 $rif = array()
 
 $rkey = array()
 
 $pkey = array()
 
 $zoneLevel = 0
 

Detailed Description

Layout is a template generator.

Layout Class can manage three kind of datas :

  • 1) Simple tags : those tags are enclosed into brackets [] and can be replaced with any dynamic data given with the Set method. e.g : [MYDATA] => $this->Set("MYDATA","this is my text");
  • 2) Block of Data : those tags are used to manage repeated set of data (as table for instance) You can assign a table of data to a specific block.
    $table = array ( "0" => array ( "NAME" => "John",
    "SURNAME" => "Smith"),
    "1" => array ( "NAME" => "Robert",
    "SURNAME" => "Martin"));
    the block :
    [BLOCK IDENTITY]
    <tr><td align="left">[NAME]</td>
    <td align="right">[SURNAME]</td>
    </tr>
    [ENDBLOCK IDENTITY]
    the code :
    $lay = new Layout ("file containing the block");
    $lay->SetBlockData("IDENTITY",$table);
    $out = $lay->gen();
    $out :
    <tr><td align="left">John</td>
    <td align="right">Smith</td>
    </tr>
    <tr><td align="left">Robert</td>
    <td align="right">Martin</td>
    </tr>
  • 3) Call a specific script (need Core App Environment to work) tag syntax : [ZONE zonename] the zone name is linked to a specific application/function eg : [ZONE CORE:APPLIST] then the APPLIST function in the CORE Application is called this function can then use another layout etc......

Definition at line 69 of file Class.Layout.php.

Constructor & Destructor Documentation

__construct (   $caneva = "",
  $action = null,
  $template = "[OUT]" 
)

construct layout to identify template

Parameters
string$canevafile path of the template
Action$actioncurrent action
string$templateif no $caneva found or is empty use this template.

Definition at line 115 of file Class.Layout.php.

Member Function Documentation

eSet (   $tag,
  $val 
)

set key/value pair and XML entity encode

Parameters
string$tagthe key to replace
string$valthe value for the key

Definition at line 418 of file Class.Layout.php.

+ Here is the call graph for this function:

eSetBlockData (   $p_nom_block,
  $data = NULL 
)

set encoded data to fill a block

Api:
set data to fill a block
Parameters
string$p_nom_blockblock name
array$datadata to fill the block

Definition at line 176 of file Class.Layout.php.

+ Here is the call graph for this function:

execute (   $appname,
  $actionargn 
)
protected

Definition at line 323 of file Class.Layout.php.

+ Here is the call graph for this function:

gen ( )

Generate text from template with data included

Api:
generate text from template
Returns
string the complete text

Definition at line 620 of file Class.Layout.php.

+ Here is the call graph for this function:

GenCssCode ( )
protected

Definition at line 585 of file Class.Layout.php.

GenCssRef (   $oldCompatibility = true)
protected

Definition at line 570 of file Class.Layout.php.

GenJsCode (   $showlog,
  $onlylog = false 
)

get js code for notification (internal usage)

Parameters
$showlog
bool$onlylog
Returns
string

Definition at line 501 of file Class.Layout.php.

GenJsRef ( )
protected

Definition at line 482 of file Class.Layout.php.

get (   $tag)

return the value set for a key

See Also
Layout::set()
Parameters
string$tag
Returns
string

Definition at line 430 of file Class.Layout.php.

getBlockData (   $p_nom_block)

return data set in block name

See Also
setBlockData
Parameters
string$p_nom_blockblock name
Returns
array|bool return data or false if no data are set yet

Definition at line 218 of file Class.Layout.php.

getRecursionCount (   $class,
  $function 
)
protected

Count number of execute() calls on the stack to detect infinite recursive loops

Parameters
string$classname to track
string$function,/methodname to track
Returns
array array('count' => $callCount, 'delta' => $callDelta, 'depth' => $stackDepth)

Definition at line 685 of file Class.Layout.php.

parseApplicationParameters ( $out,
  $addIf 
)
protected

Use application parameters like keys

Parameters
string$outcurrent template
bool$addIfif true replace key with application parameters else use conditions

Definition at line 658 of file Class.Layout.php.

ParseBlock ( $out)
protected

Definition at line 253 of file Class.Layout.php.

+ Here is the call graph for this function:

ParseCss ( $out)
protected

Definition at line 596 of file Class.Layout.php.

+ Here is the call graph for this function:

ParseIf ( $out)
protected

Definition at line 284 of file Class.Layout.php.

+ Here is the call graph for this function:

ParseJs ( $out)
protected

Definition at line 549 of file Class.Layout.php.

+ Here is the call graph for this function:

ParseKey ( $out)
protected

Definition at line 302 of file Class.Layout.php.

ParseRef ( $out)
protected

Definition at line 436 of file Class.Layout.php.

ParseText ( $out)
protected

Definition at line 461 of file Class.Layout.php.

+ Here is the call graph for this function:

ParseZone ( $out)
protected

Definition at line 293 of file Class.Layout.php.

+ Here is the call graph for this function:

printRecursionCountError (   $class,
  $function,
  $count 
)
protected

Print a recursion count error message and stop execution

Parameters
string$classname to display
string$function,/methodname to display
int$countthe call count that triggered the error

Definition at line 717 of file Class.Layout.php.

rSet (   $tag,
  $val 
)

Definition at line 405 of file Class.Layout.php.

+ Here is the call graph for this function:

set (   $tag,
  $val 
)

add a simple key /value in template the key will be replaced by value when [KEY] is found in template

Api:
affect value to a key
Parameters
string$tag
string$val

Definition at line 400 of file Class.Layout.php.

SetBlock (   $name,
  $block 
)
protected

Definition at line 224 of file Class.Layout.php.

+ Here is the call graph for this function:

setBlockCorresp (   $p_nom_block,
  $p_nom_modele,
  $p_nom = NULL 
)

set reference between array index and layout key

use these data

$table = array ( "0" => array ( "name" => "John",
"surname" => "Smith"),
"1" => array ( "name" => "Robert",
"surname" => "Martin"));

with the code

$lay = new Layout ("file containing the block");
$lay->setBlockCorresp("IDENTITY","MYNAME","name");
$lay->setBlockCorresp("IDENTITY","MYSURNAME","surname");
$lay->SetBlockData("IDENTITY",$table);
$out = $lay->gen();

for template

[BLOCK IDENTITY]
<tr><td align="left">[MYNAME]</td>
<td align="right">[MYSURNAME]</td>
</tr>
[ENDBLOCK IDENTITY]
Parameters
string$p_nom_block
string$p_nom_modele
string$p_nom

Definition at line 166 of file Class.Layout.php.

setBlockData (   $p_nom_block,
  $data = NULL 
)

set data to fill a block

Api:
set data to fill a block
Parameters
string$p_nom_blockblock name
array$datadata to fill the block

Definition at line 195 of file Class.Layout.php.

+ Here is the call graph for this function:

setEncoding (   $enc)

define new encoding text default is utf-8

Parameters
string$encencoding (only 'utf-8' is allowed)
Deprecated:
not need always utf-8

Definition at line 314 of file Class.Layout.php.

TestIf (   $name,
  $block,
  $not = false 
)
protected

Definition at line 262 of file Class.Layout.php.

+ Here is the call graph for this function:

Text (   $s)
protected

Definition at line 476 of file Class.Layout.php.

xSet (   $tag,
  $val 
)

Definition at line 409 of file Class.Layout.php.

+ Here is the call graph for this function:

Field Documentation

$action = null

Definition at line 100 of file Class.Layout.php.

$corresp
protected

Definition at line 81 of file Class.Layout.php.

$data = null
protected

Definition at line 82 of file Class.Layout.php.

$encoding = ""

Definition at line 75 of file Class.Layout.php.

$noparse = false

Definition at line 80 of file Class.Layout.php.

$pkey = array()
protected

Definition at line 94 of file Class.Layout.php.

$rif = array()
protected

Definition at line 86 of file Class.Layout.php.

$rkey = array()
protected

Definition at line 90 of file Class.Layout.php.

$zoneLevel = 0
protected

Definition at line 96 of file Class.Layout.php.


The documentation for this class was generated from the following file:
← centre documentaire © anakeen