Skip to content

Commit

Permalink
extra option in ACP->Hall of fame (board startdate/since epoch)
Browse files Browse the repository at this point in the history
  • Loading branch information
3Di committed Oct 8, 2017
1 parent b1bcf8b commit 48c356e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
2 changes: 2 additions & 0 deletions acp/tpotm_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function main($id, $mode)
$config->set('threedi_tpotm_forums', $request->variable('threedi_tpotm_forums', (int) $config['threedi_tpotm_forums']));
$config->set('threedi_tpotm_hall', $request->variable('threedi_tpotm_hall', (int) $config['threedi_tpotm_hall']));
$config->set('threedi_tpotm_users_page', $request->variable('threedi_tpotm_users_page', (int) $config['threedi_tpotm_users_page']));
$config->set('threedi_tpotm_since_epoch', $request->variable('threedi_tpotm_since_epoch', (int) $config['threedi_tpotm_since_epoch']));
$config->set('threedi_tpotm_ttl', $request->variable('threedi_tpotm_ttl', (int) $config['threedi_tpotm_ttl']));
$config->set('threedi_tpotm_miniavatar', $request->variable('threedi_tpotm_miniavatar', (int) $config['threedi_tpotm_miniavatar']));
$config->set('threedi_tpotm_miniprofile', $request->variable('threedi_tpotm_miniprofile', (int) $config['threedi_tpotm_miniprofile']));
Expand All @@ -100,6 +101,7 @@ public function main($id, $mode)
// Hall of fame
'TPOTM_HALL' => ($config['threedi_tpotm_hall']) ? true : false,
'TPOTM_USERS_PAGE' => (int) $config['threedi_tpotm_users_page'],
'TPOTM_HALL_EPOCH' => ($config['threedi_tpotm_since_epoch']) ? true : false,
// General Settings
'TPOTM_TTL' => (int) $config['threedi_tpotm_ttl'],
'TPOTM_MINIAVATAR' => ($config['threedi_tpotm_miniavatar']) ? true : false,
Expand Down
11 changes: 11 additions & 0 deletions adm/style/tpotm_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ <h1>{{ lang('ACP_TPOTM_TITLE') }}</h1>
<input type="number" min="1" max="300" name="threedi_tpotm_users_page" id="threedi_tpotm_users_page" size="6" value="{{ TPOTM_USERS_PAGE }}" />
</dd>
</dl>

<div class="tpotm-acp-rules">{{ lang('ACP_TPOTM_HALL_EPOCH_EXPLAIN') }}</div>
<dl>
<dt>
<label for="threedi_tpotm_since_epoch">{{ lang('TPOTM_HALL_EPOCH') }}{{ lang('COLON') }}</label>
</dt>
<dd>
<input type="radio" class="radio" name="threedi_tpotm_since_epoch" value="1"{% if TPOTM_HALL_EPOCH %} checked="checked"{% endif %}/> {{ lang('YES') }} &nbsp;
<input type="radio" class="radio" name="threedi_tpotm_since_epoch" value="0"{% if not TPOTM_HALL_EPOCH %} checked="checked"{% endif %} /> {{ lang('NO') }}
</dd>
</dl>
</fieldset>

<fieldset class="tpotm-acp-inner">
Expand Down
10 changes: 8 additions & 2 deletions controller/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ public function handle($name)
$this->template->assign_var('TPOTM_MESSAGE', $this->user->lang($message, $name));

/* Starting point in time */
//$board_start = (int) $this->config['board_startdate'];
$board_start = (int) '0'; // Epoch time 1970-01-01 00:00
if (!$this->config['threedi_tpotm_since_epoch'])
{
$board_start = (int) $this->config['board_startdate'];
}
else
{
$board_start = (int) '0'; // Epoch time 1970-01-01 00:00
}

/**
* if the current month is 01 (January) date() will decrement the year by one
Expand Down
2 changes: 2 additions & 0 deletions language/en/acp_tpotm.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
'TPOTM_HALL_EXPLAIN' => 'Enable the page',
'TPOTM_USERS_PAGE' => 'Top posters',
'TPOTM_USERS_PAGE_EXPLAIN' => 'How many users to show per page',
'ACP_TPOTM_HALL_EPOCH_EXPLAIN' => 'Using <em>Epoch</em> the fetch starts since <em>Epoch time 1970-01-01 00:00</em> instead of the start date of the Board. To be used if you did reset at some point that date and some users are being excluded from the <em>Top posters ever</em> list, which is based also on the post time.',
'TPOTM_HALL_EPOCH' => 'Fetch users since <em>Epoch</em>',
// Variouses
'ACP_TPOTM_VARIOUSES' => 'Various settings',
'TPOTM_TTL' => 'Time to live',
Expand Down
27 changes: 14 additions & 13 deletions migrations/m3_install_configs.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ static public function depends_on()

public function update_data()
{
return array(
array('config.add', array('threedi_tpotm_miniavatar', 1)),
array('config.add', array('threedi_tpotm_miniprofile', 1)),
array('config.add', array('threedi_tpotm_hall', 0)),
array('config.add', array('threedi_tpotm_adm_mods', 1)),
array('config.add', array('threedi_tpotm_founders', 0)),
array('config.add', array('threedi_tpotm_forums', 0)),
array('config.add', array('threedi_tpotm_index', 1)),
array('config.add', array('threedi_tpotm_ttl', 30)),
array('config.add', array('threedi_tpotm_badge_exists', 1)),
array('config.add', array('threedi_tpotm_users_page', 12)),
array('config.add', array('threedi_tpotm_utc', 'd m Y')),
);
return [
['config.add', ['threedi_tpotm_miniavatar', 1]],
['config.add', ['threedi_tpotm_miniprofile', 1]],
['config.add', ['threedi_tpotm_hall', 0]],
['config.add', ['threedi_tpotm_adm_mods', 1]],
['config.add', ['threedi_tpotm_founders', 0]],
['config.add', ['threedi_tpotm_forums', 0]],
['config.add', ['threedi_tpotm_index', 1]],
['config.add', ['threedi_tpotm_ttl', 5]],
['config.add', ['threedi_tpotm_badge_exists', 1]],
['config.add', ['threedi_tpotm_users_page', 12]],
['config.add', ['threedi_tpotm_utc', 'd m Y']],
['config.add', ['threedi_tpotm_since_epoch', 0]],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% elseif S_IS_BADGE_IMG %}
<img src="{{ postrow.TPOTM_BADGE }}" class="tpotm-miniprofile-badge" {% if S_U_TOOLTIP_SEL %}title="{{ lang('TPOTM_EXPLAIN') }}"{% endif %} />
{% else %}
{% if S_U_TOOLTIP_SEL %}{{ lang('TPOTM_BADGE') }}{% endif %}
{{ lang('TPOTM_BADGE') }}
{% endif %}
</dd>

Expand Down

0 comments on commit 48c356e

Please sign in to comment.