Example #1
0
 public function UpdateResOwnerProfile($formData)
 {
     try {
         $restOwn = new User_Model_Manager();
         $restOwn->setId($formData->resownerId);
         $restOwn->setFristName(trim($formData->firstName));
         $restOwn->setLastName(trim($formData->lastName));
         $restOwn->setRestaurantname(trim($formData->restaurantName));
         $restOwn->setPhonenumber(trim($formData->phone));
         $restOwn->setCountryCode($formData->rescodetext);
         $restOwn->setTechfirstName($formData->techfirstName);
         $restOwn->setTechlastname($formData->techlastName);
         $restOwn->setTechemail($formData->techemail);
         $restOwn->setTechphone($formData->techphone);
         $restOwn->setTechcountrycode($formData->techrescodetext);
         $restOwn->setBilfirstName($formData->bilfirstName);
         $restOwn->setBillastname($formData->billastName);
         $restOwn->setbilemail($formData->bilemail);
         $restOwn->setBilphone($formData->bilphone);
         $restOwn->setBilcountrycode($formData->bilrescodetext);
         $mapper = new User_Model_ManagerDataMapper();
         $status = $mapper->update($restOwn);
         if ($status) {
             $result = array('status' => true);
         }
         return $result;
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
 public function createsubscribedfirmAction()
 {
     try {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $storage = new Zend_Auth_Storage_Session();
             $data = $storage->read();
             $this->_helper->layout()->setLayout('adminlayout');
             $request = $this->getRequest();
             /* Populating Restaurant owners */
             $resownerMapper = new User_Model_ManagerDataMapper();
             $resOwners = $resownerMapper->fetchAll();
             $this->view->resowners = $resOwners;
             $userservice = new Application_Service_Client();
             $form = $userservice->getRestaurantOwnerForm();
             $this->view->form = $form;
             //				$CountryCodeMapper = new Application_Model_CountryCodeDataMapper();
             //		    	$CountryCode = $CountryCodeMapper->fetchAll();
             //		    	$CodeList = array();
             //		    	$CodeList[] = array('key'=>'','value'=>'Select Country Flag');
             //		    	foreach($CountryCode as $listcode){
             //		    		$CodeList[] = array('key'=>$listcode->getCountry_dial_code(),'value'=>$listcode->getCountry_flag());
             //		    	}
             //		    	$this->view->codelist = $CodeList;
             if (isset($request->userid)) {
                 $data['restownerId'] = $request->userid;
                 $rsoMapper = new User_Model_ManagerDataMapper();
                 $table = $rsoMapper->getDbTable();
                 $select = $table->select();
                 $select->setIntegrityCheck(false);
                 $select->from($table, array('rsofk_salution', 'rsofirst_name', 'rsolast_name', 'rsophone', 'rsostateid', 'rsocityid', 'rsoregionid', 'rso_companyid', 'presid', 'defaultview'))->join(array('rd.restaurant_details'), 'resfk_user = rsofk_user', array('resid'))->where('rsofk_user = ?', $request->userid)->where('resstatus = ?', 1);
                 $row = $table->fetchRow($select);
                 if ($row->resid != null) {
                     if ($row->presid != null) {
                         $data['RestId'] = $row->presid;
                     } else {
                         $data['RestId'] = $row->resid;
                     }
                     $restNameByOwnObj = new FirmManagement_Model_FirmNamesByOwnerId();
                     $restNameByOwnObj->setRestOwnerId($request->userid);
                     $restMapper = new FirmManagement_Model_FirmDataMapper();
                     $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                     $data['restList'] = $restList;
                 } else {
                     $data['RestId'] = "";
                     $data['restList'] = "";
                 }
                 $storage->write($data);
                 if ($data['companyid'] != 6) {
                     return $this->_helper->redirector('addfirm', 'Firm', 'FirmManagement');
                 } else {
                     return $this->_helper->redirector('addroundmenufirm', 'Firm', 'FirmManagement');
                 }
             } else {
                 if ($this->getRequest()->isPost()) {
                     $result = $userservice->RegisterRestaurantOwner($this->getRequest()->getPost());
                     if ($result['status']) {
                         $data['restownerId'] = $result['userid'];
                         $storage->write($data);
                         if ($data['companyid'] != 6) {
                             return $this->_helper->redirector('addfirm', 'Firm', 'FirmManagement');
                         } else {
                             return $this->_helper->redirector('addroundmenufirm', 'Firm', 'FirmManagement');
                         }
                     } else {
                         if ($result['form']) {
                             $this->view->form = $result['form'];
                             $this->view->errors = $form;
                         }
                     }
                 }
             }
         } else {
             $this->_redirect($this->view->url(array('module' => 'User', 'controller' => 'Login', 'action' => 'signin'), 'login', true));
         }
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
Example #3
0
 public function manageLoginProfileWidget($userDet)
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     try {
         $db->beginTransaction();
         $table = $this->getDbTable();
         $select = $table->select();
         $select->setIntegrityCheck(false);
         $select->from(array('usr' => 'rd.user'), array('usrid', 'usremail', 'usrregistered_date', 'usruser_status_id', 'usrusertype_id', 'usrlast_login_date'))->where('usremail = ?', $userDet['email']);
         $usrRes = $table->fetchRow($select);
         $userTable = new User_Model_ClientDataMapper();
         if (!$usrRes) {
             $email = $userDet['email'];
             $length = 8;
             $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
             $password = "";
             for ($p = 0; $p < $length; $p++) {
                 $password .= $characters[mt_rand(0, strlen($characters))];
             }
             $randomdata = "";
             for ($p = 0; $p < $length; $p++) {
                 $randomdata .= $characters[mt_rand(0, strlen($characters))];
             }
             $passSha = sha1($password . $randomdata);
             $update = date('Y-m-d H:i:s');
             $user = array('usremail' => $userDet['email'], 'usrpassword' => $passSha, 'usrusertype_id' => 2, 'usrrole_id' => 4, 'usrregistered_date' => date('Y-m-d'), 'usruser_status_id' => 1, 'usrpassphrase' => $randomdata, 'usrcreateddatetime' => $update);
             $user_id = $userTable->getDbTable()->insert($user);
             //$cusMapper = new User_Model_GuestDataMapper();
             $customerTable = $this->getDbTable();
             $data = array('cusfk_user' => $user_id, 'cusfirst_name' => $userDet['first_name'], 'cuslast_name' => $userDet['last_name']);
             $customer_id = $customerTable->insert($data);
             $db->commit();
             /*$mailmapper = new Application_Service_Communication();
             		$mailObj = new Communication_Model_Mail();
             		$mailObj->setMsgCode('Customer_Confirmation');
             		$name = $userDet->name;
             		$data = array('UserName' => $name,
             					  'pass' => $password,
             					  'SenTo'    => $email);
             		$mailObj->setData($data);
             		$mailStatus = $mailmapper->SendMail($mailObj);
             		*/
             $usertype_Id = 2;
         } else {
             $user_id = $usrRes->usrid;
             $usertype_Id = $usrRes->usrusertype_id;
             $email = $usrRes->usremail;
         }
         /* Get Usertype from Usertype BaseData */
         $signupdate = null;
         $lastlogindate = null;
         /* Updating Users Last Login Date */
         if ($user_id) {
             $userTable->UpdateUserLoggedInDate($user_id);
         }
         if ($usrRes->usrregistered_date) {
             $signupdate = $usrRes->usrregistered_date;
         } else {
             $signupdate = date('Y-m-d');
         }
         if ($usrRes->usrlast_login_date) {
             $lastlogindate = $usrRes->usrlast_login_date;
         } else {
             $lastlogindate = '';
         }
         $userType = $userTable->getUsertype($usertype_Id);
         switch ($userType->code) {
             case 'CUS':
                 //$cusMapper = new User_Model_GuestDataMapper();
                 $table = $this->getDbTable();
                 $select = $table->select();
                 $select->from($table, array('cussalution', 'cusfirst_name', 'cuslast_name', 'custimezone', 'cusphone', 'cusmobile', 'cuscity_id', 'cusstate_id', 'cusregion_id'))->where('cusfk_user = ?', $user_id);
                 $row = $table->fetchRow($select);
                 $result = array('Email' => $email, 'Salution' => $row->cussalution, 'Firstname' => $row->cusfirst_name, 'LastName' => $row->cuslast_name, 'User_Id' => $user_id, 'Usertype' => $userType->code, 'Timezone' => $row->custimezone, 'State_Id' => $row->cusstate_id, 'City_Id' => $row->cuscity_id, 'Region_Id' => $row->cusregion_id, 'Phone' => $row->cusphone, 'cusmobile' => $row->cusmobile, 'companyid' => '', 'SignUpdate' => $signupdate, 'LastLoginDate' => $lastlogindate);
                 return $result;
                 break;
             case 'RSO':
                 $rsoMapper = new User_Model_ManagerDataMapper();
                 $table = $rsoMapper->getDbTable();
                 $select = $table->select();
                 $select->from($table, array('rsofk_salution', 'rsofirst_name', 'rsolast_name', 'rsophone', 'rsostateid', 'rsocityid', 'rsoregionid', 'rso_companyid', 'presid', 'defaultview'))->where('rsofk_user = ?', $user_id);
                 $row = $table->fetchRow($select);
                 if ($row->presid == null) {
                     $resMapper = new Restaurant_Model_RestaurantMapper();
                     $table = $resMapper->getDbTable();
                     $selectres = $table->select();
                     $selectres->from(array('rest' => 'rd.restaurant_details'), array('resid', 'resname', 'rescapacity', 'resreservation_system', 'res_status'))->where('resfk_user = ?', $user_id);
                     $newrow = $table->fetchRow($selectres);
                     $presid = $newrow->resid;
                     $mapper = new User_Model_ManagerDataMapper();
                 } else {
                     $presid = $row->presid;
                     $resMapper = new Restaurant_Model_RestaurantMapper();
                     $table = $resMapper->getDbTable();
                     $selectres = $table->select();
                     $selectres->from(array('rest' => 'rd.restaurant_details'), array('resid', 'resname', 'rescapacity', 'resreservation_system', 'res_status'))->where('resid = ?', $presid);
                     $newrow = $table->fetchRow($selectres);
                 }
                 $restNameByOwnObj = new Restaurant_Model_RestNamesByOwnerId();
                 $restNameByOwnObj->setRestOwnerId($user_id);
                 $restMapper = new Restaurant_Model_RestaurantMapper();
                 $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                 /* Reterieve Restaurant Owner Permission's */
                 // 						$permTypMapp = new Application_Model_PermissionsTypeDataMapper();
                 // 						$Permissions = $permTypMapp->getRestUserMenuBD();
                 $result = array('Email' => $email, 'User_Id' => $user_id, 'Usertype' => $userType->code, 'Salution' => $row->rsofk_salution, 'Firstname' => $row->rsofirst_name, 'LastName' => $row->rsolast_name, 'State_Id' => $row->rsostateid, 'City_Id' => $row->rsocityid, 'Region_Id' => $row->rsoregionid, 'SignUpdate' => $signupdate, 'LastLoginDate' => $lastlogindate, 'Phone' => $row->rsophone, 'companyid' => $row->rso_companyid, 'RestId' => $presid, 'DefaultView' => $row->defaultview, 'restList' => $restList);
                 return $result;
                 break;
             case 'ADM':
                 // 						$adminPermMapper = new Application_Model_AdminPermissionsTypeDataMapper();
                 // 						$permRowSet = $adminPermMapper->getAdminMenuBD();
                 $result = array('User_Id' => $user_id, 'Usertype' => $userType->code, 'companyid' => 1, 'restownerId' => "", 'RestId' => "");
                 return $result;
                 break;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
Example #4
0
 public function getLoginProfile($data)
 {
     try {
         /* Get Usertype from Usertype BaseData */
         $user_id = $data->usrid;
         $usertype_Id = $data->usrusertype_id;
         $email = $data->usremail;
         $signupdate = null;
         $lastlogindate = null;
         /* Updating Users Last Login Date */
         if ($user_id) {
             $this->UpdateUserLoggedInDate($user_id);
         }
         if ($data->usrregistered_date) {
             $signupdate = $data->usrregistered_date;
         }
         if ($data->usrlast_login_date) {
             $lastlogindate = $data->usrlast_login_date;
         }
         $userType = $this->getUsertype($usertype_Id);
         switch ($userType->code) {
             case 'CUS':
                 $cusMapper = new User_Model_GuestDataMapper();
                 $table = $cusMapper->getDbTable();
                 $select = $table->select();
                 $select->from($table, array('cussalution', 'cusfirst_name', 'cuslast_name', 'custimezone', 'cusphone', 'cusmobile', 'cuscity_id', 'cusstate_id', 'cusregion_id'))->where('cusfk_user = ?', $user_id);
                 $row = $table->fetchRow($select);
                 $result = array('Email' => $email, 'Salution' => $row->cussalution, 'Firstname' => $row->cusfirst_name, 'LastName' => $row->cuslast_name, 'User_Id' => $user_id, 'Usertype' => $userType->code, 'Timezone' => $row->custimezone, 'State_Id' => $row->cusstate_id, 'City_Id' => $row->cuscity_id, 'Region_Id' => $row->cusregion_id, 'Phone' => $row->cusphone, 'cusmobile' => $row->cusmobile, 'companyid' => '', 'SignUpdate' => $signupdate, 'LastLoginDate' => $lastlogindate);
                 return $result;
                 break;
             case 'RSO':
                 $rsoMapper = new User_Model_ManagerDataMapper();
                 $table = $rsoMapper->getDbTable();
                 $select = $table->select();
                 $select->from($table, array('rsofk_salution', 'rsofirst_name', 'rsolast_name', 'rsophone', 'rsostateid', 'rsocityid', 'rsoregionid', 'rso_companyid', 'presid', 'defaultview'))->where('rsofk_user = ?', $user_id);
                 $row = $table->fetchRow($select);
                 if ($row->presid == null) {
                     $resMapper = new Restaurant_Model_RestaurantMapper();
                     $table = $resMapper->getDbTable();
                     $selectres = $table->select();
                     $selectres->from(array('rest' => 'rd.restaurant_details'), array('resid', 'resname', 'rescapacity', 'resreservation_system', 'res_status'))->where('resfk_user = ?', $user_id);
                     $newrow = $table->fetchRow($selectres);
                     $presid = $newrow->resid;
                     $mapper = new User_Model_ManagerDataMapper();
                 } else {
                     $presid = $row->presid;
                     $resMapper = new Restaurant_Model_RestaurantMapper();
                     $table = $resMapper->getDbTable();
                     $selectres = $table->select();
                     $selectres->from(array('rest' => 'rd.restaurant_details'), array('resid', 'resname', 'rescapacity', 'resreservation_system', 'res_status'))->where('resid = ?', $presid);
                     $newrow = $table->fetchRow($selectres);
                 }
                 $restNameByOwnObj = new Restaurant_Model_RestNamesByOwnerId();
                 $restNameByOwnObj->setRestOwnerId($user_id);
                 $restMapper = new Restaurant_Model_RestaurantMapper();
                 $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                 /* Reterieve Restaurant Owner Permission's */
                 // 						$permTypMapp = new Application_Model_PermissionsTypeDataMapper();
                 // 						$Permissions = $permTypMapp->getRestUserMenuBD();
                 $result = array('Email' => $email, 'User_Id' => $user_id, 'Usertype' => $userType->code, 'Salution' => $row->rsofk_salution, 'Firstname' => $row->rsofirst_name, 'LastName' => $row->rsolast_name, 'State_Id' => $row->rsostateid, 'City_Id' => $row->rsocityid, 'Region_Id' => $row->rsoregionid, 'SignUpdate' => $signupdate, 'LastLoginDate' => $lastlogindate, 'Phone' => $row->rsophone, 'companyid' => $row->rso_companyid, 'RestId' => $presid, 'DefaultView' => $row->defaultview, 'restList' => $restList);
                 return $result;
                 break;
             case 'ADM':
                 // 						$adminPermMapper = new Application_Model_AdminPermissionsTypeDataMapper();
                 // 						$permRowSet = $adminPermMapper->getAdminMenuBD();
                 $result = array('User_Id' => $user_id, 'Usertype' => $userType->code, 'companyid' => 1, 'restownerId' => "", 'RestId' => "");
                 return $result;
                 break;
         }
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
Example #5
0
 public function EditSourceofRestaurant($request)
 {
     try {
         $obj = new User_Model_Manager();
         $source2 = $request->source_list;
         $obj->setSourceid($source2);
         $userid = $request->uid;
         $obj->setId($userid);
         $sourcedesc = $request->sourcedescription;
         $obj->setSourcedescription($sourcedesc);
         $rsetownerMapper = new User_Model_ManagerDataMapper();
         $status = $rsetownerMapper->EditSourceofRestaurant($obj);
         return $status;
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
Example #6
0
 /**
  * registration of Restaurant Owner
  * 
  * @param owner registration form data
  * @return status of registration completed or not
  */
 public function RegisterRestaurantOwner(array $data, $source = 'DD')
 {
     try {
         $form = $this->getRestaurantOwnerForm();
         $stateid = null;
         $regionid = null;
         $cityid = null;
         $regionBd = array();
         $cityBd = array();
         $ngbhBd = array();
         $restService = new Application_Service_Restaurant();
         if ($form->isValid($data)) {
             $storage = new Zend_Auth_Storage_Session();
             $userdata = $storage->read();
             $formData = $form->getValues();
             $restaurantowner = new User_Model_Manager();
             $restaurantowner->setFristName($formData['firstName'])->setLastName($formData['lastName'])->setEmail(strtolower($formData['emailAddress']))->setPassword($formData['password'])->setUsertypeid(3)->setRole(2)->setRegistereddate(date('Y-m-d H:i:s'))->setRestaurantname($formData['restaurantName'])->setPhonenumber($formData['phone'])->setCountryCode($formData['countryCode'])->setcity($formData['resownercity'])->setzipCode($formData['resownerzipcode'])->setSourceid($formData['source'])->setWebsite($formData['website'])->setSourcedescription($formData['sourcedescription'])->setDescription($formData['description'])->setDateofbirth($formData['dateofbirth']);
             if ($userdata['Usertype'] == "ADM" || $userdata['Usertype'] == "ADU" || $source == 'WIX') {
                 $restaurantowner->setUserstatisid(1);
             } else {
                 $restaurantowner->setUserstatisid(3);
             }
             if (isset($userdata['companyid'])) {
                 $restaurantowner->setCompanyid($userdata['companyid']);
             } else {
                 $restaurantowner->setCompanyid(1);
             }
             $mapper = new User_Model_ManagerDataMapper();
             $res_own_id = $mapper->save($restaurantowner, $source);
             if ($res_own_id) {
                 // 					$mailmapper = new Application_Service_Communication();
                 /* for E-mail
                 			$mailObj = new Communication_Model_Mail();
                 			//$mailObj->setMsgCode('ResOwnConf');
                 			
                 			$mailObj->setMsgCode('New Registration email');
                 			$name 		= $formData['firstName'].' '.$formData['lastName'];
                 								
                 			$data = array('name'=> $name,
                 						  'restname'=> $formData['restaurantName'],
                 						  'phone'	=> $formData['countryCode'].$formData['phone'],
                 						  'email'	=> strtolower($formData['emailAddress']),
                 				//		  'state'	=> $state,
                 						  'city'	=> $city,
                 						  'userid'	=> $formData['userid'],
                 						  'approval'=> $approval,
                                                                                 'uId'         => $res_own_id,
                 						  'disapproval'=>$disapproval,
                 						  'state'	=> $formData['resownercountry'],
                 						  'city'	=> $formData['resownercity'],
                 						  'desc'	=> $formData['description']);
                 			$mailObj->setData($data);
                 			$mailStatus = $mailmapper->SendMail($mailObj);
                 			*/
                 $result = array('status' => true, 'userid' => $res_own_id);
                 if ($source == 'DD') {
                     return $result;
                 } else {
                     return array('status' => true, 'result' => $res_own_id);
                 }
             }
         } else {
             $formData = $form->getValues();
             $form->populate($data);
             $result = array('status' => false, 'form' => $form);
             return $result;
         }
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }