where('id', $uid)->first(\App\Models\User::$commonFields); if (!$user) { stderr("Error", "Invalid uid: $uid"); } if ($uid != $CURUSER['id']) { user_can(\App\Enums\Permission\PermissionEnum::VIEW_USER_HISTORY->value, true, $CURUSER['id']); } $isRecordSeedingBonusLog = \App\Models\Setting::getIsRecordSeedingBonusLog(); $defaultCategory = \App\Models\BonusLogs::CATEGORY_COMMON; $category = $_REQUEST['category'] ?? $defaultCategory; $categoryOptions = \App\Models\BonusLogs::listCategoryOptions($isRecordSeedingBonusLog); if (!isset($categoryOptions[$category])) { stderr("Error", "Invalid category: $category"); } $businessType = $_REQUEST['business_type'] ?? 0; $businessTypeOptions = \App\Models\BonusLogs::listBusinessTypeOptions($isRecordSeedingBonusLog ? '' : $defaultCategory); if ($businessType && !isset($businessTypeOptions[$businessType])) { stderr("Error", "Invalid business_type: $businessType"); } stdhead(nexus_trans('bonus-log.title_for_user')); $pagerParam = "?uid=$uid&category=$category&business_type=$businessType"; print("

".nexus_trans('bonus-log.title_for_user') . " ".htmlspecialchars($user->username)."

"); $textSelectOnePlease = nexus_trans('nexus.select_one_please'); $categoryOptionsText = $businessTypeOptionsText = ''; foreach ($categoryOptions as $name => $text) { $categoryOptionsText .= sprintf( '', $name, isset($_REQUEST['category']) && $_REQUEST['category'] == $name ? ' selected' : '', $text ); } foreach ($businessTypeOptions as $name => $text) { $businessTypeOptionsText .= sprintf( '', $name, isset($_REQUEST['business_type']) && $_REQUEST['business_type'] == $name ? ' selected' : '', $text ); } $resetText = nexus_trans('label.reset'); $submitText = nexus_trans('label.submit'); $categoryText = nexus_trans('bonus-log.category'); $businessTypeText = nexus_trans('bonus-log.fields.business_type'); $filterForm = <<
{$categoryText}:    {$businessTypeText}:   
FORM; $resetJs = <<getCount($uid, $category, $businessType); list($pagertop, $pagerbottom, $limit, $offset, $pageSize, $page) = pager(50, $total, "$pagerParam&"); $list = $rep->getList($uid, $category, $businessType, $page + 1, $pageSize); begin_main_frame(); print($filterForm); print(""); print(""); foreach ($list as $row) { print(""); } print("
".nexus_trans('bonus-log.fields.business_type')." ".nexus_trans('bonus-log.fields.old_total_value')." ".nexus_trans('bonus-log.fields.value')." ".nexus_trans('bonus-log.fields.new_total_value')." ".nexus_trans('label.comment')." ".nexus_trans('label.created_at')."
" . $row->businessTypeText . " " . ($row->old_total_value > 0 ? number_format($row->old_total_value, 1) : '-') . " " . ($row->old_total_value < $row->new_total_value ? "+" . number_format($row->value, 1) : "-" . number_format($row->value, 1)) . " " . ($row->new_total_value > 0 ? number_format($row->new_total_value, 1) : '-') . " " . $row->comment . " " . $row->created_at . "
"); print($pagerbottom); end_main_frame(); stdfoot();