public function listItem($arrParam = null, $options = null)
 {
     if ($options['task'] == 'list-items-paginator') {
         return $this->tableGateway->select(function (Select $select) use($arrParam) {
             $paginator = $arrParam['paginator'];
             $ssFilter = $arrParam['ssFilter'];
             $select->limit($paginator['itemCountPerPage']);
             $select->offset(($paginator['currentPageNumber'] - 1) * $paginator['itemCountPerPage']);
             //-------Lọc theo keyword và field----
             if (!empty($ssFilter['keywords']) && !empty($ssFilter['field'])) {
                 $keywords = '%' . $ssFilter['keywords'] . '%';
                 $select->where->like($ssFilter['field'], $keywords);
             }
             //-------Lọc theo status--------------
             if (!empty($ssFilter['status'])) {
                 $select->where->equalTo('status', $ssFilter['status']);
             }
             //------Sap xep theo cot-------------
             if (!empty($ssFilter['col']) && !empty($ssFilter['order'])) {
                 $select->order(array($ssFilter['col'] . ' ' . $ssFilter['order']));
             }
         });
     }
     if ($options['task'] == 'list-permission') {
         $sqlObj = new Sql($this->adapter);
         $select = $sqlObj->select();
         $select->from('permission');
         $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter);
         $system = new \ZendVN\System\Recursive($result);
         $result = $system->buildArray(0);
         return $result;
     }
 }
 public function itemInselectBox($arrParam = null, $options = null)
 {
     if ($options['task'] == 'list-item-city') {
         $sqlObj = new Sql($this->adapter);
         $select = $sqlObj->select()->from('city')->columns(array('id', 'name'));
         $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter);
         $default[] = array('id' => '', 'name' => '--Thành phố--');
         $result = array_merge($default, $result);
         return $result;
     }
     if ($options['task'] == 'list-item-category') {
         $sqlObj = new Sql($this->adapter);
         $select = $sqlObj->select()->from('category')->columns(array('id', 'name', 'parents' => 'parent'))->where('type = "category_project"');
         $resultRoot[] = array('id' => 1, 'name' => 'Root', 'parents' => 0);
         $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter);
         $result = array_merge($resultRoot, $result);
         $system = new \ZendVN\System\Recursive($result);
         $result = $system->buildArray(0);
         $default[] = array('id' => '', 'name' => 'Danh mục', 'level' => 1);
         $result = array_merge($default, $result);
         return $result;
     }
     if ($options['task'] == 'list-item-business') {
         $sqlObj = new Sql($this->adapter);
         $select = $sqlObj->select()->from('business')->columns(array('id', 'name'));
         $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter);
         $default[] = array('id' => '', 'name' => '--Doanh nghiệp--');
         $result = array_merge($default, $result);
         return $result;
     }
 }