Exemple #1
0
 public function init()
 {
     $this->setName('f3')->setMethod('get');
     $linh_vuc = new Default_Model_LinhVuc();
     $lv = $linh_vuc->getDSLV();
     $lv = array('0' => '========= Tất cả =========') + $lv;
     $lvOptions = array("multiOptions" => $lv);
     $ma_linh_vuc = new Zend_Form_Element_Select('ma_linh_vuc', $lvOptions);
     $ma_linh_vuc->setRequired(true)->setLabel('Lĩnh vực')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'ma_linh_vuc'));
     $nams = Default_Model_Constraints::nam();
     $nams = array('0' => '== Tất cả ==') + $nams;
     ksort($nams);
     $namOption = array("multiOptions" => $nams);
     $nam = new Zend_Form_Element_Select('nam', $namOption);
     $nam->setLabel('Năm')->setValue(date('Y'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'nam'));
     $submit = new Zend_Form_Element_Submit('loc');
     $submit->setLabel('Lọc')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'danh-sach-hdd'), null, true);
     $reset = new Zend_Form_Element_Button('reset');
     $reset->setLabel('Làm mới')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'filter_btn_r'))))->setAttribs(array('class' => 'button', 'id' => 'reset', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($ma_linh_vuc, $nam, $submit, $reset));
     // Element: order
     $this->addElement('Hidden', 'order', array('order' => 10004));
     // Element: direction
     $this->addElement('Hidden', 'direction', array('order' => 10005));
     $this->addDisplayGroup(array('ma_linh_vuc', 'nam', 'loc', 'reset'), 'group1', array('order' => 1, 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'align' => 'left', 'class' => 'text')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'filter_hdd', 'style' => 'width : 65%')), 'Form'));
 }
Exemple #2
0
 public function init()
 {
     $this->setAttrib('class', 'global_form form_search_dt')->setMethod('get');
     $don_vi = new Default_Model_DonVi();
     $dv = $don_vi->getDSDVSGU();
     unset($dv['1']);
     $dv = array('' => '') + $dv;
     $dvOptions = array("multiOptions" => $dv);
     $ma_don_vi = new Khcn_Form_Element_Select('ma_don_vi', $dvOptions);
     $ma_don_vi->setLabel('Đơn vị')->setAttribs(array('onchange' => 'this.form.submit()'));
     $this->addElement($ma_don_vi);
     $capQLs = Default_Model_Constraints::detai_capquanly();
     $capQLsOptions = array("multiOptions" => array('' => '') + $capQLs);
     $cap_quan_ly = new Khcn_Form_Element_Select('cap_quan_ly', $capQLsOptions);
     $cap_quan_ly->setLabel('Cấp quản lý')->setAttribs(array('id' => 'cap_quan_ly', 'onchange' => 'this.form.submit()'));
     $this->addElement($cap_quan_ly);
     $this->addDisplayGroup(array('ma_don_vi', 'cap_quan_ly'), 'submitbtn');
     $status = Default_Model_Constraints::detai_tinhtrang();
     $status = array('' => '') + $status;
     $statusOptions = array("multiOptions" => $status);
     $tinh_trang = new Khcn_Form_Element_Select('tinh_trang', $statusOptions);
     $tinh_trang->setLabel('Tình trạng')->setAttribs(array('onchange' => 'this.form.submit()'));
     $this->addElement($tinh_trang);
     $linh_vuc = new Default_Model_LinhVuc();
     $lv = $linh_vuc->getDSLV();
     $lv = array('' => '') + $lv;
     $lvOptions = array("multiOptions" => $lv);
     $ma_linh_vuc = new Khcn_Form_Element_Select('ma_linh_vuc', $lvOptions);
     $ma_linh_vuc->setLabel('Lĩnh vực')->setAttribs(array('onchange' => 'this.form.submit()'));
     $this->addElement($ma_linh_vuc);
     $sorts = array('' => 'Mã & Năm', 'ma' => 'Mã', 'nam' => 'Năm');
     $sortsOption = array("multiOptions" => $sorts);
     $order = new Khcn_Form_Element_Select('order', $sortsOption);
     $order->setLabel('Sắp xếp')->setAttribs(array('onchange' => 'this.form.submit()'));
     //$this->addElement($ma_don_vi);
     $directions = array('asc' => 'Tăng dần', 'desc' => 'Giảm dần');
     $directionsOption = array("multiOptions" => $directions);
     $direction = new Khcn_Form_Element_Select('direction', $directionsOption);
     $direction->setLabel('Sắp xếp')->setValue('desc')->setAttribs(array('onchange' => 'this.form.submit()'));
     //$this->addElement($ma_don_vi);
     $nams = array();
     for ($i = 2005; $i < 2030; $i++) {
         $nams[$i] = $i;
     }
     $nams = array('0' => '------') + $nams;
     $namsOption = array("multiOptions" => $nams);
     $from = new Khcn_Form_Element_Select('from', $namsOption);
     $from->setLabel('Từ ')->setValue(date('Y'))->setAttribs(array('onchange' => 'this.form.submit()'));
     $this->addElement($from);
     $to = new Khcn_Form_Element_Select('to', $namsOption);
     $to->setLabel('Đến ')->setAttribs(array('onchange' => 'this.form.submit()'));
     $this->addElement($to);
     //$this->addElements(array($ma_don_vi,$tinh_trang,$ma_linh_vuc,$order,$direction,$from,$to));
     //$this->addElements(array($ma_don_vi, $cap_quan_ly, $ma_linh_vuc, $tinh_trang, $from, $to));
 }
Exemple #3
0
 public function dsLinhVuc()
 {
     $bizLinhVuc = new Default_Model_LinhVuc();
     $result = array();
     $result = $bizLinhVuc->getAll();
     $link = new Zend_View_Helper_Url();
     $str = '<ul>';
     foreach ($result as $linh_vuc) {
         $url = $link->url(array('controller' => 'de-tai', 'action' => 'danh-sach', 'catid' => $linh_vuc['id']), null, true);
         $str .= '<li><a class="Normal" href="' . $url . '" target="_self">' . $linh_vuc['ten'] . '</a></li>';
     }
     $str .= '</ul>';
     return $str;
 }
Exemple #4
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int')->setAttribs(array('id' => 'id'));
     $this->addElement($id);
     $code = new Zend_Form_Element_Hidden('code');
     $code->setValue(5)->setAttrib('id', 'code')->removeDecorator('label');
     $this->addElement($code);
     $ma = new Zend_Form_Element_Text('ma');
     $ma->setLabel('Mã hội đồng (*)')->setOrder(1)->setDescription('vd : HDNT2000-01')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToUpper')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 15))->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input'));
     $this->addElement($ma);
     $ngay_thanh_lap = new Zend_Form_Element_Text('ngay_thanh_lap');
     $ngay_thanh_lap->setLabel('Ngày thành lập (*)')->setDescription('(dd-mm-YYYY)')->setOrder(2)->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'ngay_thanh_lap'));
     $this->addElement($ngay_thanh_lap);
     $ghi_chu = new Zend_Form_Element_Text('ghi_chu');
     $ghi_chu->setLabel('Ghi chú')->setOrder(3)->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input medium-input'));
     $this->addElement($ghi_chu);
     //dang ky thanh vien hoi dong
     //danh sach don vi
     $don_vi = new Default_Model_DonVi();
     $donVis = $don_vi->getDSDV();
     unset($donVis['1']);
     $donVis = array('0' => '============= Chọn đơn vị =============') + $donVis;
     $dvOptions = array("multiOptions" => $donVis);
     //danh sach giang vien
     $giangViens = array();
     $giangViens[0] = '===== Chọn giảng viên =====';
     $gvOptions = array("multiOptions" => $giangViens);
     $chucDanhs = Default_Model_Constraints::pcnt_chuc_danh();
     /*
      *  0	 : Chủ tịch
      *	1 	 : Phản biện 1
      *	2	 : Phản biện 2
      *	3	 : Ủy viên
      *  4	 : Ủy viên - Thư ký
      */
     for ($i = 0; $i <= 4; $i++) {
         $dv = new Zend_Form_Element_Select('don_vi_' . $i, $dvOptions);
         $dv->setValue(0)->setDecorators(Khcn_Form_Decorator_Select::getDecorator())->setAttribs(array('id' => 'don_vi_' . $i, 'onchange' => 'change(this,' . $i . ')'));
         $gv = new Zend_Form_Element_Select('thanh_vien_' . $i, $gvOptions);
         $gv->setRequired(true)->setDecorators(Khcn_Form_Decorator_Select::getDecorator())->setAttribs(array('id' => 'thanh_vien_' . $i))->setRegisterInArrayValidator(false);
         $this->addElements(array($dv, $gv));
         $this->addDisplayGroup(array('don_vi_' . $i, 'thanh_vien_' . $i), 'dk_tvhd_' . $i, array('order' => $i + 4, 'Legend' => $chucDanhs[$i] . ' (*)', 'decorators' => array('FormElements', 'Fieldset', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'dk_tvhd_' . $i)))));
     }
     $linh_vuc = new Default_Model_LinhVuc();
     $lvOptions = array("multiOptions" => $linh_vuc->getDSLV());
     $ma_linh_vuc = new Zend_Form_Element_Select('ma_linh_vuc', $lvOptions);
     $ma_linh_vuc->setRequired(true)->setLabel('Lĩnh vực')->setOrder(11)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ma_linh_vuc'));
     $this->addElement($ma_linh_vuc);
     $namOptions = array("multiOptions" => Default_Model_Constraints::nam());
     $nam = new Zend_Form_Element_Select('nam', $namOptions);
     $nam->setRequired(true)->setLabel('Năm')->setOrder(12)->setValue(date('Y'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'nam'));
     $this->addElement($nam);
     $dsdt = new Zend_Form_Element_Button('dsdt');
     $dsdt->setLabel('Danh sách đề tài')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'id' => 'dsdt'));
     $this->addElement($dsdt);
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $this->addElement($submitCon);
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $this->addElement($submitExit);
     $link = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'danh-sach-hdnt'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElement($cancel);
     $this->addDisplayGroup(array('dsdt'), 'function', array('order' => 13, 'decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn_function')))));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('order' => 14, 'decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'hdd')), 'Form'));
 }
Exemple #5
0
 public function init()
 {
     $this->setName('f3')->setMethod('get');
     $nams = Default_Model_Constraints::nam();
     $nams = array('' => '== Tất cả ==') + $nams;
     $namOption = array("multiOptions" => $nams);
     $nam = new Zend_Form_Element_Select('nam', $namOption);
     $nam->setLabel('Năm')->setValue(date('Y'))->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'title'))))->setAttribs(array('id' => 'nam', 'onchange' => 'this.form.submit()'));
     $expiredOption = array('' => '');
     for ($i = 1; $i <= 12; $i++) {
         $expiredOption[$i] = $i;
     }
     $expiredOption = array("multiOptions" => $expiredOption);
     $expired = new Zend_Form_Element_Select('expired', $expiredOption);
     $expired->setLabel('TG Hết hạn (T)')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'title'))))->setAttribs(array('id' => 'expired', 'onchange' => 'this.form.submit()'));
     $capQLs = Default_Model_Constraints::detai_capquanly();
     $capQLsOptions = array("multiOptions" => $capQLs);
     $cap_quan_ly = new Zend_Form_Element_Select('cap_quan_ly', $capQLsOptions);
     $cap_quan_ly->setLabel('Cấp QL')->setValue(2)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'title'))))->setAttribs(array('id' => 'cap_quan_ly', 'onchange' => 'this.form.submit()'));
     $status = Default_Model_Constraints::detai_tinhtrang();
     $status = array('' => '=== Tất cả ===') + $status;
     $statusOptions = array("multiOptions" => $status);
     $tinh_trang = new Zend_Form_Element_Select('tinh_trang', $statusOptions);
     $tinh_trang->setLabel('Tình trạng')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'status')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'class' => 'title'))))->setAttribs(array('id' => 'tinh_trang', 'onchange' => 'this.form.submit()'));
     $linh_vuc = new Default_Model_LinhVuc();
     $lv = $linh_vuc->getDSLV();
     $lv = array('' => '===== Tất cả =====') + $lv;
     $lvOptions = array("multiOptions" => $lv);
     $ma_linh_vuc = new Zend_Form_Element_Select('ma_linh_vuc', $lvOptions);
     $ma_linh_vuc->setLabel('Lĩnh vực')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'ma_linh_vuc', 'onchange' => 'this.form.submit()'));
     $llv = Khcn_Api::_()->getDbTable('loai_linh_vuc', 'default')->getMultiOptions();
     $llv = array('' => '===== Tất cả =====') + $llv;
     $llvOptions = array("multiOptions" => $llv);
     $loai_linh_vuc = new Zend_Form_Element_Select('loai_linh_vuc', $llvOptions);
     $loai_linh_vuc->setLabel('Loại đề tài')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'loai_linh_vuc', 'onchange' => 'this.form.submit()'));
     $don_vi = new Default_Model_DonVi();
     $dv = $don_vi->getDSDVSGU();
     unset($dv[Default_Model_Constraints::ID_DHSG]);
     $dv = array('' => '============= Tất cả =============') + $dv;
     $dvOptions = array("multiOptions" => $dv);
     $ma_don_vi = new Zend_Form_Element_Select('ma_don_vi', $dvOptions);
     $ma_don_vi->setLabel('Đơn vị')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 3)), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))->setAttribs(array('id' => 'ma_don_vi', 'onchange' => 'this.form.submit()'));
     $bo_mon_id = new Zend_Form_Element_Select('bo_mon_id');
     $bo_mon_id->setLabel('Bộ môn')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'td', 'id' => 'bo_mon_id-wrapper'))))->setAttribs(array('id' => 'bo_mon_id', 'onchange' => 'this.form.submit()'));
     $submit = new Zend_Form_Element_Button('loc', array('type' => 'submit'));
     $submit->setLabel('Lọc')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'filter_btn_l'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'de-tai', 'action' => 'index'), null, true);
     $reset = new Zend_Form_Element_Button('reset');
     $reset->setLabel('Làm mới')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'filter_btn_r'))))->setAttribs(array('class' => 'button', 'id' => 'reset', 'onclick' => 'window.location.href="' . $link . '"'));
     $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-dong', 'action' => 'them-hdd'), null, true);
     $them_hdd = new Zend_Form_Element_Button('them_hdd');
     $them_hdd->setLabel('Thành lập Hội đồng duyệt')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span', 'class' => 'filter_btn_r'))))->setAttribs(array('class' => 'button', 'id' => 'them_hdd', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($nam, $ma_linh_vuc, $loai_linh_vuc, $cap_quan_ly, $tinh_trang, $ma_don_vi, $bo_mon_id, $expired, $reset, $them_hdd));
     // Element: order
     $this->addElement('Hidden', 'order', array('order' => 10004));
     // Element: direction
     $this->addElement('Hidden', 'direction', array('order' => 10005));
     $this->addDisplayGroup(array('nam', 'ma_linh_vuc', 'loai_linh_vuc'), 'group2', array('order' => 0, 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'class' => 'group2')))));
     $this->addDisplayGroup(array('tinh_trang', 'cap_quan_ly', 'expired'), 'group3', array('order' => 1, 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'class' => 'group3')))));
     $this->addDisplayGroup(array('ma_don_vi', 'bo_mon_id'), 'group4', array('order' => 2, 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'tr', 'class' => 'group4')))));
     $this->addDisplayGroup(array('reset', 'them_hdd'), 'group1', array('order' => 3, 'decorators' => array('FormElements', array('HtmlTag', array('tag' => 'td', 'class' => 'group1', 'colspan' => 8)))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'filter_dt')), 'Form'));
 }
Exemple #6
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $this->addElement('Hidden', 'search', array('value' => 1));
     $code = new Zend_Form_Element_Hidden('code');
     $code->setValue(0)->setAttrib('id', 'code')->removeDecorator('label');
     $ma = new Zend_Form_Element_Text('ma');
     $ma->setLabel('Mã đề tài (*)')->setDescription('vd : CS2000-01')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToUpper')->addValidator(new Zend_Validate_StringLength(0, 15))->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'small', 'style' => 'display : block')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'ma'))->setOrder(0);
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên đề tài (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input')->setOrder(1);
     $namOptions = array("multiOptions" => Default_Model_Constraints::nam());
     $nam = new Zend_Form_Element_Select('nam', $namOptions);
     $nam->setRequired(true)->setLabel('Năm (*)')->setValue(date('Y'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'nam'))->setOrder(2);
     $don_vi = new Default_Model_DonVi();
     $donVis = $don_vi->getDSDVSGU();
     unset($donVis['1']);
     $dvOptions = array("multiOptions" => $donVis);
     $ma_don_vi = new Zend_Form_Element_Select('ma_don_vi', $dvOptions);
     $ma_don_vi->setRequired(true)->setLabel('Đơn vị (*)')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'ma_don_vi'))->setOrder(3);
     $bmOptions = array("multiOptions" => Khcn_Api::_()->getDbTable('bo_mon', 'default')->getBoMonByDonViAssoc(2));
     $bo_mon_id = new Zend_Form_Element_Select('bo_mon_id', $bmOptions);
     $bo_mon_id->setLabel('Bộ môn')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'bo_mon_id-wrapper'))))->setAttribs(array('class' => 'text-input', 'id' => 'bo_mon_id'))->setRegisterInArrayValidator(false)->setOrder(4);
     $giang_vien = new Default_Model_GiangVien();
     $gvOptions = array("multiOptions" => $giang_vien->getDSGVByDV(2));
     $chu_nhiem = new Zend_Form_Element_Select('chu_nhiem', $gvOptions);
     $chu_nhiem->setRequired(true)->setLabel('Chủ nhiệm (*)')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'chu_nhiem'))->setRegisterInArrayValidator(false)->setOrder(5);
     $them_tv = new Zend_Form_Element_Button('them_tv');
     $them_tv->setLabel('Thêm thành viên')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $xoa_tv = new Zend_Form_Element_Button('xoa_tv');
     $xoa_tv->setLabel('Xóa thành viên')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $linh_vuc = new Default_Model_LinhVuc();
     $lvOptions = array("multiOptions" => $linh_vuc->getDSLV());
     $ma_linh_vuc = new Zend_Form_Element_Select('ma_linh_vuc', $lvOptions);
     $ma_linh_vuc->setRequired(true)->setLabel('Lĩnh vực (*)')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(90);
     $statusOptions = array("multiOptions" => Default_Model_Constraints::detai_tinhtrang());
     $tinh_trang = new Zend_Form_Element_Select('tinh_trang', $statusOptions);
     $tinh_trang->setRequired(true)->setLabel('Tình trạng (*)')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(91);
     $thoi_gian_bat_dau = new Zend_Form_Element_Text('thoi_gian_bat_dau');
     $thoi_gian_bat_dau->setLabel('Ngày bắt đầu (*)')->setDescription('(YYYY-mm-dd)')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'thoi_gian_bat_dau'))->setOrder(92);
     $thoi_gian_hoan_thanh = new Zend_Form_Element_Text('thoi_gian_hoan_thanh');
     $thoi_gian_hoan_thanh->setLabel('Ngày hoàn thành(*)')->setDescription('(YYYY-mm-dd)')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'thoi_gian_hoan_thanh'))->setOrder(93);
     $cqlOptions = array("multiOptions" => Default_Model_Constraints::detai_capquanly());
     $cap_quan_ly = new Zend_Form_Element_Select('cap_quan_ly', $cqlOptions);
     $cap_quan_ly->setRequired(true)->setLabel('Cấp quản lý (*)')->setValue('2')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(94);
     $loai_dt = new Default_Model_LoaiDt();
     $ldtOptions = array("multiOptions" => $loai_dt->getDSLDT());
     $ma_loai = new Zend_Form_Element_Select('ma_loai', $ldtOptions);
     $ma_loai->setLabel('Loại đề tài')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(95);
     $stghOptions = array("multiOptions" => Default_Model_Constraints::detai_stgh());
     $so_thang_gia_han = new Zend_Form_Element_Select('so_thang_gia_han', $stghOptions);
     $so_thang_gia_han->setLabel('Số tháng gia hạn')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(96);
     $ngay_gia_han = new Zend_Form_Element_Text('ngay_gia_han');
     $ngay_gia_han->setLabel('Ngày gia hạn')->setDescription('(YYYY-mm-dd)')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'ngay_gia_han'))->setOrder(97);
     $kinh_phi = new Zend_Form_Element_Text('kinh_phi');
     $kinh_phi->setLabel('Kinh phí')->setDescription('(VNĐ)')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('Description', array('tag' => 'small')), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'onkeypress' => 'return inputNumber(event)', 'onkeyup' => 'formatInt(this)'))->setOrder(98);
     $xlOptions = array("multiOptions" => Default_Model_Constraints::detai_xeploai());
     $xep_loai = new Zend_Form_Element_Select('xep_loai', $xlOptions);
     $xep_loai->setLabel('Xếp loại')->setValue('0')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(99);
     $file_tom_tat = new Zend_Form_Element_File('file_tom_tat');
     $file_tom_tat->setLabel('File Tóm Tắt')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/de_tai')->addValidator(new Zend_Validate_File_Extension(array('doc,docx,pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setOrder(100);
     $ghi_chu = new Zend_Form_Element_Textarea('ghi_chu');
     $ghi_chu->setLabel('Ghi chú')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ghi_chu', 'class' => 'textarea', 'rows' => '4'))->setOrder(101);
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'de-tai', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($code, $ma, $ten, $nam, $ma_don_vi, $bo_mon_id, $chu_nhiem, $them_tv, $xoa_tv, $ma_linh_vuc, $tinh_trang, $thoi_gian_bat_dau, $thoi_gian_hoan_thanh, $cap_quan_ly, $ma_loai, $so_thang_gia_han, $ngay_gia_han, $kinh_phi, $xep_loai, $file_tom_tat, $ghi_chu, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('order' => 102, 'decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->addDisplayGroup(array('them_tv', 'xoa_tv'), 'dang_ky', array('order' => 89, 'decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn_dk')))));
     $this->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'table', 'class' => 'de_tai')), 'Form'));
 }
 public function suaAction()
 {
     $form = new Admin_Form_LinhVuc();
     $form->removeElement('submitCon');
     $form->submitExit->setLabel('Lưu');
     $form->cancel->setLabel('Không lưu');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             if ($this->linh_vuc->kiem_tra_id_ma($form->getValue('id'), $form->getValue('ma'))) {
                 $_SESSION['msg'] = 'Lỗi !. Mã lĩnh vực đã tồn tại, vui lòng kiểm tra lại .';
                 $_SESSION['type_msg'] = 'error';
                 $this->_redirect('/admin/linh-vuc/index');
             }
             $linh_vuc = new Default_Model_LinhVuc();
             $linh_vuc->setId($form->getValue('id'));
             $linh_vuc->setMa($form->getValue('ma'));
             $linh_vuc->setTen($form->getValue('ten'));
             $linh_vuc->setMoTa($form->getValue('mo_ta'));
             $linh_vuc->setMaLoai($form->getValue('ma_loai'));
             $kq = $linh_vuc->sua();
             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/linh-vuc/index');
             }
             $_SESSION['msg'] = 'Thành công !. Dữ liệu đã được cập nhật .';
             $_SESSION['type_msg'] = 'success';
             $this->_redirect('/admin/linh-vuc/index');
         } else {
             $form->populate($formData);
         }
     } else {
         $id = $this->_getParam('id');
         if (!empty($id)) {
             $data = $this->linh_vuc->getLinhVuc($id);
             if ($data != null) {
                 $data = $this->linh_vuc->LinhVucToArray($data);
                 $form->populate($data);
             } else {
                 $_SESSION['msg'] = 'Lỗi !. Mã lĩnh vực không tồn tại .';
                 $_SESSION['type_msg'] = 'error';
                 $this->_redirect('/admin/linh-vuc/index');
             }
         } else {
             $this->_redirect('/admin/linh-vuc/index');
         }
     }
 }