Example #1
0
 public function RegisterRestaurantOwnerByAdminUser(array $data)
 {
     try {
         $form = $this->getAddRestaurantOwnerForm();
         $stateid = null;
         $regionid = null;
         $cityid = null;
         $regionBd = array();
         $cityBd = array();
         $ngbhBd = array();
         $restService = new Application_Service_Firm();
         if ($data['state']) {
             $stateid = $data['state'];
             $regionBd = $restService->GetRegionByStateId_($stateid);
             if ($data['region']) {
                 $regionid = $data['region'];
                 $cityBd = $restService->GetCityByRegionId_($regionid);
             }
         }
         if ($form->isValid($data)) {
             $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'))->setUserstatisid(1)->setRestaurantname($formData['restaurantName'])->setPhonenumber($formData['phone'])->setStateid($formData['state'])->setCityid($formData['city'])->setRegionid($formData['region'])->setWebsite($formData['website'])->setDescription($formData['description']);
             $storage = new Zend_Auth_Storage_Session();
             $data = $storage->read();
             $restaurantowner->setCompanyid($data['companyid']);
             $mapper = new User_Model_ManagerDataMapper();
             $res_own_id = $mapper->save($restaurantowner);
             $result = array('status' => true);
             return $result;
         } else {
             $formData = $form->getValues();
             $form->populate($data);
             if ($regionBd) {
                 $form->region->addMultiOptions($regionBd);
             }
             if ($cityBd) {
                 $form->city->addMultiOptions($cityBd);
             }
             $result = array('status' => false, 'form' => $form);
             return $result;
         }
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
Example #2
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());
     }
 }