From 1916e7bb56c8145e93c3f5e8085a969a7d4bc1a2 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 30 Aug 2010 13:11:18 +0000 Subject: [PATCH] Added latest bots block --- .../mods/portal/portal_latest_bots_module.php | 44 ++++++ root/portal/modules/portal_latest_bots.php | 125 ++++++++++++++++++ .../portal/modules/latest_bots_side.html | 7 + .../theme/images/portal/portal_bots.png | Bin 0 -> 964 bytes 4 files changed, 176 insertions(+) create mode 100644 root/language/en/mods/portal/portal_latest_bots_module.php create mode 100644 root/portal/modules/portal_latest_bots.php create mode 100644 root/styles/prosilver/template/portal/modules/latest_bots_side.html create mode 100644 root/styles/prosilver/theme/images/portal/portal_bots.png 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 0000000000000000000000000000000000000000..604c3d593979fa532a420de3e7b2a9c01b22979b GIT binary patch literal 964 zcmV;#13UbQP)FH4y00Q415()r&HXr~I z@&*6^7WR?}D(+;k#`eV4-}qL~?)>oZ{Qv+006_r0{{ut*{s0OL44gkoN_;#tO|0OJCPIYm|V zv|DPbkE)gy6T|!W46KZd3^vNj96}5%L9buEQLvBs-zHu4)PPm=I|IXWpqu~yV^G)s zC!od45WVX%!*hTDV$%Qp+eqs7Zw3aSMmYZcm%;q?7gh=G-*Ft;uM`-0eljrp0%~Rg z834pT7#LLf7&yea8Ik}3i0SWx2mcr*OkiNxvxnh7J3GU_mv0#EFImN~T;u`6@g7Z< zB_H@0-mU{`dI!X;K>P-X&oMCkd52@-lk0q3>PmmoO<(uVGS?{ zfAv^1SPB1NIChqq;l|m&45jDaF=zu7Gn|LGgoT5Ff%!iJBR~K#-3J;3i;~+bTgOP=Wft~Rm!#|)ENB;>k++g4YYd#P3Ld-UX2Pc0p zbOQtcK>)u01O5O2$Fu+dz2pD@L=y}J5Y9mP0O$bQ00RC000aX80MFs{0J+)!0Q2wv z09oko0O-H@{#eNXywdytQ2+n{%mRo}5J?I^v8UFwJ%kbbc zJHzhle;IxQUC#2CkwJahy`N7nz3uzJz)%O&@(1J_fB*tT34)XSs31b`Ni;?5$G3ACWb%v{xDp9{QDA6a}`W82mk~SGbbck8UAwtjrsHM z@$(ZOe}4G<+eTK8kM#>X8^gVKK=J)w7#Nm5xWn+_a|uxCUF5s~5I_uqP!}-p0ZC~f z<^hMYxumbiLybxL{~6sC|1vPKZU%~qVarSa0fcIR6cFpVDb3CR0R{l|79u&Xwj&q-0000