本文整理汇总了PHP中app\models\Books::jgridBooks方法的典型用法代码示例。如果您正苦于以下问题:PHP Books::jgridBooks方法的具体用法?PHP Books::jgridBooks怎么用?PHP Books::jgridBooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Books
的用法示例。
在下文中一共展示了Books::jgridBooks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
function test_jgridBooks()
{
//OK
$get = ['page' => 1, 'limit' => 10, 'sort_column' => 'created_date', 'sort_order' => 'desc', 'filters' => ''];
$resp = Books::jgridBooks($get);
$this->assertInstanceOf('\\stdClass', $resp);
$this->assertEquals($resp->page, 1);
$this->assertEquals($resp->records, count($this->dataset['books']));
$this->assertEquals(count($resp->rows), $resp->records);
$book1 = $resp->rows[0];
$this->assertEquals(true, is_array($book1));
$this->assertEquals($this->dataset['books'][0]['book_guid'], $book1['id']);
$this->assertEquals((new \DateTime($this->dataset['books'][0]['created_date']))->format('d-m-Y'), $book1['cell'][0]);
//TODO: more stuff?
// empty get, test defaults
unset($get['page']);
$resp = Books::jgridBooks([]);
$this->assertInstanceOf('\\stdClass', $resp);
$this->assertEquals($resp->page, 1);
$this->assertEquals($resp->records, count($this->dataset['books']));
}
示例2: actionBooks
/**
* return list of books in jqgrid format
* @return string json
*/
public function actionBooks()
{
$data = ['page' => \Yii::$app->request->get('page'), 'limit' => \Yii::$app->request->get('rows'), 'filters' => \Yii::$app->request->get('filters'), 'sort_column' => \Yii::$app->request->get('sidx'), 'sort_order' => \Yii::$app->request->get('sord')];
//TODO: currently on store in cookies
//\Yii::$app->session->set('jqgrid.page', $data['page']);
return Json::encode(Books::jgridBooks($data));
}