public function get_profile() { session_start(); if (isset($_SESSION["email"]) && !empty($_SESSION["email"])) { $user = $this->getUserByEmail($_SESSION["email"]); if (empty($user)) { Auth::logout(); unset($_SESSION["email"]); return Redirect::to("/"); } $estados = new EstadosModel(); $municipios = $estados->get_temp(); return View::make("profile", array('user' => $user, "municipios" => $municipios)); } else { return Redirect::to("/"); } }
public function get_mascotaProfile($uuid, $mascotaid) { session_start(); try { if (isset($_SESSION["email"]) && !empty($_SESSION["email"])) { $user = new UsuariosController(); $userData = $user->getUserByEmail($_SESSION["email"]); $mascotaModel = new MascotaModel(); $mascotaData = $mascotaModel->mMascotaByUUID($mascotaid); $img = new ImageModel(); $images = $img->mGetByUUId($mascotaData["uuid"]); $eventObject = new CalendarioModel(); $events = $eventObject->mGetByUserUUID($mascotaData["uuid"]); $msg = new MensajesModel(); $messages = $msg->mGetAllByUser($mascotaid); $inbox = array(); if ($messages) { $userObject = new UsuariosModel(); $mascotaObject = new MascotaModel(); foreach ($messages as $key => $message) { $user_uuid = $userObject->getByuuid($message["from"]); if ($user_uuid) { $inbox[] = array("uuid" => $message["uuid"], "from" => $user_uuid["nombre"], "subject" => $message["subject"], "date" => $message["date"]); } else { $mascota = $mascotaObject->mMascotaByUUID($message["from"]); if ($mascota) { $inbox[] = array("uuid" => $message["uuid"], "from" => $mascota["nombre"], "subject" => $message["subject"], "date" => $message["date"]); } } } } $estados = new EstadosModel(); $municipios = $estados->get_temp(); return View::make("mascota-profile", array("user" => $userData, "mascota" => $mascotaData, "images" => $images, "events" => $events, "messages" => $inbox, "municipios" => $municipios)); } else { Auth::logout(); unset($_SESSION["email"]); return Redirect::to("/"); } } catch (exception $e) { echo $e; } }