コード例 #1
0
 public function newfieldAction()
 {
     $id = $_POST['id'];
     $donVis = Khcn_Api::_()->getDbTable('don_vi', 'default')->getDonVisAssoc();
     unset($donVis['1']);
     $defaultDonVi = 2;
     $dvOptions = array("multiOptions" => $donVis);
     $ma_don_vi = new Zend_Form_Element_Select('don_vi_' . $id, $dvOptions);
     $ma_don_vi->setRequired(true)->setValue($defaultDonVi)->setDecorators(Khcn_Form_Decorator_Select::getDecorator())->setAttribs(array('id' => 'don_vi_' . $id, 'onchange' => 'change(this,' . $id . ')'));
     $gvOptions = array("multiOptions" => Khcn_Api::_()->getDbTable('giang_vien', 'default')->getGiangViensByDonViAssoc($defaultDonVi));
     $thanh_vien = new Zend_Form_Element_Select('thanh_vien_' . $id, $gvOptions);
     $thanh_vien->setRequired(true)->setDecorators(Khcn_Form_Decorator_Select::getDecorator())->setAttribs(array('class' => 'text-input', 'id' => 'thanh_vien_' . $id));
     $result = '<tr id="dk_tv_' . $id . '"><td></td><td><fieldset><legend>Thành viên</legend>';
     $result .= $ma_don_vi->__toString() . $thanh_vien->__toString();
     $result .= '</td></fieldset></tr>';
     echo $result;
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
 }