<!DOCTYPE html>
<?php

include('buiapp/partials/header.php');
include ('buiapp/phpClasses/functions.php');
if (isset($_SESSION['staff_session'])) {
    $username = $_SESSION['staff_session'];
	$csession =  currentSession();
		$role = getrole($username, $csession);
	

} else {
    header('Location: index.php');
    exit();
}
$csession =  currentSession();
				$role = getrole($username, $csession);

include('header.php');
?>
<style type='text/css'>
	.vl {
		
		display: inline-block;
  border-left: 6px inset black;
  height: auto;
}
hr {
  display: block;
  margin-top: 0.2em;
  margin-bottom: 0.5em;
  margin-left: auto;
  margin-right: auto;
  border-style: inset;
  border-width: 2px;
}
  </style>
  
  <link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet">


 <link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet">
<script src="bower_components/jquery/dist/jquery.min.js"></script>
  <script src="https://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script> 
  <link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote.css" rel="stylesheet">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote.js"></script>


  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
	 Internal Memo
                
        <small>Internal Memo</small>
      </h1>
      
      <ol class="breadcrumb">
        <li><a href="memo.php"><i class="fa fa-dashboard"></i>Back</a></li>
        <li class="active">Dashboard</li>
      </ol>
      
      
      
      
    
    </section>

    <!-- Main content -->
    <section class="content container-fluid" style="background-image: url('images/logo2.png'); background-repeat: no-repeat; background-attachment: fixed; background-position: center; ">
<?php 
if(isset($_POST['feed'])){
    $dbc = connect();

	$receiver = $_POST['to'];
	








$message = mysqli_real_escape_string($dbc, $_POST['editordata']);

$title = $_POST['title'];
	
	
    $staffmail = aboutstaff($username);
    
 $ref = time();
	  savememo($username, $receiver, $message, $title, $ref);
	$to = $receiver;
    $from = "$staffmail[8]";
    $name = 'Bowen University Internal Memo';
    $subj = "Bowen University Internal Memo";
    smtpmailer($to,$from, $name ,$subj, $msg);
  
    
	echo "<script type='text/javascript'>
		alert('Memo Sent Successfully');
	</script>";
	header("Refresh:0");
    
    
}
?>
	  <form action ="sendmemo.php" method="POST">
            
        
       
        <br>
        Internal Memo to : <br>
		<div class="form-group">
        <select class="form-control select2" style="width: 100%;" required name='to'>
            <option value='BUI/ACAD/SS/427'>Directorate of Digital Services</option>
      
				<option value='BUI/ACAD/SS/427'>Deputy Vice Chancellor </option>
				<option value='BUI/ACAD/SS/427'>Registrar</option>
				<option value='BUI/ACAD/SS/427'>Bursar</option>
				<option value='BUI/ACAD/SS/427'>Libraian</option>
				<option value='BUI/ACAD/SS/427'>University Chaplin</option>
				<option value='BUI/ACAD/SS/427'>Dean of Student Affairs</option>
				<option value='BUI/ACAD/SS/427'>All Provosts List</option>
            
			
            
            
            
        </select>
        </div>
		<br>
		Title: <input type="text"  class="form-control" name="title" id="title" onchange="setit()" Placeholder="Memo Title" required>
		<br>
        <textarea id="summernote"  name="editordata" required>
		<center><img src ='images/memo.png' width="15%"/>
		<br>
		<br>
		<font face="Times New Roman" color="black" size="5"> <b>BOWEN UNIVERSITY, IWO</b></font>
<br>
<font face="Times New Roman" color="black" size="3"><b>INTERNAL MEMORANDUM</b></font>
</center>
<br>
<br>
<div class="row">

<div class='col-sm-4' >
<font face="Times New Roman" color="black" size="3"><b><i> From:</i></b></font>
<br>
<br>
<font face="Times New Roman" color="black" size="3"><b><i> Ref:</i></b></font>

 </div> 				
	<div class='col-sm-4'><center><div class="vl"></div></center></div>
	<div class='col-sm-4'>   <font face="Times New Roman" color="black" size="3"><b><i> To:</i></b></font>
	<br>
	<br>
		<font face="Times New Roman" color="black" size="3"><b><i> Date: <?php echo date("d-M-Y"); ?></i></b></font>
	</div> 
			
			
			</div>

<hr style="height:2px;border:none;color:#000;background-color:#000;">
<hr>

<font face="Times New Roman" color="black" size="5"><center><u><h1 id='mtitle'></h1></u></center></font>







<font face="Times New Roman" color="black" size="3">Best regards,
<?php
$dbc = connect();
$img  = getsignature($username);

echo "<br><img src='$img' width='10%' >";

echo "<br>
";

$name = aboutstaff( $username);
echo "$name[0] $name[1] $name[2] $name[3]";

?>
</font>


		
		
		</textarea>
        <button type="submit" name="feed" class="btn btn-basic">Send</button>
        </form>

	 
	  
	  
	       
     

          <!-- /.box -->

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <!-- Main Footer -->
  <footer class="main-footer">
    <!-- To the right -->
    <div class="pull-right hidden-xs">
      
    </div>
    <!-- Default to the left -->
    <strong>Copyright &copy; 2019 <a href="#">Bowen University</a>.</strong> All rights reserved.
  </footer>


  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
  immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->


<!-- REQUIRED JS SCRIPTS -->
 <script>
    $(document).ready(function() {
        $('#summernote').summernote({
  height: 800,                 // set editor height
  minHeight: null,             // set minimum height of editor
  maxHeight: null,             // set maximum height of editor
  focus: true                  // set focus to editable area after initializing summernote
});
		$('#summernote2').summernote({
  height: 800,                 // set editor height
  minHeight: null,             // set minimum height of editor
  maxHeight: null,             // set maximum height of editor
  focus: true                  // set focus to editable area after initializing summernote
});
    });
      $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()
      })
  </script>
  
<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="bower_components/jquery-ui/jquery-ui.min.js"></script>
<!-- Slimscroll -->
<script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<!-- fullCalendar -->
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/fullcalendar/dist/fullcalendar.min.js"></script>
<script src="bower_components/select2/dist/js/select2.full.min.js"></script>
<script>
  function setit(){
	  var title = $('#title').val();
	
	  $('#mtitle').text(title);
	  
  }
</script>
</body>
</html>