public function init() { $stateMapper = new Application_Model_CountrybdMapper(); $states = $stateMapper->fetchAll(); $stateList = array(); $stateList[] = array('key' => '', 'value' => 'Select Country'); foreach ($states as $state) { $stateList[] = array('key' => $state->getId(), 'value' => $state->getDescription()); } $stateList[] = array('key' => 'find', 'value' => 'cant find your Country'); foreach ($sources as $source) { $sourceList[] = array('key' => $source->getId(), 'value' => $source->getDescription()); } $cityMapper = new Application_Model_CitybdMapper(); $citys = $cityMapper->fetchAll(); $cityList = array(); $cityList[] = array('key' => '', 'value' => 'Select City'); foreach ($citys as $city) { $cityList[] = array('key' => $city->getId(), 'value' => $city->getDescription()); } $cityList[] = array('key' => 'find', 'value' => 'cant find your City'); $emailAddress = $this->createElement('text', 'resemail'); $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '40')->setAttrib('title', 'Email Address')->setAttrib('placeholder', 'Email Address*')->addValidator('NotEmpty', true, array('messages' => 'Please enter your EmailAddress.'))->addValidator('EmailAddress', false, array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'Please enter a valid Host Name')))->addErrorMessage('Pleaes Enter Valid Email Address')->addFilters(array('StringTrim'))->setValue('')->addFilter('StringToLower')->setRequired(true); $rastaurantname = $this->createElement('text', 'resname'); $rastaurantname->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '225')->setAttrib('title', 'Restaurant/Group')->setAttrib('placeholder', 'Restaurant/Group*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter RestaurantName.'))))->setvalue('')->setrequired(true); $resid = $this->createElement('text', 'resid'); $resid->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '225')->setAttrib('title', 'Restaurant/Group')->setAttrib('placeholder', 'Restaurant/Group*')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter RestaurantName.'))))->setvalue('')->setrequired(true); $region = $this->createElement('select', 'reslocation_id'); $region->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'State')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select Region.'))))->setRegisterInArrayValidator(false)->setRequired(false); $country = $this->createElement('select', 'rescountry_id'); $country->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'Country')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select State.'))))->addMultiOptions($stateList)->setRequired(false); $city = $this->createElement('select', 'rescity_id'); $city->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1')->setAttrib('title', 'City')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select City.'))))->addMultiOptions($citymapperList)->setRequired(false); $this->addElements(array($resid, $restuarantname, $emailAddress, $country, $city, $region)); }
public function updateCityBdm($request) { try { $action = $request->perform; $data = array(); foreach ($request->data as $value) { $data[$value['name']] = $value['value']; } $cityMapper = new Application_Model_CitybdMapper(); switch ($action) { case "append": $code = $data['code']; $iscity = $cityMapper->verifyCode($code, 0); if ($iscity) { $status = $cityMapper->addCity($data); return $status; } else { return 'f'; } break; case "update": $status = $cityMapper->updateCity($data); return $status; break; } } catch (Exception $ex) { Rdine_Logger_FileLogger::info($ex->getMessage()); throw new Exception($ex->getMessage()); } }
public function manageRestaurantOwners(User_Model_RestOwnSearch $obj, $offset) { try { $limit = 20; $table = $this->getDbTable(); $select = $table->select(); $select->setIntegrityCheck(false); $stateTableMapper = new Application_Model_StatebdMapper(); $stateTable = $stateTableMapper->getDbTable(); $stateTableSelect = $stateTable->select(); $stateTableSelect->from($stateTable, array('id', 'code', 'description'))->where('status = ?', true); $cityTableMapper = new Application_Model_CitybdMapper(); $cityTable = $cityTableMapper->getDbTable(); $cityTableSelect = $cityTable->select(); $cityTableSelect->from($cityTable, array('id', 'code', 'description'))->where('status = ?', true); $storage = new Zend_Auth_Storage_Session(); $userdata = $storage->read(); $select->from(array('usr' => 'rd.user'), array('usrid', 'usremail', 'usrregistered_date', 'usruser_status_id', 'usrusertype_id', 'usripaddress'))->joinLeft(array('res' => 'rd.restaurant_details'), 'usr.usrid = res.resfk_user', array(''))->distinct()->join(array('own' => 'rd.restaurant_owner'), 'own.rsofk_user = usr.usrid', array('rsofirst_name', 'rsolast_name', 'rsorestaurant_name', 'rsophone', 'rsostateid', 'rsocityid', 'rsodescription', 'rsoregionid', 'rsocantfind', 'rsoyourstate', 'rsoyourregion', 'rsoyourcity', 'rso_companyid'))->join(array('usrsts' => 'rd.userstatus_bd'), 'usrsts.id = usr.usruser_status_id', array('code as statuscode', 'description as statusdesc'))->where('usr.usrusertype_id = ?', 3); if ($obj->getCompany()) { $select->where('own.rso_companyid = ?', $obj->getCompany()); } else { if ($userdata['Usertype'] == "ADU" && $userdata['companyid'] != 1) { $select->where('own.rso_companyid = ?', $userdata['companyid']); } } if ($obj->getResName()) { $select->where('res.resname Ilike ?', '%' . trim($obj->getResName()) . '%'); } if ($obj->getEmail()) { $select->where('usr.usremail Ilike ?', '%' . trim($obj->getEmail()) . '%'); } if ($obj->getId()) { $select->where('usr.usrid = ?', $obj->getId()); } if ($obj->getStatusId()) { $select->where('usr.usruser_status_id = ?', $obj->getStatusId()); } if ($obj->getFirstname()) { $select->where('own.rsofirst_name Ilike ?', '%' . trim($obj->getFirstname()) . '%'); } if ($obj->getLastname()) { $select->where('own.rsolast_name Ilike ?', '%' . trim($obj->getLastname()) . '%'); } if ($obj->getStateid()) { $select->where('own.rsostateid = ?', $obj->getStateid()); } if ($obj->getRegionid()) { $select->where('own.rsoregionid = ?', $obj->getRegionid()); } if ($obj->getCityid()) { $select->where('own.rsocityid = ?', $obj->getCityid()); } $select->order('usr.usrregistered_date DESC'); $result = $table->fetchAll($select); //print_r($result);die(); $rowset = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select)); $rowset->setItemCountPerPage($limit); $rowset->setCurrentPageNumber($offset); return $rowset; } catch (Exception $ex) { throw new Exception($ex->getMessage()); } }
public function getRouteDetails() { try { $arrData = array(); $cityMapper = new Application_Model_CitybdMapper(); $arrData['cities'] = array(); $cdata = $cityMapper->fetchRequiredData(array('id', 'description')); foreach ($cdata as $value) { $arrData['cities'][str_replace(" ", "_", strtolower($value['description']))] = $value['id']; } $locationmapper = new Application_Model_LocationboundariesMapper(); $arrData['locations'] = array(); $ldata = $locationmapper->fetchRequiredData(array('id', 'description')); foreach ($ldata as $value) { $arrData['locations'][str_replace(" ", "_", strtolower($value['description']))] = $value['id']; } $resMapper = new Restaurant_Model_RestaurantMapper(); $resdata = $resMapper->fetchRequiredData(array('resid', 'resvanity_url')); $arrData['restaurants'] = array(); foreach ($resdata as $value) { $arrData['restaurants'][$value['resvanity_url']] = $value['resid']; } return $arrData; } catch (Exception $ex) { Rdine_Logger_FileLogger::info($ex->getMessage()); throw new Exception($ex->getMessage()); } }