Exemple #1
0
 public function init()
 {
     parent::init();
     $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true);
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['title_id'] = new Zend_Form_Element_Hidden('title_id');
     $form['title_id']->setValue($this->data['title_id']);
     $form['title'] = new Zend_Form_Element_Text('title');
     $form['title']->setLabel('Title')->setRequired()->setValue($this->data['title'])->setAttrib('class', 'form-text');
     $form['category_id'] = new Zend_Form_Element_Hidden('category_id');
     $form['category_id']->setValue($this->data['category_id']);
     $categoryCodes = $model->getCodeArray('DocumentCategory', '', 1, true);
     $form['category_code'] = new Zend_Form_Element_Select('category_code');
     $form['category_code']->setLabel('Category Code')->setRequired()->addMultiOptions($categoryCodes)->setValue($this->data['category_code'])->setAttrib('class', 'form-select');
     $form['url'] = new Zend_Form_Element_Text('url');
     $form['url']->setLabel('Url')->setRequired()->addValidator(new App_Validate_Url())->setValue($this->data['url'])->setAttrib('class', 'form-text');
     $this->addElements($form);
     $this->setElementsBelongTo("document[{$this->count}]");
     // Add remove button
     $remove = new Iati_Form_Element_Note('remove');
     $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element'));
     $remove->setValue("<a href='#' class='button' value='DocumentLink'> Remove element</a>");
     $this->addElement($remove);
     foreach ($form as $item_name => $element) {
         $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-document-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item'))));
     }
 }
Exemple #2
0
 public function init()
 {
     parent::init();
     $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true);
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['title_id'] = new Zend_Form_Element_Hidden('title_id');
     $form['title_id']->setValue($this->data['title_id']);
     $form['description_id'] = new Zend_Form_Element_Hidden('description_id');
     $form['description_id']->setValue($this->data['description_id']);
     $form['indicator_id'] = new Zend_Form_Element_Hidden('indicator_id');
     $form['indicator_id']->setValue($this->data['indicator_id']);
     $form['indicator_title_id'] = new Zend_Form_Element_Hidden('indicator_title_id');
     $form['indicator_title_id']->setValue($this->data['indicator_title_id']);
     $form['period_id'] = new Zend_Form_Element_Hidden('period_id');
     $form['period_id']->setValue($this->data['period_id']);
     $form['actual_id'] = new Zend_Form_Element_Hidden('actual_id');
     $form['actual_id']->setValue($this->data['actual_id']);
     $form['period_end_id'] = new Zend_Form_Element_Hidden('period_end_id');
     $form['period_end_id']->setValue($this->data['period_end_id']);
     $resultTypeCodes = $model->getCodeArray('ResultType', '', 1, true);
     $form['result_type'] = new Zend_Form_Element_Select('result_type');
     $form['result_type']->setLabel('Result Type')->setRequired()->addMultiOptions($resultTypeCodes)->setValue($this->data['result_type'])->setAttrib('class', 'form-select');
     $form['title'] = new Zend_Form_Element_Text('title');
     $form['title']->setLabel('Title')->setRequired()->setValue($this->data['title'])->setAttrib('class', 'form-text');
     $form['description'] = new Zend_Form_Element_Textarea('description');
     $form['description']->setLabel('Description')->setRequired()->setValue($this->data['description'])->setAttrib('COLS', '40')->setAttrib('ROWS', '4')->setAttrib('class', 'form-text');
     $form['indicator'] = new Zend_Form_Element_Text('indicator');
     $form['indicator']->setLabel('Indicator')->setRequired()->setValue($this->data['indicator'])->setAttrib('class', 'form-text');
     $form['achievement'] = new Zend_Form_Element_Text('achievement');
     $form['achievement']->setLabel('Achievement')->setRequired()->setValue($this->data['achievement'])->setAttrib('class', 'form-text');
     $form['end_date'] = new Zend_Form_Element_Text('end_date');
     $form['end_date']->setLabel('As of')->setRequired()->setValue($this->data['end_date'])->setAttrib('class', 'form-text datepicker simplified-result-date');
     $this->addElements($form);
     $this->setElementsBelongTo("result[{$this->count}]");
     // Add remove button
     $remove = new Iati_Form_Element_Note('remove');
     $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element'));
     $remove->setValue("<a href='#' class='button' value='Result'> Remove element</a>");
     $this->addElement($remove);
     foreach ($form as $item_name => $element) {
         $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-result-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item'))));
     }
 }
Exemple #3
0
 public function init()
 {
     parent::init();
     $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true);
     $model = new Model_Wep();
     $form = array();
     $form['id'] = new Zend_Form_Element_Hidden('id');
     $form['id']->setValue($this->data['id']);
     $form['start_id'] = new Zend_Form_Element_Hidden('start_id');
     $form['start_id']->setValue($this->data['start_id']);
     $form['end_id'] = new Zend_Form_Element_Hidden('end_id');
     $form['end_id']->setValue($this->data['end_id']);
     $form['value_id'] = new Zend_Form_Element_Hidden('value_id');
     $form['value_id']->setValue($this->data['value_id']);
     $this->addElements($form);
     $form['amount'] = new Zend_Form_Element_Text('amount');
     $form['amount']->setLabel('Amount')->setRequired()->addFilter(new App_Filter_Currency())->setValue($this->data['amount'])->addValidator(new App_Validate_Numeric())->setAttrib('class', 'form-text');
     $currency = $model->getCodeArray('Currency', '', 1, true);
     $form['currency'] = new Zend_Form_Element_Select('currency');
     $form['currency']->setLabel('Currency')->addMultiOptions($currency)->setValue($this->data['currency'])->setAttrib('class', 'form-select');
     $form['start_date'] = new Zend_Form_Element_Text('start_date');
     $form['start_date']->setLabel('Start Date')->setRequired()->setValue($this->data['start_date'])->setAttrib('class', 'form-text datepicker');
     $form['end_date'] = new Zend_Form_Element_Text('end_date');
     $form['end_date']->setLabel('End Date')->setRequired()->setValue($this->data['end_date'])->addValidator(new App_Validate_EndDate())->setAttrib('class', 'form-text datepicker');
     $form['signed_date'] = new Zend_Form_Element_Text('signed_date');
     $form['signed_date']->setLabel('Contract Signed  Date')->setRequired()->setValue($this->data['signed_date'])->setAttrib('class', 'form-text datepicker');
     $this->addElements($form);
     $this->setElementsBelongTo("budget[{$this->count}]");
     // Add remove button
     $remove = new Iati_Form_Element_Note('remove');
     $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element'));
     $remove->setValue("<a href='#' class='button' value='Budget'> Remove element</a>");
     $this->addElement($remove);
     foreach ($form as $item_name => $element) {
         $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-budget-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item'))));
     }
 }
Exemple #4
0
 public function init()
 {
     parent::init();
     $this->setAttrib('class', 'simplified-sub-element')->setIsArray(true);
     $model = new Model_Wep();
     $form = array();
     $form['location_id'] = new Zend_Form_Element_Hidden('location_id');
     $form['location_id']->setValue($this->data['location_id']);
     $form['location_desc_id'] = new Zend_Form_Element_Hidden('location_desc_id');
     $form['location_desc_id']->setValue($this->data['location_desc_id']);
     $form['location_coord_id'] = new Zend_Form_Element_Hidden('location_coord_id');
     $form['location_coord_id']->setValue($this->data['location_coord_id']);
     /*
     $form['location_coord_lat'] = new Zend_Form_Element_Hidden('location_coord_lat');
     $form['location_coord_lat']->setValue($this->data['location_coord_lat']);
     $form['location_coord_lat']->setAttrib('class' , 'latitude');
     
     $form['location_coord_long'] = new Zend_Form_Element_Hidden('location_coord_long');
     $form['location_coord_long']->setValue($this->data['location_coord_long']);
     $form['location_coord_long']->setAttrib('class' , 'longitude');
     */
     $form['location_adm_id'] = new Zend_Form_Element_Hidden('location_adm_id');
     $form['location_adm_id']->setValue($this->data['location_adm_id']);
     /*
     $form['location_adm_adm1'] = new Zend_Form_Element_Hidden('location_adm_adm1');
     $form['location_adm_adm1']->setValue($this->data['location_adm_adm1']);
     $form['location_adm_adm1']->setAttrib('class' , 'adm1');
     
     $form['location_adm_adm2'] = new Zend_Form_Element_Hidden('location_adm_adm2');
     $form['location_adm_adm2']->setValue($this->data['location_adm_adm2']);
     $form['location_adm_adm2']->setAttrib('class' , 'adm2');
     */
     $form['location_name_id'] = new Zend_Form_Element_Hidden('location_name_id');
     $form['location_name_id']->setValue($this->data['location_name_id']);
     $nameData = $this->data['location_name'];
     $form['location_name'] = new Zend_Form_Element_Select('location_name');
     $form['location_name']->setLabel('District Name')->setRequired()->addMultiOption($nameData, $nameData)->setValue($nameData)->setRegisterInArrayValidator(false)->setAttrib('class', 'location level-1 form-select')->setAttrib('style', 'width:300px');
     //$this->data['location_vdcs'] = 'Amahibariyati , Babiyabirta';
     $adm2Data = $this->data['location_vdcs'];
     if (is_array($adm2Data)) {
         $adm2Data = implode(',', $adm2Data);
     }
     $options = array();
     if ($adm2Data) {
         $adm2Data = explode(',', $adm2Data);
         $adm2Data = preg_replace('/ /', '', $adm2Data);
         foreach ($adm2Data as $data) {
             $options[$data] = $data;
         }
     }
     $form['location_vdcs'] = new Zend_Form_Element_Select('location_vdcs');
     $form['location_vdcs']->setLabel('VDC name')->addMultiOptions($options)->setValue($adm2Data)->setRegisterInArrayValidator(false)->setAttrib('multiple', true)->setAttrib('class', 'location level-2 form-select');
     $this->addElements($form);
     $this->setElementsBelongTo("location[{$this->count}]");
     // Add remove button
     $remove = new Iati_Form_Element_Note('remove');
     $remove->addDecorator('HtmlTag', array('tag' => 'span', 'class' => 'simplified-remove-element'));
     $remove->setValue("<a href='#' class='button' value='Location'> Remove element</a>");
     $this->addElement($remove);
     foreach ($form as $item_name => $element) {
         $form[$item_name]->addDecorators(array(array('HtmlTag', array('tag' => '<div>', 'placement' => 'PREPEND', 'class' => 'help simplified-location-' . $item_name)), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'clearfix form-item'))));
     }
 }