<?php 
    $running_year = $this->crud->getInfo('running_year');
    $info = base64_decode($data);
    $ex = explode('-', $info);
    $sub = $this->db->get_where('subject', array('subject_id' => $ex[2]))->result_array();
    foreach($sub as $row):
    $students   =   $this->db->get_where('enroll' , array('class_id' => $ex[0], 'section_id' => $ex[1] , 'year' => $running_year))->result_array();
?>
    <div class="content-w">
        <div class="conty">
        <?php include 'fancy.php';?>
            <div class="header-spacer"></div>
            <?php include 'subject_header.php';?>
            <div class="container">
                <div class="content-box">
                    <div class="col-lg-12">   
                        <div class="back mb-3">
                            <a class="fs-16" href="<?php echo base_url();?>teacher/subject_dashboard/<?php echo $data;?>/"><i class="picons-thin-icon-thin-0131_arrow_back_undo"></i> <span><?php echo getEduAppGTLang('return_to_dashboard');?></span></a>
                        </div>
                        <div class="element-wrapper"> 
                            <div class="element-box lined-primary shadow">
                                <div class="modal-header pd10">
                                    <h5 class="modal-title"><?php echo getEduAppGTLang('new_exam');?></h5>
                                </div>
                                <?php echo form_open(base_url() . 'teacher/activities/exam/', array('enctype' => 'multipart/form-data')); ?>
                                    <input type="hidden" name="method" value="create">
                                    <div class="row mt-3">
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('title');?></label>
                                                <div class="input-group">
                                                    <input type="text" class="form-control" name="title">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('date');?></label>
                                                <div class="input-group">
                                                    <input type='text' class="datepicker-here" data-position="top left" data-language='en' name="exam_date" data-multiple-dates-separator="/"/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('start_time');?></label>
                                                <div class="input-group clockpicker" data-align="top" data-autoclose="true">
                                                    <input type="text" required="" name="time_start" class="form-control" value="00:00">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('end_time');?></label>
                                                <div class="input-group clockpicker" data-align="top" data-autoclose="true">
                                                    <input type="text" required="" name="time_end" class="form-control" value="00:00">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('minimum_percentage');?></label>
                                                <div class="input-group">
                                                    <input type="text" class="form-control" name="minimum_percentage">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <div class="form-group is-select">
                                                <label><?php echo getEduAppGTLang('issue_certificate');?></label>
                                                <div class="select">
                                                    <select name="certificate" required="">
                                                        <option value=""><?php echo getEduAppGTLang('select');?></option>
                                                        <option value="1"><?php echo getEduAppGTLang('yes');?></option>
                                                        <option value="2"><?php echo getEduAppGTLang('no');?></option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('password');?></label>
                                                <div class="input-group">
                                                    <input type="text" class="form-control" name="password">
                                                </div>
                                                <small><?php echo getEduAppGTLang('optional');?></small>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="form-group is-select">
                                                <label><?php echo getEduAppGTLang('show_results');?></label>
                                                <div class="select">
                                                    <select name="results" required="">
                                                        <option value=""><?php echo getEduAppGTLang('select');?></option>
                                                        <option value="1"><?php echo getEduAppGTLang('keep_hidden');?></option>
                                                        <option value="2"><?php echo getEduAppGTLang('show_when_exam_is_finished');?></option>
                                                        <option value="3"><?php echo getEduAppGTLang('15_minutes_after_finished');?></option>
                                                        <option value="4"><?php echo getEduAppGTLang('30_minutes_after_finished');?></option> 
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <div class="checkbox-wrapper-4 mt-4">
                                                <input class="inp-cbx" id="show_random" name="show_random" value="1" type="checkbox"/>
                                                <label class="cbx" for="show_random"><span>
                                                    <svg width="12px" height="10px">
                                                        <use xlink:href="#check-4"></use>
                                                    </svg>
                                                    </span><span><?php echo getEduAppGTLang('show_questions_randomly');?>.</span>
                                                </label>
                                                <svg class="inline-svg">
                                                    <symbol id="check-4" viewbox="0 0 12 10">
                                                        <polyline points="1.5 6 4.5 9 10.5 1"></polyline>
                                                    </symbol>
                                                </svg>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="form-group">
                                                <label for=""><?php echo getEduAppGTLang('description');?></label>
                                                <textarea class="form-control" name="instruction" id="ckeditorEmail"></textarea>
                                            </div>
                                        </div>
                                        <input type="hidden" value="<?php echo $ex[0];?>" name="class_id">
                                        <input type="hidden" value="<?php echo $ex[1];?>" name="section_id">
                                        <input type="hidden" value="<?php echo $ex[2];?>" name="subject_id">
                                        <div class="form-group">
                                            <div class="col-sm-12 text-center">
                                                <button type="submit" class="btn btn-success"><?php echo getEduAppGTLang('save');?></button>
                                            </div>
                                        </div>
                                    </div>
                                <?php echo form_close();?>
                            </div>
                        </div>
                    </div>
                </div>  
            </div>
        </div>
    </div>
<?php endforeach;?>