<?php

/**
 * Core
 *
 * @author Arkadiusz Rychlik <a.rychlik at eppe.com.pl>
 */
class Rtn_SimpleTable_Core {

	/**
	 *
	 * @var Rtn_SimpleTable_DataSource
	 */
	public $dataSource;
	
	/**
	 *
	 * @var Rtn_SimpleTable_Renderer
	 */
	public $renderer;

	public $blocks = [];
	
	public function __construct() {
		$this->renderer = new Rtn_SimpleTable_Renderer($this);
		$this->init();
	}
	
	public function addBlock($block,$name=null) {
		if(!$name){
			$this->blocks[] = $block;
		}
		else{
			$this->blocks[$name] = $block;
		}
		return $this;
	}

	public function setDataSource($ds) {
		$this->dataSource = $ds;
		return $this;
	}
	
	public function render() {
		return $this->renderer->render();
	}
	
	protected function init(){
		
	}
	
}
