public function Record() { $this->setDB(); $this->setCollection(); $cryptography = new Cryptography(); if ($this->validation($this->db, $this->collection)) { $record = array(); $skip = $this->request->getParam('start', 0); $limit = $this->request->getParam('limit', 10); $type = $this->request->getParam('type', 'array'); $query = array(); $fields = array(); if ($this->request->getParam('search', false) && $this->request->getParam('query', false)) { switch (strtolower($this->request->getParam('type'))) { case 'fieldvalue': $query = $this->getQuery($this->request->getParam('query')); break; case 'array': $query = $cryptography->stringToArray($this->request->getParam('query')); break; case 'json': $query = $this->request->getParam('query'); break; default: $query = array(); break; } } if (!$this->isError()) { $cursor = $this->getModel()->find($this->db, $this->collection, $query, $fields, $limit, $skip, $type); $ordeBy = $this->getSort($this->request->getParam('order_by', false), $this->request->getParam('orders', false)); if ($ordeBy) { $cursor->sort($ordeBy); } $record = $cryptography->decode($cursor, $type); } $this->application->view = 'Collection'; $format = array('json', 'array', 'document'); $this->display('record', array('record' => $record, 'format' => $format)); } else { $this->request->redirect($this->url); } }