Jump to content

Как сделать?


Recommended Posts

всем привет. На главном выводится Лучшие авторы. Как сделать чтобы первый выводилась Все время а не неделя

Link to comment
Share on other sites

1 минуту назад, Respected сказал:

Никак не сделать без правки кода.

очень жаль😡 а какой файл отвечает на это

Link to comment
Share on other sites

core > front > widgets > topContributors, в нём поменять параметры ipsTabs_activeItem и aria-selected='true' на нужный список li.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

13 минут назад, Desti сказал:

$topContributorsThisWeek = \array_slice( $topContributorsThisWeek, 0, $limit, TRUE );

это можно удалить, limit уже есть в запросе

Link to comment
Share on other sites

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 это через менеджер?или в админке?

Link to comment
Share on other sites

23 минуты назад, Desti сказал:

Не, с такими вопросами не ко мне (Платные услуги)

Вот этот файл topContributors.php не могу найти где расположен

Link to comment
Share on other sites

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

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

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

Link to comment
Share on other sites

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

id="ipsTabs_elTopContributors_el_topContributorsWeek_panel"

на

id="ipsTabs_elTopContributors_el_topContributorsAll_panel"

Link to comment
Share on other sites

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

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

id="ipsTabs_elTopContributors_el_topContributorsWeek_panel"

на

id="ipsTabs_elTopContributors_el_topContributorsAll_panel"

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

Link to comment
Share on other sites

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

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

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

 

 

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

Link to comment
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Ваша ссылка была автоматически строена.   Отображать как обычную ссылку

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...