| 1 |
<?php |
| 2 |
add_action('template_redirect', 'avcp_job_cpt_template'); |
| 3 |
function avcp_job_cpt_template() |
| 4 |
{ |
| 5 |
global $wp, $wp_query; |
| 6 |
if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] == 'avcp') { |
| 7 |
if (have_posts()) { |
| 8 |
add_filter('the_content', 'avcp_job_cpt_template_filter'); |
| 9 |
} else { |
| 10 |
$wp_query->is_404 = true; |
| 11 |
} |
| 12 |
} |
| 13 |
} |
| 14 |
function avcp_job_cpt_template_filter($content) |
| 15 |
{ |
| 16 |
global $wp_query; |
| 17 |
$jobID = $wp_query->post->ID; |
| 18 |
//echo get_post_meta(get_the_ID(), 'ammap_wysiwyg', true) . '<br/>'; |
| 19 |
|
| 20 |
echo '<br/>'; |
| 21 |
echo '<table>'; |
| 22 |
echo '<tr><td>CIG:</td><td>' . get_post_meta(get_the_ID(), 'avcp_cig', true) . '</td></tr>'; |
| 23 |
echo '<tr><td>Struttura proponente:</td><td>' . get_option('avcp_denominazione_ente') . '<br/>' . get_option('avcp_codicefiscale_ente') . '</td></tr>'; |
| 24 |
echo '<tr><td>Oggetto del bando:</td><td>' . get_the_title(get_the_ID()) . '</td></tr>'; |
| 25 |
echo '<tr><td>Procedura di scelta del contraente:</td><td>' . get_post_meta(get_the_ID(), 'avcp_contraente', true) . '</td></tr>'; |
| 26 |
echo '<tr><td>Importo di aggiudicazione:</td><td>' . get_post_meta(get_the_ID(), 'avcp_aggiudicazione', true) . '</td></tr>'; |
| 27 |
echo '<tr><td>Data di effettivo inizio:</td><td>' . date("d F Y", strtotime(get_post_meta(get_the_ID(), 'avcp_data_inizio', true))) . '</td></tr>'; |
| 28 |
echo '<tr><td>Data di ultimazione:</td><td>' . date("d F Y", strtotime(get_post_meta(get_the_ID(), 'avcp_data_fine', true))) . '</td></tr>'; |
| 29 |
echo '<tr><td>Importo delle somme liquidate:</td><td>' . get_post_meta(get_the_ID(), 'avcp_somme_liquidate', true) . '</td></tr>'; |
| 30 |
echo '<tr><td>Anno di riferimento:</td><td>'; |
| 31 |
$get_avcp_dis_archivioanni = get_option('avcp_dis_archivioanni'); |
| 32 |
if ($get_avcp_dis_archivioanni == '1') { |
| 33 |
echo strip_tags ( |
| 34 |
get_the_term_list( $post->ID, 'annirif', '', ' - ', '' ) |
| 35 |
); |
| 36 |
} else { |
| 37 |
echo get_the_term_list( $post->ID, 'annirif', '', ' - ', '' ); |
| 38 |
} |
| 39 |
echo '</td></tr>'; |
| 40 |
echo '</table>'; |
| 41 |
echo '<h3>Elenco degli operatori partecipanti</h3>'; |
| 42 |
|
| 43 |
echo '<table>'; |
| 44 |
$terms = get_the_terms( $post->ID, 'ditte' ); |
| 45 |
if ($terms) { |
| 46 |
foreach($terms as $term) { |
| 47 |
$get_term = get_term_by('name', $term->name, 'ditte'); |
| 48 |
$t_id = $get_term->term_id; |
| 49 |
$term_meta = get_option( "taxonomy_$t_id" ); |
| 50 |
$term_return = esc_attr( $term_meta['avcp_codice_fiscale'] ); |
| 51 |
$stato_var = get_tax_meta($t_id,'avcp_is_ditta_estera'); |
| 52 |
if (empty($stato_var)) {$is_estera = 'IT';}else{$is_estera = 'EE';} |
| 53 |
echo '<tr> |
| 54 |
<td><a href="' . get_term_link( $t_id, 'ditte' ) . '" title="' . $term->name . '">' . $term->name . '</a></td> |
| 55 |
<td>' . $term_return . ' - <b>' . $is_estera . '</b></td> |
| 56 |
</tr>'; |
| 57 |
} |
| 58 |
} |
| 59 |
echo '</table>'; |
| 60 |
|
| 61 |
echo '<h3>Aggiudicatari</h3>'; |
| 62 |
echo '<table>'; |
| 63 |
global $post; |
| 64 |
$dittepartecipanti = get_the_terms( $post->ID, 'ditte' ); |
| 65 |
$cats = get_post_meta($post->ID,'avcp_aggiudicatari',true); |
| 66 |
if(is_array($dittepartecipanti)) { |
| 67 |
foreach ($dittepartecipanti as $term) { |
| 68 |
$cterm = get_term_by('name',$term->name,'ditte'); |
| 69 |
$cat_id = $cterm->term_id; //Prende l'id del termine |
| 70 |
$term_meta = get_option( "taxonomy_$cat_id" ); |
| 71 |
$term_return = esc_attr( $term_meta['avcp_codice_fiscale'] ); |
| 72 |
$checked = (in_array($cat_id,(array)$cats)? ' checked="checked"': ""); |
| 73 |
$stato_var = get_tax_meta($cat_id,'avcp_is_ditta_estera'); |
| 74 |
if (empty($stato_var)) {$is_estera = 'IT';}else{$is_estera = 'EE';} |
| 75 |
if ($checked) { |
| 76 |
echo '<tr> |
| 77 |
<td><a href="' . get_term_link( $cterm->term_id, 'ditte' ) . '" title="' . $term->name . '">' . $term->name . '</a></td> |
| 78 |
<td>' . $term_return . ' - <b>' . $is_estera . '</b></td> |
| 79 |
</tr>'; |
| 80 |
} |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
echo '</table>'; |
| 85 |
|
| 86 |
$get_avcp_showlove = get_option('avcp_showlove'); |
| 87 |
if ($get_avcp_showlove == '1') { |
| 88 |
echo '<center><small>Vista generata con il plugin <a href="http://wordpress.org/plugins/avcp/" target="_blank" title="AVCP Wordpress Plugin">AVCP XML per Wordpress</a></small></center>'; |
| 89 |
} |
| 90 |
} |
| 91 |
?> |