<?php

//////////////////////////////////////////////////////////////
//===========================================================
// add_user_notice_theme.php
//===========================================================
// SOFTACULOUS VIRTUALIZOR
// Version : 1.0
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date:       8th Mar 2010
// Time:       23:00 hrs
// Site:       https://www.virtualizor.com/ (SOFTACULOUS VIRTUALIZOR)
// ----------------------------------------------------------
// Please Read the Terms of use at https://www.virtualizor.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Ltd.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('VIRTUALIZOR')){

	die('Hacking Attempt');

}

function add_user_notice_theme(){

global $theme, $globals, $cluster, $users, $l, $error, $done, $servergroups, $servers, $users_email, $notices;

softheader($l['<title>']);

$GLOBALS['breadcrumbs'] = array('dashboard',  'lm_user_notice', 'lms_add_user_notice');

echo page_header(__('Add User Notice'), 'fas fa-paper-plane');

error_handle($error);

if(!empty($done)){
	show_alert($done, '', 'user_notice');
}

echo '
<script type="text/javascript" src="'.$theme['url'].'/js/tinymce/tinymce.min.js"></script>

<script>
	
	// tinymce.init({
	// 	selector:"textarea",
	// 	plugins: [
	// 		"advlist autolink lists link image charmap print preview hr anchor pagebreak",
	// 		"searchreplace wordcount visualblocks visualchars code fullscreen",
	// 		"insertdatetime nonbreaking save table contextmenu directionality",
	// 		"emoticons template paste textcolor"
	// 	],
	// 	toolbar1: "insertfile undo redo | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent blockquote| link image",
	// 	toolbar2: "preview media | forecolor backcolor emoticons | formatselect fontselect fontsizeselect "
	// });
	
	$(document).ready(function(){
		$("#serid").select2({
			placeholder : "",
			allowClear: true
		});
		$("#serid").on("select2:select", function(e){
			var id = e.params.data.id;
			var option = $(e.target).children("[value="+id+"]");
			option.detach();
			$(e.target).append(option).change();
		});
	});
	$("#serid").select2({width:"100%"});
</script>

<div class="card p-2 mx-3">
	<form id="mail" accept-charset="'.$globals['charset'].'" action="" method="post" name="mail" >
		<!-- Two Column Section-->
		<div class="row mx-auto">
			<!-- Notice Name -->
			<div class="col-md-6 mb-2">
				<label class="control-label w-100 my-3" for="notice">'.__('Notice Name').'</label><br>
				<input type="text" name="notice_name" id="notice_name" class="form-control w-100"/>
			</div>
			<!-- Server -->
			<div class="col-md-6 mb-2">
				<label class="control-label w-100 my-3" for="serid">'.__('Server').'</label><br>
				<div class="col-sm-12 m-0 p-0">
					<select class="custom-select" name="serid[]" id="serid" multiple="multiple">
						<option value="-1">'.__('All').'</option>';
						foreach ($servergroups as $k => $v){
							echo '<option class="fhead" value="'.$k.'_group" >[Group]&nbsp;'.$v['sg_name'].'</option>';
							
							foreach ($servers as $m => $n){
								if($n['sgid'] == $k){
									echo '<option value="'.$n['serid'].'" >&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$n['server_name'].'</option>';
								}
							}
						}
					echo '</select>
				</div>
			</div>
		</div>
		<div class="row mx-auto">
			<!-- Notice Name -->
			<div class="col-md-6 mb-2">
				<label class="control-label w-100 my-3" for="user_type" >'.__('User Type').'</label><br>
				<div class="col-sm-12 m-0 p-0">
					<select class="custom-select w-100" name="user_type" id="user_type">
						<option value="-1">'.__('All').'</option>
						<option value="0">'.__('User').'</option>
						<option value="2">'.__('Cloud').'</option>
					</select>
				</div>
			</div>
			<!-- Server -->
			<div class="col-md-6 mb-2">
				<label class="control-label w-100 my-3" for="notice_type">'.__('Notice Type').'</label><br>
				<div class="col-sm-12 m-0 p-0">
					<select name="notice_type" id="notice_type" class="virt-select">
						<option value="primary">'.__('Information notice in blue banner').'</option>
						<option value="warning">'.__('Warning notice in yellow banner').'</option>
						<option value="success">'.__('Success notice in green banner').'</option>
						<option value="danger">'.__('Danger notice in red banner').'</option>
					</select>
				</div>
			</div>
		</div>
		<div class="row mx-auto my-3 w-100">
			<div class="col-md-2" >
				<label for="notice">'.__('Enable Notice').'</label>
			</div>
			<div class="col-md-10">
				'.get_switch('enabled', '', '', array('chk_it' => 1, 'val' => 'enabled')).'
			</div>
		</div>	
		<!-- Notice (FULL WIDTH - unchanged) -->
		<div class="row mx-auto w-100 my-3">
			<div class="col-md-12 mb-2">
				<label  class="control-label w-100 my-3" for="notice">'.__('Notice').'</label><br>
				<div class="col-sm-12 m-0 p-0">
					<textarea rows="10" name="message" id="message" class="w-100"></textarea>
				</div>
			</div>	
		</div>
		<center>
			<center><input type="submit" name="submit" value="'.__('Add Notice').'" class="go_btn mt-3"/></center><br>
		</center>
	</form>
</div>
';

softfooter();

}

?>
