示例#1
0
 public function index($parent_id = '')
 {
     // Process filter
     if ($user_id = $this->request->query('user_id')) {
         $this->paginate['conditions']['user_id'] = $user_id;
     }
     $status = $this->request->query('status');
     if ($status != '') {
         $this->paginate['conditions']['status'] = $status;
     }
     $id = $this->request->query('id');
     if ($id) {
         if (strpos($id, ',') !== false) {
             $id = explode(',', $id);
         }
         $this->paginate['conditions']['id'] = $id;
     }
     $rowset = parent::index();
     $ids = Hash::extract($rowset, '{n}.Order.id');
     $orders = $this->Order->getOrder($ids);
     $ids = Hash::extract($rowset, '{n}.Order.user_id');
     $users = Hash::combine($this->User->findAllById($ids), '{n}.User.id', '{n}.User');
     $aUserOptions = $this->User->find('list', array('fields' => array('id', 'username')));
     $this->set(compact('orders', 'users', 'aUserOptions'));
 }
示例#2
0
 public function index($parent_id = '')
 {
     if ($parent_id) {
         // Fix for redirecting on parent list
         return $this->redirect(array('action' => 'index'));
     }
     parent::index();
 }