Commit 0971f468 authored by Angel Matilla's avatar Angel Matilla
Browse files

added visualization of option table corrections 2

parent 60c13b2c
......@@ -80,7 +80,6 @@ class GEN_EU_Caldera_Forms_Data_Collector {
$this->form_id = $form_id;
$this->error_list = new WP_Error();
$this->all_registrations = self::get_registrants_from_form( $form_id );
$this->all_options = self::get_options_from_wp();
}
/** Function that uses Caldera Forms API methods to fetch entries from a specific form.
......@@ -117,26 +116,6 @@ class GEN_EU_Caldera_Forms_Data_Collector {
return $all_registrations;
}
/** Function that gets the relevant options for the dashboard from the Wordpress options table
*
* @since 1.0.3
* @return array array with wp options.
*/
private function get_options_from_wp() {
$all_options = [];
$db_accommodation = get_option( 'gen_eu_accommodation_bookings' );
$db_coupons = get_option( 'gen_eu_coupons' );
$db_tier_price = get_option( 'gen_eu_tier_price' );
$db_attendees = get_option( 'gen_eu_number_of_attendees' );
$db_youth_discount = get_option( 'gen_eu_youth_discount_available' );
$db_group_discount = get_option( 'gen_eu_group_discount_available' );
$db_aspiring_members = get_option( 'gen_eu_aspiring_members' );
$db_full_members = get_option( 'gen_eu_full_members' );
$db_network_members = get_option( 'gen_eu_network_members' );
$all_options[] = $db_accommodation;
return $all_options;
}
/** Function that iterates through the data of a registration entry and return arrays of objects from GEN_EU_Registrant class.
*
* @param array $registration_array array of data from a registration.
......@@ -524,12 +503,4 @@ class GEN_EU_Caldera_Forms_Data_Collector {
public function get_all_registrations() {
return $this->all_registrations;
}
/** Retrieves all wp options relevant for the dashboard.
*
* @since 1.0.3
* @return array array with wp options.
*/
public function get_all_options() {
return $this->all_options;
}
}
......@@ -161,14 +161,6 @@ class GEN_EU_Dashboard_Loader {
* @var float $total_donations_income Total donations income.
*/
protected $total_donations_income;
/**
* List of wp options related to form.
*
* @since 1.0.3
* @access private
* @var array $all_options List of wp options related to form.
*/
private $all_options = [];
/**
* Retrieves the class instance.
*
......@@ -194,7 +186,7 @@ class GEN_EU_Dashboard_Loader {
$this->total_donations_income = 0;
$this->total_accommodation_income = 0;
$all_registrations = $data_source->get_all_registrations();
$this->all_options = $data_source->get_all_options();
$this->all_options = get_options_from_wp();
foreach ( $data_source->get_diet_types() as $type_name ) {
$this->number_of_registrants_by_diet_type_list[ $type_name ] = 0;
}
......@@ -506,4 +498,24 @@ class GEN_EU_Dashboard_Loader {
public function get_total_meals_income() {
return $this->total_meals_income;
}
/** Function that gets the relevant options for the dashboard from the Wordpress options table
*
* @since 1.0.3
* @return array array with wp options.
*/
public function get_options_from_wp() {
$all_options = [];
//$db_accommodation = get_option( 'gen_eu_accommodation_bookings' );
//$db_coupons = get_option( 'gen_eu_coupons' );
$db_tier_price = get_option( 'gen_eu_tier_price' );
//$db_attendees = get_option( 'gen_eu_number_of_attendees' );
$db_youth_discount = get_option( 'gen_eu_youth_discount_available' );
$db_group_discount = get_option( 'gen_eu_group_discount_available' );
//$db_aspiring_members = get_option( 'gen_eu_aspiring_members' );
//$db_full_members = get_option( 'gen_eu_full_members' );
//$db_network_members = get_option( 'gen_eu_network_members' );
$all_options[] = $db_accommodation;
return $all_options;
}
}
......@@ -351,7 +351,7 @@ class GEN_EU_Dashboard_Viewer {
<div class="gen-container">
<hr>
<?php
foreach ( $dashboard->get_all_options() as $options => $value ) {
foreach ( $dashboard->get_options_from_wp() as $options => $value ) {
echo '<strong>' . esc_html( $options ) . ' </strong><span class="gen-value">' . esc_html( $value ) . '</span><hr>';
}
?>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment