find($userid, \App\Models\User::$commonFields); if (empty($userInfo)) { stderr('Error', "User not exists."); } $pageTitle = $userInfo->username . ' - H&R'; stdhead($pageTitle); print("

$pageTitle

"); $status = $_GET['status'] ?? \App\Models\HitAndRun::STATUS_INSPECTING; $allStatus = \App\Models\HitAndRun::listStatus(); $headerFilters = []; $pagerParams['status'] = $status; $filterParams = $pagerParams; $queryString = http_build_query($pagerParams); foreach ($allStatus as $key => $value) { $filterParams['status'] = $key; $headerFilters[] = sprintf('%s', http_build_query($filterParams), $key == $status ? 'faqlink' : '', $value['text']); } print("

" . implode(' | ', $headerFilters) . "

"); $q = htmlspecialchars($_GET['q'] ?? ''); $filterForm = <<
FORM; begin_main_frame("", true); print $filterForm; $baseQuery = \App\Models\HitAndRun::query()->where('uid', $userid)->where('status', $status); $rescount = (clone $baseQuery)->count(); list($pagertop, $pagerbottom, $limit, $offset, $pageSize) = pager(50, $rescount, sprintf('?%s&', $queryString)); print(""); print(""); if ($rescount) { $query = (clone $baseQuery) ->with([ 'torrent' => function ($query) {$query->select(['id', 'size', 'name', 'category']);}, 'torrent.basic_category', 'snatch', 'user' => function ($query) {$query->select(['id', 'lang']);}, 'user.language', ]) ->offset($offset) ->limit($pageSize) ->orderBy('id', 'desc'); if (!empty($q)) { $query->where('id', $q); } $list = $query->get(); $hasActionRemove = false; foreach($list as $row) { $columnAction = ''; print(" {$columnAction} "); } if ($hasActionRemove) { $msg = nexus_trans('hr.remove_confirm_msg', ['bonus' => get_setting('bonus.cancel_hr')]); $js = <<"); print($pagerbottom); end_main_frame(); stdfoot();
{$lang_myhr['th_hr_id']} {$lang_myhr['th_torrent_name']} {$lang_myhr['th_uploaded']} {$lang_myhr['th_downloaded']} {$lang_myhr['th_share_ratio']} {$lang_myhr['th_seed_time_required']} {$lang_myhr['th_completed_at']} {$lang_myhr['th_ttl']} {$lang_myhr['th_comment']} {$lang_functions['std_action']}
'; if ($row->uid == $CURUSER['id'] && in_array($row->status, \App\Models\HitAndRun::CAN_PARDON_STATUS)) { $hasActionRemove = true; $columnAction .= sprintf('', $lang_myhr['action_remove'], $row->id); } $columnAction .= '
" . $row->id . " " . optional($row->torrent)->name . " " . mksize($row->snatch->uploaded) . " " . mksize($row->snatch->downloaded) . " " . get_hr_ratio($row->snatch->uploaded, $row->snatch->downloaded) . " " . $row->seedTimeRequired . " " . format_datetime($row->snatch->completedat) . " " . $row->inspectTimeLeft . " " . nl2br(trim($row->comment)) . "