<?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>']);
					

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

$breadcrumbs = array('dashboard', 'lm_users', 'user_notice', 'lms_add_user_notice');

echo get_breadcrumb($breadcrumbs);

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" class="form-horizontal">
		<div class="row mx-auto w-100 my-3 adj_ht">
			<div class="col-sm-2 adj_ht_cont" >
				<label for="notice">'.__('Notice Name').'</label>
			</div>
			<div class="col-sm-10 m-0 p-0">
				<input type="text" name="notice_name" class="form-control w-100"/>
			</div>
		</div>
		<div class="row mx-auto w-100 my-3 adj_ht">
			<div class="col-sm-2 adj_ht_cont" >
				<label class="control-label" for="serid">'.__('Server').'</label>
			</div>
			<div class="col-sm-10 m-0 p-0">
				<select class="select2 w-100" 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 class="row mx-auto w-100 my-3 adj_ht">
			<div class="col-sm-2 adj_ht_cont" >
				<label class="control-label" for="user_type" >'.__('User Type').'</label>
			</div>
			<div class="col-sm-10 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>
		<div class="row mx-auto w-100 my-3">
			<div class="col-sm-2 adj_ht_cont">
				<label for="notice_type">'.__('Notice Type').'</label>
			</div>
			<div class="col-sm-10 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 class="row mx-auto w-100 my-3 adj_ht">
			<div class="col-sm-2 adj_ht_cont" >
				<label for="notice">'.__('Notice').'</label>
			</div>
			<div class="col-sm-10 m-0 p-0">
				<textarea rows="10" name="message" class="w-100"></textarea>
			</div>
		</div>
		<div class="row mx-auto w-100 adj_ht">
			<div class="col-sm-2 adj_ht_cont" >
				<label for="notice">'.__('Enable Notice').'</label>
			</div>
			<div class="col-sm-10 m-0 p-0">
				'.get_checkbox('enabled', '', 'enabled', array('chk_it' => 1, 'name' => 'enabled')).'
			</div>
		</div>		
		<center><input type="submit" name="submit" value="'.__('Add').'" class="go_btn mt-3"/></center><br>
	</form>
</div>
</div>
';

softfooter();

}

?>
