コード例 #1
0
 public function init()
 {
     $this->translate = Zend_Registry::get("Zend_Translate");
     $formutil = new Agana_Form_Util($this->_action, $this->_model);
     $this->setName("personhelped");
     $this->setMethod('post');
     $this->_addClassNames('well');
     $this->addAttribs(array('load-in' => 'content-container'));
     $this->addElement($this->_getIdElement());
     //$this->_addElementName();
     $this->_addElementPerson();
     $formutil->addElementDate($this, array('name' => 'first_help_date', 'modelfield' => 'first_help_date', 'label' => 'First help date', 'description' => 'When the first help was made for this person', 'required' => false, 'default' => 'today'));
     $this->_addElementReligion();
     $formutil->addElementStateId($this, array('name' => 'born_state_id', 'modelfield' => 'born_state_id', 'required' => true));
     $formutil->addElementCityId($this, array('name' => 'born_city_id', 'modelfield' => 'born_city_id', 'required' => true));
     $this->_addElementProfessionalOccupation();
     $formutil->addElementDescription($this, array('label' => 'Professional experience', 'name' => 'professional_experience', 'modelfield' => 'professional_experience'));
     $this->addElement('checkbox', 'live_with_family', array('label' => 'Live with family', 'value' => $this->_model ? $this->_model->getLive_with_family() : '', 'description' => 'Check this field if this person live with his/her family'));
     $this->_addElementHomeSituation();
     $this->_addElementRentValue();
     $this->_addElementHomeArea();
     $this->_addElementHomeType();
     $formutil->addElementDate($this, array('name' => 'home_since', 'modelfield' => 'home_since', 'label' => 'Living since', 'description' => 'Since that date lives in this house', 'required' => true, 'default' => 'false'));
     $this->addElement('text', 'home_pieces_number', array('label' => 'Home pieces', 'value' => $this->_model ? $this->_model->getHome_pieces_number() : '', 'type' => 'number', 'required' => true, 'class' => 'mask-input', 'data-mask' => '{"mask": "9", "repeat": 2, "greedy":false}'));
     $formutil->addElementButtonSave($this);
     $formutil->addElementButtonCancel($this);
     $this->addDisplayGroup(array('id', 'first_help_date', 'religion'), 'personhelpedform', array());
     $this->addDisplayGroup(array('born_state_id', 'born_city_id'), 'personhelpedbornform', array('legend' => 'Birth data'));
     $this->addDisplayGroup(array('professional_occupation_choice', 'professional_occupation', 'professional_experience'), 'personhelpedprofessionalform', array('legend' => 'Professional data'));
     $this->addDisplayGroup(array('live_with_family', 'home_since', 'home_situation_choice', 'home_situation', 'rent_value', 'home_area_choice', 'home_area', 'home_type_choice', 'home_type', 'home_pieces_number'), 'personhelpedhomeform', array('legend' => 'Home data'));
     $this->addDisplayGroup(array('save', 'cancel'), 'actions-end', array('disableLoadDefaultDecorators' => true, 'decorators' => array('Actions')));
 }