<style>.top-bar-minimize{display:none;}
thead, tfoot {display: table-header-group;}
.top-bar+.well,.accordion .accordion-heading+.accordion-body{display: inline-block !important;width: 100% !important;overflow: inherit !important;} .check{ width: 133px; padding: 5px; display: inline-block; border-right: 1px dotted;}
.check input[type="checkbox"] { margin: 0 6px;}
.fac {cursor: move;list-style: none;border: 1px solid #ccc;padding: 5px 10px;display: inline-block;}
</style>
<?php
$pgMod="attendance";
$pgAct="view";
if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);

?>
<link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>


<?php
$class="1";
$weekDays = array(
      'Monday',
      'Tuesday',
      'Wednesday',
      'Thursday',
      'Friday',
      'Saturday',
    );
?>
<div class="row-fluid">
    <div class="span12">
        <div class="top-bar">
            <h3><i class="icon-eye-open"></i> Manage class TimeTable</h3>
        </div>
        <div class="well no-padding">
            <table class="table"><?php
            $period=$db->getRows("select * from timetableSchedule where school_id='".$_SESSION["admin"]["school_id"]."' and class='$class'");
            if(is_array($period) && count($period)>0){
                ?><tr><td></td><?php
                foreach($period as $name){
                    ?><td><?php echo $name["start"]."-".$name["end"]; ?></td><?php	
                }
                ?></tr><?php
            }
            foreach($weekDays as $week){
                if(is_array($period) && count($period)>0){
                    ?><tr>
                    <td><?php echo $week ?></td>
                    <?php
                    foreach($period as $name){
                        ?><td>---</td><?php	
                    }
                    ?></tr><?php
                }
            }
            ?>
            </table>
        </div>
    </div>
</div>
<div class="row-fluid">
	<div class="span12">
        <div class="top-bar">
            <h3><i class="icon-eye-open"></i>Select Subject</h3>
        </div>
        <div class="well no-padding">
             <div class="control-group">
                <label class="control-label" for="subject">Subject</label>
                <div class="controls">
                    <select class="span12" onchange="getTeacher(this.value)" name="subject" id="subject">
                        <option value="">subject</option>
                        <?php 
                            $classes=$db->getRows("select * from subject where school_id='".$_SESSION["admin"]["school_id"]."' and class='$class'");
                            foreach($classes as $cla){
                                ?>
                                <option <?php if($cla["subject"]==$aryForm["subject"])echo 'selected';?> value="<?php echo $cla["subject"] ?>">
                                    <?php echo $cla["subject"] ?>
                                </option>
                                <?php
                            }
                        ?>
                    </select>
                </div>
            </div>
            <div id="fac"></div>
        </div>
    </div>
</div>
<?php //echo $db->getLastQuery().$db->getErMsg(); ?>
<script>
	function getTeacher(id){
		$.post( "<?php echo URL_ROOT ?>Faculty/ajax.php", { type: "getTeacher", subject: id, cls: "<?php echo $class ?>" } , function( data ) {
			$("#fac").html(data);
			$(".fac").draggable({
			
				// brings the item back to its place when dragging is over
				revert:true,
			
				// once the dragging starts, we decrease the opactiy of other items
				// Appending a class as we do that with CSS
				drag:function () {
					//$(this).addClass("active");
					$(this).closest("#product").addClass("active");
				},
			
				// removing the CSS classes once dragging is over.
				stop:function () {
					$(this).removeClass("active").closest("#product").removeClass("active");
				}
			});
		});
	}
</script>