/**
  * @param array $survey_data
  * @param array $formData
  *
  * @return FormValidator
  */
 public function createForm($survey_data, $formData)
 {
     parent::createForm($survey_data, $formData);
     $options = array('horizontal' => get_lang('Horizontal'), 'vertical' => get_lang('Vertical'));
     $this->getForm()->addRadio('horizontalvertical', get_lang('DisplayAnswersHorVert'), $options);
     $formData['horizontalvertical'] = isset($formData['horizontalvertical']) ? $formData['horizontalvertical'] : 'horizontal';
     $this->getForm()->setDefaults($formData);
     $config = array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '120');
     $total = count($formData['answers']);
     if (is_array($formData['answers'])) {
         foreach ($formData['answers'] as $key => $value) {
             $this->getForm()->addHtmlEditor('answers[' . $key . ']', null, false, false, $config);
             if ($key < $total - 1) {
                 //$this->getForm()->addButton("move_down[$key]", get_lang('Down'));
             }
             if ($key > 0) {
                 //$this->getForm()->addButton("move_up[$key]", get_lang('Up'));
             }
             if ($total > 2) {
                 $this->getForm()->addButton("delete_answer[{$key}]", get_lang('Delete'), 'trash', 'danger');
             }
         }
     }
     parent::addRemoveButtons($formData);
 }
Example #2
0
 /**
  * @param array $survey_data
  * @param $formData
  *
  * @return FormValidator
  */
 public function createForm($survey_data, $formData)
 {
     parent::createForm($survey_data, $formData);
     if (is_array($formData['answers'])) {
         foreach ($formData['answers'] as $key => $value) {
             $this->getForm()->addText('answers[' . $key . ']', $key + 1);
         }
     }
     parent::addRemoveButtons($formData);
 }
Example #3
0
 /**
  * @param array $survey_data
  * @param $form_content
  */
 public function createForm($survey_data, $formData)
 {
     parent::createForm($survey_data, $formData);
     $this->getForm()->addText('maximum_score', get_lang('MaximumScore'));
     $config = array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '120');
     if (is_array($formData['answers'])) {
         foreach ($formData['answers'] as $key => $value) {
             $this->getForm()->addHtmlEditor('answers[' . $key . ']', null, false, false, $config);
         }
     }
     parent::addRemoveButtons($formData);
 }
 /**
  * @param array $surveyData
  * @param array $formData
  */
 public function createForm($surveyData, $formData)
 {
     parent::createForm($surveyData, $formData);
     $options = array('horizontal' => get_lang('Horizontal'), 'vertical' => get_lang('Vertical'));
     $this->getForm()->addRadio('horizontalvertical', get_lang('DisplayAnswersHorVert'), $options);
     $formData['horizontalvertical'] = isset($formData['horizontalvertical']) ? $formData['horizontalvertical'] : 'horizontal';
     $this->getForm()->setDefaults($formData);
     $config = array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '120');
     if (is_array($formData['answers'])) {
         foreach ($formData['answers'] as $key => $value) {
             $this->getForm()->addHtmlEditor('answers[' . $key . ']', null, false, false, $config);
         }
     }
     parent::addRemoveButtons($formData);
 }