PluginProbe
ANAC XML Bandi di Gara / 3
ANAC XML Bandi di Gara v3
7.8 trunk 0.1 1.0.0.1 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.1.1 1.1.2 2.0 2.0.1 2.0.2 2.0.3 2.1 2.2 2.3 2.3.1 3 3.0.1 3.1 3.1.1 3.1.2 3.1.3 All 57 releases
avcp / alerts.php

alerts.php in ANAC XML Bandi di Gara 3, at alerts.php

79 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 add_action('admin_notices', 'avcp_custom_notice');
4 function avcp_custom_notice()
5 {
6 global $current_screen;
7
8 if ( 'ditte' == $current_screen->taxonomy )
9 {
10 echo '<div class="updated" style="background-color: #f1f1f1;
11 color: black;
12 font-weight: bold;
13 border: none;
14 box-shadow: none;
15 font-size: 20px;
16 font-family: verdana;
17 "><p>Attenzione: ogni modifica effettuata a una ditta si applica anche alle gare già pubblicate!</p></div>';
18 }
19 }
20
21 /* Display a thankyou notice */
22 add_action('admin_notices', 'avcp_admin_messages');
23 function avcp_admin_messages() {
24 global $current_user ;
25 $user_id = $current_user->ID;
26
27 $get_avcp_invalid = get_option('avcp_invalid');
28 if ($get_avcp_invalid == '1') {
29 echo '<div class="error"><p>AVCP | Alcuni dataset .xml non hanno superato il controllo di validazione</p><p><a href="' . admin_url() . 'edit.php?post_type=avcp&page=avcp_v_dataset">Clicca qui vedere i dettagli degli errori</a></div>';
30 }
31
32 if ( is_admin() && current_user_can( 'manage_options' ) && !get_user_meta($user_id, 'avcp_upgrade_3') ) {
33 echo '<div class="error"><p>';
34 printf(__('AVCP | Per completare l\'aggiornamento alla versione 3.0 è necessario spostare le gare con anno di riferimento "2012" in "2013".<br/>
35 <br/><a class="add-new-h2" href="%1$s">Clicca qui per eseguire automaticamente lo spostamento e per eliminare la voce anno di riferimento 2012</a>.'), '?avcp_upgrade_3=0');
36 echo "</p></div>";
37 }
38
39 //if ( ! get_user_meta($user_id, 'avcp_thankyou_ignore_notice') ) {
40 // echo '<div class="updated"><p>';
41 // printf(__('Grazie per avere installato Amministrazione Trasparente!<br/>Per la gestione delle spese dai un\'occhiata a <a href="http://wordpress.org/plugins/amministrazione-aperta/" target="_blank">Amministrazione Aperta</a> | <a href="%1$s">Nascondi</a>'), '?avcp_thankyou_nag_ignore=0');
42 // echo "</p></div>";
43 //}
44
45 //global $pagenow;
46 //if (( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) && ($_GET['post_type'] == 'at_gara')) {
47 //echo '<div class="error"><p>';
48 // printf(__('Attenzione! Stai usando una versione beta di AVCP for Wordpress. Procedi a tuo rischio e pericolo'));
49 // echo "</p></div>";
50 //}
51 }
52
53
54 add_action('admin_init', 'avcp_admin_messages_ignore');
55 function avcp_admin_messages_ignore() {
56 global $current_user;
57 $user_id = $current_user->ID;
58 /* If user clicks to ignore the notice, add that to their user meta */
59
60 if ( isset($_GET['avcp_upgrade_3']) && '0' == $_GET['avcp_upgrade_3'] ) { // 19 gennaio 2014
61 query_posts( array( 'post_type' => 'avcp', 'annirif' => '2012') ); global $post;
62 if ( have_posts() ) : while ( have_posts() ) : the_post();
63 wp_remove_object_terms( $post->ID, '2012', 'annirif' );
64 wp_add_object_terms( $post->ID, '2013', 'annirif' );
65 endwhile; else:
66 endif;
67 $get_term = get_term_by('name', '2012', 'annirif');
68 $t_id = $get_term->term_id;
69 wp_delete_term( $t_id, 'annirif' );
70 add_user_meta($user_id, 'avcp_upgrade_3', 'true', true);
71 unlink(ABSPATH . 'avcp/2012.xml');
72 }
73
74 if ( isset($_GET['avcp_upgrade_2date_ignore']) && '0' == $_GET['avcp_upgrade_2date_ignore'] ) {
75 add_user_meta($user_id, 'avcp_upgrade_2date', 'true', true);
76 }
77 }
78
79 ?>