當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Books::jgridBooks方法代碼示例

本文整理匯總了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']));
 }
開發者ID:yurii-github,項目名稱:yii2-mylib,代碼行數:21,代碼來源:BooksTest.php

示例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));
 }
開發者ID:yurii-github,項目名稱:yii2-mylib,代碼行數:11,代碼來源:SiteController.php


注:本文中的app\models\Books::jgridBooks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。