function validateEditActions(&$validation, $params) { parent::validateEditActions($validation, $params); $http = eZHTTPTool::instance(); $locale = eZLocale::instance(); $prefix = eZSurveyType::PREFIX_ATTRIBUTE; $attributeID = $params['contentobjectattribute_id']; $postNumHidden = $prefix . '_ezsurvey_question_' . $this->ID . '_num_hidden_' . $attributeID; $postNum = false; if ($http->hasPostVariable($postNumHidden)) { $postNum = $prefix . '_ezsurvey_question_' . $this->ID . '_num_' . $attributeID; } if ($postNum !== false and $http->hasPostVariable($postNum)) { $reqInteger = true; $validator = new eZIntegerValidator(); } else { $reqInteger = false; $validator = new eZFloatValidator(); } $postNumText2 = $prefix . '_ezsurvey_question_' . $this->ID . '_text2_' . $attributeID; if ($http->hasPostVariable($postNumText2) and strlen(trim($http->postVariable($postNumText2))) > 0) { $data = $locale->internalNumber(trim($http->postVariable($postNumText2))); if ($reqInteger and is_numeric($data) and (int) $data == $data) { $data = (int) $data; } if ($validator->validate($data) != eZInputValidator::STATE_ACCEPTED) { $validation['error'] = true; if ($reqInteger) { $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question with id %number is not an integer number!', null, array('%number' => $this->ID)), 'question_id' => $this->ID, 'code' => 'number_not_integer_number', 'question' => $this); } else { $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question with id %number is not an number!', null, array('%number' => $this->ID)), 'question_id' => $this->ID, 'code' => 'number_not_number', 'question' => $this); } } } $postNumText3 = $prefix . '_ezsurvey_question_' . $this->ID . '_text3_' . $attributeID; if ($http->hasPostVariable($postNumText3) and strlen($http->postVariable($postNumText3)) > 0) { $data = $locale->internalNumber(trim($http->postVariable($postNumText3))); if ($reqInteger and is_numeric($data) and (int) $data == $data) { $data = (int) $data; } if ($validator->validate($data) != eZInputValidator::STATE_ACCEPTED) { $validation['error'] = true; if ($reqInteger) { $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question with id %number is not an integer number!', null, array('%number' => $this->ID)), 'question_id' => $this->ID, 'code' => 'number_not_integer_number', 'question' => $this); } else { $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question with id %number is not an number!', null, array('%number' => $this->ID)), 'question_id' => $this->ID, 'code' => 'number_not_number', 'question' => $this); } } } $postNumDefaultValue = $prefix . '_ezsurvey_question_' . $this->ID . '_default_value_' . $attributeID; if ($http->hasPostVariable($postNumDefaultValue) and strlen($http->postVariable($postNumDefaultValue)) > 0) { $data = $locale->internalNumber(trim($http->postVariable($postNumDefaultValue))); if ($reqInteger && is_numeric($data) && (int) $data == $data) { $data = (int) $data; } if ($validator->validate($data) != eZInputValidator::STATE_ACCEPTED) { $validation['error'] = true; if ($reqInteger) { $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question with id %number is not an integer number!', null, array('%number' => $this->ID)), 'question_id' => $this->ID, 'code' => 'number_not_integer_number', 'question' => $this); } else { $validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question with id %number is not an number!', null, array('%number' => $this->ID)), 'question_id' => $this->ID, 'code' => 'number_not_number', 'question' => $this); } } } }