<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj=new my_class();
// ============

extract($_GET);

$medium_id;
$homework_status_id;
?>

<style type="text/css">
	.input-append, .input-prepend {
		margin-bottom: 0px !important;
	}
	.table td {
		padding: 3px !important;
	}
	.topics-count{
		margin-left:9px !important;
		}
</style>

<script src="module/homework/js/view_and_edit_homework_topics.js" type="text/javascript"></script>
<?php
$det_in = $obj->Details_By_Cond("_int_institute_setup_vw","section_id='$section_id'");

$tch_id = $obj->Details_By_Cond("_r_class_routine","_section_id='$section_id' AND _teacher_type='CT' AND _teacher_id!='0' GROUP BY _teacher_type");
$teacher_id =  $tch_id['_teacher_id'];

$tch_det = $obj->Details_By_Cond("_pf_emp_personal_info","_id='$teacher_id'");
?>

<div class="row-fluid">
<legend>
<!-- 	<button class="btn btn-mini btn-danger" id="back_hw">
    <i class="icon-reply icon-only" id="back_hw"></i>
      Back
</button> -->
<a href="#" id="back_hw" >
<img src="asset/custom/back.png" id="back" >
</a>
	
	Daily Class Wise Homework Sheet for (<?php echo 'Class: '.$det_in['class'].', Department: '.$det_in['department'].', Student Type: '.$det_in['student_type'].', Section: '.$det_in['section']; ?>).
</legend>



<!-- ==================================== -->
<form class="form-vertical" id="attendance_sheet">

<div class="row-fluid">	
	<input type="hidden" name="homework_status_id" value="<?php echo $homework_status_id; ?>">
	<input type="hidden" id="md_id" name="medium_id" value="<?php echo $medium_id; ?>">
	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>">	
    <input type="hidden" id="sft_id" name="shift_id" value="<?php echo $shift_id; ?>">				
	
	<table class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
                <th>Sl</th>
                <th>Student ID</th>
                <th>Name</th>
                <th>Roll</th>
                <th style="text-align: center;">Send</th>
                <th style="text-align: center;">Home Work Topics</th>
                <th>Contact No</th>
             </tr>   
             <tr>
                <th></th>
                <th></th>
                <th></th>
                <th></th>
                <th style="text-align: center;"><label></label> <input type="checkbox" id="check_all" ><span class="lbl"> Check All</span> </th>
                <th style="text-align: center;"> <textarea id="topics_default" onkeyup="deft_val(this.value)" class="input-small"  placeholder="Home Work Topics" style="width:370px;height:20px" rows="1"></textarea>
                   
                <th></th>
             </tr>   
		</thead>
		<tbody>
			<?php
			$i=0;
			foreach($obj->View_Student_List("sc._id='$section_id' AND pf_std._status='A' ORDER BY _section_roll ASC") as $value){
			extract($value);
			$i++;	
			?>	
			<tr>
				<td class="td_pad">
					<input type="hidden" name="std_id_<?php echo $i; ?>" value="<?php echo $value['_id']; ?>">
					<?php echo $i; ?>
				</td>
				<td class="td_pad"><?php echo $value['_uniq_id']; ?></td>
				<td class="td_pad"><?php echo $value['_full_name']; if(!empty($value['_nick_name'])){echo ' ('.$value['_nick_name'].')'; } ?></td>
				<td class="td_pad"><?php echo $value['_section_roll']; ?></td>
				<td class="td_pad" style="text-align: center;"><label><input type="checkbox" id="home_status_<?php echo $i; ?>" name="home_status_<?php echo $i; ?>" class="checked_home_topics" value="0" ><span class="lbl"></span></label></td>
				
				<td class="td_pad" style="text-align: center;"><textarea name="topics_<?php echo $i; ?>" class="input-small topics_specific"  placeholder="Home Work Topics" style="width:370px;height:20px" id="topics_<?php echo $i; ?>" rows="1"  /> </textarea>
                    <div class="topics-bottom" style="width:100%;">  
                    	<div class="span6 topics-count">
                        	   Characther:<span class="char-length" style="margin-right:20px"> </span> 
                               Message:<span class="message-number"> </span>
                         </div>
                    </div>
                </td>
				<td class="td_pad"><?php echo $value['_contact_mobile']; ?></td>
			</tr>	
			<?php
			}
			$total_row = $obj->View_Student_List_rows("sc._id='$section_id' AND pf_std._status='A'");
			?>
			<tr>
				<input type="hidden" name="total_row" value="<?php echo $total_row; ?>">
			</tr>
		</tbody>	

	</table>
</div>

<!-- ========================== -->

<div class="row-fluid">	
	<div class="span5"><b>Class Teacher name:</b> <?php echo $tch_det['_full_name']; if(!empty($tch_det['_nick_name'])){ echo ' ('.$tch_det['_nick_name'].')';} ?></div>

	<div class="span3"><b>Mobile No:</b> <?php echo $tch_det['_contact_mobile_no']; ?></div>
</div>

<!-- ========================= -->

<div class="row-fluid">	
	<div class="span3">Homework Time :
		<div class="controls">
			<div class="input-append bootstrap-timepicker">
				<input name="home_work_time" type="text" class="input-small timepicker1" />
				<span class="add-on">
					<i class="icon-time"></i>
				</span>
			</div>
		</div>
	</div>
	
	<div class="span3">Comments :
		<div class="controls">
			<input name="remarks" class="input-large" type="text" placeholder="Comments">
		</div>
	</div>
    <div class="span3">Common Topics :
		<div class="controls">
			<textarea name="_homework_common_topics" id="_homework_common_topics" class="input-large" rows="3" placeholder=""></textarea>
		</div>
	</div>
</div>


<!-- =========================== -->

<div class="row-fluid">									
	<div class="span12">			
		<div class="control-group">
			<label class="control-label" for="form-field-1">&nbsp;</label>

			<div class="controls">
				<?php if($total_row){ ?>
				<button class="btn btn-small btn-success" type="button" id="btn_save_atdsheet">
					<i class="icon-ok bigger-100"></i>Save
				</button>
				<?php
				}
				else{
				?>
				<button class="btn btn-small btn-success" type="button" id="btn_save_atd">
					<i class="icon-ok bigger-100"></i>Save
				</button>
				<?php } ?>

				&nbsp; &nbsp; &nbsp;
				<button class="btn btn-small btn-danger" type="reset" id="btn_reset">
					<i class="icon-undo bigger-100"></i>
					Reset
				</button>
			</div>
		</div>
	</div>
	
</div>


</form>
<script type="text/javascript">
$("#back_hw").click(function(){
	var shift_id = $("#sft_id").val();
	var medium_id = $("#md_id").val();			
	var dataStr1="medium_id="+medium_id+"&shift_id="+shift_id;
	

				$(".data_to_show_atd").load("module/homework/daily_homework_class_status_view.php",dataStr1);

				$('#first_part').remove();
				$('#second_part').css("display","block");
	
});

</script>