diff --git a/root/language/en/mods/portal/portal_latest_bots_module.php b/root/language/en/mods/portal/portal_latest_bots_module.php new file mode 100644 index 00000000..f781c99f --- /dev/null +++ b/root/language/en/mods/portal/portal_latest_bots_module.php @@ -0,0 +1,44 @@ + 'Latest Bots', + 'LAST_VISITED_BOTS' => 'Last %s visited bots', + + // ACP + 'ACP_PORTAL_BOTS_SETTINGS' => 'Visiting bots settings', + 'ACP_PORTAL_BOTS_SETTINGS_EXP' => 'This is where you customize the visiting bots block.', + 'PORTAL_LAST_VISITED_BOTS_NUMBER' => 'How many bots to display', + 'PORTAL_LAST_VISITED_BOTS_NUMBER_EXP' => '0 means infinite', +)); + +?> \ No newline at end of file diff --git a/root/portal/modules/portal_latest_bots.php b/root/portal/modules/portal_latest_bots.php new file mode 100644 index 00000000..3220f77f --- /dev/null +++ b/root/portal/modules/portal_latest_bots.php @@ -0,0 +1,125 @@ +lang}/mods/portal/" + */ + var $language = 'portal_latest_bots_module'; + + function get_template_side($module_id) + { + global $config, $template, $db, $user; + + // Last x visited bots + $sql = 'SELECT username, user_colour, user_lastvisit + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_IGNORE . ' + ORDER BY user_lastvisit DESC'; + $result = $db->sql_query_limit($sql, $config['board3_last_visited_bots_number']); + $first = true; + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['user_lastvisit'] && $first == true) + { + $template->assign_vars(array( + 'S_DISPLAY_LAST_BOTS' => false, + )); + } + else + { + $template->assign_var('S_DISPLAY_LAST_BOTS', true); + + if($row['user_lastvisit'] > 0) + { + $template->assign_block_vars('last_visited_bots', array( + 'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']), + 'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']), + )); + } + } + $first = false; + } + $db->sql_freeresult($result); + + // Assign specific vars + $template->assign_vars(array( + 'LAST_VISITED_BOTS' => sprintf($user->lang['LAST_VISITED_BOTS'], $config['board3_last_visited_bots_number']), + )); + + return 'latest_bots_side.html'; + } + + function get_template_acp($module_id) + { + return array( + 'title' => 'ACP_PORTAL_BOTS_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_PORTAL_BOTS_SETTINGS', + 'board3_last_visited_bots_number' => array('lang' => 'PORTAL_LAST_VISITED_BOTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), + ) + ); + } + + /** + * API functions + */ + function install($module_id) + { + set_config('board3_last_visited_bots_number', 1); + return true; + } + + function uninstall($module_id) + { + global $db; + + $del_config = array( + 'board3_last_visited_bots_number', + ); + $sql = 'DELETE FROM ' . CONFIG_TABLE . ' + WHERE ' . $db->sql_in_set('config_name', $del_config); + return $db->sql_query($sql); + } +} + +?> \ No newline at end of file diff --git a/root/styles/prosilver/template/portal/modules/latest_bots_side.html b/root/styles/prosilver/template/portal/modules/latest_bots_side.html new file mode 100644 index 00000000..96a93941 --- /dev/null +++ b/root/styles/prosilver/template/portal/modules/latest_bots_side.html @@ -0,0 +1,7 @@ + +{$LR_BLOCK_H_L} {LAST_VISITED_BOTS}{$LR_BLOCK_H_R} + + {last_visited_bots.BOT_NAME}
{last_visited_bots.LAST_VISIT_DATE} +
+ +{$LR_BLOCK_F_L}{$LR_BLOCK_F_R} \ No newline at end of file diff --git a/root/styles/prosilver/theme/images/portal/portal_bots.png b/root/styles/prosilver/theme/images/portal/portal_bots.png new file mode 100644 index 00000000..604c3d59 Binary files /dev/null and b/root/styles/prosilver/theme/images/portal/portal_bots.png differ