芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/public_html/wp-content/plugins/fluentformpro/src/classes/SurveyResultProcessor.php
null, 'field_name' => '', 'label' => 'yes', 'counts' => 'yes' )); if (empty($attributes['form_id'])) { return ''; } $form = wpFluent()->table('fluentform_forms')->find($attributes['form_id']); if (!$form) { return ''; } $reportingFields = $this->getReportableFields($form, $attributes['field_name']); $reports = ReportHelper::getInputReport($form->id, array_keys($reportingFields)); $formattedReports = []; foreach ($reports as $reportKey => $report) { $formattedValues = []; $options = $reportingFields[$reportKey]['options'];; foreach ($report['reports'] as $reportItem) { $reportItem['percent'] = round( ($reportItem['count'] / $report['total_entry']) * 100); if (isset($options[$reportItem['value']])) { $itemKey = $reportItem['value']; $reportItem['value'] = $options[$itemKey]; $formattedValues[$itemKey] = $reportItem; } } $shotableArray = array_intersect(array_keys($options), array_keys($formattedValues)); $formattedValues = array_replace(array_flip($shotableArray), $formattedValues); $formattedValues = array_filter($formattedValues, 'is_array'); $report['reports'] = $formattedValues; $report['label'] = $reportingFields[$reportKey]['label']; $report['options'] = $options; $report['element'] = $reportingFields[$reportKey]['element']; $formattedReports[$reportKey] = $report; } $reportHtml = '
'; foreach ($formattedReports as $formattedReport) { $reportHtml .= $this->getGereratedReortHtml($formattedReport, $attributes['label'], $attributes['counts'], $form); } $reportHtml .= '
'; $css = $this->getPollCss(); return $css.$reportHtml; } public function getReportableFields($form, $reportFieldName) { $reportFieldNames = explode(',', $reportFieldName); $fields = FormFieldsParser::getInputs($form, ['element', 'options', 'label']); $reportableFields = Helper::getReportableInputs(); $reportableItems = []; foreach ($fields as $fieldName => $field) { if ($field['element'] == 'select_country') { $field['options'] = getFluentFormCountryList(); } if (in_array($field['element'], $reportableFields) && !empty($field['options'])) { $reportableItems[$fieldName] = $field; } } if (!$reportFieldName) { return $reportableItems; } $returnItems = []; foreach ($reportFieldNames as $reportFieldName) { if (isset($reportableItems[$reportFieldName])) { $returnItems[$reportFieldName] = $reportableItems[$reportFieldName]; } } return $returnItems; } public function getGereratedReortHtml($data, $showLabel = 'yes', $showCount = 'yes', $form) { $showLabel = $showLabel == 'yes'; $showCount = $showCount == 'yes'; ob_start(); ?>
%
()