示例#1
0
 /**
  * Retrieves the html block for pagination codes
  *
  * @since	1.0
  * @access	public
  * @param	bool		Determines if we should use the normal post form.
  * @return	string		The html codes for the pagination.
  */
 public function getListFooter($path = 'admin', $url = '')
 {
     // Retrieve pages data from Joomla itself.
     $theme = FD::themes();
     // If there's nothing here, no point displaying the pagination
     if ($this->pagination->total == 0) {
         return;
     }
     $data = $this->pagination->getData();
     $theme->set('data', $data);
     $theme->set('pagination', $this->pagination);
     $contents = $theme->output($path . '/pagination/default');
     return $contents;
 }
示例#2
0
 /**
  * Tests the getData method with multiple JPagination instances
  *
  * @return  void
  *
  * @since   3.4
  * @link    https://github.com/joomla/joomla-cms/pull/4521
  */
 public function testGetDataWithMultipleInstances()
 {
     $p1 = new JPagination(10, 0, 5, 'pref1');
     $data1 = $p1->getData();
     $p2 = new JPagination(20, 0, 10, 'pref2');
     $data2 = $p2->getData();
     $this->assertEquals(5, $data1->next->base, 'Assert the base value for the next page for object 1 is correct.');
     $this->assertEquals(10, $data2->next->base, 'Assert the base value for the next page for object 2 is correct.');
 }
示例#3
0
 /**
  * This method tests the _buildDataObject method.
  *
  * @param   integer  $total       The total number of items.
  * @param   integer  $limitstart  The offset of the item to start at.
  * @param   integer  $limit       The number of items to display per page.
  * @param   integer  $active      The page number which contains the active pagination.
  * @param   array    $expected    The expected results for the JPagination object
  *
  * @return  void
  *
  * @dataProvider  dataTestBuildDataObject
  * @covers        JPagination::getData
  * @since         3.2
  */
 public function testGetData($total, $limitstart, $limit, $active, $expected)
 {
     $pagination = new JPagination($total, $limitstart, $limit);
     $object = $pagination->getData();
     // Test the view all Object
     $this->assertEquals($object->all->text, $expected["0"]["text"], 'This is not the expected view all text');
     $this->assertEquals($object->all->base, $expected["0"]["base"], 'This is not the expected view all base value');
     $this->assertEquals($object->all->link, $expected["0"]["link"], 'This is not the expected view all link value');
     $this->assertEquals($object->all->prefix, $expected["0"]["prefix"], 'This is not the expected view all prefix value');
     $this->assertEquals($object->all->active, $expected["0"]["active"], 'This is not the expected view all active value');
     // Test the start Object
     $this->assertEquals($object->start->text, $expected["1"]["text"], 'This is not the expected start text');
     $this->assertEquals($object->start->base, $expected["1"]["base"], 'This is not the expected start base value');
     $this->assertEquals($object->start->link, $expected["1"]["link"], 'This is not the expected start link value');
     $this->assertEquals($object->start->prefix, $expected["1"]["prefix"], 'This is not the expected start prefix value');
     $this->assertEquals($object->start->active, $expected["1"]["active"], 'This is not the expected start active value');
     // Test the previous Object
     $this->assertEquals($object->previous->text, $expected["2"]["text"], 'This is not the expected previous text');
     $this->assertEquals($object->previous->base, $expected["2"]["base"], 'This is not the expected previous base value');
     $this->assertEquals($object->previous->link, $expected["2"]["link"], 'This is not the expected previous link value');
     $this->assertEquals($object->previous->prefix, $expected["2"]["prefix"], 'This is not the expected previous prefix value');
     $this->assertEquals($object->previous->active, $expected["2"]["active"], 'This is not the expected previous active value');
     // Test the next Object
     $this->assertEquals($object->next->text, $expected["3"]["text"], 'This is not the expected next text');
     $this->assertEquals($object->next->base, $expected["3"]["base"], 'This is not the expected next base value');
     $this->assertEquals($object->next->link, $expected["3"]["link"], 'This is not the expected next link value');
     $this->assertEquals($object->next->prefix, $expected["3"]["prefix"], 'This is not the expected next prefix value');
     $this->assertEquals($object->next->active, $expected["3"]["active"], 'This is not the expected next active value');
     // Test the end Object
     $this->assertEquals($object->end->text, $expected["4"]["text"], 'This is not the expected end text');
     $this->assertEquals($object->end->base, $expected["4"]["base"], 'This is not the expected end base value');
     $this->assertEquals($object->end->link, $expected["4"]["link"], 'This is not the expected end link value');
     $this->assertEquals($object->end->prefix, $expected["4"]["prefix"], 'This is not the expected end prefix value');
     $this->assertEquals($object->end->active, $expected["4"]["active"], 'This is not the expected end active value');
     // Test the active object
     $this->assertEquals($object->pages[$active]->text, $expected["5"]["text"], 'This is not the expected active text');
     $this->assertEquals($object->pages[$active]->base, $expected["5"]["base"], 'This is not the expected active base value');
     $this->assertEquals($object->pages[$active]->link, $expected["5"]["link"], 'This is not the expected active link value');
     $this->assertEquals($object->pages[$active]->prefix, $expected["5"]["prefix"], 'This is not the expected active prefix value');
     $this->assertEquals($object->pages[$active]->active, $expected["5"]["active"], 'This is not the expected active active value');
     unset($pagination);
 }