<?php $this->load->view('header');?>

	<!-- BEGIN PAGE HEADER-->

	<div class="row-fluid">

		<div class="span12">

			<!-- BEGIN PAGE TITLE & BREADCRUMB-->

			<h3 class="page-title"><?php echo $this->lang->line('hf_new_message');?></h3>

			<ul class="breadcrumb">

				<li>

					<i class="icon-home"></i>

					<a href="<?php echo base_url();?>home/"><?php echo $this->lang->line('hf_home');?></a> 

					<i class="icon-angle-right"></i>

				</li>
				<li><?php echo $this->lang->line('hf_private_message');?> <i class="icon-angle-right"></i></li>

				<li>

					<?php echo $this->lang->line('hf_new_message');?>

				</li>
			</ul>

			<!-- END PAGE TITLE & BREADCRUMB-->

		</div>

	</div>

	<!-- END PAGE HEADER-->

	<!-- BEGIN PAGE CONTENT-->

	<div class="row-fluid">

		<div class="span12">

			<div class="portlet box blue">

				<div class="portlet-title">

					<div class="caption"><i class="icon-reorder"></i><?php echo $this->lang->line('hf_new_message');?></div>

				</div>

				<div class="portlet-body form">

					<form id="message-form" class="form-horizontal" method="post" action="<?php echo base_url();?>message/submit/" onsubmit="return validateForm('message-form')">
						<?php 
							$alert_box = '';
							$alert_msg = '';
							
							if($this->session->userdata('form_msg_type') == 100) {
								$alert_box = 'success';
								$alert_msg = $this->session->userdata('form_msg');
							}
							else if($this->session->userdata('form_msg_type') == 200) {
								$alert_box = 'error';
								$alert_msg = $this->session->userdata('form_msg');
							}
							
							if($this->session->userdata('form_msg_type') == 100 OR $this->session->userdata('form_msg_type') == 200) {
								$this->session->unset_userdata(array('form_msg_type' => '', 'form_msg' => ''));
							}

							if( ! empty($alert_msg)) {
						?>
						<div class="alert alert-<?php echo $alert_box;?>">
							<button class="close" data-dismiss="alert"></button>
							<?php echo $alert_msg;?>
						</div>
						<?php }?>
					
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('message_subject');?> <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="message_subject" name="message_subject" class="m-wrap large" value="<?php echo isset($message_subject) ? htmlspecialchars($message_subject, ENT_QUOTES) : '';?>" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('message_message');?> <span class="mandatory">*</span></label>
							<div class="controls">
								<textarea id="message_message" name="message_message" class="span10 wysihtml5 m-wrap" rows="15"><?php echo isset($message_message) ? htmlspecialchars($message_message, ENT_QUOTES) : '';?></textarea>
							</div>
						</div>					
						<div class="form-actions">
							<input class="no_display" type="hidden" id="message_id" name="message_id" value="<?php echo isset($message_id) ? htmlspecialchars($message_id, ENT_QUOTES) : '';?>" />
							<input class="no_display" type="hidden" id="is_reply" name="is_reply" value="<?php echo isset($is_reply) ? htmlspecialchars($is_reply, ENT_QUOTES) : '';?>" />
							<input class="no_display" type="hidden" id="selected_tab" name="selected_tab" value="<?php echo isset($selected_tab) ? htmlspecialchars($selected_tab, ENT_QUOTES) : '';?>" />
							<input class="no_display" type="hidden" id="member_id" name="member_id" value="<?php echo isset($member_id) ? htmlspecialchars($member_id, ENT_QUOTES) : '';?>" />
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('message_submit');?></button>
						</div>
					</form>

					<!-- END FORM-->

				</div>

			</div>

		</div>

	</div>

	<!-- END PAGE CONTENT -->

<?php $this->load->view('footer');?>