protected function getConfigDisplay() { $select = $this->sqlObj->select(); $select->from('config')->where('id = 1'); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return \Zend\Json\Json::decode($result['display']); }
public function countItem($arrParam = null, $options = null) { if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('b' => 'users'))->columns(array('count' => new Expression('COUNT(b.id)'))); $select->where('parent = ' . $arrParam['parent']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]['count']; return $result; } }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('comment'); $select->where('comment.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('contact_real_estate'); $select->join(array('r' => 'real_estate'), 'r.id = contact_real_estate.real_estate_id', array('rid' => 'id', 'rcat_id' => 'cat_id', 'title', 'images'), $select::JOIN_LEFT); $select->join(array('retype' => 'category'), 'retype.id = r.cat_id', array('name_type' => 'name'), $select::JOIN_LEFT); $select->where('contact_real_estate.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } }
public function countItem($arrParam = null, $options = null) { if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('c' => 'contract_forms'))->columns(array('count' => new Expression('COUNT(id)'))); if (!empty($arrParam['cat_id'])) { $select->where('c.cat_id = ' . $arrParam['cat_id']); } $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]['count']; return $result; } }
public function itemInselectBox($arrParam = null, $options = null) { if ($options['task'] == 'list-item-category-news') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('category')->columns(array('id', 'name', 'parents' => 'parent'))->where('type = "category_legislationhousing"'); $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; } }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-email-template') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('e' => 'email_marketing_template'))->where('e.id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'file') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('mfile' => 'manager_file'))->join(array('mfolder' => 'manager_folder'), 'mfolder.id = mfile.folder_id', array('name_folder' => 'name'), $select::JOIN_LEFT)->where('mfile.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = !empty($result) ? $result[0] : ''; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-thoi-han-su-dung') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('service_account_register')->columns(array('service_account_id', 'date_end')); $select->join(array('se' => 'service_account'), 'se.id = service_account_register.service_account_id', array('name_service' => 'name'), $select::JOIN_LEFT); $select->where('user_id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('f' => 'fengshui_news'))->columns(array('id', 'cat_id', 'title', 'description', 'content', 'images', 'status', 'date_time', 'order', 'images')); $select->join(array('cat' => 'category'), 'cat.id = f.cat_id', array('name_category' => 'name'), $select::JOIN_LEFT); $select->where('f.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('contact_agency'); $select->join(array('u' => 'users'), 'u.id = contact_agency.user_id', array('fullname_contact' => 'fullname'), $select::JOIN_LEFT); $select->where('contact_agency.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('l' => 'legislation_housing')); $select->join(array('cat' => 'category'), 'cat.id = l.cat_id', array('name_category' => 'name'), $select::JOIN_LEFT); $select->where('l.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select = $sqlObj->select()->from(array('s' => 'service_account_register')); $select->join(array('u' => 'users'), 's.user_id = u.id', array('fullname', 'phone', 'website', 'email'), $select::JOIN_LEFT); $select->join(array('sa' => 'service_account'), 's.service_account_id = sa.id', array('name', 'normal', 'vip', 'hot', 'free', 'chinhchu', 'price'), $select::JOIN_LEFT); $select->where('s.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item-notification-template') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('n' => 'notificationtemplate'))->columns(array('id', 'content')); $select->where('n.id = ' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options == null) { return $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'username', 'fullname', 'email', 'group_id')); $select->where->equalTo('id', $arrParam['id']); })->current(); } if ($options['task'] == 'user-active') { return $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->where->equalTo('id', $arrParam['id'])->where->equalTo('active_code', $arrParam['code']); })->count(); } if ($options['task'] == 'restore-password') { return $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->where->equalTo('fpass_code', $arrParam['code']); })->count(); } if ($options['task'] == 'store-group-info') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('u' => 'user_group'))->columns(array('id', 'group_name', 'group_acp', 'permission_id')); $select->where('u.id = ' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'category-frontend') { $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'name', 'description', 'left', 'right'))->where->equalTo('id', $arrParam['id']); })->current(); return $result; } if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-find-parent-cat') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('real_estate_type')->columns(array('parent'))->where('id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); return $result; } if ($options['task'] == 'get-item-category') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('category')->where('id = ' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'get-item-city') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('city')->columns(array('id', 'name'))->where('id =' . $arrParam['cityid']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('p' => 'project'))->join(array('ct' => 'city'), 'ct.id = p.city', array('name_city' => 'name'), $select::JOIN_LEFT)->join(array('ctd' => 'city_district'), 'ctd.id = p.district', array('name_district' => 'name'), $select::JOIN_LEFT)->join(array('b' => 'business'), 'b.id = p.investors', array('name_investors' => 'name', 'alias_investors' => 'alias'), $select::JOIN_LEFT)->join(array('b1' => 'business'), 'b1.id = p.construction', array('name_construction' => 'name', 'alias_construction' => 'alias'), $select::JOIN_LEFT)->join(array('b2' => 'business'), 'b2.id = p.management', array('name_management' => 'name', 'alias_management' => 'alias'), $select::JOIN_LEFT)->join(array('b3' => 'business'), 'b3.id = p.design', array('name_design' => 'name', 'alias_design' => 'alias'), $select::JOIN_LEFT)->join(array('b4' => 'business'), 'b4.id = p.distributors', array('name_distributors' => 'name', 'alias_distributors' => 'alias', 'logo_distributors' => 'logo'), $select::JOIN_LEFT)->join(array('retype' => 'category'), 'retype.id = p.cat_id', array('name_category' => 'name'), $select::JOIN_LEFT); $select->where('p.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'category-frontend') { $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'name', 'description', 'left', 'right'))->where->equalTo('id', $arrParam['id']); })->current(); return $result; } if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-find-parent-cat') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('real_estate_type')->columns(array('parent'))->where('id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); return $result; } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('n' => 'news'))->columns(array('id', 'cat_id', 'title', 'description', 'content', 'images', 'city', 'status', 'date_time', 'order')); $select->where('n.id =' . $arrParam['id']); //echo $sqlString = $sqlObj->getSqlStringForSqlObject($select); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'category-frontend') { $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'name', 'description', 'left', 'right'))->where->equalTo('id', $arrParam['id']); })->current(); return $result; } if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-find-parent-cat') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('category')->columns(array('parent'))->where('id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); return $result; } if ($options['task'] == 'get-item-fengshui') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('fengshui')->columns(array('id', 'birth', 'sex', 'direction', 'content')); //Năm sinh $select->where('birth =' . $arrParam['feng-shui-birth']); if (!empty($arrParam['feng-shui-sex'])) { $select->where('sex =' . $arrParam['feng-shui-sex']); } if (!empty($arrParam['feng-shui-huong'])) { $select->where('direction =' . $arrParam['feng-shui-huong']); } $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'get-item-city') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('city')->columns(array('id', 'name'))->where('id =' . $arrParam['cityid']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('re' => 'real_estate'))->join(array('ct' => 'city'), 'ct.id = re.city', array('name_city' => 'name'), $select::JOIN_LEFT)->join(array('ctd' => 'city_district'), 'ctd.id = re.district', array('name_district' => 'name'), $select::JOIN_LEFT)->join(array('ctdw' => 'city_district_ward'), 'ctdw.id = re.ward', array('name_ward' => 'name'), $select::JOIN_LEFT)->join(array('retype' => 'category'), 'retype.id = re.cat_id', array('name_type' => 'name'), $select::JOIN_LEFT)->join(array('project' => 'project'), 'project.id = re.project', array('name_project' => 'name'), $select::JOIN_LEFT)->join(array('u' => 'users'), 'u.id = re.user_id', array('fullname', 'phone', 'avatar'), $select::JOIN_LEFT)->join(array('ju' => 'juridical'), 'ju.id = re.juridical', array('name_juridical' => 'name'), $select::JOIN_LEFT)->join(array('status' => 'real_estate_status'), 'status.id = re.status', array('name_status' => 'name'), $select::JOIN_LEFT); $select->where('re.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'view-bds') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('re' => 'real_estate_view'))->columns(array('id', 'real_estate_id', 'date_time', 'view')); $select->where('re.real_estate_id = ' . $arrParam['id']); $select->where('re.date_time = "' . $arrParam['date_time'] . '"'); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); if (!empty($result)) { $result = $result[0]; } return $result; } return $row; }
public function deleteItem($arrParam = null, $options = null) { if ($options['task'] == 'delete-item') { $this->tableGateway->delete(array('id' => $arrParam['id'])); //Xóa xã, phường của quận. huyện $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from('city_district')->where('city_id = ' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); foreach ($result as $value) { $deleteObj = $sqlObj->delete('city_district_ward'); $deleteObj->where(new \Zend\Db\Sql\Predicate\In('district_id', array($value['id']))); $sqlString = $sqlObj->getSqlStringForSqlObject($deleteObj); $this->adapter->query($sqlString)->execute(); } //Xóa quận, huyện của thành phố $sqlObj = new Sql($this->adapter); $deleteObj = $sqlObj->delete('city_district'); $deleteObj->where(new \Zend\Db\Sql\Predicate\In('city_id', array($arrParam['id']))); $sqlString = $sqlObj->getSqlStringForSqlObject($deleteObj); $this->adapter->query($sqlString)->execute(); } if ($options['task'] == 'delete-item-ward') { $sqlObj = new Sql($this->adapter); $deleteObj = $sqlObj->delete('city_district_ward'); $deleteObj->where(new \Zend\Db\Sql\Predicate\In('id', array($arrParam['id']))); $sqlString = $sqlObj->getSqlStringForSqlObject($deleteObj); $this->adapter->query($sqlString)->execute(); } if ($options['task'] == 'delete-item-district') { $sqlObj = new Sql($this->adapter); $deleteObj = $sqlObj->delete('city_district'); $deleteObj->where(new \Zend\Db\Sql\Predicate\In('id', array($arrParam['id']))); $sqlString = $sqlObj->getSqlStringForSqlObject($deleteObj); $this->adapter->query($sqlString)->execute(); //Xóa xã, phường của quận. huyện $deleteObj = $sqlObj->delete('city_district_ward'); $deleteObj->where(new \Zend\Db\Sql\Predicate\In('district_id', array($arrParam['id']))); $sqlString = $sqlObj->getSqlStringForSqlObject($deleteObj); $this->adapter->query($sqlString)->execute(); } }
public function accessDate($totalCounter) { //Select dữ liệu truy cập của ngày hôm đó $select = $this->sqlObj->select(); $select->from('statistics_access_date')->where('day = ' . $this->day)->where('month = ' . $this->month)->where('year = ' . $this->year); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = !empty($result) ? $result[0] : null; //Nếu chưa có dữ liệu truy cập của ngày hôm đó thì tiến hành insert tổng số truy cập , ngày, tháng, năm if (empty($result['total_counter'])) { $data = array('total_counter' => $totalCounter, 'day' => $this->day, 'month' => $this->month, 'year' => $this->year); $insertObj = $this->sqlObj->insert('statistics_access_date'); $insertObj->values($data); $sqlString = $this->sqlObj->getSqlStringForSqlObject($insertObj); $this->adapter->query($sqlString)->execute(); } else { //Ngược lại tiến hành update tổng lượt truy cập $data = array('total_counter' => $totalCounter); $updateObj = $this->sqlObj->update('statistics_access_date'); $updateObj->set($data); $updateObj->where('id = ' . $result['id']); $sqlString = $this->sqlObj->getSqlStringForSqlObject($updateObj); $this->adapter->query($sqlString)->execute(); } }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $row = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'username', 'fullname', 'email', 'birth')); $select->where->equalTo('id', $arrParam['id']); })->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-with-id') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('u' => 'user_ban'))->columns(array('nguyennhan')); $select->where('u.user_id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = !empty($result) ? $result[0] : ''; return $result; } if ($options['task'] == 'get-item-with-ip') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('u' => 'user_ban'))->columns(array('nguyennhan')); $select->where('u.ip = "' . $arrParam['ip'] . '"'); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = !empty($result) ? $result[0] : ''; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from(array('b' => 'business'))->columns(array('id', 'type_business', 'name', 'logo', 'address', 'city', 'district', 'ward', 'phone', 'fax', 'website', 'intro', 'contact', 'department', 'date_time', 'status', 'order', 'alias')); $select->join(array('ct' => 'city'), 'ct.id = b.city', array('name_city' => 'name'), $select::JOIN_LEFT); $select->join(array('ctd' => 'city_district'), 'ctd.id = b.district', array('name_district' => 'name'), $select::JOIN_LEFT); $select->join(array('ctdw' => 'city_district_ward'), 'ctdw.id = b.ward', array('name_ward' => 'name'), $select::JOIN_LEFT); $select->join(array('tb' => 'category'), 'tb.id = b.type_business', array('type_business' => 'name'), $select::JOIN_LEFT); if (!empty($arrParam['id'])) { $select->where('b.id =' . $arrParam['id']); } if (!empty($arrParam['alias'])) { $keywords = '%' . $arrParam['alias'] . '%'; $select->where->like('b.alias', $keywords); } $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-find-parent-cat') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('category')->columns(array('parent'))->where('id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); return $result; } if ($options == null) { $row = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'username', 'fullname', 'email', 'birth')); $select->where->equalTo('id', $arrParam['id']); })->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-statistic-service') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('users')->columns(array('id', 'info_service_account')); $select->where('id = ' . $arrParam); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'staff') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('users')->columns(array('id'))->where('parent = "' . $arrParam['id'] . '"'); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-city') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('city')->columns(array('id', 'name'))->where('id =' . $arrParam['cityid']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'get-item-district') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('city_district')->columns(array('id', 'name'))->where('id =' . $arrParam['iddistrict']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'category-frontend') { $result = $this->tableGateway->select(function (Select $select) use($arrParam) { $select->columns(array('id', 'name', 'description', 'left', 'right'))->where->equalTo('id', $arrParam['id']); })->current(); return $result; } if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'get-item-cat') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('category')->columns(array('name'))->where('type = "category_legislationhousing"')->where('id = ' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('l' => 'legislation_housing')); $select->where('l.id =' . $arrParam['id']); //echo $sqlString = $sqlObj->getSqlStringForSqlObject($select); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options['task'] == 'view-send') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('message_send'); $select->join(array('u' => 'users'), 'u.id = message_send.user_id_receive', array('fullname' => 'fullname'), $select::JOIN_LEFT); $select->where('message_send.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'view-receive') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('message_receive'); $select->join(array('u' => 'users'), 'u.id = message_receive.user_id_send', array('fullname' => 'fullname'), $select::JOIN_LEFT); $select->where('message_receive.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } if ($options['task'] == 'check-username') { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select()->from('users')->columns(array('id'))->where('username ="******"'); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); return $result; } return $row; }
public function getItem($arrParam = null, $options = null) { if ($options['task'] == 'get-item') { $row = $this->tableGateway->select(array('id' => $arrParam['id']))->current(); if (empty($row)) { return false; } } if ($options == null) { $sqlObj = new Sql($this->adapter); $select = $sqlObj->select(); $select->from(array('re' => 'real_estate'))->join(array('ct' => 'city'), 'ct.id = re.city', array('name_city' => 'name'), $select::JOIN_LEFT)->join(array('ctd' => 'city_district'), 'ctd.id = re.district', array('name_district' => 'name'), $select::JOIN_LEFT)->join(array('ctdw' => 'city_district_ward'), 'ctdw.id = re.ward', array('name_ward' => 'name'), $select::JOIN_LEFT)->join(array('retype' => 'category'), 'retype.id = re.cat_id', array('name_type' => 'name'), $select::JOIN_LEFT)->join(array('project' => 'project'), 'project.id = re.project', array('name_project' => 'name'), $select::JOIN_LEFT)->join(array('u' => 'users'), 'u.id = re.user_id', array('fullname', 'phone', 'avatar'), $select::JOIN_LEFT)->join(array('ju' => 'juridical'), 'ju.id = re.juridical', array('name_juridical' => 'name'), $select::JOIN_LEFT)->join(array('status' => 'real_estate_status'), 'status.id = re.status', array('name_status' => 'name'), $select::JOIN_LEFT); $select->where('re.id =' . $arrParam['id']); $result = \ZendVN\Db\Sql\Result::toArray($select, $this->adapter); $result = $result[0]; return $result; } return $row; }