/** * Filter Hidden Prices * @param mixed $events Either a json string or an array of events. * @return array The modified/filtered array. */ private static function filter_hidden_prices($events) { if (is_string($events)) { $events = json_decode($events, true); } $hidden_prices = get_option('_bpt_hidden_prices'); if ($hidden_prices) { // If the user is an admin, we'll just add a property "hidden" to the // price. if (Utilities::is_user_an_admin()) { foreach ($events as &$event) { foreach ($event['dates'] as &$date) { foreach ($date['prices'] as &$price) { if (array_key_exists($price['id'], $hidden_prices)) { $price['hidden'] = true; } } } } } else { // If the user is not an admin, we'll remove that price. foreach ($events as &$event) { foreach ($event['dates'] as &$date) { $i = 0; foreach ($date['prices'] as &$price) { if (array_key_exists($price['id'], $hidden_prices)) { unset($date['prices'][$i]); } $i++; } $date['prices'] = array_values($date['prices']); } } } } return $events; }
esc_attr_e($currency); ?> ')}} w/service fee)</small> {{/value}} {{ /.includeFee }} </td> <td> <select class="bpt-price-qty" name="price_{{ id }}" data-price-id="{{ id }}"> {{{ getQuantityOptions( . ) }}} <option value="0" selected="true">0</option> </select> </td> </tr> <?php if (Utilities::is_user_an_admin()) { ?> <tr class="bpt-admin-option"> <td colspan="3"> <!-- <h5>Price Options</h5> --> <span> <label for="bpt-price-hidden-{{ id }}" class="bpt-admin-option bpt-price-hidden">Display Price</label> <select id="bpt-price-hidden-{{ id }}" on-change="togglePriceVisibility" class="bpt-admin-option bpt-price-hidden" data-price-id="{{ id }}" data-price-name="{{ name }}"> <option {{ ^hidden }}selected{{ /hidden }} value="true">Yes</option> <option {{ #hidden }}selected{{ /hidden }}value="false">No</option> </select> </span> <span> <label class="bpt-admin-option bpt-price-max-quantity" for="bpt-price-max-quantity-{{ id }}">Set Max Quantity</label> <input id="bpt-price-max-quantity-{{ id }}" type="text" value="{{ .maxQuantity }}" class="bpt-admin-option bpt-price-max-quantity" on-change="setPriceMaxQuantity" placeholder="20"> </span>