Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка Invision Community, релизы, темы, плагины и приложения

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

topContributors.php

	public function render()
	{
		/* How many? */
		$limit = isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 5;
		
		/* Work out who has got the most reputation this week... */
		$topContributorsThisWeek = array();
        $topContributorsThisWeek = iterator_to_array( \IPS\Db::i()->select( 'member_id as themember, pp_reputation_points as rep', 'core_members', array( 'pp_reputation_points > 0' ), 'rep DESC', $limit )->setKeyField('themember')->setValueField('rep') );
		arsort( $topContributorsThisWeek );
		$topContributorsThisWeek = \array_slice( $topContributorsThisWeek, 0, $limit, TRUE );
		
		/* Load their data */	
		if( \count( $topContributorsThisWeek ) )
		{
			foreach ( \IPS\Db::i()->select( '*', 'core_members', \IPS\Db::i()->in( 'member_id', array_keys( $topContributorsThisWeek ) ) ) as $member )
			{
				\IPS\Member::constructFromData( $member );
			}
		}
		
		/* Display */
		return $this->output( $topContributorsThisWeek, $limit );
	}

Шаблон topContributors

<h3 class='ipsType_reset ipsWidget_title'>{lang="block_topContributors"}</h3>
<div class='ipsTabs ipsTabs_small ipsTabs_stretch ipsClearfix' id='elTopContributors' data-ipsTabBar data-ipsTabBar-updateURL='false' data-ipsTabBar-contentArea='#elTopContributors_content'>
	<a href='#elTopContributors' data-action='expandTabs'><i class='fa fa-caret-down'></i></a>
	<ul role="tablist" class='ipsList_reset'>
		<li>
			<a href='#ipsTabs_elTopContributors_el_topContributorsAll_panel' aria-selected='true' class='ipsTabs_item ipsTabs_activeItem' id='el_topContributorsAll' role="tab" aria-selected='false'>{lang="alltime"}</a>
		</li>
		<li>
			<a href='{url="app=core&module=system&controller=ajax&do=topContributors&time=week&limit={$limit}&orientation={$orientation}"}' id='el_topContributorsWeek' role="tab" class='ipsTabs_item'>{lang="week"}</a>
		</li>
		<li>
			<a href='{url="app=core&module=system&controller=ajax&do=topContributors&time=month&limit={$limit}&orientation={$orientation}"}' id='el_topContributorsMonth' class='ipsTabs_item' role="tab" aria-selected='false'>{lang="month"}</a>
		</li>		
		<li>
			<a href='{url="app=core&module=system&controller=ajax&do=topContributors&time=year&limit={$limit}&orientation={$orientation}"}' id='el_topContributorsYear' class='ipsTabs_item' role="tab" aria-selected='false'>{lang="year"}</a>
		</li>
	</ul>
</div>

<section id='elTopContributors_content' class='ipsWidget_inner ipsPad_half'>
	<div id="ipsTabs_elTopContributors_el_topContributorsWeek_panel" class='ipsTabs_panel'>
		{template="topContributorRows" group="widgets" app="core" params="$topContributorsThisWeek, 'all', $orientation"}
	</div>
</section>

У меня в таком виде всё работает нормально

image.png.72d5c7bc64a35740aaec72d46e42be4e.png

  • Author
1 час назад, Desti сказал:

topContributors.php


	public function render()
	{
		/* How many? */
		$limit = isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 5;
		
		/* Work out who has got the most reputation this week... */
		$topContributorsThisWeek = array();
        $topContributorsThisWeek = iterator_to_array( \IPS\Db::i()->select( 'member_id as themember, pp_reputation_points as rep', 'core_members', array( 'pp_reputation_points > 0' ), 'rep DESC', $limit )->setKeyField('themember')->setValueField('rep') );
		arsort( $topContributorsThisWeek );
		$topContributorsThisWeek = \array_slice( $topContributorsThisWeek, 0, $limit, TRUE );
		
		/* Load their data */	
		if( \count( $topContributorsThisWeek ) )
		{
			foreach ( \IPS\Db::i()->select( '*', 'core_members', \IPS\Db::i()->in( 'member_id', array_keys( $topContributorsThisWeek ) ) ) as $member )
			{
				\IPS\Member::constructFromData( $member );
			}
		}
		
		/* Display */
		return $this->output( $topContributorsThisWeek, $limit );
	}

Шаблон topContributors


<h3 class='ipsType_reset ipsWidget_title'>{lang="block_topContributors"}</h3>
<div class='ipsTabs ipsTabs_small ipsTabs_stretch ipsClearfix' id='elTopContributors' data-ipsTabBar data-ipsTabBar-updateURL='false' data-ipsTabBar-contentArea='#elTopContributors_content'>
	<a href='#elTopContributors' data-action='expandTabs'><i class='fa fa-caret-down'></i></a>
	<ul role="tablist" class='ipsList_reset'>
		<li>
			<a href='#ipsTabs_elTopContributors_el_topContributorsAll_panel' aria-selected='true' class='ipsTabs_item ipsTabs_activeItem' id='el_topContributorsAll' role="tab" aria-selected='false'>{lang="alltime"}</a>
		</li>
		<li>
			<a href='{url="app=core&module=system&controller=ajax&do=topContributors&time=week&limit={$limit}&orientation={$orientation}"}' id='el_topContributorsWeek' role="tab" class='ipsTabs_item'>{lang="week"}</a>
		</li>
		<li>
			<a href='{url="app=core&module=system&controller=ajax&do=topContributors&time=month&limit={$limit}&orientation={$orientation}"}' id='el_topContributorsMonth' class='ipsTabs_item' role="tab" aria-selected='false'>{lang="month"}</a>
		</li>		
		<li>
			<a href='{url="app=core&module=system&controller=ajax&do=topContributors&time=year&limit={$limit}&orientation={$orientation}"}' id='el_topContributorsYear' class='ipsTabs_item' role="tab" aria-selected='false'>{lang="year"}</a>
		</li>
	</ul>
</div>

<section id='elTopContributors_content' class='ipsWidget_inner ipsPad_half'>
	<div id="ipsTabs_elTopContributors_el_topContributorsWeek_panel" class='ipsTabs_panel'>
		{template="topContributorRows" group="widgets" app="core" params="$topContributorsThisWeek, 'all', $orientation"}
	</div>
</section>

У меня в таком виде всё работает нормально

image.png.72d5c7bc64a35740aaec72d46e42be4e.png

topContributors.php это через менеджер?или в админке?

  • Author
21 час назад, мвмвмм сказал:

topContributors.php это через менеджер?или в админке?

все работает. Но неделя перестала работать можешь у себя проверить?

  • Author
4 часа назад, Desti сказал:

В шаблоне в третьей снизу строке изменить 

id="ipsTabs_elTopContributors_el_topContributorsWeek_panel"

на

id="ipsTabs_elTopContributors_el_topContributorsAll_panel"

Спасибо все норм. Можно последний штрих как теперь можно исправить вывод месяц? А то сейчас вывод месяц и вывод год одинаковые

1 час назад, мвмвмм сказал:

А то сейчас вывод месяц и вывод год одинаковые

Ну так может они и правда одинаковые? 

 

 

В базу должны разные запросы уходить, причем этот подсчет делается в файле, который мы не трогали.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.