Files
Testing/html5-chat/chatadmin/news.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

189 lines
5.6 KiB
PHP

<?php
session_start();
include ("../Config.php");
include_once('protect.php');
include_once ('../classes/Room.php');
checkCanEnter('adminpanelNews');
$webmasterid = 8221;
$webmaster = Webmaster::get($webmasterid);
include("xcrud/xcrud.php");
include ("lng/language.php");
!empty($_GET['lang']) ? $lng = new Language($_GET['lang']) : $lng = new Language();
$lng = $lng->getData();
$lngPage = $lng['news'];
$xcrud = Xcrud::get_instance();
$table = 'chat_news';
$xcrud->table($table);
$xcrud->pass_var('webmasterid', $webmasterid);
$xcrud->where('webmasterid =', $webmasterid);
$xcrud->columns('news, active');
$xcrud->fields('news, active');
$xcrud->field_tooltip('news', $lngPage['news']);
$xcrud->field_tooltip('active', $lngPage['active']);
//view, edit, remove, duplicate, add, csv, print, save_new, save_edit, save_return, return.
$xcrud->hide_button('save_new');
//$xcrud->hide_button('save_return');
$xcrud->hide_button('return');
//$xcrud->unset_add();
//$xcrud->unset_list();
$xcrud->unset_title();
$xcrud->unset_view();
$xcrud->unset_csv();
$xcrud->unset_limitlist();
$xcrud->unset_numbers();
$xcrud->unset_print();
$xcrud->unset_sortable();
$config = DB::getOne('chat_config', "where webmasterid = $webmasterid",false);
$xcrud2 = Xcrud::get_instance();
$table = 'chat_config';
$xcrud2->table($table);
$xcrud2->pass_var('webmasterid', $webmasterid);
$xcrud2->where('webmasterid =', $webmasterid);
$xcrud2->columns('display_news_minutes');
$xcrud2->fields('display_news_minutes');
$xcrud2->change_type('display_news_minutes','text','', array('id'=>'display_news_minutes'));
$xcrud2->label(array('display_news_minutes'=>'News frequency (in minutes)'));
$xcrud2->validation_pattern('display_news_minutes', 'integer');
//$xcrud2->change_type('display_news_minutes','integer','',5);
$xcrud2->field_tooltip('display_news_minutes', 'Display News Every N minutes');
$xcrud2->unset_add();
$xcrud2->unset_list();
$xcrud2->unset_title();
$configid = DB::getOne('chat_config', "where webmasterid=$webmasterid")->id;
$frequency = $config->display_news_minutes;
$xcrud3 = Xcrud::get_instance();
$table3 = 'chat_rss';
$xcrud3->table($table3);
$xcrud3->pass_var('webmasterid', $webmasterid);
$xcrud3->where('webmasterid =', $webmasterid);
$roomsRows = Room::getAll($webmasterid);
$rooms = array('0'=>'All rooms');
foreach($roomsRows as $room) {
$rooms[$room->id] = $room->name;
}
$xcrud3->columns('url, roomid, enabled');
$xcrud3->fields('url, roomid, enabled');
$xcrud3->validation_required('url');
$xcrud3->change_type('roomid','select','0', $rooms);
$xcrud3->label(array(
'url'=>'RSS URL',
'roomid'=>'Room',
'titleTag'=>'Tile Tag',
'linkTag'=>'Link Tag',
'descriptionTag'=>'Desscription Tag',
'enabled'=>'Enabled',
));
$xcrud3->field_tooltip('url', 'Url of the XML RSS');
$xcrud3->field_tooltip('roomid', 'Room where the RSS will be displayed');
$xcrud3->field_tooltip('titleTag', 'Tag that contains the title');
$xcrud3->field_tooltip('linkTag', 'Tag that contains the URL');
$xcrud3->field_tooltip('descriptionTag', 'Tag that contains the description');
$xcrud3->field_tooltip('enabled', 'Should be enabled ?');
$xcrud3->hide_button('save_new');
$xcrud3->hide_button('return');
$xcrud3->unset_title();
$xcrud3->unset_view();
$xcrud3->unset_csv();
$xcrud3->unset_limitlist();
$xcrud3->unset_numbers();
$xcrud3->unset_print();
$xcrud3->unset_sortable();
// $xcrud->emails_label(' email');
//$xcrud->show_primary_ai_column(true);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name=viewport content="width=device-width, initial-scale=1">
<?php include('css.php');?>
<?php include('js.php');?>
<link rel="stylesheet" type="text/css" href="../css/common.css">
<title><?php echo $lngPage['metaTtitle']; ?></title>
<style>
#display_news_minutes {
max-width: 80px;
width: 80px;
min-width:80px;
}
.admin-table .xcrud-top-actions {
padding: 0;
}
.admin-panel .adition-box {
height:0;
}
.xcrud-nav:first-child {
display: none;
}
div#news a[data-primary="2"] {
position: absolute;
left:570px;
}
</style>
</head>
<body>
<div class="panel panel-default admin-panel">
<div class="panel-heading">
<Button class="btn a-header-btn" id="logout"><i class="fa fa-sign-out"></i> <?php echo $lng['menu']['logout']; ?></Button>
<ul class="breadcrumb">
<li><a href="loggedon.php"><?php echo $lng['menu']['loggedon']; ?></a></li>
<li class="active"><?php echo $lng['menu']['news']; ?></li>
</ul>
</div>
<div class="panel-body">
<div class="flex-property adition-box margin-btm">
<?php include('freeAccount.php');?>
</div>
<h2>News</h2>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#news">News</a></li>
<li><a data-toggle="tab" href="#RSS">RSS</a></li>
</ul>
<div class="tab-content">
<div id="news" class="tab-pane fade in active">
<?php echo $xcrud2->render('edit', $configid); ?>
<?php echo $xcrud->render($webmasterid); ?>
</div>
<div id="RSS" class="tab-pane fade">
<div>
<h2>RSS</h2>
A RSS should be composed of these elements:
<b>title</b>, <b>description</b>, <b>link</b>, <b>pubDate</b>
</div>
<?php echo $xcrud3->render($webmasterid); ?>
</div>
</div>
</div>
</div>
<?php include ("footer.php");?>
</body>
</html>