2005-05-02 17:07:37 +02:00
|
|
|
<?php
|
2006-04-20 19:12:30 +02:00
|
|
|
/**
|
|
|
|
* eGroupWare Baseclass for SiteMgr Modules written with eTemplate
|
|
|
|
*
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package etemplate
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
2005-05-02 17:07:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Baseclass for SiteMgr Modules written with eTemplate
|
|
|
|
*
|
|
|
|
* To create a SiteMgr module from an eTemplate app, you need to:
|
|
|
|
* - extend this class and set the $etemplate_method class-var to a method/menuaction of the app
|
|
|
|
* - the app need to return etemplate::exec (otherwise the content is empty)!!!
|
|
|
|
* - the app need to avoid redirects or links, as this would leave sitemgr!!!
|
|
|
|
*
|
|
|
|
* @package etemplate
|
2005-11-10 06:15:06 +01:00
|
|
|
* @subpackage api
|
2005-05-02 17:07:37 +02:00
|
|
|
* @author RalfBecker-AT-outdoor-training.de
|
|
|
|
* @license GPL
|
|
|
|
*/
|
|
|
|
class sitemgr_module extends Module // the Module class get automatic included by SiteMgr
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string $etemplate_method Method/menuaction of an eTemplate app to be used as module
|
|
|
|
*/
|
|
|
|
var $etemplate_method;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* generate the module content AND process submitted forms
|
|
|
|
*
|
2006-08-17 07:36:19 +02:00
|
|
|
* @param array &$arguments $arguments['arg1']-$arguments['arg3'] will be passed for non-submitted forms (first call)
|
2005-05-02 17:07:37 +02:00
|
|
|
* @param array $properties
|
|
|
|
* @return string the html content
|
|
|
|
*/
|
2009-09-28 21:14:45 +02:00
|
|
|
function get_content(&$arguments,$properties)
|
2005-05-02 17:07:37 +02:00
|
|
|
{
|
|
|
|
list($app) = explode('.',$this->etemplate_method);
|
|
|
|
$GLOBALS['egw']->translation->add_app($app);
|
2009-09-28 21:14:45 +02:00
|
|
|
|
2007-05-03 21:16:32 +02:00
|
|
|
$extra = "<style type=\"text/css\">\n<!--\n@import url(".$GLOBALS['egw_info']['server']['webserver_url'].
|
2007-03-09 12:25:08 +01:00
|
|
|
"/etemplate/templates/default/app.css);\n";
|
|
|
|
|
|
|
|
if ($app != 'etemplate' && file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates/default/app.css'))
|
2005-05-02 17:07:37 +02:00
|
|
|
{
|
2007-05-03 21:16:32 +02:00
|
|
|
$extra .= "@import url(".$GLOBALS['egw_info']['server']['webserver_url'].
|
2007-03-09 12:25:08 +01:00
|
|
|
'/'.$app."/templates/default/app.css);\n";
|
2005-05-02 17:07:37 +02:00
|
|
|
}
|
2007-05-03 21:16:32 +02:00
|
|
|
$extra .= "-->\n</style>\n";
|
|
|
|
$extra .= '<script src="'.$GLOBALS['egw_info']['server']['webserver_url'].'/etemplate/js/etemplate.js" type="text/javascript"></script>'."\n";
|
2005-05-02 17:07:37 +02:00
|
|
|
$ret = false;
|
|
|
|
if($_POST['etemplate_exec_id'])
|
|
|
|
{
|
|
|
|
$ret = ExecMethod('etemplate.etemplate.process_exec');
|
|
|
|
}
|
2009-09-28 21:14:45 +02:00
|
|
|
return $extra.($ret ? $ret : ExecMethod2($this->etemplate_method,null,$arguments['arg1'],$arguments['arg2'],$arguments['arg3'],$arguments['arg4'],$arguments['arg5'],$arguments['arg6'],$arguments['arg7']));
|
2005-05-02 17:07:37 +02:00
|
|
|
}
|
|
|
|
}
|