<?php
    $encode_data    = $data;
    $decode_data    = base64_decode($encode_data);
    $explode_data   = explode("-", $decode_data);
    $min            = $this->db->get_where('academic_settings', array('type' => 'minium_mark'))->row()->description;
    $running_year   = $this->crud->getInfo('running_year');
    $sub            = $this->db->get_where('subject', array('subject_id' => $explode_data[2]))->result_array();
    $class_id       = $explode_data[0];
    $section_id     = $explode_data[1];
    $subject_id     = $explode_data[2];
    $student_id     = $explode_data[3];
    $nota_c         = $this->academic->getInfo('minium_mark');
    foreach ($sub as $rows) :
?>
    <div class="content-w">
        <div class="conty">
            <?php $info = base64_decode($data); ?>
            <?php $ids = explode("-", $info); ?>
            <?php include 'fancy.php'; ?>
            <div class="header-spacer"></div>
            <div class="content-i">
                <div class="content-box">
                    <div class="row">
                        <main class="col col-xl-12 order-xl-2 col-lg-12 order-lg-1 col-md-12 col-sm-12 col-12">
                            <div id="newsfeed-items-grid">
                                <div class="pd00">
                                    <div id='cssmenu'>
                                        <ul>
                                        <?php  
                                            $var = 0;
                                            $examss = $this->db->get('exam')->result_array();
                                            foreach($examss as $exam):
                                            $var++;
                                        ?>
                                            <li class='<?php if($exam['exam_id'] == $exam_id) echo "act";?>'><a href="<?php echo base_url();?>parents/subject_marks/<?php echo $data.'/'.$exam['exam_id'];?>/"><i class="os-icon picons-thin-icon-thin-0023_calendar_month_day_planner_events"></i><?php echo $exam['name'];?></a></li>
                                        <?php endforeach;?>
                                        </ul>
                                    </div>
                                </div>
                                <div class="element-wrapper bg-white">
                                    <div class="element-box-tp">
                                        <div class="table-responsive">
                                            <table class="table table-lightborder">
                                                <thead>
                                                    <tr>
                                                        <th><?php echo getEduAppGTLang('activity');?></th>
                                                        <th><?php echo getEduAppGTLang('mark');?></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php 
                                                        $classID = $this->db->get_where('enroll' , array('student_id' => $student_id, 'year' => $running_year))->row()->class_id;
                                                        $sectionID = $this->db->get_where('enroll' , array('student_id' => $student_id, 'year' => $running_year))->row()->section_id;
                                                        $capacidades = $this->db->order_by('mark_activity_id', 'ASC')->get_where('mark_activity', array('class_id' => $classID, 'subject_id' => $explode_data[2], 'year' => $running_year, 'exam_id' => $exam_id))->result_array();
                                                        foreach ($capacidades as $cap) : 
                                                    ?>
                                                    <tr>
                                                        <td>
                                                            <?php echo $cap['name'];?>
                                                        </td>
        					                            <td>
        					                            <?php 
        					                                $nota_cap = $this->db->order_by('point_id', 'ASC')->get_where('point', array('mark_activity_id' => $cap['mark_activity_id'], 'student_id' => $student_id))->row()->nota;
                                                        ?>
                                                            <?php if ($nota_cap <= $min) : ?>
                                                                <?php echo $nota_cap;?>
                                                            <?php else : ?>
                                                                <?php echo $nota_cap;?>
                                                            <?php endif; ?>
        					                            </td>
                                                    </tr>
                                                    <?php endforeach;?>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div class="form-buttons-w text-center">
                                            <a class="btn btn-success text-white btn-rounded" style="margin-left:10px;" href="<?php echo base_url(); ?>parents/marks/"><?php echo getEduAppGTLang('view_all_marks'); ?></a><br><br>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </main>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php endforeach; ?>