本文整理匯總了PHP中UserDB::getBasicUserById方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserDB::getBasicUserById方法的具體用法?PHP UserDB::getBasicUserById怎麽用?PHP UserDB::getBasicUserById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserDB
的用法示例。
在下文中一共展示了UserDB::getBasicUserById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get
public static function get()
{
$page = new Page();
$page->data['title'] = 'Transacties';
//Checks if user is set, if not redirect to manage user
if (!isset($_GET['user'])) {
header('Location: manageuser', true, 303);
} else {
//Gets the amount from GET or use default
if (isset($_GET['amount'])) {
$amount = $_GET['amount'];
} else {
$amount = MoneyTransactionsViewConfig::DEFAULT_AMOUNT;
}
try {
//Get user for his name
$page->data['TransactionsNameView']['fullName'] = UserDB::getBasicUserById($_GET['user'])->getFullName();
//Get transactions for user
$transactions = MoneyTransactionDB::getTransactionsByUserId($_GET['user'], $amount);
$transactionCount = count($transactions);
//If no transactions show no transactions view, otherwise show list with transactions
if ($transactionCount > 0) {
$page->data['TransactionsWithDiscountListView']['transactions'] = $transactions;
$page->data['TransactionsWithDiscountListView']['totalAmount'] = $transactionCount;
$page->addView('transactions/TransactionsTitleView');
$page->addView('transactions/TransactionsNameView');
$page->addView('transactions/TransactionsBackToManageUserLinkView');
$page->addView('transactions/TransactionsWithDiscountListView');
} else {
$page->data['InfoMessageNoDescriptionWithLinkView']['infoTitle'] = 'Er zijn nog geen transacties';
$page->data['InfoMessageNoDescriptionWithLinkView']['redirectUrl'] = 'manageuser';
$page->addView('transactions/TransactionsTitleView');
$page->addView('transactions/TransactionsNameView');
$page->addView('info/InfoMessageNoDescriptionWithLinkView');
}
} catch (Exception $ex) {
$page->data['ErrorMessageNoDescriptionWithLinkView']['errorTitle'] = 'Kan gegevens niet ophalen uit de database';
$page->data['ErrorMessageNoDescriptionWithLinkView']['tryAgainUrl'] = $_SERVER['REQUEST_URI'];
$page->addView('error/ErrorMessageNoDescriptionWithLinkView');
}
$page->showWithMenu();
}
}
示例2: get
public static function get()
{
$page = new Page();
$page->data['title'] = 'Winnaar van de week';
$page->addView('weeklyWinner/WeeklyWinnerTopView');
try {
$weeklyWinnerData = WeeklyWinnerDB::getThisWeeksWinnerData();
//If there's already a winner we show it's data
if ($weeklyWinnerData) {
$user = UserDB::getBasicUserById($weeklyWinnerData->userId);
$page->data['WeeklyWinnerShowWinnerView']['winnerFullName'] = $user->getFullName();
$page->data['WeeklyWinnerShowWinnerView']['hasCollectedPrize'] = $weeklyWinnerData->hasCollectedPrize;
$page->addView('weeklyWinner/WeeklyWinnerShowWinnerView');
} else {
$page->data['WeeklyWinnerGenerateFormView']['generate_winner_formAction'] = $_SERVER['REQUEST_URI'];
$page->addView('weeklyWinner/WeeklyWinnerGenerateFormView');
}
} catch (Exception $ex) {
$page->data['ErrorMessageNoDescriptionNoLinkView']['errorTitle'] = 'Kon winnaar niet ophalen';
$page->addView('error/ErrorMessageNoDescriptionNoLinkView');
}
$page->showWithMenu();
}