Skip to content

Instantly share code, notes, and snippets.

@altuno
Created June 4, 2019 15:36
Show Gist options
  • Save altuno/394a15ad09009d55407baab884438e7a to your computer and use it in GitHub Desktop.
Save altuno/394a15ad09009d55407baab884438e7a to your computer and use it in GitHub Desktop.
<style>
.time{
min-width:100px;
}
.start_date{
min-width:60px;
}
</style>
<?php
// Options
$date_format = 'j M';
$time_format = get_option( 'time_format' );
// Load Venue View Helper
//EE_Registry::instance()->load_helper('Venue_View');
//Defaults
$reg_button_text = !isset($reg_button_text) ? __('Register', 'event_espresso') : $reg_button_text;
$alt_button_text = !isset($alt_button_text) ? __('View Details', 'event_espresso') : $alt_button_text;//For alternate registration pages
$sold_out_button_text = !isset($sold_out_button_text) ? __('Sold Out', 'event_espresso') : $sold_out_button_text;//For sold out events
$booknow_botton_text = !isset($booknow_botton_text) ? __('Book Now', 'event_espresso') : $booknow_botton_text;//For Book Now events
$city= !isset($city) ? __('', 'event_espresso') : $city;//For sold out events
$language= !isset($language) ? __('', 'event_espresso') : $language;//For sold out events
?>
<div id="selected_city" style="display:none;"><?php echo $city; ?></div>
<div id="selected_language" style="display:none;"><?php echo $language; ?></div>
<?php
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if ( have_posts() ) :
// allow other stuff
do_action( 'AHEE__espresso_events_table_template_template__before_loop' );
?>
<p class="category-filter">
<label><?php echo __('Language Filter', 'event_espresso'); ?></label>
<select class="" id="ee_filter_lang" style="width: 15%;">
<?php
if (strpos($url,'/fr/') !== false) { ?>
<option class="ee_filter_show_all" value="showall"><?php echo __('Toutes les Langues', 'event_espresso'); ?></option>
<?php } else { ?>
<option class="ee_filter_show_all" value="showall"><?php echo __('All Languages', 'event_espresso'); ?></option>
<?php
}
$langs=array();
while ( have_posts() ) : the_post();
global $post;
$languages = get_the_tags();
if( $languages ) {
foreach ($languages as $lang) {
$langs[]=$lang->name;
$unique_lang = array_unique($langs);
foreach($unique_lang as $language) {
if($language){
echo '<option value="' . $language . '" class="'.$language.'">'.$language.'</option>';
}
}
}
}
endwhile;
?>
</select>
<select class="" id="ee_filter_c">
<?php
if (strpos($url,'/fr/') !== false) { ?>
<option value="showall">Tous les Niveaux</option>
<?php } else { ?>
<option value="showall">All Levels</option>
<?php
}
if (strpos($url,'/fr/') !== false) { ?>
<option value="Beginners-Half Day" class="beginners-halfday">Débutants </option>
<option value="Intermediate" class="intermediate">Intermédiaire </option>
<?php
}
else{
?>
<option value="Beginners-Half Day" class="beginners-halfday">Beginners </option>
<option value="Intermediate" class="intermediate">Intermediate </option>
<?php
}
?>
</select>
<?php if ($category_filter != 'false'){ ?>
<label style="margin-left: 27px;"><?php echo __('Category Filter', 'event_espresso'); ?></label>
<select class="" id="ee_filter_cats">
<?php
if (strpos($url,'/fr/') !== false) { ?>
<option value="showall" class="ee_filter_show_all"><?php echo __('Tous les Cours', 'event_espresso'); ?></option>
<?php } else { ?>
<option value="showall" class="ee_filter_show_all"><?php echo __('All Courses', 'event_espresso'); ?></option>
<?php
}
$taxonomy = array('espresso_event_categories');
$args = array('orderby'=>'name','hide_empty'=>true);
$ee_terms = get_terms($taxonomy, $args);
foreach($ee_terms as $term){
if (strpos($url,'/fr/') !== false) {
if($term->name == 'Beginners-Half Day'){
$termname = 'Débutants-Demi Journée';
}
elseif($term->name == 'Beginners-Intensive'){
$termname = 'Débutants-Intensif';
}
elseif($term->name == 'Beginners-Weekday'){
$termname = 'Débutants-Semaine';
}
elseif($term->name == 'Intermediate'){
$termname = 'Intermédiaire';
}
elseif($term->name == 'Intermediate Weekday'){
$termname = 'Intermédiaire-Semaine';
}
elseif($term->name == 'Lightroom'){
$termname = 'Lightroom';
}
elseif($term->name == 'Night Low Light'){
$termname = 'Photo de Nuit';
}
elseif($term->name == 'Photoshop'){
$termname = 'Photoshop';
}
elseif($term->name == 'Portrait Studio'){
$termname = 'Portrait Studio';
}
elseif($term->name == 'Street Photography'){
$termname = 'Photo de Rue';
}
elseif($term->name == 'Teens Photography'){
$termname = 'Photographie pour Ados';
}
else{
$termname = $term->name;
}
/* if($term->slug != 'lightroom'){
if($term->slug != 'photoshop'){ */
echo '<option value="' . $term->name . '" class="' . $term->slug . '">'. $termname . '</option>';
/* }
} */
}
else{
/* if($term->slug != 'lightroom'){
if($term->slug != 'photoshop'){ */
echo '<option value="' . $term->name . '" class="' . $term->slug . '">'. $term->name . '</option>';
/* }
} */
}
}
?>
</select>
<label style="margin-left: 27px;"><?php echo __('City Filter', 'event_espresso'); ?></label>
<select class="" id="ee_filter_city" style="width: 15%;">
<?php
if (strpos($url,'/fr/') !== false) { ?>
<option class="ee_filter_show_all" value="showall"><?php echo __('Toutes les villes', 'event_espresso'); ?></option>
<?php } else { ?>
<option class="ee_filter_show_all" value="showall"><?php echo __('All Cities', 'event_espresso'); ?></option>
<?php
}
$arr = array();
while ( have_posts() ) : the_post();
global $post;
// $arr[] = do_shortcode('[acf field="event_city" post_id="'.$post->ID.'"]');
// $unique_data = array_unique($arr);
// foreach($unique_data as $val) {
// if($val){
// $lowcity = str_replace(" ","-",strtolower($val));
global $wpdb;
$event = EEH_Event_View::get_event();
$event_id=$event->ID();
$venue_id = $wpdb->get_results("SELECT VNU_ID FROM ".$wpdb->prefix."esp_event_venue WHERE
(EVT_ID = '". $event_id ."')");
$venue_id=$venue_id[0]->VNU_ID;
$event_city = $wpdb->get_results("SELECT VNU_city FROM ".$wpdb->prefix."esp_venue_meta WHERE
(VNU_ID = '". $venue_id ."')");
$event_city=$event_city[0]->VNU_city;
$event_city = str_replace(" ","-",strtolower($event_city));
echo '<option class="'.$event_city.'" value="'.$event_city.'"> '.$event_city.'</option>';
// }
//}
endwhile;
// }
?>
</select>
</p>
<?php } ?>
<?php if ($footable != 'false' && $table_search != 'false'){ ?>
<p>
<?php echo __('Search:', 'event_espresso'); ?> <input id="filter" type="text"/>
</p>
<?php } ?>
<table id="ee_filter_table" class="espresso-table footable table responsive-custom-table" data-page-size="<?php echo $table_pages; ?>" data-filter="#filter">
<thead class="espresso-table-header-row">
<tr>
<th style="text-align:center" class="th-group"><?php _e('DATE','event_espresso'); ?></th>
<th style="text-align:center" class="th-group"><?php _e('DAY','event_espresso'); ?></th>
<th style="text-align:center" class="th-group"><?php _e('TIME','event_espresso'); ?></th>
<th style="text-align:center" class="th-group"><?php echo 'CITY'; ?></th>
<th class="th-group"><?php _e('COURSE','event_espresso'); ?></th>
<th style="text-align:center" class="th-group"><?php _e('LANG.','event_espresso'); ?></th>
<th style="text-align:center" class="th-group"><?php _e('PRICE','event_espresso'); ?></th>
<th class="th-group" data-sort-ignore="true"></th>
</tr>
</thead>
<?php if ($footable != 'false' && $table_paging != 'false'){ ?>
<tfoot>
<tr>
<td colspan="5">
<div class="pagination pagination-centered"></div>
</td>
</tr>
</tfoot>
<?php } ?>
<tbody>
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
// Include the post TYPE-specific template for the content.
global $post;
global $wpdb;
//Debug
//d( $post );
//Get the category for this event
$event = EEH_Event_View::get_event();
// echo "<pre>";
// print_r($event);
// exit;
//echo "<pre> new line stated now";
// print_r($event->ID());
$event_id=$event->ID();
//echo $event_id;
$venue_id = $wpdb->get_results("SELECT VNU_ID FROM ".$wpdb->prefix."esp_event_venue WHERE
(EVT_ID = '". $event_id ."')");
$venue_id=$venue_id[0]->VNU_ID;
//echo $venue_id;
$event_city = $wpdb->get_results("SELECT VNU_city FROM ".$wpdb->prefix."esp_venue_meta WHERE
(VNU_ID = '". $venue_id ."')");
$event_city=$event_city[0]->VNU_city;
//echo $event_city;
if ( $event instanceof EE_Event ) {
if ( $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' )) {
// loop thru terms and create links
$category_slugs = array();
foreach ( $event_categories as $term ) {
$category_slugs[] = $term->slug;
}
$category_slugs = implode(' ', $category_slugs);
} else {
// event has no terms
$category_slugs = array();
}
}
//Create the event link
$external_url = $post->EE_Event->external_url();
$button_text = !empty($external_url) ? $alt_button_text : $reg_button_text;
$registration_url = !empty($external_url) ? $post->EE_Event->external_url() : $post->EE_Event->get_permalink();
//OA Add: Language
$languages = get_the_tags();
//Create the register now button
$live_button = '<a class="register-button" id="a_register_link-'.$post->ID.'" href="'.$registration_url.'">'.$button_text.'</a>';
if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
$live_button = '<a id="a_register_link-'.$post->ID.'" class="soldout-button" href="'.$registration_url.'">'.$sold_out_button_text.'</a>';
}
$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, $show_expired, false, 1 );
$datetime = end( $datetimes );
if ( ! $event->is_sold_out() ) {
// grab array of EE_Ticket objects for event
$tickets = EEH_Event_View::event_tickets_available( $post->ID );
foreach($tickets as $temp_ticket) {
if($temp_ticket instanceof EE_Ticket) {
$cap_required = $temp_ticket->get_extra_meta('ee_ticket_cap_required', true);
if(!$cap_required) {
$ticket = $temp_ticket;
break;
}
}
}
//check if the ticket is free, if set the ticket price to 'Free'
$ticket_price = 0;
if ( $ticket instanceof EE_Ticket ) {
$ticket_price = $ticket->pretty_price();
$ticket_price_data_value = $ticket->price();
$ticket_price = $ticket_price_data_value == 0 ? __( 'Free', 'event_espresso' ) : $ticket_price;
}
//Get the remaining ticket values for the next datetime.
$tickets_remaining = $datetime->tickets_remaining() === EE_INF ? __('Unlimited','event_espresso') : $datetime->tickets_remaining();
} else {
//The event is sold out, set the ticket price to 'N/A'
$ticket_price = __( 'N/A', 'event_espresso');
}
if( $datetime->tickets_remaining() <= 3 && $datetime->tickets_remaining() > 0){
$live_button = '<a id="a_register_link-'.$post->ID.'" class="remaining-event-button" href="'.$registration_url.'">'.$booknow_botton_text.'</a>';
}
$startdate = date_i18n( $date_format, strtotime( $datetime->start_date_and_time('Y-m-d', 'H:i:s') ) );
$starttime = date_i18n( 'G:i', strtotime( $datetime->start_time('H:i:s') ) );
$endtime = date_i18n( 'G:i', strtotime( $datetime->end_time('H:i:s') ) );
// $variable = get_field('event_city',18447);
// echo "s".$variable;
//$varcity = do_shortcode('[acf field="event_city" post_id="'.$post->ID.'"]');
// echo $varcity;
?>
<?php
if( $languages ) {
foreach ($languages as $lang) {
$varlang= $lang->name;
$varlangs = strtolower($varlang);
}
}
$category = $term->name;
$category = strtolower($category);
$category = preg_replace("/[\s_]/", "-", $category);
?>
<tr class="espresso-table-row city-row <?php echo $varlangs; ?> <?php echo $category; ?> <?php echo (str_replace(" ","-",strtolower($event_city)))?str_replace(" ","-",strtolower($event_city)):"geneva";?> <?php echo $category_slugs; ?>">
<td class="start_date event-<?php echo $post->ID; ?>" style="text-align: center; " data-value="<?php echo $datetime->get_raw( 'DTT_EVT_start' ); ?>"><?php echo $startdate; ?></td>
<td style="text-align:center" class="day_of_week event-<?php echo $post->ID; ?>"><?php espresso_event_date_range( 'D', ' ', 'D', ' ', $event->ID() ); ?></td>
<td style="text-align:center" class="time event-<?php echo $post->ID; ?>"><?php echo $starttime ; ?> - <?php echo $endtime ; ?></td>
<td style="text-align:center" class="city_row event_city event-<?php echo $post->ID; ?>"><?php echo ($event_city)?$event_city:"Geneva"; ?></td>
<td style="max-width:380px" class="event_title event-<?php echo $post->ID; ?>"><?php echo $post->post_title; ?></td>
<td style="text-align:center" class="lang_row languages-<?php echo $post->ID; ?>">
<?php
if( $languages ) {
foreach ($languages as $lang) {
echo $lang->name . ' ';
}
}
?>
</td>
<td style="text-align:center" class="starting_from_pricing event-<?php echo $post->ID; ?>"><?php echo $ticket_price; ?></td>
<td style="text-align:center" class="td-group reg-col" nowrap="nowrap"><?php echo $live_button; ?></td>
</tr>
<?php
endwhile;
echo '</table>';
echo '<div class="custom-border-bottom"></div>';
// allow moar other stuff
do_action( 'AHEE__espresso_events_table_template_template__after_loop' );
else :
// If no content, include the "No posts found" template.
espresso_get_template_part( 'content', 'none' );
endif;?>
<script>
// city
(function(jQuery) {
jQuery("#ee_filter_city").on("change",function(){
var selectcity = jQuery("#ee_filter_city").val();
var selectlang = jQuery("#ee_filter_lang").val();
var filtercat=jQuery("#ee_filter_cats").val();
if(filtercat!= 'showall'){
filtercat = filtercat.replace(/\s+/g, '-').toLowerCase();
}
var filterlevel=jQuery("#ee_filter_c").val();
if(filterlevel!= 'showall'){
filterlevel = filterlevel.replace(/\s+/g, '-').toLowerCase();
}
if(jQuery(this).val() == "showall"){
//itself
jQuery(".city-row").css("display","table-row");
//category
if(filtercat == "showall" && filterlevel == "showall"){
jQuery(".city-row").css("display","table-row");
}
else if(filtercat != "showall"){
jQuery(".city-row").css("display","none");
jQuery("."+filtercat).css("display","table-row");
}
else{
jQuery(".city-row").css("display","none");
if(filterlevel == "beginners-half-day"){
jQuery("."+filterlevel).css("display","table-row");
jQuery(".beginners-intensive").css("display","table-row");
jQuery(".beginners-weekday").css("display","table-row");
jQuery(".lightroom").css("display","table-row");
jQuery(".photoshop").css("display","table-row");
jQuery(".teens-photography").css("display","table-row");
jQuery(".photoshop").css("display","table-row");
jQuery(".competition---concours").css("display","table-row");
}
if(filterlevel == "intermediate"){
jQuery("."+filterlevel).css("display","table-row");
jQuery(".intermediate-weekday").css("display","table-row");
jQuery(".night-low-light").css("display","table-row");
jQuery(".portrait-studio").css("display","table-row");
jQuery(".street-photography").css("display","table-row");
jQuery(".competition---concours").css("display","table-row");
jQuery(".lightroom").css("display","table-row");
jQuery(".photoshop").css("display","table-row");
}
}
//lang
if(selectlang == "showall"){
//jQuery(".city-row").css("display","table-row");
}else{
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
}else{
jQuery(".city-row").css("display","none");
jQuery("."+jQuery(this).val()).css("display","table-row");
if(filtercat == "showall" && filterlevel == "showall"){
// jQuery(".city-row").css("display","table-row");
}
else if(filtercat != "showall"){
jQuery(".city-row").css("display","none");
jQuery("."+selectcity+"."+filtercat).css("display","table-row");
}
else{
jQuery(".city-row").css("display","none");
if(filterlevel == "beginners-half-day"){
jQuery("."+selectcity+"."+filterlevel).css("display","table-row");
jQuery("."+selectcity+".beginners-intensive").css("display","table-row");
jQuery("."+selectcity+".beginners-weekday").css("display","table-row");
jQuery("."+selectcity+".lightroom").css("display","table-row");
jQuery("."+selectcity+".photoshop").css("display","table-row");
jQuery("."+selectcity+".teens-photography").css("display","table-row");
jQuery("."+selectcity+".photoshop").css("display","table-row");
jQuery("."+selectcity+".competition---concours").css("display","table-row");
}
if(filterlevel == "intermediate"){
jQuery("."+selectcity+"."+filterlevel).css("display","table-row");
jQuery("."+selectcity+".intermediate-weekday").css("display","table-row");
jQuery("."+selectcity+".night-low-light").css("display","table-row");
jQuery("."+selectcity+".portrait-studio").css("display","table-row");
jQuery("."+selectcity+".street-photography").css("display","table-row");
jQuery("."+selectcity+".competition---concours").css("display","table-row");
jQuery("."+selectcity+".lightroom").css("display","table-row");
jQuery("."+selectcity+".photoshop").css("display","table-row");
}
}
//lang
if(selectlang == "showall"){
// jQuery(".city-row").css("display","table-row");
}else{
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
}
});
})( jQuery );
// language
(function(jQuery) {
jQuery("#ee_filter_lang").on("change",function(){
var selectlang = jQuery("#ee_filter_lang").val();
jQuery(".city-row").css("display","table-row");
var filtercat=jQuery("#ee_filter_cats").val();
if(filtercat!= 'showall'){
filtercat = filtercat.replace(/\s+/g, '-').toLowerCase();
}
if(jQuery(this).val() == "showall"){
jQuery(".city-row").css("display","table-row");
var selectcity = jQuery("#ee_filter_city").val();
if(filtercat == "showall"){
jQuery(".city-row").css("display","table-row");
}
if(selectcity == "showall"){
jQuery(".city-row").css("display","table-row");
}
if(filtercat != "showall" && selectcity == "showall"){
jQuery(".city-row").css("display","none");
jQuery("."+filtercat).css("display","table-row");
}
else if(selectcity != "showall" && filtercat == "showall"){
jQuery(".city-row").css("display","none");
jQuery("."+selectcity).css("display","table-row");
}
//if(filtercat != "showall" && selectcity != "showall"){
else if(selectcity == "showall" && filtercat == "showall"){
jQuery(".city-row").css("display","table-row");
}
else{
jQuery(".city-row").css("display","none");
jQuery("."+selectcity+"."+filtercat).css("display","table-row");
}
}
else{
//category city
var selectcity = jQuery("#ee_filter_city").val();
if(filtercat == "showall"){
jQuery(".city-row").css("display","table-row");
}
if(selectcity == "showall"){
jQuery(".city-row").css("display","table-row");
}
if(filtercat != "showall" && selectcity == "showall"){
jQuery(".city-row").css("display","none");
jQuery("."+filtercat).css("display","table-row");
}
else if(selectcity != "showall" && filtercat == "showall"){
jQuery(".city-row").css("display","none");
jQuery("."+selectcity).css("display","table-row");
}
//if(filtercat != "showall" && selectcity != "showall"){
else if(selectcity == "showall" && filtercat == "showall"){
jQuery(".city-row").css("display","table-row");
}
else{
jQuery(".city-row").css("display","none");
jQuery("."+selectcity+"."+filtercat).css("display","table-row");
}
//lang itself
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
});
})( jQuery );
// title category filteration
(function(jQuery) {
jQuery("#ee_filter_cats").on("change",function(){
var filtercat=jQuery("#ee_filter_cats").val();
if(filtercat!= 'showall'){
filtercat = filtercat.replace(/\s+/g, '-').toLowerCase();
}
var selectlang = jQuery("#ee_filter_lang").val();
if(filtercat == "showall"){
jQuery(".city-row").css("display","table-row");
//checking city
var selectcity = jQuery("#ee_filter_city").val();
if(selectcity == "showall"){
//jQuery(".city-row").css("display","table-row");
}else{
jQuery(".city-row").css("display","none");
jQuery("."+selectcity).css("display","table-row");
}
//checking lang
if(selectlang == "showall"){
//jQuery(".city-row").css("display","table-row");
}else{
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
}else{
jQuery(".city-row").css("display","none");
jQuery("."+filtercat).css("display","table-row");
//checkig city
var selectcity = jQuery("#ee_filter_city").val();
if(selectcity == "showall"){
// jQuery(".city-row").css("display","table-row");
}else{
jQuery(".city-row").css("display","none");
jQuery("."+selectcity+"."+filtercat).css("display","table-row");
//jQuery("."+filtercat).css("display","table-row");
}
//checkig lang
if(selectlang == "showall"){
// jQuery(".city-row").css("display","table-row");
}else{
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
}
});
})( jQuery );
// remove duplicate value
var found = [];
jQuery("#ee_filter_lang option").each(function() {
if(jQuery.inArray(this.value, found) != -1) jQuery(this).remove();
found.push(this.value);
});
var founds = [];
jQuery("#ee_filter_city option").each(function() {
if(jQuery.inArray(this.value, founds) != -1) jQuery(this).remove();
founds.push(this.value);
});
//// remove duplicate value\\\\
// city attribute as a short code
var city=jQuery("#selected_city").text();
city = city.trim();
jQuery('.city_row').each(function(){
var city_r =jQuery(this).text();
city_r = city_r.trim();
if(city!=""){
if(city!=city_r){
jQuery(this).parent().closest('tr').remove();
}
}
});
if(city!=""){
jQuery("#ee_filter_city option").each(function(){
city = city.toLowerCase();
if (!jQuery(this).hasClass(city)) {
if (!jQuery(this).hasClass('ee_filter_show_all')) {
jQuery(this).remove();
}
}
});
}
// language shortcode handling
var language=jQuery("#selected_language").text();
language = language.trim();
jQuery('.lang_row').each(function(){
var lang_r =jQuery(this).text();
lang_r = lang_r.trim();
if(language!=""){
if(language!=lang_r){
jQuery(this).parent().closest('tr').remove();
}
}
});
if(language!=""){
jQuery("#ee_filter_lang option").each(function(){
//language = language.toLowerCase();
if (!jQuery(this).hasClass(language)) {
if (!jQuery(this).hasClass('ee_filter_show_all')) {
jQuery(this).remove();
}
}
});
}
// title level filteration
(function(jQuery) {
jQuery("#ee_filter_c").on("change",function(){
var filterlevel=jQuery("#ee_filter_c").val();
if(filterlevel!= 'showall'){
filterlevel = filterlevel.replace(/\s+/g, '-').toLowerCase();
}
var selectlang = jQuery("#ee_filter_lang").val();
if(filterlevel == "showall"){
jQuery(".city-row").css("display","table-row");
//checking city
var selectcity = jQuery("#ee_filter_city").val();
if(selectcity == "showall"){
//jQuery(".city-row").css("display","table-row");
}else{
jQuery(".city-row").css("display","none");
jQuery("."+selectcity).css("display","table-row");
}
//checking lang
if(selectlang == "showall"){
//jQuery(".city-row").css("display","table-row");
}else{
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
}else{
jQuery(".city-row").css("display","none");
//jQuery("."+filterlevel).css("display","table-row");
if(filterlevel == "beginners-half-day"){
jQuery("."+filterlevel).css("display","table-row");
jQuery(".beginners-intensive").css("display","table-row");
jQuery(".beginners-weekday").css("display","table-row");
/* jQuery(".lightroom").css("display","table-row");
jQuery(".photoshop").css("display","table-row"); */
jQuery(".teens-photography").css("display","table-row");
jQuery(".competition---concours").css("display","table-row");
}
if(filterlevel == "intermediate"){
jQuery("."+filterlevel).css("display","table-row");
jQuery(".intermediate-weekday").css("display","table-row");
jQuery(".night-low-light").css("display","table-row");
jQuery(".portrait-studio").css("display","table-row");
jQuery(".street-photography").css("display","table-row");
jQuery(".competition---concours").css("display","table-row");
jQuery(".lightroom").css("display","table-row");
jQuery(".photoshop").css("display","table-row");
}
//checkig city
var selectcity = jQuery("#ee_filter_city").val();
if(selectcity == "showall"){
// jQuery(".city-row").css("display","table-row");
}else{
jQuery(".city-row").css("display","none");
jQuery("."+selectcity+"."+filterlevel).css("display","table-row");
//jQuery("."+filterlevel).css("display","table-row");
}
//checkig lang
if(selectlang == "showall"){
// jQuery(".city-row").css("display","table-row");
}else{
jQuery('.lang_row').each(function(){
var optionlang =jQuery(this).text();
optionlang = optionlang.trim();
selectlang = selectlang.trim();
if(selectlang!=optionlang){
jQuery(this).parent().closest('tr').css('display','none');
}
});
}
}
});
})( jQuery );
</script>
<script>
jQuery(document).ready(function() {
var switched = false;
var updateTables = function() {
if ((jQuery(window).width() < 767) && !switched) {
switched = true;
jQuery("table.responsive-custom-table").each(function(i, element) {
splitTable(jQuery(element));
});
return true;
} else if (switched && (jQuery(window).width() > 767)) {
switched = false;
jQuery("table.responsive-custom-table").each(function(i, element) {
unsplitTable(jQuery(element));
});
}
};
jQuery(window).load(updateTables);
jQuery(window).bind("resize", updateTables);
function splitTable(original) {
original.wrap("<div class='table-wrapper' />");
var copy = original.clone();
copy.find("td:not(:last-child), th:not(:last-child)").css("display", "none");
copy.removeClass("responsive");
original.closest(".table-wrapper").append(copy);
copy.wrap("<div class='pinned' />");
original.wrap("<div class='scrollable' />");
}
function unsplitTable(original) {
original.closest(".table-wrapper").find(".pinned").remove();
original.unwrap();
original.unwrap();
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment