function processEditActions(&$validation, $params) { $http = eZHTTPTool::instance(); $prefix = eZSurveyType::PREFIX_ATTRIBUTE; $attributeID = $params['contentobjectattribute_id']; eZSurveyQuestion::processEditActions($validation, $params); $postCheckedRadio = $prefix . '_ezsurvey_receiver_' . $this->ID . '_checked_' . $attributeID; foreach (array_keys($this->Options) as $key) { $option =& $this->Options[$key]; $optionID = $option['id']; $postReceiver = $prefix . '_ezsurvey_receiver_' . $this->ID . '_' . $optionID . '_label_' . $attributeID; if ($http->hasPostVariable($postReceiver) and $http->postVariable($postReceiver) != $option['label']) { $option['label'] = $http->postVariable($postReceiver); $this->setHasDirtyData(true); } $postValue = $prefix . '_ezsurvey_receiver_' . $this->ID . '_' . $optionID . '_value_' . $attributeID; if ($http->hasPostVariable($postValue) and $http->postVariable($postValue) != $option['value']) { $option['value'] = $http->postVariable($postValue); $this->setHasDirtyData(true); } if ($http->hasPostVariable($postCheckedRadio) and !is_array($http->postVariable($postCheckedRadio))) { $checkedID = $http->postVariable($postCheckedRadio); if ($checkedID == $optionID and $option['checked'] != 1) { $option['checked'] = 1; $this->setHasDirtyData(true); } else { if ($checkedID != $optionID and $option['checked'] != 0) { $option['checked'] = 0; $this->setHasDirtyData(true); } } } else { $postChecked = $prefix . '_ezsurvey_receiver_' . $this->ID . '_' . $optionID . '_checked_' . $attributeID; $checked = $http->hasPostVariable($postChecked) ? 1 : 0; if ($checked != $option['checked']) { $option['checked'] = $checked; $this->setHasDirtyData(true); } } // Need to store the attribute id for sorting in the callback function tabOrderCompare. $option['contentobjectattribute_id'] = $attributeID; } usort($this->Options, array($this, 'tabOrderCompare')); $this->reorderOptions(); $this->encodeXMLOptions(); }
function processEditActions(&$validation, $params) { $http = eZHTTPTool::instance(); eZSurveyQuestion::processEditActions($validation, $params); $prefix = eZSurveyType::PREFIX_ATTRIBUTE; $attributeID = $params['contentobjectattribute_id']; $postRenderingStyle = $prefix . '_ezsurvey_question_' . $this->ID . '_num_' . $attributeID; $renderingStyle = $http->postVariable($postRenderingStyle); foreach (array_keys($this->Options) as $key) { $option =& $this->Options[$key]; $optionID = $option['id']; $postMCLabel = $prefix . '_ezsurvey_mc_' . $this->ID . '_' . $optionID . '_label_' . $attributeID; if ($http->hasPostVariable($postMCLabel) and $http->postVariable($postMCLabel) != $option['label']) { $option['label'] = $http->postVariable($postMCLabel); $this->setHasDirtyData(true); } $postMCValue = $prefix . '_ezsurvey_mc_' . $this->ID . '_' . $optionID . '_value_' . $attributeID; if ($http->hasPostVariable($postMCValue)) { if ($http->postVariable($postMCValue) != $option['value']) { $option['value'] = trim($http->postVariable($postMCValue)); $this->setHasDirtyData(true); } } if ($renderingStyle == 1 or $renderingStyle == 2 or $renderingStyle == 5) { $postMCChecked = $prefix . '_ezsurvey_mc_' . $this->ID . '_checked_' . $attributeID; if ($http->hasPostVariable($postMCChecked) and $http->postVariable($postMCChecked) == $option['value']) { if ($option['checked'] != 1) { $option['checked'] = 1; $this->setHasDirtyData(true); } } else { if ($option['checked'] != 0) { $option['checked'] = 0; $this->setHasDirtyData(true); } } } else { $postMCChecked = $prefix . '_ezsurvey_mc_' . $this->ID . '_' . $optionID . '_checked_' . $attributeID; $checked = $http->hasPostVariable($postMCChecked) ? 1 : 0; if ($checked != $option['checked']) { $option['checked'] = $checked; $this->setHasDirtyData(true); } } // Need to store the attribute id for sorting in the callback function tabOrderCompare. $option['contentobjectattribute_id'] = $attributeID; } usort($this->Options, array($this, 'tabOrderCompare')); $this->reorderOptions(); if (isset($this->ExtraInfo['extra_info'])) { $extraOption =& $this->ExtraInfo['extra_info']; $extraOptionID = $extraOption['id']; $extraOptionArrayInput = array('extra_label' => 'label', 'extra_value' => 'value', 'extra_default_value' => 'default_value', 'extra_column' => 'column', 'extra_row' => 'row'); foreach ($extraOptionArrayInput as $extraOptionValue => $xmlKey) { $postMCExtraVariable = $prefix . '_ezsurvey_mc_' . $this->ID . '_' . $extraOptionValue . '_' . $attributeID; if ($http->hasPostVariable($postMCExtraVariable) and $http->postVariable($postMCExtraVariable) != $extraOption[$xmlKey]) { $extraOption[$xmlKey] = $http->postVariable($postMCExtraVariable); $this->setHasDirtyData(true); } } $extraOptionArrayChecked = array('extra_enable_css_style' => 'enable_css_style'); $postMCExtraLabel = $prefix . '_ezsurvey_mc_' . $this->ID . '_extra_label_' . $attributeID; // check that this is not the first initial request where we don't have any postvariables. if ($http->hasPostVariable($postMCExtraLabel)) { foreach ($extraOptionArrayChecked as $extraOptionValue => $xmlKey) { $postMCExtraVariable = $prefix . '_ezsurvey_mc_' . $this->ID . '_' . $extraOptionValue . '_' . $attributeID; $checked = $http->hasPostVariable($postMCExtraVariable) ? 1 : 0; if ($checked != $extraOption[$xmlKey]) { $extraOption[$xmlKey] = $checked; $this->setHasDirtyData(true); } } } if ($renderingStyle == 1 or $renderingStyle == 2 or $renderingStyle == 5) { $postMCChecked = $prefix . '_ezsurvey_mc_' . $this->ID . '_checked_' . $attributeID; if ($http->hasPostVariable($postMCChecked) and $http->postVariable($postMCChecked) == $extraOption['value']) { if ($extraOption['value_checked'] != 1) { $extraOption['value_checked'] = 1; $this->setHasDirtyData(true); } } else { if ($extraOption['value_checked'] != 0) { $extraOption['value_checked'] = 0; $this->setHasDirtyData(true); } } } else { $extraOptionValue = 'extra_value_checked'; $xmlKey = 'value_checked'; $postMCExtraVariable = $prefix . '_ezsurvey_mc_' . $this->ID . '_' . $extraOptionValue . '_' . $attributeID; $checked = $http->hasPostVariable($postMCExtraVariable) ? 1 : 0; if ($checked != $extraOption[$xmlKey]) { $extraOption[$xmlKey] = $checked; $this->setHasDirtyData(true); } } } $this->encodeXMLOptions(); }