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

	<div class="row-fluid">
		<div class="span12">

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

			<h3 class="page-title"><?php echo $this->lang->line('hf_add_new_announcement');?> </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_announcement');?> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_add_new_announcement');?></li>
			</ul>
			<!-- END PAGE TITLE & BREADCRUMB-->
		</div>
	</div>
	
	<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_add_new_announcement');?></div>

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="announcement-form" class="form-horizontal" method="post" action="<?php echo base_url();?>announcement/submit/" onsubmit="return validateForm('announcement-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 }?>
						
						<ul class="nav nav-tabs">
							<li class="active">
								<a href="#tab_1" data-toggle="tab">
									<?php echo $this->lang->line('lang_en'); ?>
								</a>
							</li>
							<li class="">
								<a href="#tab_2" data-toggle="tab">
									<?php echo $this->lang->line('lang_zh_cn'); ?>
								</a>
							</li>
							<li class="">
								<a href="#tab_3" data-toggle="tab">
									<?php echo $this->lang->line('lang_zh_hk'); ?>
								</a>
							</li>
						</ul>

						<div class="tab-content">
							<div class="tab-pane active" id="tab_1">
								<div class="control-group">
									<label class="control-label" ><?php echo $this->lang->line('announcement_title');?>: <span class="mandatory">*</span></label>
									<div class="controls">
										<input type="text" id="title_en" name="title_en" class="m-wrap span4" value="<?php echo isset($title_en) ? htmlspecialchars($title_en, ENT_QUOTES) : '';?>">
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label" ><?php echo $this->lang->line('announcement_content');?>: <span class="mandatory">*</span></label>
									<div class="controls">
										<textarea id="message_en" name="message_en" class="span10 wysihtml5 m-wrap" rows="15"><?php echo isset($message_en) ? $message_en : '';?></textarea>
									</div>
								</div>
							</div>
							<div class="tab-pane" id="tab_2">
								<div class="control-group">
									<label class="control-label" ><?php echo $this->lang->line('announcement_title');?>: <span class="mandatory">*</span></label>
									<div class="controls">
										<input type="text" id="title_zh_cn" name="title_zh_cn" class="m-wrap span4" value="<?php echo isset($title_zh_cn) ? htmlspecialchars($title_zh_cn, ENT_QUOTES) : '';?>">
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label" ><?php echo $this->lang->line('announcement_content');?>: <span class="mandatory">*</span></label>
									<div class="controls">
										<textarea id="message_zh_cn" name="message_zh_cn" class="span10 wysihtml5 m-wrap" rows="15"><?php echo isset($message_zh_cn) ? $message_zh_cn : '';?></textarea>
									</div>
								</div>
							</div>
							<div class="tab-pane" id="tab_3">
								<div class="control-group">
									<label class="control-label" ><?php echo $this->lang->line('announcement_title');?>: <span class="mandatory">*</span></label>
									<div class="controls">
										<input type="text" id="title_zh_hk" name="title_zh_hk" class="m-wrap span4" value="<?php echo isset($title_zh_hk) ? htmlspecialchars($title_zh_hk, ENT_QUOTES) : '';?>">
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label" ><?php echo $this->lang->line('announcement_content');?>: <span class="mandatory">*</span></label>
									<div class="controls">
										<textarea id="message_zh_hk" name="message_zh_hk" class="span10 wysihtml5 m-wrap" rows="15"><?php echo isset($message_zh_hk) ? $message_zh_hk : '';?></textarea>
									</div>
								</div>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('announcement_status');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="status" name="status" class="m-wrap span4">
									<option value="0" <?php echo isset($status) && $status == 0 ? 'selected="selected"' : ''; ?>><?php echo $this->lang->line('announcement_unpublish'); ?></option>
									<option value="1" <?php echo isset($status) && $status == 1 ? 'selected="selected"' : ''; ?>><?php echo $this->lang->line('announcement_publish'); ?></option>
								</select>
							</div>
						</div>
						
						<div class="form-actions">
							
							<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('announcement_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
			</div>					
		</div><!-- End span12 -->
		
	</div> <!-- End Row Fluid -->
	
	<iframe id="form_target_en" name="form_target" style="display:none"></iframe>
	<iframe id="form_target_zh_cn" name="form_target" style="display:none"></iframe>
	<iframe id="form_target_zh_hk" name="form_target" style="display:none"></iframe>
	<form id="file_form_en" action="<?php echo base_url();?>announcement/imageupload/" target="form_target_en" method="post" enctype="multipart/form-data" style="width:0px;height:0;overflow:hidden">
		<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(); ?>" />
		<input name="userfile" type="file" id="file_form_selector_en" />
	</form>
	<form id="file_form_zh_cn" action="<?php echo base_url();?>announcement/imageupload/" target="form_target_zh_cn" method="post" enctype="multipart/form-data" style="width:0px;height:0;overflow:hidden">
		<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(); ?>" />
		<input name="userfile" type="file" id="file_form_selector_zh_cn" />
	</form>
	<form id="file_form_zh_hk" action="<?php echo base_url();?>announcement/imageupload/" target="form_target_zh_hk" method="post" enctype="multipart/form-data" style="width:0px;height:0;overflow:hidden">
		<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(); ?>" />
		<input name="userfile" type="file" id="file_form_selector_zh_hk" />
	</form>

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