示例#1
0
 public function showQuestion($data, $elemId = '', $elemSeq = null, $type = array(), $langId = '')
 {
     $html = '';
     $htmlVal = '';
     $htmlOpt = '';
     $params = array();
     $oValidation = new FormQuestionValidationTypeObject();
     $oOptionsList = new FormResponseOptionObject();
     // If loading an existing element (page loading)
     if (count($data) > 0) {
         // To simplify when settings registred values
         $question = $data[0];
         //Load data for validation
         $valOpt = $this->_getValidator($question['FQ_ID'], $langId);
         $htmlVal = $valOpt['htmlVal'];
         $htmlOpt = $valOpt['htmlOpt'];
         // Load data for response options
         $this->_htmlList = $oOptionsList->getOptionsList($question['FQ_ID'], $langId);
         // set values from db to build the question
         $this->_formElemId = "element_" . $question['FQ_ElementID'];
         $this->_qTextId = "question_" . $question['FQ_ID'];
         $this->_qValidId = "questionValidation_" . $question['FQ_ID'];
         $this->_title = $question['FQTI_Title'];
         $this->_descr = $question['FQTI_Description'];
         $this->_icon = $this->_baseUrl . $question['FQT_ImageLink'];
         $this->_htmlVal = $htmlVal;
         $this->_htmlOpt = $htmlOpt;
         $this->_elemSeq = $elemSeq;
         $this->_label = $question['FQI_Title'];
         $this->_checked = '';
         // render the question
         $html = $this->_render();
     } else {
         $db = Zend_Registry::get('db');
         $tableElem = new FormElement();
         $tableQst = new FormQuestion();
         // Set values to build the new question
         // Defined default values
         $this->_title = $type['FQTI_Title'];
         $this->_descr = $type['FQTI_Description'];
         $this->_icon = $this->_baseUrl . $type['FQT_ImageLink'];
         $this->_formElemId = "element_" . $this->_currentElmId;
         $this->_qTextId = "question_" . $this->_currentQstId;
         $this->_qValidId = "questionValidation_" . $this->_currentQstId;
         // Set the validation type for this type of question
         $this->_htmlVal = $oValidation->getValidationType(1, $langId);
         // Set the option for this question type
         //            $this->_htmlOpt = $oValidation->getValidationType(2, $langId);
         //            $this->_htmlOpt .= $oValidation->getValidationType(3, $langId);
         // Set the list to create options
         $this->_htmlList = $oOptionsList->selectValuesList();
         // render the new question
         $html = $this->_render();
     }
     return $html;
 }