Beispiel #1
0
 public function updateRestaurantStatus($request)
 {
     try {
         $restaurantMapper = new Restaurant_Model_RestaurantMapper();
         $value = $request->getPost('data');
         $toUpdate;
         $returnStatus;
         if ($value == 1) {
             $toUpdate = 2;
         } else {
             $toUpdate = 1;
         }
         $data = array("res_status" => $toUpdate);
         $resid = $request->getPost("updateId");
         $result = $restaurantMapper->updateRestaurantDetails($data, $resid);
         if ($result == 1) {
             return $toUpdate;
         } else {
             return false;
         }
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
Beispiel #2
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());
     }
 }
Beispiel #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());
     }
 }
Beispiel #4
0
 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());
     }
 }