public function getUserTrips() { $email = SessionHandler::getSessionValue('email'); $trip = new Trip(); $rawData = $trip->getUserTrips($email); $this->emitResponse($rawData, 'trip', "Unable to get trip info "); }
public function getUpdate($name, $surname, $locality, $email, $password, $id) { $user = new User(); $rawData = $user->updateUser($name, $surname, $locality, $email, $password, $id); if ($rawData > 0) { SessionHandler::addToSession('email', $email); } else { $rawData = null; } $this->emitResponse($rawData, 'user', "Unable to update information "); }
public function getEmailInfo($tripId, $from, $to, $date) { $st = $this->_conn->getHandler()->prepare("\n SELECT \n Trip.fromPlace, Trip.toPlace, Trip.pickupDate, Trip.returnDate,\n User.email, User.name\n FROM\n Trip \n JOIN User ON User.email = Trip.user\n WHERE\n Trip.id = :tripId"); $st->bindParam(':tripId', $tripId); $st->execute(); $tripInfo = $st->fetch(PDO::FETCH_OBJ); $st2 = $this->_conn->getHandler()->prepare("\n SELECT User.name, User.surname, User.email FROM User WHERE User.email = :userEmail"); $userEmail = SessionHandler::getSessionValue('email'); $st2->bindParam(':userEmail', $userEmail); $st2->execute(); $userInfo = $st2->fetch(PDO::FETCH_OBJ); $emailString = <<<EMAIL Dear {$tripInfo->name}, This is a message from MaltaTrip. You offered a trip on MaltaTrip from {$tripInfo->fromPlace} to {$tripInfo->toPlace} on {$tripInfo->pickupDate} returning {$tripInfo->returnDate}. {$userInfo->name} {$userInfo->surname} would like a ride with you from {$from} to {$to} on {$date}. If you are still available, please reply to this e-mail and confirm details with this user. Remember to arrange a pick-up point and a date and time. Giving the person your mobile number may help too, but this is at your discretion. Regards, MaltaTrip Team EMAIL; $resObject = new \stdClass(); $resObject->from = $userInfo->email; $resObject->to = $tripInfo->email; $resObject->subject = "Ride request from MaltaTrip"; $resObject->body = $emailString; return $resObject; }