示例#1
0
 /**
  * Retorna lista de usuários
  */
 public function getUserList()
 {
     $UserDAO = new UserDAO();
     return $UserDAO->getUsers();
 }
示例#2
0
 } elseif (isset($_GET['artistsignup'])) {
     if ($_SERVER['REQUEST_METHOD'] === "POST" && isset($_SESSION['user'])) {
         $logger->writeLog("Updating: " . $request_data->name);
         $fnHash = ArtistDAO::insertArtist($request_data->name, $request_data->bio, $request_data->twitter_id, $request_data->facebook_id, $request_data->google_id, $request_data->url, $request_data->instagram_id, $request_data->tumblr_id, $request_data->img_url, $request_data->img_file_path, $request_data->area, 0);
         if ($fnHash['ok']) {
             //get created artist
             $fnHash2 = ArtistDAO::getCreatedArtistId($request_data->name);
             if ($fnHash2['ok']) {
                 //link user to artist
                 $fnHash3 = ArtistDAO::createUserToArtistLink($fnHash2['result'], $_SESSION['user']);
                 //send email to requesting user
                 //send email to admin
                 if ($fnHash3['ok']) {
                     $userTypeHash = UserDAO::setUserAsArtistType($_SESSION['user']);
                     if ($userTypeHash['ok']) {
                         $userFnHash = UserDAO::getUsers($_SESSION['user']);
                         if ($userFnHash['ok']) {
                             $toUser = mail($userFnHash['result'][0]['email'], 'New SpireArtist Request', 'Thank you for your request! We will be contacting you soon.');
                             $toAdmin = mail('*****@*****.**', 'New SpireArtist Request', 'Request from user ' . $userFnHash['result'][0]['email'] . ' for new artist ' . $fnHash2['result'] . '-' . $request_data->name);
                             if ($toUser && $toAdmin) {
                                 JsonResponse::sendResponse(200, 'Email Sent to ' . $userFnHash['result'][0]['email']);
                             } else {
                                 if (!$toUser) {
                                     JsonResponse::sendResponse(400, 'Email Not Sent to ' . $userFnHash['result'][0]['email']);
                                 }
                                 if (!$toAdmin) {
                                     JsonResponse::sendResponse(400, 'Email Not Sent to admin');
                                 }
                             }
                         } else {
                             JsonResponse::sendResponse(400, $userFnHash['reason']);
 public function user()
 {
     $infosUser = new UserDAO();
     $infos = $infosUser->getInfoUser($_SESSION['idUser']);
     if ($infos['type'] == 'Admin') {
         $userView = new UserView();
         $managerUser = new UserDAO();
         if (isset($_GET['tri'])) {
             if ($_GET['tri'] == 'Admin') {
                 $mesUtilisateurs = $managerUser->getUsersByType($_GET['tri']);
             } else {
                 if ($_GET['tri'] == 'Professeur') {
                     $mesUtilisateurs = $managerUser->getUsersByType($_GET['tri']);
                 } else {
                     if ($_GET['tri'] == 'Etudiant') {
                         $mesUtilisateurs = $managerUser->getUsersByType($_GET['tri']);
                     } else {
                         $mesUtilisateurs = $managerUser->getUsers();
                     }
                 }
             }
         } else {
             $mesUtilisateurs = $managerUser->getUsers();
         }
         echo $userView->getView($mesUtilisateurs);
     } else {
         $_SESSION['error'] = 'Vous n\'avez pas les droits requis pour accéder à cette page';
         $_SESSION['display_msg_error'] = true;
         $this->profile();
     }
 }