本文整理汇总了PHP中integer_format函数的典型用法代码示例。如果您正苦于以下问题:PHP integer_format函数的具体用法?PHP integer_format怎么用?PHP integer_format使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了integer_format函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
if (!addon_installed('calendar')) {
return new ocp_tempcode();
}
require_lang('calendar');
$bits = new ocp_tempcode();
if (get_option('calendar_show_stats_count_events', true) == '1') {
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS'), 'VALUE' => integer_format($GLOBALS['SITE_DB']->query_value('calendar_events', 'COUNT(*)')))));
}
if (get_option('calendar_show_stats_count_events_this_week', true) == '1') {
require_code('calendar');
$events = calendar_matches($GLOBALS['FORUM_DRIVER']->get_guest_id(), true, utctime_to_usertime(time()), utctime_to_usertime(time() + 60 * 60 * 24 * 7));
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS_THIS_WEEK'), 'VALUE' => integer_format(count($events)))));
}
if (get_option('calendar_show_stats_count_events_this_month', true) == '1') {
require_code('calendar');
$events = calendar_matches($GLOBALS['FORUM_DRIVER']->get_guest_id(), true, utctime_to_usertime(time()), utctime_to_usertime(time() + 60 * 60 * 24 * 31));
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS_THIS_MONTH'), 'VALUE' => integer_format(count($events)))));
}
if (get_option('calendar_show_stats_count_events_this_year', true) == '1') {
require_code('calendar');
$events = calendar_matches($GLOBALS['FORUM_DRIVER']->get_guest_id(), true, utctime_to_usertime(time()), utctime_to_usertime(time() + 60 * 60 * 24 * 365));
$bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => do_lang_tempcode('EVENTS_THIS_YEAR'), 'VALUE' => integer_format(count($events)))));
}
if ($bits->is_empty()) {
return new ocp_tempcode();
}
$section = do_template('BLOCK_SIDE_STATS_SECTION', array('SECTION' => do_lang_tempcode('CALENDAR'), 'CONTENT' => $bits));
return $section;
}
示例2: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$type = get_param('type');
if (!has_zone_access(get_member(), 'adminzone')) {
return new ocp_tempcode();
}
decache('main_staff_checklist');
require_lang('staff_checklist');
switch ($type) {
case 'add':
$recurinterval = get_param_integer('recurinterval', 0);
$task_title = get_param('tasktitle', false, true);
$id = $GLOBALS['SITE_DB']->query_insert('customtasks', array('tasktitle' => $task_title, 'datetimeadded' => time(), 'recurinterval' => $recurinterval, 'recurevery' => get_param('recurevery'), 'taskisdone' => NULL), true);
require_code('notifications');
$subject = do_lang('CT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $task_title);
$mail = do_lang('CT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($task_title));
dispatch_notification('checklist_task', NULL, $subject, $mail);
return do_template('BLOCK_MAIN_STAFF_CHECKLIST_CUSTOM_TASK', array('TASKTITLE' => comcode_to_tempcode(get_param('tasktitle', false, true)), 'DATETIMEADDED' => display_time_period(time()), 'RECURINTERVAL' => $recurinterval == 0 ? '' : integer_format($recurinterval), 'RECUREVERY' => get_param('recurevery'), 'TASKDONE' => 'not_completed', 'ID' => strval($id)));
case 'delete':
$GLOBALS['SITE_DB']->query_delete('customtasks', array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_done':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => time()), array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_undone':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => NULL), array('id' => get_param_integer('id')), '', 1);
break;
}
return new ocp_tempcode();
}
示例3: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('calendar')) {
return array();
}
return array(array('cms', 'calendar', array('cms_calendar', array('type' => 'misc'), get_module_zone('cms_calendar')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CALENDAR'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('calendar_events', 'COUNT(*)', NULL, '', true))))), 'DOC_CALENDAR'));
}
示例4: getAlexaRank
function getAlexaRank($url)
{
require_code('files');
$p = array();
$result = http_download_file('http://data.alexa.com/data?cli=10&dat=s&url=' . urlencode($url), NULL, false);
if (preg_match('#<POPULARITY [^<>]*TEXT="([0-9]+){1,}"#si', $result, $p) != 0) {
$rank = integer_format(intval($p[1]));
} else {
$rank = do_lang('NA');
}
if (preg_match('#<LINKSIN [^<>]*NUM="([0-9]+){1,}"#si', $result, $p) != 0) {
$links = integer_format(intval($p[1]));
} else {
$links = '0';
}
if (preg_match('#<SPEED [^<>]*PCT="([0-9]+){1,}"#si', $result, $p) != 0) {
$speed = 'Top ' . integer_format(100 - intval($p[1])) . '%';
} else {
$speed = '?';
}
// we would like, but cannot get (without an API key)...
/*
time on site
reach (as a percentage)
page views
audience (i.e. what country views the site most)
*/
return array($rank, $links, $speed);
}
示例5: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
if (get_forum_type() != 'ocf') {
return new ocp_tempcode();
}
if (is_guest()) {
return new ocp_tempcode();
}
require_css('side_blocks');
ocf_require_all_forum_stuff();
require_code('ocf_notifications');
// Only show what's new in week. Some forums may want to tweak this, but forums themselves only mark unread topics for a week.
$rows = ocf_get_pp_rows();
// if (count($rows)==0) return new ocp_tempcode();
require_lang('ocf');
$out = new ocp_tempcode();
foreach ($rows as $topic) {
$topic_url = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'findpost'), get_module_zone('topicview'));
$topic_url->attach('#post_' . strval($topic['id']));
$title = $topic['t_cache_first_title'];
$date = get_timezoned_date($topic['t_cache_last_time'], true);
$username = $topic['t_cache_last_username'];
$member_link = $GLOBALS['OCF_DRIVER']->member_profile_url($topic['t_cache_last_member_id'], false, true);
$num_posts = $topic['t_cache_num_posts'];
$out->attach(do_template('TOPIC_LIST', array('_GUID' => '55ae21a9f8d67ba6237c118a18b9657b', 'USER_LINK' => $member_link, 'TOPIC_LINK' => $topic_url, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic['t_cache_last_time']), 'USERNAME' => $username, 'NUM_POSTS' => integer_format($num_posts))));
}
$send_url = build_url(array('page' => 'topics', 'type' => 'new_pt', 'redirect' => SELF_REDIRECT), get_module_zone('topics'));
if (!ocf_may_make_personal_topic()) {
$send_url = new ocp_tempcode();
}
$view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => get_member()), get_module_zone('members'), NULL, true, false, false, 'tab__pts');
return do_template('BLOCK_SIDE_OCF_PERSONAL_TOPICS', array('_GUID' => '9376cd47884a78f3d1914c176b67ee28', 'SEND_URL' => $send_url, 'VIEW_URL' => $view_url, 'CONTENT' => $out, 'FORUM_NAME' => do_lang_tempcode('PERSONAL_TOPICS')));
}
示例6: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @param boolean Whether to look deep into the database (or whatever else might be time-intensive) for links
* @return array Array of links and where to show
*/
function run($exhaustive = false)
{
if (!addon_installed('catalogues')) {
return array();
}
$ret = array();
if (has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_catalogues')) {
$ret[] = array('cms', 'catalogues', array('cms_catalogues', array('type' => 'misc'), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CATALOGUES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'COUNT(*)', NULL, '', true))))), 'DOC_CATALOGUES');
}
if ($exhaustive) {
$catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name', 'c_title', 'c_description', 'c_ecommerce'), NULL, '', 10, NULL, true);
if (!is_null($catalogues)) {
$ret2 = array();
foreach ($catalogues as $row) {
if (substr($row['c_name'], 0, 1) == '_') {
continue;
}
if ($row['c_ecommerce'] == 0 || addon_installed('shopping')) {
if (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues', array('catalogues_catalogue', $row['c_name']))) {
$ret2[] = array('cms', 'of_catalogues', array('cms_catalogues', array('type' => 'misc', 'catalogue_name' => $row['c_name']), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', escape_html(get_translated_text($row['c_title'])), escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogue_entries', 'COUNT(*)', array('c_name' => $row['c_name']), '', true)))), get_translated_text($row['c_description']));
}
}
}
if (count($ret2) < 10) {
$ret = array_merge($ret, $ret2);
}
}
}
return $ret;
}
示例7: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('tickets')) {
return array();
}
require_lang('tickets');
require_code('tickets');
require_code('tickets2');
$outstanding = 0;
$tickets = get_tickets(get_member(), NULL, false, true);
if (!is_null($tickets)) {
foreach ($tickets as $topic) {
if ($topic['closed'] == 0) {
$outstanding++;
}
}
}
if ($outstanding > 0) {
$status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0', array('_GUID' => 'g578142633c6f3d37776e82a869deb91'));
} else {
$status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1', array('_GUID' => 'h578142633c6f3d37776e82a869deb91'));
}
$url = build_url(array('page' => 'tickets', 'type' => 'misc'), get_module_zone('tickets'));
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('URL' => $url, 'STATUS' => $status, 'TASK' => do_lang_tempcode('SUPPORT_TICKETS'), 'INFO' => do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($outstanding)))));
return array(array($tpl, NULL, $outstanding, NULL));
}
示例8: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
require_code('ocfiltering');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
$sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', 'id');
// Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
$title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
if (array_key_exists('title', $map) && $map['title'] != '') {
$title = protect_from_escaping(escape_html($map['title']));
}
$out = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$out->attach(do_template('BLOCK_SEPARATOR'));
}
$out->attach(get_download_html($row, true, true, $zone));
}
if ($out->is_empty()) {
if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
$submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
}
示例9: action
/**
* Standard interface stage of pointstore item purchase.
*
* @return tempcode The UI
*/
function action()
{
require_code('database_action');
$class = str_replace('hook_pointstore_', '', strtolower(get_class($this)));
$title = get_page_title('OCGIFTS_TITLE');
require_code('form_templates');
$map = NULL;
$category = either_param('category', '');
if ($category != '') {
$map = array('category' => $category);
}
$max_rows = $GLOBALS['SITE_DB']->query_value('ocgifts', 'COUNT(*)', $map);
$max = get_param_integer('max', 20);
$start = get_param_integer('start', 0);
require_code('templates_results_browser');
$results_browser = results_browser(do_lang_tempcode('OCGIFTS_TITLE'), get_param('id'), $start, 'start', $max, 'max', $max_rows, NULL, NULL, true, true);
$rows = $GLOBALS['SITE_DB']->query_select('ocgifts g', array('*', '(SELECT COUNT(*) FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'members_gifts m WHERE m.gift_id=g.id) AS popularity'), $map, 'ORDER BY popularity DESC', $max, $start);
$username = get_param('username', '');
$gifts = array();
foreach ($rows as $gift) {
$gift_url = build_url(array('page' => 'pointstore', 'type' => 'action_done', 'id' => 'ocgifts', 'gift' => $gift['id'], 'username' => $username), '_SEARCH');
$image_url = '';
if (is_file(get_custom_file_base() . '/' . rawurldecode($gift['image']))) {
$image_url = get_custom_base_url() . '/' . $gift['image'];
}
$gifts[] = array('NAME' => $gift['name'], 'PRICE' => integer_format($gift['price']), 'POPULARITY' => integer_format($gift['popularity']), 'GIFT_URL' => $gift_url, 'IMAGE_URL' => $image_url);
}
$categories = collapse_1d_complexity('category', $GLOBALS['SITE_DB']->query_select('ocgifts', array('DISTINCT category'), NULL, 'ORDER BY category'));
return do_template('POINTSTORE_OCGIFTS_GIFTS', array('TITLE' => $title, 'GIFTS' => $gifts, 'RESULTS_BROWSER' => $results_browser, 'CATEGORY' => $category, 'CATEGORIES' => $categories));
}
示例10: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('ocf_forum')) {
return array();
}
if (get_forum_type() != 'ocf') {
return array();
}
require_lang('ocf_config');
$forum_id = $GLOBALS['FORUM_DRIVER']->forum_id_from_name(get_option('reported_posts_forum'));
if (is_null($forum_id)) {
return array();
}
$where = 't_forum_id=' . strval($forum_id) . ' AND t_is_open=1';
$query = 'SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE ' . $where;
$outstanding = $GLOBALS['FORUM_DB']->query_value_null_ok_full($query);
if ($outstanding > 0) {
$status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0', array('_GUID' => 'e578142633c6f3d37776e82a869deb91'));
} else {
$status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1', array('_GUID' => 'f578142633c6f3d37776e82a869deb91'));
}
$url = $GLOBALS['FORUM_DRIVER']->forum_url($forum_id);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('URL' => $url, 'STATUS' => $status, 'TASK' => do_lang_tempcode('REPORTED_POSTS_FORUM'), 'INFO' => do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($outstanding)))));
return array(array($tpl, NULL, $outstanding, NULL));
}
示例11: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
global $NON_CANONICAL_PARAMS;
$NON_CANONICAL_PARAMS[] = 'max';
$max = get_param_integer('max', 10);
if ($max < 1) {
$max = 1;
}
$start = get_param_integer('start', 0);
$rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('validated' => 1), 'ORDER BY num_downloads DESC', $max, $start);
$content = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$content->attach(do_template('BLOCK_SEPARATOR'));
}
$content->attach(get_download_html($row, true, true, $zone));
}
$page_num = intval(floor(floatval($start) / floatval($max))) + 1;
$count = $GLOBALS['SITE_DB']->query_value('download_downloads', 'COUNT(*)', array('validated' => 1));
$num_pages = intval(ceil(floatval($count) / floatval($max)));
if ($num_pages == 0) {
$page_num = 0;
}
$previous_url = $start == 0 ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start - $max), '_SELF');
$next_url = $page_num == $num_pages ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'start' => $start + $max), '_SELF');
$browse = do_template('NEXT_BROWSER_BROWSE_NEXT', array('_GUID' => '15ca70ec400629f67edefa869fb1f1a8', 'NEXT_LINK' => $next_url, 'PREVIOUS_LINK' => $previous_url, 'PAGE_NUM' => integer_format($page_num), 'NUM_PAGES' => integer_format($num_pages)));
return do_template('BLOCK_MAIN_DOWNLOAD_TEASE', array('_GUID' => 'a164e33c0b4ace4bae945c39f2f00ca9', 'CONTENT' => $content, 'BROWSE' => $browse));
}
示例12: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('news');
$categories = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => NULL));
$content = new ocp_tempcode();
$categories2 = array();
foreach ($categories as $category) {
if (has_category_access(get_member(), 'news', strval($category['id']))) {
$join = ' LEFT JOIN ' . get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id';
$count = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'news p' . $join . ' WHERE validated=1 AND (news_entry_category=' . strval($category['id']) . ' OR news_category=' . strval($category['id']) . ') ORDER BY date_and_time DESC');
if ($count > 0) {
$category['_nc_title'] = get_translated_text($category['nc_title']);
$categories2[] = $category;
}
}
}
if (count($categories2) == 0) {
global $M_SORT_KEY;
$M_SORT_KEY = '_nc_title';
usort($categories2, 'multi_sort');
foreach ($categories as $category) {
if (has_category_access(get_member(), 'news', strval($category['id']))) {
$categories2[] = $category;
}
}
}
foreach ($categories2 as $category) {
$url = build_url(array('page' => 'news', 'type' => 'misc', 'id' => $category['id']), get_module_zone('news'));
$name = $category['_nc_title'];
$content->attach(do_template('BLOCK_SIDE_NEWS_CATEGORIES_CATEGORY', array('_GUID' => 'fee49cac370ec00fc59d2e9c66b6255a', 'URL' => $url, 'NAME' => $name, 'COUNT' => integer_format($count))));
}
return do_template('BLOCK_SIDE_NEWS_CATEGORIES', array('_GUID' => 'b47a0047247096373e5aa626348c4ebb', 'CONTENT' => $content, 'PRE' => '', 'POST' => ''));
}
示例13: run
/**
* Standard modular run function for OcCLE notification hooks.
*
* @param ?integer The "current" time on which to base queries (NULL: now)
* @return ~array Array of section, type and message responses (false: nothing)
*/
function run($timestamp = NULL)
{
if (!addon_installed('chat')) {
return false;
}
if (!is_null(get_value('occle_watched_chatroom'))) {
require_lang('chat');
if (is_null($timestamp)) {
$timestamp = time();
}
$room = intval(get_value('occle_watched_chatroom'));
$room_messages = $GLOBALS['SITE_DB']->query('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'chat_messages WHERE room_id=' . strval($room) . ' AND date_and_time>=' . strval((int) $timestamp));
if (!array_key_exists(0, $room_messages)) {
return false;
}
if ($room_messages[0]['cnt'] > 0) {
$rooms = array();
$messages = $room_messages[0]['cnt'];
$room_data = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'room_name', array('id' => $room));
if (is_null($room_data)) {
return false;
}
// Selected room deleted
$rooms[$room_data] = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room), get_module_zone('chat'));
return array(do_lang('SECTION_CHAT'), do_lang('NEW_MESSAGES'), do_template('OCCLE_CHAT_NOTIFICATION', array('MESSAGE_COUNT' => integer_format($messages), 'ROOMS' => $rooms)));
} else {
return false;
}
} else {
return false;
}
}
示例14: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('leader_board');
require_code('points');
require_css('points');
$title = get_page_title('POINT_LEADERBOARD');
$start_date = intval(get_option('leaderboard_start_date'));
$weeks = $GLOBALS['SITE_DB']->query('SELECT DISTINCT date_and_time FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'leader_board WHERE date_and_time>=' . strval($start_date) . ' ORDER BY date_and_time DESC');
if (count($weeks) == 0) {
warn_exit(do_lang_tempcode('NO_ENTRIES'));
}
$first_week = $weeks[count($weeks) - 1]['date_and_time'];
$weeks = collapse_1d_complexity('date_and_time', $weeks);
$out = new ocp_tempcode();
foreach ($weeks as $week) {
$rows = collapse_2d_complexity('lb_member', 'lb_points', $GLOBALS['SITE_DB']->query_select('leader_board', array('lb_member', 'lb_points'), array('date_and_time' => $week)));
$week_tpl = new ocp_tempcode();
foreach ($rows as $member => $points) {
$points_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $member), get_module_zone('points'));
$profile_url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member, false, true);
$name = $GLOBALS['FORUM_DRIVER']->get_username($member);
if (is_null($name)) {
$name = do_lang('UNKNOWN');
}
$week_tpl->attach(do_template('POINTS_LEADERBOARD_ROW', array('_GUID' => '6d323b4b5abea0e82a14cb4745c4af4f', 'POINTS_URL' => $points_url, 'PROFILE_URL' => $profile_url, 'POINTS' => integer_format($points), 'NAME' => $name, 'ID' => strval($member))));
}
$nice_week = intval(($week - $first_week) / (7 * 24 * 60 * 60) + 1);
$out->attach(do_template('POINTS_LEADERBOARD_WEEK', array('_GUID' => '3a0f71bf20f9098e5711e85cf25f6549', 'WEEK' => integer_format($nice_week), 'ROWS' => $week_tpl)));
}
return do_template('POINTS_LEADERBOARD_SCREEN', array('_GUID' => 'bab5f7b661435b83800532d3eebd0d54', 'TITLE' => $title, 'WEEKS' => $out));
}
示例15: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('galleries')) {
return array();
}
return array(array('cms', 'galleries', array('cms_galleries', array('type' => 'misc'), get_module_zone('cms_galleries')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('GALLERIES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('images', 'COUNT(*)', NULL, '', true) + $GLOBALS['SITE_DB']->query_value_null_ok('videos', 'COUNT(*)', NULL, '', true))))), 'DOC_GALLERIES'));
}