2011-08-25 21:52:51 +02:00
< ? php
/**
* EGroupware - eTemplate serverside base widget , to define new widgets using a transformation out of existing widgets
*
* @ license http :// opensource . org / licenses / gpl - license . php GPL - GNU General Public License
* @ package etemplate
* @ subpackage api
* @ link http :// www . egroupware . org
* @ author Ralf Becker < RalfBecker @ outdoor - training . de >
2016-03-19 14:06:07 +01:00
* @ copyright 2002 - 16 by RalfBecker @ outdoor - training . de
2011-08-25 21:52:51 +02:00
* @ version $Id $
*/
2016-03-19 14:06:07 +01:00
use EGroupware\Api\Etemplate\Widget\Transformer ;
2011-08-25 21:52:51 +02:00
/**
* eTemplate serverside base widget , to define new widgets using a transformation out of existing widgets
2016-03-19 14:06:07 +01:00
*
* @ deprecated use Api\Etemplate\Widget\Transformer
2011-08-25 21:52:51 +02:00
*/
2016-03-19 14:06:07 +01:00
abstract class etemplate_widget_transformer extends Transformer
2011-08-25 21:52:51 +02:00
{
/**
* Rendering transformer widget serverside as an old etemplate extension
*
* This function is called before the extension gets rendered
*
* @ param string $name form - name of the control
* @ param mixed & $value value / existing content , can be modified
* @ param array & $cell array with the widget , can be modified for ui - independent widgets
* @ param array & $readonlys names of widgets as key , to be made readonly
* @ param mixed & $extension_data data the extension can store persisten between pre - and post - process
* @ param etemplate & $tmpl reference to the template we belong too
* @ return boolean true if extra label is allowed , false otherwise
*/
2013-11-01 22:19:08 +01:00
public function pre_process ( $name , & $value , & $cell , & $readonlys , & $extension_data , & $tmpl )
2011-08-25 21:52:51 +02:00
{
2016-03-19 14:06:07 +01:00
unset ( $readonlys , $extension_data , $tmpl ); // not used but required by function signature
2014-05-07 11:00:59 +02:00
$_value = $value ;
$_cell = $cell ;
2011-08-25 21:52:51 +02:00
$cell [ 'value' ] =& $value ;
$cell [ 'options' ] =& $cell [ 'size' ]; // old engine uses 'size' instead of 'options' for legacy options
$cell [ 'id' ] =& $cell [ 'name' ]; // dto for 'name' instead of 'id'
// run the transformation
2014-05-07 11:00:59 +02:00
foreach ( static :: $transformation as $filter => $data )
2011-08-25 21:52:51 +02:00
{
$this -> action ( $filter , $data , $cell );
}
2014-05-07 11:00:59 +02:00
unset ( $cell [ 'value' ]);
error_log ( __METHOD__ . " (' $name ', " . ( is_array ( $_value ) ? $_value [ 'id' ] : $_value ) . " , " . array2string ( $_cell ) . " , ...) transformed to " . array2string ( $cell ) . " and value= " . array2string ( $value ));
2011-08-25 21:52:51 +02:00
return true ;
}
}