post_name; $full_screen_url = $home.'/'.$slug; global $wp; $current_url = $full_screen_url . add_query_arg(array($_GET), $wp->request); $posts_list; $regions_to_result = ''; $boutons_to_result = ''; $date_list_to_result = ''; $reglages_base = http_build_query($_GET); //user access $user_access = mcf_get_user_access('any'); //-----------------------------------boutons avant le calendrier if (!isset($_GET["fullview"])){$boutons_to_result .= 'Voir le corpus en plein écran
';} if (isset($_GET["fullview"])){$boutons_to_result .= 'Revenir à l\'accueil
';} $boutons_to_result .= '
'; $boutons_to_result .= '
'; foreach ($_GET as $key => $value) { if (($key == 'rechercher')or($key == 'corpus_search')){continue;} $boutons_to_result .= ''; } $search_words = ''; if (isset($_GET["corpus_search"])){$search_words = $_GET["corpus_search"];} $search_words = str_replace(",", " ", $search_words); $search_array = explode(" ", $search_words); $boutons_to_result .= ''; $boutons_to_result .= '
Pour lancer une recherche dans le corpus'; $boutons_to_result .= '
'; $boutons_to_result .= '

'; $copy_url = 'Copier le lien du corpus'; $copy_text = ''; $boutons_to_result .= $copy_text; $boutons_to_result .= $copy_url; //-----------------------------------liste des régions //le formulaire $regions_to_result .= '
'; $regions_to_result .= '
'; //les catégories d'événements $categories = get_terms( array('categorie_corpus'), array( 'hide_empty' => false, 'orderby' => 'name', 'order' => 'ASC', 'number' => 18 //specify yours ) ); foreach ($_GET as $key => $value) { $skip = false; foreach($categories as $category) {if ($category->slug == $key){$skip = true;}} if (!$skip){ $regions_to_result .= ''; } } $regions_to_result .= ''; //les régions en tableau $regions_to_result .= ''; //sous forme de tableau $lineCount = 0; foreach($categories as $category) { if ($lineCount == 0){$regions_to_result .= '';} //if ($lineCount % 6 == 0){$regions_to_result .= '';} $regions_to_result .= ''; $lineCount = $lineCount + 1; } if ($lineCount != 0){$regions_to_result .= '';} $regions_to_result .= '
'; $regions_to_result .= '
'; if ((isset($_GET[$category->slug]))or(!isset($_GET['defaut_region']))){ $regions_to_result .= ''; } else {$regions_to_result .= '';} $regions_to_result .= ' '.$category->name.' '; $regions_to_result .= '
'; $regions_to_result .= '
'; //fin du tableau $regions_to_result .= '
'; //fin du formulaire //les dates sous forme de liste $args_full = array( 'numberposts' => -1, 'post_type' => 'texte_corpus', 'meta_key' => 'lazy_date', 'orderby' => 'meta_value', 'order' => 'DESC', ); $_posts_full = new WP_Query( $args_full ); //le tableau du corpus $date_list_to_result .= ''; $pair_colored = true; $no_events = true; if( $_posts_full->have_posts() ) { $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; while( $_posts_full->have_posts() ) : $_posts_full->the_post(); $post_id = get_the_ID(); $categories = get_the_terms( $post_id , 'categorie_corpus' ); $allowed_category = true; $filtered_category = true; if (is_array($categories)){ foreach ($categories as $category){ if ($category->slug == 'prive'){$allowed_category = false;} if ((!isset($_GET[$category->slug]))&&(isset($_GET['defaut_region']))){$filtered_category = false;} } } if ((!$allowed_category)&&(!$user_access)){continue;} if (!$filtered_category){continue;} //au moins 1 événement $no_events = false; //ajouter le post //titre $post_title = get_the_title(); $post_title_display = wp_trim_words($post_title, 10, '...'); // date au format : YYYY-MM-DDTHH:ii:ss $date = get_lzb_meta( 'lazy_date' ); // la date au format que l'on souhaite afficher $date_to_display = date_i18n( 'j/m/Y', strtotime( $date ) ); //le n° de publication $numero_publication = get_lzb_meta( 'numero' ); //le n° d'article $numero_article = get_lzb_meta( 'numero_article' ); //le contenu $contenu = get_lzb_meta( 'contenu' ); //les notes $notes = get_lzb_meta( 'notes' ); //les notes $post_notes_display = wp_trim_words(get_post_meta( $post_id, 'notes', true ), 10, '...'); //l'url $post_url = get_permalink(); $search_found = false; if ($search_words !== ''){ $post_title_lower = strtolower($post_title); $date_to_display_lower = strtolower($date_to_display) ; $numero_publication_lower = strtolower($numero_publication) ; $numero_article_lower = strtolower($numero_article) ; $notes_lower = strtolower($notes) ; $contenu_lower = strtolower($contenu); foreach($search_array as $search_clean_word){ $search_clean_word_lower = strtolower($search_clean_word); if (strpos($post_title_lower, $search_clean_word_lower) !== false) {$search_found = true; break;} if (strpos($date_to_display_lower, $search_clean_word_lower) !== false) {$search_found = true; break;} if (strpos($numero_publication_lower, $search_clean_word_lower) !== false) {$search_found = true; break;} if (strpos($numero_article_lower, $search_clean_word_lower) !== false) {$search_found = true; break;} if (strpos($notes_lower, $search_clean_word_lower) !== false) {$search_found = true; break;} if (strpos($contenu_lower, $search_clean_word_lower) !== false) {$search_found = true; break;} } } else {$search_found = true;} if (!$search_found){continue;} if ($pair_colored){$date_list_to_result .= ''; $pair_colored = false;} else {$date_list_to_result .= ''; $pair_colored = true;} $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; $date_list_to_result .= ''; endwhile; } wp_reset_postdata(); $date_list_to_result .= '
DateTitreNuméroArticleNotesConsulter
'. $date_to_display .'

' .$post_title. '

'. $numero_publication .''. $numero_article .''. $post_notes_display .'Voir
'; if ($no_events){$date_list_to_result .= '

Pas de textes de corpus dans les catégories séléctionnées.

';} //-----------------------------------DIFFUSION if (!isset($_GET["event"])){$result .= '
'. $boutons_to_result .'
';} $result .= $regions_to_result; $result .= '
' .$date_list_to_result .'
'; echo $result; }catch(Exception $e) {echo 'Caught exception: '.$e->getMessage();$exception_occur=1;$exception_msg=$e->getMessage();}?>
Retour haut de page