[ticket/12838] Add core events to acp_ranks.php

PHPBB3-12838
This commit is contained in:
PayBas 2014-07-10 13:29:07 +02:00
parent bfdaefa7f6
commit 9468d173bc

View file

@ -25,7 +25,7 @@ class acp_ranks
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $request;
global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@ -73,6 +73,17 @@ class acp_ranks
'rank_image' => htmlspecialchars_decode($rank_image)
);
/**
* Modify the SQL array when saving a rank
*
* @event core.acp_ranks_save_modify_sql_ary
* @var int rank_id The ID of the rank (if available)
* @var array sql_ary Array with the rank's data
* @since 3.1.0-RC2
*/
$vars = array('rank_id', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.acp_ranks_save_modify_sql_ary', compact($vars)));
if ($rank_id)
{
$sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id";
@ -202,7 +213,7 @@ class acp_ranks
$filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list;
unset($existing_imgs, $imglist);
$template->assign_vars(array(
$tpl_ary = array(
'S_EDIT' => true,
'U_BACK' => $this->u_action,
'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'],
@ -212,9 +223,21 @@ class acp_ranks
'S_FILENAME_LIST' => $filename_list,
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif',
'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false,
'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0,
);
/**
* Modify the template output array for editing/adding ranks
*
* @event core.acp_ranks_edit_modify_tpl_ary
* @var int rank_id The ID of the rank (if available)
* @var array tpl_ary Array with the rank's template data
* @since 3.1.0-RC2
*/
$vars = array('rank_id', 'tpl_ary');
extract($phpbb_dispatcher->trigger_event('core.acp_ranks_edit_modify_tpl_ary', compact($vars)));
$template->assign_vars($tpl_ary);
return;
break;
@ -231,7 +254,7 @@ class acp_ranks
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('ranks', array(
$rank_row = array(
'S_RANK_IMAGE' => ($row['rank_image']) ? true : false,
'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false,
@ -240,8 +263,20 @@ class acp_ranks
'MIN_POSTS' => $row['rank_min'],
'U_EDIT' => $this->u_action . '&amp;action=edit&amp;id=' . $row['rank_id'],
'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['rank_id'])
'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['rank_id'],
);
/**
* Modify the template output array for each listed rank
*
* @event core.acp_ranks_list_modify_rank_row
* @var array rank_row Array with the rank's template data
* @since 3.1.0-RC2
*/
$vars = array('rank_row');
extract($phpbb_dispatcher->trigger_event('core.acp_ranks_list_modify_rank_row', compact($vars)));
$template->assign_block_vars('ranks', $rank_row);
}
$db->sql_freeresult($result);