* @copyright 2005 by http://wombat.exit0.net * @package wombatModule * @subpackage Test */ /** * Test: one, two, three * * @version 1.0.0 * @package wombatModule * @subpackage Test */ class wbModule_Collection extends wbModule { /** * some parameter * * @access private * @var array $_params */ var $_params = array( 'tmpldir' => 'module/Collection', 'parts' => 'First Test Parameter', ); /** * wbSite object * * @access private * @var object $_site */ var $_site; /** * empty constructor! * * empty constructors should be removed! * * @access public * @return boolean $result true on success */ function __construct() { $this->_site =& wbFactory::singleton( 'wbSite' ); } /** * constructor wrapper for PHP4 * * @access public * @see __construct() */ function wbModule_Collection() { $this->__construct(); } /** * recieve content * * * * @return string $html */ function getHtml() { $parts = explode( ',', $this->_params['parts'] ); $content = array(); foreach( $parts as $part ) { if( !isset( $this->_params[$part . ':action'] ) ) { return patErrorManager::raiseError( 'wbModule:Collection:1', 'Configuration Error', 'Parameter "acttion" is required for part "' . $part . '"!' ); } $action = $this->_params[$part . ':action']; if( !isset( $this->_params[$part . ':href'] ) ) { return patErrorManager::raiseError( 'wbModule:Collection:1', 'Configuration Error', 'Parameter "href" is required for part "' . $part . '"!' ); } $href = $this->_params[$part . ':href']; $timeStart = wbDebugger::getUTime(); $function = 'getContent' . ucfirst( $action ); if( !is_callable( array( $this->_site, $function ) ) ) { patErrorManager::raiseWarning( 'wbModue:Collection:1', 'Configuration error', 'The parameter "action" contains an undefined value in part "'. $part.'"!' ); continue; } $conf = array( 'href' => $href, 'params' => $this->_params ); // recieve content $partFake = $part; if( isset( $this->_params[$part . ':fakepart'] ) ) { $partFake = $this->_params[$part . ':fakepart']; } $html = $this->_site->$function( $conf, $partFake, $this->_page ); if( patErrorManager::isError( $html ) ) { patErrorManager::raiseWarning( 'wbModue:Collection:2', 'Fetching content failed', 'Execution of cation "'. $action .'" in "'. $part.'" failed!!' ); continue; } wbDebugger::addMsg( 'Module:Collection', 'Action: "'. $action .'->'.$href.'" Time: '. wbDebugger::getUTime( $timeStart, 1000, 6 ) .' ms', $part ); $content[$part] = $html; } $this->_loadTemplates( 'collection' ); $this->_tmpl->addVars( 'wbModule_Collection', $content ); return $this->_tmpl->getParsedTemplate( 'wbModule_Collection' ); } } ?>