Example #1
0
 public function capNhatTV($ma_hd_nghiem_thu, $thanhViens)
 {
     $this->pc_nghiem_thu->xoa_tv_by_mhd($ma_hd_nghiem_thu);
     foreach ($thanhViens as $thanh_vien) {
         $pc_nghiem_thu = new Default_Model_Pcnt();
         $pc_nghiem_thu->setMaGiangVien($thanh_vien['ma_giang_vien'])->setMaHdNghiemThu($ma_hd_nghiem_thu)->setChucDanh($thanh_vien['chuc_danh']);
         $pc_nghiem_thu->them();
     }
 }
Example #2
0
 public function themHdntAction()
 {
     // TODO Auto-generated {0}::indexAction() default action
     $form = new Admin_Form_HDNT();
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'danh-sach-hdnt'), null, true);
     $form->submitCon->setLabel('Lưu và tiếp tục');
     $form->submitExit->setLabel('Lưu và thoát');
     $form->cancel->setLabel('Không lưu')->setAttribs(array('onclick' => 'window.location.href="' . $link . '"'));
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $form->preValidation($_POST);
         $formData = $this->getRequest()->getPost();
         foreach ($formData as $k => $v) {
             if (strpos($k, 'thanh_vien_') !== false && $v == '0') {
                 $formData[$k] = null;
             }
         }
         if ($form->isValid($formData)) {
             if (!Default_Model_Functions::kiem_tra_ma($form->getValue('ma'), 'HDNT', true)) {
                 $_SESSION['msg'] = 'Lỗi !. Mã hội đồng nghiệm thu không đúng định dạng, vui lòng kiểm tra lại .';
                 $_SESSION['type_msg'] = 'error';
                 $this->_redirect('/admin/hoi-dong/danh-sach-hdnt');
             }
             if ($this->hd_nghiem_thu->kiem_tra_ma($form->getValue('ma'))) {
                 $_SESSION['msg'] = 'Lỗi !. Mã hội đồng nghiệm thu đã tồn tại, vui lòng kiểm tra lại .';
                 $_SESSION['type_msg'] = 'error';
                 $this->_redirect('/admin/hoi-dong/danh-sach-hdnt');
             }
             $db = Zend_Registry::get('connectDB');
             $hd_nghiem_thu = new Default_Model_Hdnt();
             $hd_nghiem_thu->setMa($form->getValue('ma'))->setNgayThanhLap(date('Y-m-d', strtotime($form->getValue('ngay_thanh_lap'))))->setGhiChu($form->getValue('ghi_chu'))->setMaDeTai($_POST['hdnt'][0]);
             $kq = $hd_nghiem_thu->them();
             if (!$kq) {
                 $_SESSION['msg'] = 'Lỗi !. Đã có lỗi trong quá trình xử lý, vui lòng thử lại .';
                 $_SESSION['type_msg'] = 'error';
                 $this->_redirect('/admin/hoi-dong/danh-sach-hdnt');
             }
             //them phan cong hoi dong
             $hdnt_id = $db->lastInsertId();
             for ($i = 0; $i <= 4; $i++) {
                 //kiem tra co chon giang vien
                 if ($form->getValue('thanh_vien_' . $i) != 0) {
                     $pc_nghiem_thu = new Default_Model_Pcnt();
                     $pc_nghiem_thu->setMaGiangVien($form->getValue('thanh_vien_' . $i))->setMaHdNghiemThu($hdnt_id)->setChucDanh($i);
                     $pc_nghiem_thu->them();
                 }
             }
             $_SESSION['msg'] = 'Thành công !. Dữ liệu đã được lưu trữ .';
             $_SESSION['type_msg'] = 'success';
             if ($form->submitCon->isChecked()) {
                 $this->_redirect('/admin/hoi-dong/them-hdnt');
             } else {
                 $this->_redirect('/admin/hoi-dong/danh-sach-hdnt');
             }
         } else {
             $form->populate($formData);
         }
     }
 }