- <?php /**
- * Template name: Zadania
- */
- get_header();
- if( isset($_GET['Kategoriazadan']) ||
- isset($_GET['Typzadan']) ||
- isset($_GET['Poziom']) ||
- isset($_GET['Rokmatury']) ||
- isset($_GET['Typmatury']) ||
- isset($_GET['Miesiacmatury']) ||
- isset($_GET['tryb'])
- ) {
- $zadanie = -1;
- }else {
- $zadanie = 2;
- }
- ?>
- <div class="col-lg-3 col-sidebar">
- <div class="certificate-sidebar_toggle"><i class="fa fa-database" aria-hidden="true"></i></div>
- <div class="certificate-sticky">
- <form action="<?php echo esc_url(get_pagenum_link(1)); ?>" method="get">
- <div class="certificate-sticky_header">
- <div class="certificate-sidebar_close"></div><?php the_field('mobile-filters-title'); ?>:
- </div>
- <div class="certificate-sidebar">
- <div class="certificate-sidebar_button">
- <a class="btn-primary" href="<?php the_field('core-curriculum-title-url'); ?>"><?php the_field('core-curriculum-title-text'); ?></a>
- </div>
- <div class="certificate-sidebar_widget-group">
- <div class="certificate-sidebar_widget">
- <div class="certificate-search">
- <input name="szukaj" type="search" placeholder="Szukane wyrażenie">
- <?php
- $q1 = new WP_Query( array(
- 'post_type' => 'zadania',
- 's' => 'rurce'
- ));
- $q2 = new WP_Query( array(
- 'post_type' => 'zadania',
- '"s" => "rurce"' => array(
- 'relation' => 'OR',
- array(
- 'key' => 'post_title',
- 'value' => 'rurce',
- 'compare' => 'LIKE'
- ),
- array(
- 'key' => 'post_content',
- 'value' => 'rurce',
- 'compare' => 'LIKE'
- )
- )
- ));
- $result = new WP_Query();
- $result->posts = array_unique( array_merge( $q1->posts, $q2->posts ), SORT_REGULAR );
- $result->post_count = count( $result->posts );
- ?>
- <?php //echo do_shortcode('[wpbsearch]'); ?>
- </div>
- </div>
- <div class="certificate-sidebar_widget">
- <h3 class="certificate-sidebar_widget-title">Kategorie zadań</h3>
- <div class="certificate-filter">
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'kategorie_zadan_taxonomy',
- 'hide_empty' => false,
- )
- );
- if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- if($term->parent == 0) {
- ?>
- <div class="certificate-filter_group">
- <div class="certificate-filter_item">
- <?php
- foreach ( $terms as $term1 ) {
- if($term1->parent == $term->term_id) {
- ?>
- <div class="certificate-filter_toggle"></div>
- <?php
- break;
- }
- }
- ?>
- <input name="<?php echo "Kategoriazadan[]"; ?>" value="<?php echo $term->slug; ?>" class="check-control" type="checkbox" id="certificateFilter<?php echo $term->slug.get_the_ID(); ?>" <?php if( isset($_GET['Kategoriazadan'])&& strlen(array_search($term->slug,$_GET['Kategoriazadan'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificateFilter<?php echo $term->slug.get_the_ID(); ?>"><?php echo $term->name; ?></label>
- </div>
- <?php
- $counter = 0;
- foreach ( $terms as $term1 ) {
- if($term1->parent == $term->term_id) {
- if($counter == 0){
- ?>
- <div class="certificate-filter_collapse">
- <div class="certificate-filter_group-inner">
- <?php
- }
- ?>
- <div class="certificate-filter_item">
- <input name="<?php echo "Kategoriazadan[]"; ?>" value="<?php echo $term1->slug; ?>" class="check-control" type="checkbox" id="certificateFilter<?php echo $term1->slug.get_the_ID(); ?>" <?php if( isset($_GET['Kategoriazadan'])&& strlen(array_search($term->slug,$_GET['Kategoriazadan'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificateFilter<?php echo $term1->slug.get_the_ID(); ?>"><?php echo $term1->name; ?></label>
- </div>
- <?php
- $counter++;
- }
- }
- if($counter > 0){
- ?>
- </div>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- }
- }
- }
- ?>
- </div>
- </div>
- <div class="certificate-sidebar_widget">
- <h3 class="certificate-sidebar_widget-title">Typ zadań</h3>
- <div class="certificate-check">
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'typ_zadan_taxonomy',
- 'hide_empty' => false,
- )
- );
- if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- ?>
- <div class="certificate-check_item">
- <input name="<?php echo "Typzadan[]"; ?>" value="<?php echo $term->slug; ?>" class="check-control" type="checkbox" id="certificateType<?php echo $term->slug.get_the_ID(); ?>" <?php if( isset($_GET['Typzadan'])&& strlen(array_search($term->slug,$_GET['Typzadan'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificateType<?php echo $term->slug.get_the_ID(); ?>"><?php echo $term->name; ?></label>
- </div>
- <?php
- }
- }
- ?>
- </div>
- </div>
- <div class="certificate-sidebar_widget">
- <h3 class="certificate-sidebar_widget-title">Poziom</h3>
- <div class="certificate-check">
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'poziom_taxonomy',
- 'hide_empty' => false,
- )
- );
- if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- ?>
- <div class="certificate-check_item">
- <input name="<?php echo "Poziom[]"; ?>" value="<?php echo $term->slug; ?>" class="check-control" type="checkbox" id="certificateLevel<?php echo $term->slug.get_the_ID(); ?>" <?php if( isset($_GET['Poziom'])&& strlen(array_search($term->slug,$_GET['Poziom'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificateLevel<?php echo $term->slug.get_the_ID(); ?>"><?php echo $term->name; ?></label>
- </div>
- <?php
- }
- }
- ?>
- </div>
- </div>
- <div class="certificate-sidebar_widget">
- <h3 class="certificate-sidebar_widget-title">Typ matury</h3>
- <div class="certificate-check">
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'typ_matury_taxonomy',
- 'hide_empty' => false,
- )
- );
- if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- ?>
- <div class="certificate-check_item">
- <input name="<?php echo "Typmatury[]"; ?>" value="<?php echo $term->slug; ?>" class="check-control" type="checkbox" id="certificate<?php echo $term->slug.get_the_ID(); ?>" <?php if( isset($_GET['Typmatury'])&& strlen(array_search($term->slug,$_GET['Typmatury'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificate<?php echo $term->slug.get_the_ID(); ?>"><?php echo $term->name; ?></label>
- </div>
- <?php
- }
- }
- ?>
- </div>
- </div>
- <div class="certificate-sidebar_widget">
- <h3 class="certificate-sidebar_widget-title">Rok matury</h3>
- <div class="certificate-check-group">
- <div class="certificate-check check-all-wrapper certificate-check_double">
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'rok_matury_taxonomy',
- 'hide_empty' => false,
- )
- );
- if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- ?>
- <div class="certificate-check_item">
- <input name="<?php echo "Rokmatury[]"; ?>" value="<?php echo $term->slug; ?>" class="check-control" type="checkbox" id="certificateYear<?php echo $term->slug.get_the_ID(); ?>" <?php if( isset($_GET['Rokmatury'])&& strlen(array_search($term->slug,$_GET['Rokmatury'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificateYear<?php echo $term->slug.get_the_ID(); ?>"><?php echo $term->name; ?></label>
- </div>
- <?php
- }
- }
- ?>
- </div>
- <div class="certificate-check">
- <div class="certificate-check_item">
- <input class="check-control check-all" type="checkbox" id="certificateSelect<?php echo $term->slug.get_the_ID(); ?>">
- <label class="check-control-label check-all-label"
- for="certificateSelect<?php echo $term->slug.get_the_ID(); ?>">Zaznacz wszystkie</label>
- </div>
- </div>
- </div>
- </div>
- <div class="certificate-sidebar_widget">
- <h3 class="certificate-sidebar_widget-title">Miesiąc matury</h3>
- <div class="certificate-check">
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'miesiac_matury_taxonomy',
- 'hide_empty' => false,
- )
- );
- if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- ?>
- <div class="certificate-check_item">
- <input name="<?php echo "Miesiacmatury[]"; ?>" value="<?php echo $term->slug; ?>" class="check-control" type="checkbox" id="certificateMonth<?php echo $term->slug.get_the_ID(); ?>" <?php if( isset($_GET['Miesiacmatury'])&& strlen(array_search($term->slug,$_GET['Miesiacmatury'])) > 0) echo 'checked'; ?>>
- <label class="check-control-label" for="certificateMonth<?php echo $term->slug.get_the_ID(); ?>"><?php echo $term->name; ?></label>
- </div>
- <?php
- }
- }
- ?>
- </div>
- </div>
- <div class="certificate-sidebar_footer">
- <div class="certificate-sidebar_action">
- <div>
- <input name="filtruj" class="btn-primary filter-btn" type="submit" value="Zastosuj" />
- </div>
- <div>
- <input class="btn-primary btn-danger" type="button" value="Wyczyść" onclick="UncheckAll()" />
- </div>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
- </div>
- <div class="col-lg-6 col-md-8">
- <div class="certificate-main">
- <div class="certificate-main_header">
- <h1 class="certificate-main_header-title"><?php the_field('excercises-title'); ?></h1>
- </div>
- <?php
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 0;
- $wp_query = new WP_Query(
- array(
- 'posts_per_page' => $zadanie,
- 'post_type' => 'zadania',
- 'paged' => $paged,
- 'kategorie_zadan_taxonomy' => $_GET['Kategoriazadan'],
- 'typ_zadan_taxonomy' => $_GET['Typzadan'],
- 'poziom_taxonomy' => $_GET['Poziom'],
- 'typ_matury_taxonomy' => $_GET['Typmatury'],
- 'rok_matury_taxonomy' => $_GET['Rokmatury'],
- 'miesiac_matury_taxonomy' => $_GET['Miesiacmatury'],
- 'tax_query' => array(
- array(
- 'taxonomy' => 'przedmiot_taxonomy',
- 'field' => 'slug',
- 'terms' => array( 'biologia' ),
- 'operator' => 'IN'
- ),
- ),
- )
- )
- ?>
- <div class="certificate-main_body">
- <div class="certificate-main_actions">
- <div>
- <div class="certificate-main_summary">Znalezionych zadań: <strong><?php echo $wp_query->found_posts; ?></strong></div>
- </div>
- <div>
- <ul class="pager-primary certificate-main_pager">
- <div class="post-pagination">
- <?php if(show_posts_nav($wp_query)) : ?>
- <div class="excercises-items_pagination">
- <?php excercises_pagination(); ?>
- </div>
- <?php endif; ?>
- </div>
- </ul>
- </div>
- </div>
- <?php if($wp_query->have_posts()) { ?>
- <div class="certificate-main_browser">
- <?php
- if($paged == 0){
- $counter = $zadanie * $paged + 1;
- } else {
- $counter = $zadanie * ($paged - 1) + 1;
- }
- if( $wp_query->have_posts()) {
- while( $wp_query->have_posts()) { $wp_query->the_post();
- $kategorie = get_the_terms( $post->ID, 'kategorie_zadan_taxonomy');
- $typy_zadan = get_the_terms( $post->ID, 'typ_zadan_taxonomy');
- $poziom = get_the_terms( $post->ID, 'poziom_taxonomy');
- $typ_matury = get_the_terms( $post->ID, 'typ_matury_taxonomy');
- $rok = get_the_terms( $post->ID, 'rok_matury_taxonomy');
- $miesiac = get_the_terms( $post->ID, 'miesiac_matury_taxonomy');
- ?>
- <article class="certificate-main_article">
- <header class="certificate-main_article-header">
- <div class="certificate-main_article-counter"><?php echo $counter; ?></div>
- <h2><a href="<?php echo get_post_permalink(); ?>">Matura <?php echo $miesiac[0]->name." ".$rok[0]->name; ?>, Poziom <?php echo $poziom[0]->name." (".$typ_matury[0]->name.")"; ?><br>
- <?php the_title(); ?></a></h2>
- </header>
- <ul class="certificate-main_article-cats">
- <?php
- foreach($kategorie as $kategoria) { ?>
- <li>
- <form>
- <input name="<?php echo "Kategoriazadan[]"; ?>" value="<?php echo $kategoria->name; ?>" type="submit" id="certificateFilter<?php echo $kategoria->slug.get_the_ID(); ?>" <?php if( isset($_GET['Kategoriazadan'])&& strlen(array_search($kategoria->slug,$_GET['Kategoriazadan'])) > 0) echo 'checked'; ?>>
- </form>
- </li>
- <?php
- }
- foreach($typy_zadan as $typ_zadan) { ?>
- <li>
- <form>
- <input name="<?php echo "Typzadan[]"; ?>" value="<?php echo $typ_zadan->name; ?>" type="submit" id="certificateType<?php echo $typ_zadan->slug.get_the_ID(); ?>" <?php if( isset($_GET['Typzadan'])&& strlen(array_search($typ_zadan->slug,$_GET['Typzadan'])) > 0) echo 'checked'; ?>>
- </form>
- </li>
- <?php
- } ?>
- </ul>
- <div class="certificate-main_article-content">
- <?php the_field('ex-description'); ?>
- <figure>
- <a data-fancybox href="<?php the_field('ex-img-photo'); ?>"><img
- src="<?php the_field('ex-img-photo'); ?>" /></a>
- </figure>
- <?php the_field('ex-content'); ?>
- </div>
- <div class="certificate-main_article-answer">
- <div class="article-answer_header">
- <div class="btn-primary article-answer_toggle">Pokaż rozwiązanie</div>
- </div>
- <div class="article-answer_collapse">
- <div class="article-answer_content">
- <?php the_field('ex-solution'); ?>
- </div>
- </div>
- </div>
- <div class="certificate-main_article-footer">
- <div class="article-print_title">Drukuj zadanie:</div>
- <ul class="certificate-main_article-print">
- <li>
- <a href="#" data-print="task">Zadanie</a>
- </li>
- <li>
- <a href="#" data-print="solution">Rozwiązanie</a>
- </li>
- <li>
- <a href="#" data-print="both">Zadanie + Rozwiązanie</a>
- </li>
- </ul>
- </div>
- <div class="certificate-main_article-check">
- <input id="printCheck<?php echo $counter; ?>" type="checkbox" checked>
- <label for="printCheck<?php echo $counter; ?>"></label>
- </div>
- </article>
- <?php
- $counter++;
- }
- }
- ?>
- </div>
- <form methogd="get" class="print-btn-box">
- <input class="btn-primary print-btn" name="tryb" type="submit" value="Tryb drukowania">
- </form>
- <div class="certificate-main_footer">
- <div class="certificate-main_footer-holder">
- <ul class="pager-primary">
- <div class="post-pagination">
- <?php if(show_posts_nav($wp_query)) : ?>
- <div class="excercises-items_pagination">
- <?php excercises_pagination(); ?>
- </div>
- <?php endif; ?>
- </div>
- </ul>
- </div>
- <div class="print-primary">
- <div id="printSwitchTitle" class="print-primary_title">Drukuj wszystkie zadania:</div>
- <div class="print-primary_switch">
- <div class="print-switch">
- <input id="printSwitch" type="checkbox" checked>
- <label for="printSwitch"></label>
- </div>
- </div>
- <ul class="print-primary_list">
- <li>
- <a href="#" data-print="task">Zadania</a>
- </li>
- <li>
- <a href="#" data-print="solution">Rozwiązania</a>
- </li>
- <li>
- <a href="#" data-print="both">Zadania + Rozwiązania</a>
- </li>
- </ul>
- </div>
- </div>
- <?php
- } else {
- ?>
- <div class="no-posts-info">
- <?php the_field('no-posts-info'); ?>
- </div>
- <?php
- }
- ?>
- </div>
- </div>
- <?php echo '<pre>';
- print_r($q1);
- echo '</pre>'; ?>
- </div>
- <div class="col-lg-3 col-md-4">
- <?php get_template_part('template-parts/sidebar'); ?>
- </div>
- <?php get_template_part('template-parts/newsletter'); ?>
- <?php get_footer();
- if( isset($_GET['Kategoriazadan']) ||
- isset($_GET['Typzadan']) ||
- isset($_GET['Poziom']) ||
- isset($_GET['Rokmatury']) ||
- isset($_GET['Typmatury']) ||
- isset($_GET['Miesiacmatury'])||
- isset($_GET['tryb'])
- ) {
- ?>
- <script> printAction(); </script>
- <?php }
- ?>