本文整理汇总了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();
}