/** * Manage the update of the form parameters sent via ajax (jQuery) * * @return void */ public function updateformparamAction() { $data = $this->_getAllParams(); foreach ($data as $key => $value) { $data[$key] = urldecode($data[$key]); } if ($data['model'] != 'Form') { $dataObject = 'Form' . ucfirst($data['model']) . 'Object'; } else { $dataObject = ucfirst($data['model']) . 'Object'; } if (strpos($dataObject, 'Validation') > 0) { switch ($data['FQVT_Category']) { case 'VAL': $oValidation = new FormQuestionValidationObject($data); $oValidation->update(); break; case 'MIX': $oValidation = new FormQuestionValidationObject($data); $oOption = new FormQuestionOptionObject($data); $saved2 = $oValidation->update(); $saved1 = $oOption->update(); break; case 'OPT': $oOption = new FormQuestionOptionObject($data); $oOption->update(); break; default: } } else { $oForm = new $dataObject(); $initData = $oForm->getInitialData($data); $saved = $oForm->save($initData['id'], $data, $initData['lang']); echo $saved; } exit; }
public function addValidatorAction() { if ($this->view->aclIsAllowed($this->view->current_module, 'edit')) { $data = $this->_getAllParams(); if ($data['model'] != 'Form') { $dataObject = 'Form' . ucfirst($data['model']) . 'Object'; } else { $dataObject = ucfirst($data['model']) . 'Object'; } if ($data['FQVT_Category'] == 'VAL') { unset($data['FQVT_Category']); $oValid = new $dataObject(); $initData = $oValid->getInitialData($data); $saved = $oValid->insert($data, 1); } else { unset($data['FQVT_Category']); $oValid = new $dataObject(); $initData = $oValid->getInitialData($data); $saved = $oValid->insert($data, 1); foreach ($data as $key => $val) { $key = str_replace("FQV_", "FQO_", $key); $option[$key] = $val; } $oOption = new FormQuestionOptionObject(); $saved = $oOption->insert($option, 1); } echo $saved; exit; } }
/** * Get the question options on page loading * * @param int $questionId * @param int $langId * * @return array */ protected function _getQuestionOptions($questionId, $langId = 1) { $data = array(); $oOptions = new FormQuestionOptionObject(); $data = $oOptions->getOptions($questionId); return $data; }