* @license PHP License * @package WB * @subpackage content */ /** * Load classes */ WBClass::load('WBITS' , 'WBDatasource_Pager' ); /** * Wombat Incident Ticket System Ticket List Exporter * * @version 1.0.0 * @package WB * @subpackage content */ class WBITS_TicketList_Exporter extends WBStdClass { /** * Pager * @var WBDatasource_Pager */ private $pager; /** * Current Config * @var array */ protected $config; /** * Constructor * */ final public function __construct() { $this->config = WBITS::getConfig(); $this->useNamespace($this->config['namespace']); $this->init(); } /** * 2nd Constructor */ protected function init() { } /** * Set Pager * * Pager provides list of tickets * @param WBDatasource_Pager */ final public function setPager(WBDatasource_Pager $pager) { $this->pager = $pager; } final public function useNamespace($ns = '') { $ns = WBITS::selectNamespace($ns); } /** * Export Ticket List * */ final public function export() { $this->onExportStart(); $info = $this->pager->browse('__first'); for ($i = 1; $i < $info['pages']; ++$i) { $list = $this->pager->get(); foreach ($list as $l) { $this->exportListItem($l); } $this->pager->browse('__next'); } $list = $this->pager->get(); foreach ($list as $l) { $this->exportListItem($l); } $this->pager->browse('__first'); $this->onExportEnd(); } /** * Event Handler to Start Export * */ protected function onExportStart() { } /** * Event Handler for Each List Item * * @param array list item data */ protected function exportListItem($item) { } /** * Event Handler at End of Export * */ protected function onExportEnd() { } }