%PDF- %PDF-
Direktori : /var/www/pn/wp-content/themes/intosai/ |
Current File : //var/www/pn/wp-content/themes/intosai/sai_in_the_world.php |
<?php /* * Template Name: The SAI in the world */ /* TOP BANNER */ $banner = get_field('top_banner_options'); if($banner == 'static_banner'){ include('templates/sections/banner_static.php'); }elseif($banner == 'slide_banner'){ include('templates/sections/banner_slider.php'); } /* PAGE CONTENT */ while (have_posts()) : the_post(); if(get_the_content() != ''){ echo '<div class="page-content">'; echo '<div class="wrapper">'; the_content(); echo '</div>'; echo '</div>'; } endwhile; /* PAGE SECTIONS */ if(have_rows('page_sections')): while (have_rows('page_sections')) : the_row(); if(get_row_layout() == 'boxes'): include('templates/sections/boxes.php'); elseif(get_row_layout() == 'latest_news'): include('templates/sections/latest_news.php'); elseif(get_row_layout() == 'latest_projects'): include('templates/sections/latest_projects.php'); elseif(get_row_layout() == 'newsletter'): include('templates/sections/newsletter.php'); elseif(get_row_layout() == 'partners'): include('templates/sections/partners.php'); elseif(get_row_layout() == 'text'): include('templates/sections/text.php'); elseif(get_row_layout() == 'colorbox'): include('templates/sections/colorbox.php'); elseif(get_row_layout() == 'accordion'): include('templates/sections/accordion.php'); elseif(get_row_layout() == 'success_stories'): include('templates/sections/success_stories.php'); elseif(get_row_layout() == 'downloads'): include('templates/sections/downloads.php'); endif; endwhile; endif; ?> <div class="page-content single-page sai-in-world"> <script type="text/javascript"> var country; function setCountry(){ country = document.getElementById('data').value; window.location.href = "<?php echo get_home_url(); ?>/the-sai-in-the-world/?location="+country+"/#link"; } </script> <?php //Variables //We delete the last charater of string because the / from the anchor follows in with the location $temp_location = array_key_exists('location', $_GET) ? $_GET['location'] : ''; $specRegID = substr($temp_location, 0, -1); $specRegName = get_term_by('id', $specRegID, 'wdi'); //ACF $DAC = get_field('economic_classification', 'wdi_'.$specRegID); $SMC = get_field('wdi_characteristics', 'wdi_'.$specRegID); $wdiLat = get_field('wdi_lat', 'wdi_'.$specRegID); $wdiLong = get_field('wdi_long', 'wdi_'.$specRegID); $WTT = get_field('wdi_tooltip', 'wdi_'.$specRegID); $WOI = get_field('wdi_other_initiatives', 'wdi_'.$specRegID); $WPA = get_field('wdi_pmf_assessments', 'wdi_'.$specRegID); $WPFA = get_field('wdi_pefa_assessments', 'wdi_'.$specRegID); $wdiIBO = get_field('wdi_ibo', 'wdi_'.$specRegID); $flag = get_field('flag', 'wdi_'.$specRegID); $national_emblem = get_field('national_emblem', 'wdi_'.$specRegID); $list_documents = get_field('list_documents', 'wdi_'.$specRegID); //Please pay attention to that $optionHolder has to be declared after $specRegName $optionHolder = $temp_location ? $specRegName->name : ''; $wdi = get_terms(array( 'taxonomy' => 'wdi', 'hide_empty' => false, )); ?> <div id="link" class="mainContainer"> <div class="wrapper"> <div class="headerContainer"> <h2>Country selector</h2> <div class="contentContainer"> <p>Select the country you want to see more information about in the right box please.</p> </div> </div> <div class="selectContainer"> <div class="select_holder"> <select id="data" class="dropdown" onchange="setCountry()"> <?php if (!$optionHolder) : ?> <option value="" style="display:none;">-Välj ett land-</option> <?php else : ?> <option value="" style="display:none;"><?= $optionHolder; ?></option> <?php endif; ?> <?php foreach ($wdi as $region) : $regID = $region->term_id; $regNamn = $region->name; ?> <option value='<?= $regID; ?>'><?= $regNamn; ?></option> <?php endforeach; ?> </select> </div> </div> </div> </div> <div class="resultContainer"> <div class="wrapper"> <?php // if (!$specRegID) { // echo "ITS EMPTY"; // } else { // echo "Country is set to : ".$specRegName->name; // } // PC::debug($specRegID, '$specRegID'); if (!$specRegID) : ?> <div class="innerContainer"> <h2>No results found!</h2> <p>Make sure that you have selected a country</p> </div> <?php else : ?> <div class="innerContainer"> <div class="headerContainer"> <h2>SAI: <span class="sai"><?= $specRegName->name; ?></span></h2> </div> <div class="countryInformation"> <?php if($DAC){ ?> <span class="spacer"><strong>WB Economic Classification:</strong> <?= $DAC; ?></span><br /> <?php } ?> <?php if($SMC){ ?> <span><strong>SAI Main Characteristics:</strong> <?= $SMC; ?></span> <?php } ?> <?php if($WTT){ ?> <span class="spacer"><?= $WTT; ?></span><br /> <?php } ?> </div> <?php if(false){ ?> <div class="countrySidebar"> <span class="spacer"><strong>Latitude:</strong> <?= $wdiLat; ?></span><br /> <span class="spacer"><strong>Longitude:</strong> <?= $wdiLong; ?></span> <?php // Use the substr function to get rid of the p-tagg that follows in the $WTT ?> </div> <?php } ?> <?php if($flag || $national_emblem){ ?> <div class="countrySidebar"> <?php if($flag) echo "<img class='flag' src='{$flag}''>"; if($national_emblem) echo "<img class='emblem' src='{$national_emblem}''>"; ?> </div> <?php } ?> </div> <div class="wrapp-projectsinSai"> <div class="content-projectsinSai"> <h2 class="mb-0">Capacity development activities</h2> <h3>Projects registered in the SAI Capacity database</h3> <div class="projectsinSai"> <?php $args = array( 'post_type' => 'project', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'wdi', 'field' => 'term_id', 'terms' => $specRegID, 'operator' => 'IN' ), ), ) ?> <?php $wdiQuery = new WP_Query($args); ?> <?php if($wdiQuery->have_posts()) : $projCounter = 1; ?> <div class="row_heading"> <div class="ben">Ben. level</div> <div class="name">Project name</div> <div class="status">Status</div> </div> <?php while($wdiQuery->have_posts()) : $wdiQuery->the_post(); ?> <div class="row"> <div class="project_head" data-projecttgl="<?= $projCounter; ?>"> <div class="ben"> <?php the_field('beneficiary_level'); ?> </div> <div class="name"> <?php the_title(); ?> </div> <div class="status"> <?php the_field('project_status'); ?> </div> <div class="icon"> <i class="fa fa-angle-right"></i> </div> </div> <div class="project_bottom" data-projectmore="<?= $projCounter; ?>"> <div class="row"> <div class="half funding"> <span class="label">Source of funding</span> <?php the_field('source_funding'); ?> </div> <div class="half budget"> <span class="label">Total budget (in US $)</span> $ <?php the_field('total_budget'); ?> </div> </div> <div class="row"> <div class="half durrfrom"> <span class="label">Duration from</span> <?php the_field('duration_from'); ?> </div> <div class="half durrto"> <span class="label">Duration to</span> <?php the_field('duration_to'); ?> </div> </div> <div class="row"> <div class="twothird supp"> <span class="label">Support Categories covered</span> <?php the_field('support_cats_covered'); ?> </div> <div class="onethird rmore"> <a href="<?php the_permalink(); ?>"> View Project </a> </div> </div> </div> </div> <?php $projCounter++; endwhile; ?> <?php wp_reset_postdata(); ?> <?php endif; ?> </div> <?php $saiID = $specRegID; ?> <section class="wdi_performance-in-the-world wdi_performance"> <h2>SAI Performance</h2> <?php /*------ SAI PMF ASSESSMENTS ------*/ if (get_field('wdi_pmf_assessments', 'wdi_'.$saiID)): $performanceIsEmpty = false; echo "<h3>SAI PMF Assessments</h3>"; echo "<div class='performanceHolder'>"; while (has_sub_field('wdi_pmf_assessments', 'wdi_'.$saiID)): $date = get_sub_field("date"); $type = get_sub_field("type_of_assessment"); $link = get_sub_field("link"); if ($link) { echo "<a href='{$link}' target='_blank'>"; } echo "<span class='date'>[{$date}]</span> <span class='title'>{$type}</span></br>"; if ($link) { echo "</a>"; } endwhile; echo "</div>"; endif; /*------ SAI PEFA ASSESSMENTS ------*/ //if(get_field('wdi_pefa_assessments', 'wdi_'.$saiID)): //$performanceIsEmpty = false; echo "<h3>PEFA Assessments</h3>"; echo "<div class='performanceHolder'>"; echo "<span>(Indicators related to SAI are indicators 29.2,30,31)</span>"; while(has_sub_field('wdi_pefa_assessments', 'wdi_'.$saiID)): $date = get_sub_field("date"); $link = get_sub_field("link"); if($link){ echo "<a href='{$link}' target='_blank' style='padding-left: 0;'>"; echo "<span class='date'>[{$date}]</span>"; echo "</a>"; }else{ echo "<div class='no-link'>"; echo "<span class='date'>[{$date}]</span>"; echo "</div>"; } endwhile; echo "</div>"; //endif; /*------ SAI OPEN BUDGET INDEX ------*/ //if(get_field('wdi_ibo', 'wdi_'.$saiID)): //$performanceIsEmpty = false; echo "<h3>Open Budget Index</h3>"; echo "<div class='performanceHolder'>"; echo "<span>(Questions related to SAI are questions AR, 97-102, 118-124, 139-142)</span>"; while (has_sub_field('wdi_ibo', 'wdi_'.$saiID)): $date = get_sub_field("date"); $link = get_sub_field("link"); if ($link) { echo "<a href='{$link}' target='_blank' style='padding-left: 0;'>"; echo "<span class='date'>[{$date}]</span>"; echo "</a>"; } else { echo "<div class='no-link'>"; echo "<span class='date'>[{$date}]</span>"; echo "</div>"; } endwhile; echo "</div>"; //endif; //if($performanceIsEmpty){ //echo "<p class='empty'>No information added</p>"; //} ?> </section> <?php if($list_documents){ ?> <div class="content-projectsinSai content-documents"> <h2 class="mb-0">Documents</h2> <div class="projectsinSai"> <div class="row_heading"> <div class="file-type-head">File type</div> <div class="file-title-head">File name</div> <div class="file-download-head">Download</div> </div> <?php foreach ($list_documents as $doc) { // var_dump($doc); $explode_fileName = explode('.', $doc['document']['filename']); $explode_fileName_lastChild = end($explode_fileName); ?> <div class="row"> <div class="project_head"> <div class="file-type"> <div class="wrapp-img"> <?php if($explode_fileName_lastChild == 'pdf'){ ?> <img src="<?php echo get_template_directory_uri(); ?>/assets/images/file-pdf.svg" alt="pdf" > <?php }else{ ?> <img src="<?php echo get_template_directory_uri(); ?>/assets/images/file-word.svg" alt="doc" > <?php } ?> </div> </div> <div class="file-title"> <?php echo $doc['document']['title']; ?> </div> <div class="file-download"> <a href="<?php echo $doc['document']['url']; ?>"><i class="fa fa-download" aria-hidden="true"></i></a> </div> </div> </div> <?php } ?> </div> </div> <?php } ?> <?php endif; ?> </div> </div> </div> </div>