Add option to customize the number of days until a document is considered old

This commit is contained in:
Kijin Sung 2019-09-14 21:31:47 +09:00
parent 0fdb48c31a
commit 72651ed095
3 changed files with 6 additions and 2 deletions

View file

@ -53,6 +53,7 @@ class boardAdminController extends board {
if(!in_array($args->order_target,$this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order';
if(!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
$args->skip_bottom_list_days = max(0, intval($args->skip_bottom_list_days));
$args->browser_title = trim(utf8_normalize_spaces($args->browser_title));
$args->meta_keywords = $args->meta_keywords ? implode(', ', array_map('trim', explode(',', $args->meta_keywords))) : '';
$args->meta_description = trim(utf8_normalize_spaces($args->meta_description));

View file

@ -534,7 +534,8 @@ class boardView extends board
$oDocument = $oDocumentModel->getDocument($document_srl);
if($oDocument->isExists() && !$oDocument->isNotice())
{
if($oDocument->getRegdateTime() < (time() - (86400 * 30)) && $this->module_info->skip_bottom_list_for_olddoc === 'Y')
$days = $this->module_info->skip_bottom_list_days ?: 30;
if($oDocument->getRegdateTime() < (time() - (86400 * $days)) && $this->module_info->skip_bottom_list_for_olddoc === 'Y')
{
Context::set('page', $args->page = null);
}

View file

@ -225,10 +225,12 @@
<div class="x_control-group">
<label class="x_control-label">{$lang->customize_bottom_list}</label>
<div class="x_controls">
<label for="skip_bottom_list_for_olddoc">
<label for="skip_bottom_list_for_olddoc" class="x_inline">
<input type="checkbox" name="skip_bottom_list_for_olddoc" id="skip_bottom_list_for_olddoc" value="Y" checked="checked"|cond="$module_info->skip_bottom_list_for_olddoc === 'Y'" />
{$lang->skip_bottom_list_for_olddoc}
</label>
<input type="number" name="skip_bottom_list_days" value="{$module_info->skip_bottom_list_days ?: 30}" /> {$lang->unit_day}
<br />
<label for="skip_bottom_list_for_robot">
<input type="checkbox" name="skip_bottom_list_for_robot" id="skip_bottom_list_for_robot" value="Y" checked="checked"|cond="$module_info->skip_bottom_list_for_robot === 'Y'" />
{$lang->skip_bottom_list_for_robot}