finish field management

This commit is contained in:
xiaomlove
2021-03-03 01:56:07 +08:00
parent 528d559f24
commit 7b8a6a7ce2
5 changed files with 60 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ HTML;
$perPage = 10;
$total = get_row_count('torrents_custom_fields');
list($paginationTop, $paginationBottom, $limit) = pager($perPage, $total, "?");
$sql = "select * from torrents_custom_fields order by id desc $limit";
$sql = "select * from torrents_custom_fields order by id asc $limit";
$res = sql_query($sql);
$header = [
'id' => $lang_fields['col_id'],
@@ -178,4 +178,33 @@ HEAD;
$table .= '</tbody></table>';
return $table;
}
public function buildFieldCheckbox($name, $current = [])
{
$sql = 'select * from torrents_custom_fields';
$res = sql_query($sql);
$checkbox = [];
if (!is_array($current)) {
$current = explode(',', $current);
}
while ($row = mysql_fetch_assoc($res)) {
$checkbox[] = sprintf(
'<label style="margin-right: 4px;"><input type="checkbox" name="%s" value="%s"%s>%s</label>',
$name, $row['id'], in_array($row['id'], $current) ? ' checked' : '', "{$row['label']}({$row['id']})"
);
}
return implode('', $checkbox);
}
public function renderUploadPage()
{
$searchBoxId = get_setting('main.browsecat');
$searchBox = DB::getOne('searchbox', "id = $searchBoxId");
if (empty($searchBox)) {
throw new \RuntimeException("Invalid search box: $searchBoxId");
}
$customFieldIdArr = explode(',', $searchBox['custom_fields']);
}
}