SHARE
TWEET

Untitled

a guest Jun 15th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $abFirstExam = 0;
  3.     $absecondExam = 0;
  4.     $abThirdExam = 0;
  5.     $abFourthExam = 0;
  6.  
  7.     $absences = array(
  8.       '0' => 0,
  9.       '1' => 0,
  10.       '2' => 0,
  11.       '3' => 0,
  12.     );
  13.  
  14.     $studentAttendance = $this->db->get_where('attendance', array(
  15.       'section_id' => $section_id,
  16.       'class_id' => $class_id,
  17.       'year' => $running_year,
  18.       'student_id' => $student_id
  19.     ))->result_array();
  20.  
  21.     for ($i = 1; $i <= 12; $i++) {
  22.       $year = explode('-', $running_year);
  23.       $days = cal_days_in_month(CAL_GREGORIAN, $i, $sessional_year);
  24.       for ($d = 1; $d <= $days; $d++) {
  25.         $timestamp = strtotime($d . '-' . $i . '-' . $sessional_year);
  26.  
  27.         $attendance = array_filter($studentAttendance, function($v) use ($timestamp) {
  28.           return ($v['timestamp'] == $timestamp);              
  29.         });
  30.  
  31.         for ($ab = 0; $ab < sizeof($attendance); $ab++) {
  32.           if ($attendance[$ab]['status'] == 2) {
  33.             $attd = gmdate("Y-m-dTH:i:sZ", $attendance[$ab]['timestamp']);
  34.             $attTimestamp = new DateTime($attd);
  35.             // echo $attTimestamp->format('d/m/Y');
  36.  
  37.             $dateBegin = new DateTime($period_data->first_start);
  38.             $dateEnd  = new DateTime($period_data->first_end);
  39.  
  40.             if ($attTimestamp->getTimestamp() > $dateBegin->getTimestamp() && $attTimestamp->getTimestamp() < $dateEnd->getTimestamp())
  41.               $absences[0]++;
  42.  
  43.             $dateBegin = new DateTime($period_data->second_start);
  44.             $dateEnd  = new DateTime($period_data->second_end);
  45.  
  46.             if ($attTimestamp->getTimestamp() > $dateBegin->getTimestamp() && $attTimestamp->getTimestamp() < $dateEnd->getTimestamp())
  47.               $absences[1]++;
  48.  
  49.             $dateBegin = new DateTime($period_data->third_start);
  50.             $dateEnd  = new DateTime($period_data->third_end);
  51.  
  52.             if ($attTimestamp->getTimestamp() > $dateBegin->getTimestamp() && $attTimestamp->getTimestamp() < $dateEnd->getTimestamp())
  53.               $absences[2]++;
  54.  
  55.             $dateBegin = new DateTime($period_data->fourth_start);
  56.             $dateEnd  = new DateTime($period_data->fourth_end);
  57.  
  58.             if ($attTimestamp->getTimestamp() > $dateBegin->getTimestamp() && $attTimestamp->getTimestamp() < $dateEnd->getTimestamp())
  59.               $absences[3]++;
  60.           }
  61.         }
  62.       }
  63.     }
  64.     ?>
  65.      
  66. <div class="col-xs-5" style="padding-left: 0px;">
  67.     <div style="margin-left: -1px" class="col-xs-3 header-goal text-center border-bottom border-left">
  68.         <?php
  69.         $abFirstExam = $absences[0];
  70.  
  71.         print_r($abFirstExam);
  72.         ?>
  73.     </div>
  74.     <div style="margin-left:  0px" class="col-xs-3 header-goal text-center border-bottom border-left">
  75.       <?php
  76.       $absecondExam = $absences[1];
  77.  
  78.       print_r($absecondExam);
  79.       ?>
  80.     </div>
  81.     <div style="margin-left:  0px" class="col-xs-3 header-goal text-center border-bottom border-left">
  82.       <?php
  83.         $abThirdExam = $absences[2];
  84.  
  85.         print_r($abThirdExam);
  86.       ?>
  87.     </div>
  88.     <div style="margin-left:  1px" class="col-xs-3 header-goal border-left text-center border-bottom border-right">
  89.       <?php
  90.         $abFourthExam = $absences[3];
  91.  
  92.         print_r($abFourthExam);
  93.       ?>
  94.     </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top