Beispiel #1
0
 /**
  * Constructor.
  *
  * @param Zrt_JQuery_JqGrid_Adapter_Interface $adaptor
  * @param array $options
  */
 public function __construct($id, $adapter, array $options = array())
 {
     Zend_Paginator::addAdapterPrefixPath('Zrt_JQuery_JqGrid_Adapter', 'Zrt/JQuery/JqGrid/Adapter');
     if ($adapter instanceof Zrt_JQuery_JqGrid_Adapter_Interface) {
         $this->_adapter = $adapter;
     } else {
         throw new Zrt_JQuery_JqGrid_Exception('Zrt_JQuery_JqGrid only accepts instances of the type ' . 'Zrt_JQuery_JqGrid_Adapter_Interface');
     }
     $this->_id = $id;
     // Set grid options, automatically set the default options
     // and over-ride with user options.
     $this->_setDefaultOptions();
     if (isset($options)) {
         if ($options instanceof Zend_Config) {
             $options = $options->toArray();
         }
         if (!is_array($options)) {
             throw new Zend_Exception('JqGrid options must be in an array or a Zend_Config object');
         }
         $this->setOptions($options);
     }
     $this->_plugins = new Zrt_JQuery_JqGrid_Plugin_Broker();
     $this->_plugins->setGrid($this);
     $this->_plugins->registerPlugin(new Zrt_JQuery_JqGrid_Plugin_Pager());
 }
 public function testAddsSingleAdapterPrefixPath()
 {
     Zend_Paginator::addAdapterPrefixPath('prefix1', 'path1');
     $loader = Zend_Paginator::getAdapterLoader();
     $paths = $loader->getPaths();
     $this->assertArrayHasKey('prefix1_', $paths);
     $this->assertEquals($paths['prefix1_'], array('path1/'));
     $loader->clearPaths('prefix1');
 }