Board 3 - Module statistics in center column

Eingeschränkter Support!
Forumsregeln
Bei Fragen zu einer bestimmten Extension sind Extension-Name und die Downloadquelle (Link) der Extension erforderlich.
Antworten
firebird13
Offline
Beiträge: 16
Registriert: Sa 10. Okt 2020, 19:42
Okt 2020 23 12:19

Board 3 - Module statistics in center column

Beitrag von firebird13


Hi,
I would like to be able to display a statistics module in the center column (as native in index - see screenshot). I have tried various solutions without success.
Is it possible to do it?

Bild
Benutzeravatar
Kirk
Administrator
Offline
Beiträge: 1358
Registriert: Di 15. Apr 2014, 10:54
Wohnort: Erde
Kontaktdaten:
Okt 2020 23 15:12

Re: Board 3 - Module statistics in center column

Beitrag von Kirk


Hi
Open: root/ext/board3/portal/modules/statistics.php

Find
Tip: This may be a partial find and not the whole line

Code: Alles auswählen

	public $columns = 10;
Replace with
Tip: Replace the preceding lines with the following

Code: Alles auswählen

	public $columns = 31;
Find
Tip: This may be a partial find and not the whole line

Code: Alles auswählen

 		return 'statistics_side.html';
	}
Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find

Code: Alles auswählen

/**
	* {@inheritdoc}
	*/
	public function get_template_center($module_id)
	{
		// Get totals language strings
		$l_total_user_s = $this->get_totals_language($this->config['num_users'], 'TOTAL_USERS');
		$l_total_post_s = $this->get_totals_language($this->config['num_posts'], 'TOTAL_POSTS', 'TOTAL_POSTS_COUNT');
		$l_total_topic_s = $this->get_totals_language($this->config['num_topics'], 'TOTAL_TOPICS');

		// Average statistics
		$this->board_days = (double) ((time() - $this->config['board_startdate']) / 86400);

		$topics_per_day		= round($this->config['num_topics'] / $this->board_days, 0);
		$posts_per_day		= round($this->config['num_posts'] / $this->board_days, 0);
		$users_per_day		= round($this->config['num_users'] / $this->board_days, 0);
		$topics_per_user	= round($this->config['num_topics'] / $this->config['num_users'], 0);
		$posts_per_user		= round($this->config['num_posts'] / $this->config['num_users'], 0);
		$posts_per_topic	= ($this->config['num_topics']) ? round($this->config['num_posts'] / $this->config['num_topics'], 0) : 0;

		// Mitigate incorrect averages on first day
		$topics_per_day = $this->get_first_day_average($topics_per_day, $this->config['num_topics']);
		$posts_per_day = $this->get_first_day_average($posts_per_day, $this->config['num_posts']);
		$users_per_day = $this->get_first_day_average($users_per_day, $this->config['num_users']);
		$topics_per_user = $this->get_first_day_average($topics_per_user, $this->config['num_topics']);
		$posts_per_user = $this->get_first_day_average($posts_per_user, $this->config['num_topics']);
		$posts_per_topic = $this->get_first_day_average($posts_per_topic, $this->config['num_posts']);

		// Get language variables for averages
		$l_topics_per_day_s = $this->get_average_language($this->config['num_topics'], 'TOPICS_PER_DAY');
		$l_posts_per_day_s = $this->get_average_language($this->config['num_posts'], 'POSTS_PER_DAY');
		$l_users_per_day_s = $this->get_average_language($this->config['num_users'], 'USERS_PER_DAY');
		$l_topics_per_user_s = $this->get_average_language($this->config['num_topics'], 'TOPICS_PER_USER');
		$l_posts_per_user_s = $this->get_average_language($this->config['num_posts'], 'POSTS_PER_USER');
		$l_posts_per_topic_s = $this->get_average_language($this->config['num_posts'], 'POSTS_PER_TOPIC');

		$topics_count = $this->get_topics_count();

		// Assign specific vars
		$this->template->assign_vars(array(
			'B3_TOTAL_POSTS'				=> $l_total_post_s,
			'B3_TOTAL_TOPICS'				=> $l_total_topic_s,
			'B3_TOTAL_USERS'				=> $l_total_user_s,
			'B3_NEWEST_USER'				=> sprintf($this->user->lang['NEWEST_USER'], get_username_string('full', $this->config['newest_user_id'], $this->config['newest_username'], $this->config['newest_user_colour'])),
			'B3_ANNOUNCE_COUNT'				=> $topics_count[POST_ANNOUNCE],
			'B3_STICKY_COUNT'				=> $topics_count[POST_STICKY],
			'B3_TOTAL_ATTACH'				=> ($this->config['allow_attachments']) ? $this->config['num_files'] : 0,

			// average stat
			'B3_TOPICS_PER_DAY'		=> sprintf($this->user->lang[$l_topics_per_day_s], $topics_per_day),
			'B3_POSTS_PER_DAY'		=> sprintf($this->user->lang[$l_posts_per_day_s], $posts_per_day),
			'B3_USERS_PER_DAY'		=> sprintf($this->user->lang[$l_users_per_day_s], $users_per_day),
			'B3_TOPICS_PER_USER'	=> sprintf($this->user->lang[$l_topics_per_user_s], $topics_per_user),
			'B3_POSTS_PER_USER'		=> sprintf($this->user->lang[$l_posts_per_user_s], $posts_per_user),
			'B3_POSTS_PER_TOPIC'	=> sprintf($this->user->lang[$l_posts_per_topic_s], $posts_per_topic),
		));
		return 'statistics_center.html';
	}
Go to the directory rootext/board3/portal/styles/prosilver/template/portal/modules/

Create a new file with the name statistics_center.html
Insert this code:

Code: Alles auswählen

{$C_BLOCK_H_L}{$TITLE}{$C_BLOCK_H_R}
	<ul class="topiclist bg1">
		<li>
			<dl>
				<dd class="portal-whois-online-content portal-responsive-show">
					<p>
						<strong>{L_ST_TOP}</strong> &bull; {B3_TOTAL_POSTS} &bull; {B3_TOTAL_TOPICS} &bull; {B3_TOTAL_USERS} &bull; {B3_NEWEST_USER}
					</p>
				</dd>
			</dl>
		</li>
	</ul>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
In the end "ACP -> General" --> purge cache, it's recommended to purge your browser cache too.
Then you can slide the statistics module into the middle.
Gruß Udo
firebird13
Offline
Beiträge: 16
Registriert: Sa 10. Okt 2020, 19:42
Okt 2020 23 16:01

Re: Board 3 - Module statistics in center column

Beitrag von firebird13


Hi Kirk,
It's perfect.
Thank you so much.
Antworten

Wer ist online?


Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste