124 lines
5.2 KiB
PHP
124 lines
5.2 KiB
PHP
<?php
|
|
/**
|
|
* NewsBoard element for tactical view.
|
|
*
|
|
* @category General
|
|
* @package Pandora FMS
|
|
* @subpackage TacticalView
|
|
* @version 1.0.0
|
|
* @license See below
|
|
*
|
|
* ______ ___ _______ _______ ________
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
*
|
|
* ============================================================================
|
|
* Copyright (c) 2007-2023 Artica Soluciones Tecnologicas, http://www.artica.es
|
|
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
|
* You cannnot redistribute it without written permission of copyright holder.
|
|
* ============================================================================
|
|
*/
|
|
|
|
use PandoraFMS\TacticalView\Element;
|
|
|
|
/**
|
|
* NewsBoard, this class contain all logic for this section.
|
|
*/
|
|
class NewsBoard extends Element
|
|
{
|
|
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct()
|
|
{
|
|
ui_require_css_file('news');
|
|
include_once 'general/news_dialog.php';
|
|
$this->title = __('News Board');
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns the html of the latest news.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getNews():string
|
|
{
|
|
global $config;
|
|
$options = [];
|
|
$options['id_user'] = $config['id_user'];
|
|
$options['modal'] = false;
|
|
$options['limit'] = 7;
|
|
$news = get_news($options);
|
|
|
|
if (!empty($news)) {
|
|
$output = '<div id="news-board" class="new">';
|
|
foreach ($news as $article) {
|
|
$default = false;
|
|
if ($article['text'] == '&lt;p style="text-align: center; font-size: 13px;"&gt;Hello, congratulations, if you've arrived here you already have an operational monitoring console. Remember that our forums and online documentation are available 24x7 to get you out of any trouble. You can replace this message with a personalized one at Admin tools -&amp;gt; Site news.&lt;/p&gt; ') {
|
|
$article['subject'] = __('Welcome to Pandora FMS Console');
|
|
$default = true;
|
|
}
|
|
|
|
$text_bbdd = io_safe_output($article['text']);
|
|
$text = html_entity_decode($text_bbdd);
|
|
|
|
$output .= '<div class="new-board">';
|
|
$output .= '<div class="new-board-header">';
|
|
$output .= '<span class="new-board-title">'.$article['subject'].'</span>';
|
|
$output .= '<span class="new-board-author">'.__('By').' '.$article['author'].' '.ui_print_timestamp($article['timestamp'], true).'</span>';
|
|
$output .= '</div>';
|
|
$output .= '<div class="new content">';
|
|
|
|
if ($default) {
|
|
$output .= '<div class="default-new">';
|
|
$output .= '<div class="default-image-new">';
|
|
$output .= '<img src="./images/welcome_image.svg" alt="img colabora con nosotros - Support">';
|
|
$output .= '</div><div class="default-text-new">';
|
|
|
|
$output .= '
|
|
<p>'.__('Welcome to our monitoring tool so grand,').'
|
|
<br>'.__('Where data insights are at your command.').'
|
|
<br>'.__('Sales, marketing, operations too,').'
|
|
<br>'.__("Customer support, we've got you.").'
|
|
</p>
|
|
|
|
<p>'.__('Our interface is user-friendly,').'
|
|
<br>'.__("Customize your dashboard, it's easy.").'
|
|
<br>'.__('Set up alerts and gain insights so keen,').'
|
|
<br>'.__("Optimize your data, like you've never seen.").'
|
|
</p>
|
|
|
|
<p>'.__('Unleash its power now, and join the pro league,').'
|
|
<br>'.__('Unlock the potential of your data to intrigue.').'
|
|
<br>'.__('Monitoring made simple, efficient and fun,').'
|
|
<br>'.__('Discover a whole new way to get things done.').'
|
|
</p>
|
|
|
|
<p>'.__('And take control of your IT once and for all.').'</p>
|
|
|
|
<span>'.__('You can replace this message with a personalized one at Admin tools -> Site news.').'</span>
|
|
';
|
|
|
|
$output .= '</div></div>';
|
|
} else {
|
|
$text = str_replace('<script', '<script', $text);
|
|
$text = str_replace('</script', '</script', $text);
|
|
$output .= nl2br($text);
|
|
}
|
|
|
|
$output .= '</div></div>';
|
|
}
|
|
|
|
$output .= '</div>';
|
|
|
|
return $output;
|
|
}
|
|
}
|
|
|
|
|
|
}
|