* @license PHP License * @package WB * @subpackage content */ /** * Load classes */ WBClass::load('WBITS'); /** * List of Tickets * * @version 1.1.0 * @package WB * @subpackage content */ class WBITS_TicketList extends WBStdClass { /** * table * @var WBDatasource_Table */ protected $table; /** * Namespace To Use * @var string */ private $selectedNamespace = ''; /** * Constructor * * @param array */ public function __construct($params) { $this->table = WBClass::create('WBDatasource_Table'); } /** * Use Namespace * * @param string */ public function useNamespace($ns) { $this->selectedNamespace = WBITS::selectNamespace($ns); } /** * Get Ticket Pager * * @param array $clause * @param array $options * @return WBDatasource_Pager */ public function getPager($clause = array(), $options = array()) { if (!is_array($clause)) { $clause = array(); } // force namespace? if (!empty($this->selectedNamespace)) { $clause[] = array( 'field' => 'namespace', 'value' => $this->selectedNamespace ); } $id = __CLASS__ . ':' . WBITS::TABLE_TICKET; if (!is_array($options)) { $options = array(); } $options['callback'] = WBClass::create('WBITS_DatasourceCallback'); if (!isset($options['limit'])) { $options['limit'] = 10; } return $this->table->getPager($id, WBITS::TABLE_TICKET, null, $clause, $options); } }