/**
* Initialize the limit parameter for a QueryObject.
*/
-Configure::write('LIMIT',25);
+Configure::write('LIMIT',50);
/**
* Initialize the offset parameter for a QueryObject
*/
/**
* Initialize the order parameter for a QueryObject
*/
-Configure::write('ORDER','desc');
+Configure::write('ORDER','asc');
/**
* Connect middleware/dispatcher filters.
- public $paginate = [
- //'fields' => ['Articles.id', 'Articles.created'],
- 'limit' => 5,
- 'order' => [
- 'Softwares.softwarename' => 'asc'
- ],
- 'contain' => ['Licenses']
- ];
+
/**
* Index method
*/
public function index()
{
-
-// $this->paginate = [
-// 'contain' => ['Licenses']
-// ];
$this->set('softwares', $this->paginate($this->Softwares));
-
-
- $this->set('_serialize', ['softwares','pagination','paging']);
+ $this->set('_serialize', ['softwares','pagination','paging']);
}
$licenses = $this->Softwares->Licenses->find('list', ['limit' => 200]);
$this->set(compact('software', 'licenses'));
$this->set('_serialize', ['software']);
-
+ //IF JSON
}else if ($this->request->is(['patch', 'post', 'put']) && $this->request->is('json')) {
$software = $this->Softwares->patchEntity($software, $this->request->data);
if ($this->Softwares->save($software)) {
$this->set('software', $this->paginate($software));
$this->set('_serialize', ['software','pagination']);
}
+
+ public function initialize(){
+
+
+ parent::initialize();
+
+ $this->paginate = [
+ //'fields' => ['Articles.id', 'Articles.created'],
+ 'limit' => Configure::read('LIMIT'),
+ 'order' => [
+ 'Softwares.softwarename' => Configure::read('ORDER')
+ ],
+ 'contain' => ['Licenses']
+ ];
+
+ }
}
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
+use Cake\Core\Configure;
+
/**
* Users Controller
*
*/
class UsersController extends AppController
{
-
- public $paginate = [
- //'fields' => ['Articles.id', 'Articles.created'],
- 'limit' => 50,
- 'order' => [
- 'Users.username' => 'desc'
- ],
- 'contain' => ['UserTypes']
- ];
/**
* Index method
*/
public function index()
{
- $this->paginate = [
- 'limit' => 50,
- 'order' => [
- 'Users.username' => 'desc'
- ],
- 'contain' => ['UserTypes']
- ];
$this->set('users', $this->paginate($this->Users));
$this->set('_serialize', ['users','paging']);
}
return parent::isAuthorized($user);
}
+
+
+ public function initialize(){
+
+
+ parent::initialize();
+
+ $this->paginate = [
+ 'limit' => Configure::read('LIMIT'),
+ 'order' => [
+ 'Users.username' => Configure::read('ORDER'),
+ ],
+ 'contain' => ['UserTypes']
+ ];
+
+ }
}