예제 #1
0
 public function addPartyRel($args)
 {
     $noOfPeopleArr = $args['noOfPeople'];
     $avgTimeArr = $args['avgTime'];
     $bufferTimeArr = $args['bufferTime'];
     $restId = $args['rest_id'];
     $dbObj = new DbConnc(DB_URL);
     $error = false;
     $return = array();
     foreach ($noOfPeopleArr as $key => $noOfPeople) {
         $eligibleTableKey = $key + 1;
         if (!empty($noOfPeopleArr[$key]) && !empty($avgTimeArr[$key]) && !empty($bufferTimeArr[$key]) && !empty($args['eligibleTableOpts_' . $eligibleTableKey])) {
             $eligibleTables = implode(",", $args['eligibleTableOpts_' . $eligibleTableKey]);
             $insertSql = "";
             $insertSql = 'insert into tbl_party_rest_relation (rest_id,no_of_people,eligible_tables,avg_time,buffer_time,created_on) values(' . $restId . ',' . $noOfPeople . ',"' . $eligibleTables . '",' . $avgTimeArr[$key] . ',' . $bufferTimeArr[$key] . ',' . time() . ')';
             $return['sql'][] = $insertSql;
             if (!$dbObj->db_query($insertSql)) {
                 $error = true;
                 break;
             }
         }
     }
     $dbObj->db_close();
     if (!$error) {
         $return['status'] = 1;
     } else {
         $return['status'] = 0;
         $return['errMsg'] = "Could not execute query";
     }
     return $return;
 }
예제 #2
0
 public function getPerformanceData($restId)
 {
     $return = array();
     $dbObj = new DbConnc(DB_URL);
     $currentTime = time();
     $currentDayStart = $dayStartTime = strtotime(date('Y-m-d') . '10:00:00');
     $yesterdayStart = strtotime(date("Y-m-d", strtotime("yesterday")) . "10:00:00");
     $thisWeekMonday = strtotime(date("Y-m-d", strtotime("monday this week")) . "10:00:00");
     $lastWeekMonday = strtotime(date("Y-m-d", strtotime("monday last week")) . "10:00:00");
     $todayData = $yesterdayData = $thisWeekData = $lastWeekData = array();
     $getLastWeekFeedback = "select booking_id,ambience,food_qaulity,staff_friendly,cleanliness,service_speed,recommend,created_on from tbl_feedback where created_on >= " . $lastWeekMonday;
     //echo $getLastWeekFeedback; exit;
     if ($dbObj->db_query($getLastWeekFeedback)) {
         if ($dbObj->num_rows > 0) {
             while ($rows = $dbObj->db_fetch_array()) {
                 $data = array("bookingId" => $rows['booking_id'], "ambience" => $rows['ambience'], "foodQuality" => $rows['food_qaulity'], "staffFriendly" => $rows['staff_friendly'], "cleanliness" => $rows['cleanliness'], "serviceSpeed" => $rows['service_speed'], "recommend" => $rows['recommend']);
                 if ($rows['created_on'] >= $currentDayStart && $rows['created_on'] <= $currentTime) {
                     $todayData[] = $data;
                 }
                 if ($rows['created_on'] >= $yesterdayStart && $rows['created_on'] < $currentDayStart) {
                     $yesterdayData[] = $data;
                 }
                 if ($rows['created_on'] >= $thisWeekMonday && $rows['created_on'] <= $currentTime) {
                     $thisWeekData[] = $data;
                 }
                 if ($rows['created_on'] >= $lastWeekMonday && $rows['created_on'] < $thisWeekMonday) {
                     $lastWeekData[] = $data;
                 }
             }
         } else {
             $return['status'] = "fail";
             $return['errMsg'] = "No data found";
         }
         //ppr($todayData);ppr($yesterdayData);ppr($thisWeekData);ppr($lastWeekData);exit;
         $todayScore = $yesterdayScore = $thisWeekScore = $lastWeekScore = array("ambience" => 0, "foodQuality" => 0, "staffFriendly" => 0, "cleanliness" => 0, "serviceSpeed" => 0, "npsScore" => 0);
         //For Today's Performance
         if (!empty($todayData)) {
             $todayScore = $this->getRatingAvgNpsScore($todayData);
         }
         if (!empty($yesterdayData)) {
             $yesterdayScore = $this->getRatingAvgNpsScore($yesterdayData);
         }
         if (!empty($thisWeekData)) {
             $thisWeekScore = $this->getRatingAvgNpsScore($thisWeekData);
         }
         if (!empty($lastWeekData)) {
             $lastWeekScore = $this->getRatingAvgNpsScore($lastWeekData);
         }
         $return['todayScore'] = $todayScore;
         $return['yesterdayScore'] = $yesterdayScore;
         $return['thisWeekScore'] = $thisWeekScore;
         $return['lastWeekScore'] = $lastWeekScore;
         $return['status'] = "success";
     } else {
         $return['status'] = "fail";
         $return['errMsg'] = "There seems to be some problem. Please try again later";
     }
     //ppr($return);exit;
     return $return;
 }
예제 #3
0
 public function getUser($userId)
 {
     $dbObj = new DbConnc(DB_URL);
     $userDtls = array();
     $getUser = "******";
     if ($dbObj->db_query($getUser)) {
         $rows = $dbObj->db_fetch_array();
         $userDtls['userId'] = $userId;
         $userDtls['userEmail'] = $rows['user_email'];
         $userDtls['userType'] = $rows['user_type'];
         $userDtls['restId'] = $rows['rest_id'];
         return $userDtls;
     } else {
         return false;
     }
 }