Exemplo n.º 1
0
 public function baocaotongketAction()
 {
     $lop = new Model_Lophoc();
     $idlop = $classes_id = $_GET['idlop'];
     $listsv = $lop->listsv($idlop);
     $this->view->listsv = $listsv;
     $lophoc = $lop->findOneLop($classes_id);
     $this->view->lop = $lophoc;
     $hocky = $lop->findschoolyears($lophoc->schoolyears_id);
     $this->view->hocky = $hocky;
     $diemtru = $lop->diemtru();
     $this->view->diemtru = $diemtru;
     //echo '<pre>';
     //print_r($diemtru[0]->minus_point);
     //echo '</pre>';
     foreach ($listsv as $sv) {
         $masv = $sv->student_id;
         $dihoc[$masv] = $lop->dihoc($idlop, $masv);
     }
     $this->view->dihoc = $dihoc;
     foreach ($listsv as $sv) {
         $masv = $sv->student_id;
         $diem[$masv] = $lop->indiem($idlop, $masv);
     }
     $this->view->diem = $diem;
 }
Exemplo n.º 2
0
 public function chitietdiemdanhAction()
 {
     $lop = new Model_Lophoc();
     $idlop = $classes_id = $_GET['idlop'];
     $listsv = $lop->listsv($idlop);
     $this->view->listsv = $listsv;
     $lophoc = $lop->findOneLop($classes_id);
     $getDate = $lop->findDateByClassesID($classes_id);
     $this->view->getDate = $getDate;
     $this->view->lop = $lophoc;
     //var_dump($lop);
     foreach ($listsv as $sv) {
         $masv = $sv->student_id;
         $dihoc[$masv] = $lop->dihoc($idlop, $masv);
     }
     $this->view->dihoc = $dihoc;
     $tongsv = $lop->tongsv($idlop);
     $this->view->tongsv = $tongsv;
     for ($i = 1; $i <= $lophoc->session_number; $i++) {
         $buoi = $i;
         $sodihoc[$buoi] = $lop->sodihoc($idlop, $buoi);
     }
     $this->view->sodihoc = $sodihoc;
     //echo '<pre>';
     //print_r($sodihoc);
     //echo '</pre>';
 }
Exemplo n.º 3
0
 public function nhapdiemAction()
 {
     $lop = new Model_Lophoc();
     $idlop = $classes_id = $_GET['idlop'];
     $listsv = $lop->listsv($idlop);
     $this->view->listsv = $listsv;
     $lophoc = $lop->findOneLop($classes_id);
     $this->view->lop = $lophoc;
     $hocky = $lop->findschoolyears($lophoc->schoolyears_id);
     $this->view->hocky = $hocky;
     $diemtru = $lop->diemtru();
     $this->view->diemtru = $diemtru;
     //echo '<pre>';
     //print_r($diemtru[0]->minus_point);
     //echo '</pre>';
     foreach ($listsv as $sv) {
         $masv = $sv->student_id;
         $dihoc[$masv] = $lop->dihoc($idlop, $masv);
     }
     $this->view->dihoc = $dihoc;
     $listnhap = $lop->kiemtranhapdiem($idlop);
     $this->view->listnhap = $listnhap;
     foreach ($listsv as $sv) {
         $masv = $sv->student_id;
         $diem[$masv] = $lop->indiem($idlop, $masv);
     }
     $this->view->diem = $diem;
     $idsv = $this->_getParam('id');
     $diemchuyencan = $this->_getParam('diemchuyencan');
     $diemquatrinh = $this->_getParam('diemquatrinh');
     if ($this->_request->isPost()) {
         $kiemtra = $lop->kiemtranhapdiem($idlop);
         if (count($kiemtra) > 0) {
             for ($i = 0; $i < count($idsv); $i++) {
                 $student_id = $idsv[$i];
                 $dcc = $diemchuyencan[$i];
                 $dqt = $diemquatrinh[$i];
                 $lop->updatediem($student_id, $idlop, $dcc, $dqt);
             }
             // $this->redirect('nhapdiem/nhapdiem?idlop='.$idlop);
             header("Refresh:0");
             echo "<script>alert('Nhập điểm thành công');</script>";
         } else {
             for ($i = 0; $i < count($idsv); $i++) {
                 $student_id = $idsv[$i];
                 $dcc = $diemchuyencan[$i];
                 $dqt = $diemquatrinh[$i];
                 $lop->nhapdiem($student_id, $idlop, $dcc, $dqt);
             }
             //$this->redirect('nhapdiem/nhapdiem?idlop='.$idlop);
             header("Refresh:0");
             echo "<script>alert('Nhập điểm thành công');</script>";
         }
     }
 }
Exemplo n.º 4
0
 public function updateAction()
 {
     $lop = new Model_Lophoc();
     $classes_id = $_GET['classes_id'];
     $findOne = $lop->findOneLop($classes_id);
     $this->view->findOne = $findOne;
     $listgv = $lop->listgv();
     $this->view->listgv = $listgv;
     $listmon = $lop->listmon();
     $this->view->listmon = $listmon;
     if ($this->_request->isPost()) {
         $data = $this->_getParam('searchParam');
         $lop->updateLop($classes_id, $data);
         $this->redirect('giaovu/lop/list');
     }
 }
Exemplo n.º 5
0
 private function createCSVEnroll()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $lop = new Model_Lophoc();
     $idlop = $classes_id = $_GET['idlop'];
     $listsv = $lop->listsv($idlop);
     $this->view->listsv = $listsv;
     $lophoc = $lop->findOneLop($classes_id);
     $getDate = $lop->findDateByClassesID($classes_id);
     $this->view->getDate = $getDate;
     $this->view->lop = $lophoc;
     $schoolyears_name = $lop->findschoolyears($lophoc->schoolyears_id);
     $this->view->schoolyears_name = $schoolyears_name;
     foreach ($listsv as $sv) {
         $masv = $sv->student_id;
         $dihoc[$masv] = $lop->dihoc($idlop, $masv);
     }
     $this->view->dihoc = $dihoc;
     $tongsv = $lop->tongsv($idlop);
     $this->view->tongsv = $tongsv;
     for ($i = 1; $i <= $lophoc->session_number; $i++) {
         $buoi = $i;
         $sodihoc[$buoi] = $lop->sodihoc($idlop, $buoi);
     }
     $this->view->sodihoc = $sodihoc;
     //Create Excel file
     $header = "Mã SV" . ",\t";
     $header .= "Tên SV" . ",\t";
     $k = 0;
     for ($a = 1; $a <= $lophoc->session_number; $a++) {
         $header .= "Buổi" . $a . "(" . $getDate[$k]->date . ")" . ",\t";
         $k++;
     }
     $header .= "Tổng buổi vắng" . ",\t\n";
     $line = '';
     foreach ($listsv as $listsv) {
         $value1 = str_replace('"', '""', $listsv->student_id);
         $value2 = str_replace('"', '""', $listsv->student_name);
         $setValue = '"' . $value1 . '"' . ",\t" . $value2 . ",\t";
         for ($a = 0; $a < $lophoc->session_number; $a++) {
             if ($dihoc[$listsv->student_id][$a]['d'] != null) {
                 $value = str_replace('"', '""', 'x');
                 $setValue .= $value . ",\t";
             } else {
                 $value = str_replace('"', '""', '');
                 $setValue .= $value . ",\t";
             }
         }
         $value3 = str_replace('"', '""', $lophoc->session_number - count($dihoc[$listsv->student_id]));
         $setValue .= $value3 . ",\t\n";
         $line .= $setValue;
     }
     $data .= trim($line) . "\n";
     $data = str_replace("\r", "", $data);
     // output data
     echo $header . "\n" . $data;
     header('Content-Encoding: UTF-8');
     header("Content-type: application/csv; name='excel';charset='UTF-8'");
     header("Content-Disposition: attachment; filename=" . $lophoc->classes_name . ".csv");
     header("Pragma: no-cache");
     header("Expires: 0");
 }