* @license PHP License * @package WB * @subpackage db */ /** * Datasource renderer base class * * @version 0.4.0 * @package WB * @subpackage db */ class WBDatasource_Renderer extends WBStdClass { /** * Configuration parameters * @var array */ protected $config = array(); /** * Additional Variables * @var array */ protected $vars = array(); /** * Map Infomation * @var array */ private $itemMap = array(); /** * Infomation For Datasource * @var array */ private $datasourceInfo = array( 'name' => '', 'title' => '', 'brief' => '' ); /** * Set configuration values * * @param array */ public function setConfig($config = array()) { if (!is_array($config)) { return; } $this->config = array_merge($this->config, $config); } /** * Set Additional Variables * * @param array */ public function setVars($vars = array()) { if (!is_array($vars)) { $vars = array(); } $this->vars = $vars; } /** * Set Map Information * * Set optional map. Map informs renderer how to interpret item values * @param array */ final public function setItemMap($map) { $this->itemMap = $map; } /** * Get Map Information * * Get optional map * @return array */ final public function getItemMap() { return $this->itemMap; } /** * Set Datasource Information * * Set optional Information * @param array */ final public function setDatasourceInfo($info) { $this->datasourceInfo = array_merge($this->datasourceInfo, $info); } /** * Get Datasource Information * * Get optional information about datasource * @return array */ final public function getDatasourceInfo() { return $this->datasourceInfo; } /** * start rendering * * Things to do just before iterating through datasource * @param string $datasource name separated with slashes */ public function start($datasource) { } /** * render single item * * The consumer for data source iteratrion * @param array $item */ public function renderItem($item) { } /** * finish rendering * * Things to do after iterating through datasource */ public function end() { } }