当前位置: 首页>>代码示例>>PHP>>正文


PHP UserDB::getSearchUsers方法代码示例

本文整理汇总了PHP中UserDB::getSearchUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDB::getSearchUsers方法的具体用法?PHP UserDB::getSearchUsers怎么用?PHP UserDB::getSearchUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserDB的用法示例。


在下文中一共展示了UserDB::getSearchUsers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post

 public static function post()
 {
     //If required data is not in session go to search page
     if (!isset($_SESSION['Stippers']['ManageUserSearch']['inputData']['values'])) {
         header('Location: manageuser', TRUE, 303);
     } else {
         $page = new Page();
         $page->data['title'] = 'E-mail versturen naar gebruikers';
         $errMsgs = SendEmailToUsersViewValidator::validate($_POST);
         if (empty($errMsgs)) {
             try {
                 //Get search users
                 $select = ['email' => true, 'firstName' => true, 'lastName' => true];
                 $users = array_column(UserDB::getSearchUsers($select, $_SESSION['Stippers']['ManageUserSearch']['inputData']['values'], null), 'user');
                 //Send email
                 $failedAddresses = Email::sendEmails($_POST['email_file'], $_POST['subject'], EmailConfig::FROM_ADDRESS, $users, null);
                 //Check if some emails failed
                 if (empty($failedAddresses)) {
                     $page->date['SuccessMessageNoDescriptionWithLinkView']['successTitle'] = 'E-mails succesvol verzonden';
                     $page->date['SuccessMessageNoDescriptionWithLinkView']['redirectUrl'] = 'manageuser';
                     $page->addView('success/SuccessMessageNoDescriptionWithLinkView');
                 } else {
                     $page->data['ErrorMessageWithDescriptionNoLinkView']['errorTitle'] = 'Kan niet alle e-mails verzenden';
                     $page->data['ErrorMessageWithDescriptionNoLinkView']['errorDescription'] = 'Het verzenden van de e-mail naar onderstaande addressen is mislukt.';
                     $page->addView('error/ErrorMessageWithDescriptionNoLinkView');
                     $page->data['FailedEmailListView']['addresses'] = $failedAddresses;
                     $page->data['FailedEmailListView']['redirectUrl'] = 'manageuser';
                     $page->addView('sendEmailToUsers/FailedEmailListView');
                 }
             } catch (UserDBException $ex) {
                 $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan gebruikers niet ophalen';
                 $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
                 $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
             } catch (EmailException $ex) {
                 if ($ex->getCode() == EmailException::CANNOTREADEMAILFILE) {
                     $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan e-mailbestand niet lezen';
                 } else {
                     $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan e-mails niet verzenden';
                 }
                 $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
                 $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
             } catch (Exception $ex) {
                 $page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan e-mails niet verzenden';
                 $page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
                 $page->addView('error/ErrorMessageNoDescriptionWithLinkView');
             }
         } else {
             $page->addView('sendEmailToUsers/SendEmailToUsersTitleView');
             SendEmailToUsersController::buildSendEmailToUsersFormView($page, true);
             $page->data['SendEmailToUsersFormView']['errMsgs'] = array_merge($page->data['SendEmailToUsersFormView']['errMsgs'], $errMsgs);
         }
         $page->showWithMenu();
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:54,代码来源:SendEmailToUsersController.php

示例2: loadSearchResults

 /**
  * Get search results and load the data into the page.
  * 
  * @param Page $page
  */
 private static function loadSearchResults($page)
 {
     try {
         $users = UserDB::getSearchUsers(['firstName' => true, 'lastName' => true, 'email' => true], ['firstName' => $_POST['first_name'], 'lastName' => $_POST['last_name'], 'email' => $_POST['email']], null);
         if (count($users) == 0) {
             $page->addView('userSearch/UserSearchNoResultsView');
         } else {
             $page->data['RenewUserSearchResultsView']['users'] = $users;
             $page->addView('addRenewUser/renewUserSearch/RenewUserSearchResultsView');
         }
     } catch (Exception $ex) {
         $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan gebruikers niet ophalen.';
         $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:20,代码来源:RenewUserSearchController.php

示例3: get

 public static function get()
 {
     try {
         //Get search results
         $searchUsers = UserDB::getSearchUsers($_SESSION['Stippers']['ManageUserSearch']['inputData']['show'], $_SESSION['Stippers']['ManageUserSearch']['inputData']['values'], $_SESSION['Stippers']['ManageUserSearch']['inputData']['options']);
         $csvString = '';
         //If there are results we build the csv string
         if (count($searchUsers) > 0) {
             //Create headers
             $csvString .= '#';
             if (isset($searchUsers[0]['user']->lastName)) {
                 $csvString .= ';Achternaam';
             }
             if (isset($searchUsers[0]['user']->firstName)) {
                 $csvString .= ';Voornaam';
             }
             if (isset($searchUsers[0]['membershipYear'])) {
                 $csvString .= ';Lidjaar';
             }
             if (isset($searchUsers[0]['cardNumber'])) {
                 $csvString .= ';Kaartnummer';
             }
             if (isset($searchUsers[0]['user']->street)) {
                 $csvString .= ';Straat';
             }
             if (isset($searchUsers[0]['user']->houseNumber)) {
                 $csvString .= ';Huisnummer';
             }
             if (isset($searchUsers[0]['user']->city)) {
                 $csvString .= ';Gemeente';
             }
             if (isset($searchUsers[0]['user']->postalCode)) {
                 $csvString .= ';Postcode';
             }
             if (isset($searchUsers[0]['user']->country)) {
                 $csvString .= ';Land';
             }
             if (isset($searchUsers[0]['user']->email)) {
                 $csvString .= ';E-mail';
             }
             if (isset($searchUsers[0]['user']->phone)) {
                 $csvString .= ';Telefoonnummer';
             }
             if (isset($searchUsers[0]['user']->dateOfBirth)) {
                 $csvString .= ';Geboortedatum';
             }
             if (isset($searchUsers[0]['user']->balance)) {
                 $csvString .= ';Saldo';
             }
             if (isset($searchUsers[0]['user']->creationTime)) {
                 $csvString .= ';Registratietijd';
             }
             if (isset($searchUsers[0]['nCheckIns'])) {
                 $csvString .= ';Aantal check-ins';
             }
             if (isset($searchUsers[0]['user']->isAdmin)) {
                 $csvString .= ';Administrator';
             }
             if (isset($searchUsers[0]['user']->isUserManager)) {
                 $csvString .= ';Gebruikersbeheerder';
             }
             if (isset($searchUsers[0]['user']->isBrowserManager)) {
                 $csvString .= ';Browserbeheerder';
             }
             if (isset($searchUsers[0]['user']->isMoneyManager)) {
                 $csvString .= ';Geldbeheerder';
             }
             //Add data rows
             for ($i = 0; $i < count($searchUsers); $i++) {
                 $csvString .= PHP_EOL . $i;
                 if (isset($searchUsers[$i]['user']->lastName)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->lastName;
                 }
                 if (isset($searchUsers[$i]['user']->firstName)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->firstName;
                 }
                 if (isset($searchUsers[$i]['membershipYear'])) {
                     $csvString .= ';' . $searchUsers[$i]['membershipYear'];
                 }
                 if (isset($searchUsers[$i]['cardNumber'])) {
                     $csvString .= ';' . $searchUsers[$i]['cardNumber'];
                 }
                 if (isset($searchUsers[$i]['user']->street)) {
                     $csvString .= ';Straat';
                 }
                 if (isset($searchUsers[$i]['user']->houseNumber)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->houseNumber;
                 }
                 if (isset($searchUsers[$i]['user']->city)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->city;
                 }
                 if (isset($searchUsers[$i]['user']->postalCode)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->postalCode;
                 }
                 if (isset($searchUsers[$i]['user']->country)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->country;
                 }
                 if (isset($searchUsers[$i]['user']->email)) {
                     $csvString .= ';' . $searchUsers[$i]['user']->email;
                 }
//.........这里部分代码省略.........
开发者ID:JHDeStip,项目名称:Stippers,代码行数:101,代码来源:DownloadSearchResultsController.php

示例4: post

 public static function post()
 {
     $page = new Page();
     $page->data['title'] = 'Inchecken';
     $errMsgs = CheckInFormViewValidator::validate($_POST);
     $user = null;
     if (empty($errMsgs)) {
         $checkInOk = false;
         $weeklyWinnerOk = true;
         //Get user to check in
         try {
             //Get the user who's card number for this year was entered
             $user = UserDB::getBasicUserByCardNumber($_POST['card_number']);
         } catch (Exception $ex) {
             //Check-in failed (can't get user)
             CheckInController::buildCheckInFormView($page, true);
             $page->data['CheckInFormView']['errMsgs']['global'] = '<h2 class="error_message" id="check_in_form_error_message">Kan gebruiker niet inchecken, probeer het opnieuw.</h2>';
             $page->showWithMenu();
             exit;
         }
         if (!$user) {
             //There's no user for this card
             CheckInController::buildCheckInFormView($page, true);
             $page->data['CheckInFormView']['errMsgs']['global'] = '<h2 class="error_message" id="check_in_form_error_message">Dit kaartnummer is niet gekoppeld aan een gebruiker.</h2>';
             $page->showWithMenu();
             exit;
         } else {
             //Check user in
             try {
                 $checkInOk = CheckInDB::checkIn($user->userId);
             } catch (Exception $ex) {
                 //Check-in failed (something went wrong or check-in isn't valid)
                 CheckInController::buildCheckInFormView($page, true);
                 $page->data['CheckInFormView']['errMsgs']['global'] = '<h2 class="error_message" id="check_in_form_error_message">Kan gebruiker niet inchecken, probeer het opnieuw.</h2>';
                 $page->showWithMenu();
                 exit;
             }
         }
         if (!$checkInOk) {
             //The user has already checked in
             CheckInController::buildCheckInFormView($page, true);
             $page->data['CheckInFormView']['errMsgs']['global'] = '<h2 class="error_message" id="check_in_form_error_message">Deze gebruiker is de voorbije 12 uur al ingechecked.</h2>';
             $page->showWithMenu();
             exit;
         } else {
             //Check in successful, check whether he is the winner of the week
             $isWinner = false;
             try {
                 //Check if this user is the winner of the week
                 $weeklyWinnerData = WeeklyWinnerDB::getThisWeeksWinnerData();
                 $isWinner = $weeklyWinnerData && $weeklyWinnerData->userId == $user->userId && !$weeklyWinnerData->hasCollectedPrize;
                 //If he is the winner we set in the database that the user collected his prize
                 if ($isWinner) {
                     $newWeeklyWinnerData = new WeeklyWinnerData($weeklyWinnerData->startOfWeek, $weeklyWinnerData->userId, true);
                     WeeklyWinnerDB::updateWeeklyWinnerData($weeklyWinnerData, $newWeeklyWinnerData);
                 }
             } catch (Exception $ex) {
                 $weeklyWinnerOk = false;
             }
             //If he is the winner, add the winner views and try to send an email to all usermanagers
             if ($isWinner) {
                 $page->addView('checkIn/CheckInWeeklyWinnerTitleView');
                 CheckInController::buildCheckInSuccessfulView($page, $user);
                 try {
                     $select = array('email' => true);
                     $searchFilter = array('isUserManager' => true);
                     $searchUsers = UserDB::getSearchUsers($select, $searchFilter, null);
                     $extras['common']['winnerFirstName'] = $user->firstName;
                     $extras['common']['winnerLastName'] = $user->lastName;
                     $failedAddresses = Email::sendEmails('WeeklyWinnerNotification.html', 'Winnaar van de week', EmailConfig::FROM_ADDRESS, array_column($searchUsers, 'user'), $extras);
                     if (!empty($failedAddresses)) {
                         $page->data['ErrorMessageWithDescriptionNoLinkView']['errorTitle'] = 'Kan e-mail niet versturen.';
                         $page->data['ErrorMessageWithDescriptionNoLinkView']['description'] = 'Kan geen e-mail versturen naar het bestuur om te laten weten dat je gewonnen hebt. Meld dit even aan een tapper of bestuurslid.';
                         $page->addView('error/ErrorMessageWithDescriptionNoLinkView');
                     }
                 } catch (Exception $ex) {
                     $page->data['ErrorMessageWithDescriptionNoLinkView']['errorTitle'] = 'Kan e-mail niet versturen.';
                     $page->data['ErrorMessageWithDescriptionNoLinkView']['errorDescription'] = 'Kan geen e-mail versturen naar het bestuur om te laten weten dat je gewonnen hebt. Meld dit even aan een tapper of bestuurslid.';
                     $page->addView('error/ErrorMessageWithDescriptionNoLinkView');
                 }
                 $page->addView('checkIn/CheckInWeeklyWinnerImageView');
                 $page->showWithMenu();
             } else {
                 $page->addView('checkIn/CheckInSuccessfulTitleView');
                 CheckInController::buildCheckInSuccessfulView($page, $user);
                 if (!$weeklyWinnerOk) {
                     $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan niet controleren of je de winnaar van de week bent.';
                     $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
                 } else {
                     $page->addExtraJsFile('views/checkIn/CheckInRedirector.js');
                     $page->addExtraJsFile('views/checkIn/checkInSuccessfulOnLoadHandler.js');
                 }
                 $page->showWithMenu();
             }
         }
     } else {
         //Errors in the form, retry
         CheckInController::buildCheckInFormView($page, true);
         $page->data['CheckInFormView']['errMsgs'] = array_merge($page->data['CheckInFormView']['errMsgs'], $errMsgs);
         $page->showWithMenu();
//.........这里部分代码省略.........
开发者ID:JHDeStip,项目名称:Stippers,代码行数:101,代码来源:CheckInController.php

示例5: loadSearchResults

 /**
  * Get search results and load the data into the page.
  * 
  * @param Page $page
  */
 private static function loadSearchResults($page)
 {
     try {
         $users = UserDB::getSearchUsers($_SESSION['Stippers']['ManageUserSearch']['inputData']['show'], $_SESSION['Stippers']['ManageUserSearch']['inputData']['values'], $_SESSION['Stippers']['ManageUserSearch']['inputData']['options']);
         if (count($users) == 0) {
             $page->addView('userSearch/UserSearchNoResultsView');
         } else {
             $page->data['UserSearchResultsView']['users'] = $users;
             $page->addView('userSearch/UserSearchResultsView');
         }
     } catch (Exception $ex) {
         $page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kan gebruikers niet ophalen.';
         $page->addView('error/ErrorMessageNoDescriptionNoLinkView');
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:20,代码来源:ManageUserController.php

示例6: post

 public static function post()
 {
     //Get the request body as json
     $checkInRequest = json_decode(file_get_contents('php://input'));
     //Check if the json was valid and a card number is given
     if (!$checkInRequest || !isset($checkInRequest->cardNumber)) {
         header('HTTP/1.1 400 Bad Request');
     } else {
         //Create response object
         $response = new APICheckInResponse();
         //Check if the card number is valid
         if (!CheckInController::validateCardNumber($checkInRequest->cardNumber)) {
             $response->errorCode = APICheckInResponse::MALFORMED_CARDNUMBER;
             echo json_encode($response);
             exit;
         } else {
             $user = null;
             $checkInOk = false;
             $weeklyWinnerOk = true;
             //Get user to check in
             try {
                 //Get the user who's card number for this year was entered
                 $user = UserDB::getBasicUserByCardNumber($checkInRequest->cardNumber);
             } catch (Exception $ex) {
                 $response->errorCode = APICheckInResponse::CANNOT_GET_USER_DATA;
                 echo json_encode($response);
                 exit;
             }
             if (!$user) {
                 //There's no user for this card
                 $response->errorCode = APICheckInResponse::NO_USER_FOR_CARD_NUMBER;
                 echo json_encode($response);
                 exit;
             } else {
                 //We have a user so get the names in the response
                 $response->userFirstName = $user->firstName;
                 $response->userLastName = $user->lastName;
                 //Check user in
                 try {
                     $checkInOk = CheckInDB::checkIn($user->userId);
                 } catch (Exception $ex) {
                     //Check-in failed (something went wrong or check-in isn't valid)
                     $response->errorCode = APICheckInResponse::CANNOT_CHECK_IN;
                     echo json_encode($response);
                     exit;
                 }
             }
             if (!$checkInOk) {
                 //The user has already checked in
                 $response->errorCode = APICheckInResponse::ALREADY_CHECKED_IN;
                 echo json_encode($response);
                 exit;
             } else {
                 $response->checkInSuccessful = true;
                 //Check in successful, check whether he is the winner of the week
                 $isWinner = false;
                 try {
                     //Check if this user is the winner of the week
                     $weeklyWinnerData = WeeklyWinnerDB::getThisWeeksWinnerData();
                     $isWinner = $weeklyWinnerData && $weeklyWinnerData->userId == $user->userId && !$weeklyWinnerData->hasCollectedPrize;
                     //If he is the winner we set in the database that the user collected his prize
                     if ($isWinner) {
                         $newWeeklyWinnerData = new WeeklyWinnerData($weeklyWinnerData->startOfWeek, $weeklyWinnerData->userId, true);
                         WeeklyWinnerDB::updateWeeklyWinnerData($weeklyWinnerData, $newWeeklyWinnerData);
                     }
                 } catch (Exception $ex) {
                     $response->errorCode = APICheckInResponse::CANNOT_CHECK_WEEKLY_WINNER;
                     echo json_encode($response);
                     exit;
                 }
                 $response->isWeeklyWinner = $isWinner;
                 //If he is the winner, add the winner views and try to send an email to all usermanagers
                 if ($isWinner) {
                     try {
                         $select = array('email' => true);
                         $searchFilter = array('isUserManager' => true);
                         $searchUsers = UserDB::getSearchUsers($select, $searchFilter, null);
                         $extras['common']['winnerFirstName'] = $user->firstName;
                         $extras['common']['winnerLastName'] = $user->lastName;
                         $failedAddresses = Email::sendEmails('WeeklyWinnerNotification.html', 'Winnaar van de week', EmailConfig::FROM_ADDRESS, array_column($searchUsers, 'user'), $extras);
                         if (!empty($failedAddresses)) {
                             $response->errorCode = APICheckInResponse::CANNOT_SEND_WINNER_NOTIFICATIONS;
                         }
                         echo json_encode($response);
                         exit;
                     } catch (Exception $ex) {
                         $response->errorCode = APICheckInResponse::CANNOT_SEND_WINNER_NOTIFICATIONS;
                         echo json_encode($response);
                         exit;
                     }
                 } else {
                     echo json_encode($response);
                     exit;
                 }
             }
         }
     }
 }
开发者ID:JHDeStip,项目名称:Stippers,代码行数:98,代码来源:CheckInController.php


注:本文中的UserDB::getSearchUsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。