diff --git a/admin/add_broadcast_page.php b/admin/add_broadcast_page.php index 394bff5..7a22130 100644 --- a/admin/add_broadcast_page.php +++ b/admin/add_broadcast_page.php @@ -42,6 +42,7 @@ function live_meta_box_add() function orari_dirette_input($post) { $values = get_post_custom($post->ID); + $onair_cadence = array(); $text_start = array(); $text_end = array(); wp_nonce_field('on_air_nonce', 'onair_nonce'); @@ -52,12 +53,13 @@ function orari_dirette_input($post) post_title, 'category', $broadcast); ?> -
+
-
+
+ +
+
-
+
@@ -85,37 +96,48 @@ function orari_dirette_input($post) function orari_repliche_input($post) { $values = get_post_custom($post->ID); + $rerun_cadence = array(); $text_start = array(); $text_end = array(); wp_nonce_field('rerun_nonce', 're_run_nonce'); for ($x=0;$x<7;$x++) : $rerun_day[$x] = isset($values['rerun_day_'.$x]) ? esc_attr($values['rerun_day_'.$x][0]) : ''; - $text_start[$x] = isset($values['rerun_start_'.$x]) ? esc_attr($values['rerun_start_'.$x][0]) : ''; - $text_end[$x] = isset($values['rerun_end_'.$x]) ? esc_attr($values['rerun_end_'.$x][0]) : ''; ?> -
-

Replica n.

-
-
- -
-
- - -
-
- - -
-
+ $rerun_cadence[$x] = isset($values['on_air_cadence'.$x]) ? esc_attr($values['on_air_cadence'.$x][0]) : ''; + $text_start[$x] = isset($values['rerun_start_'.$x]) ? esc_attr($values['rerun_start_'.$x][0]) : ''; + $text_end[$x] = isset($values['rerun_end_'.$x]) ? esc_attr($values['rerun_end_'.$x][0]) : ''; ?> +
+

Replica n.

+
+
+ +
+
+ +
+
+ + +
+
+ + +
+
-1, - 'post_type' => 'broadcast', - 'orderby' => 'title', - 'order' => 'asc', -/* 'exclude' => array( - 'key'=> '_wp_page_template', - 'value' => 'old_broadcast_template.php', - 'compare' => '!=' - )*/ + 'numberposts' => -1, + 'post_type' => 'broadcast', + 'orderby' => 'title', + 'order' => 'asc', +/* 'exclude' => array( + 'key'=> '_wp_page_template', + 'value' => 'old_broadcast_template.php', + 'compare' => '!=' + )*/ ); $broadcast = get_posts($broadcast_post); @@ -25,13 +25,13 @@ function rwt_broadcast_list() foreach ($broadcast as $post) { $on_air_day = get_post_meta($post->ID, 'on_air_day_0', false); - $on_air = empty($on_air_day[0]) ? false : true; - if ($on_air) { - array_push($attive,$post); - } else { - array_push($concluse,$post); - } - } + $on_air = empty($on_air_day[0]) ? false : true; + if ($on_air) { + array_push($attive,$post); + } else { + array_push($concluse,$post); + } + } $content = '
[ Attive ] [ Concluse ]
'; echo $content; diff --git a/shortcodes/palinsesto.php b/shortcodes/palinsesto.php index 83491e9..11c047c 100644 --- a/shortcodes/palinsesto.php +++ b/shortcodes/palinsesto.php @@ -21,18 +21,24 @@ function show_palinsesto($args) $on_air_day[] = get_post_meta($post->ID, 'on_air_day_'.$d, false); $on_air_start[] = get_post_meta($post->ID, 'on_air_start_'.$d, false); $on_air_end[] = get_post_meta($post->ID, 'on_air_end_'.$d, false); - if (!empty($on_air_day[$d][0])&&!empty($on_air_start[$d][0])&&!empty($on_air_end[$d][0])) { - $palinsesto[$on_air_day[$d][0]][(string) $on_air_start[$d][0]] = - array( - 'ID' => $post->ID, - 'start' => $on_air_start[$d][0], - 'end' => $on_air_end[$d][0], - 'on_air' => true, - 'title' => $post->post_title, - 'excerpt' => $post->post_excerpt, - 'thumb_url' => get_the_post_thumbnail_url($post->ID, 'full'), - 'the_permalink' => get_permalink($post->ID), - ); + $on_air_cadence[] = get_post_meta($post->ID, 'on_air_cadence_'.$d, false); //added + + if (!empty($on_air_day[$d][0])&&!empty($on_air_start[$d][0])&&!empty($on_air_end[$d][0])&&!empty($on_air_cadence[$d][0])) { + if (!isset($palinsesto[$on_air_day[$d][0]][(string) $on_air_start[$d][0]])){ + $palinsesto[$on_air_day[$d][0]][(string) $on_air_start[$d][0]] = array(); + } + array_push($palinsesto[$on_air_day[$d][0]] [(string)$on_air_start[$d][0]], + array( + 'ID' => $post->ID, + 'start' => $on_air_start[$d][0], + 'end' => $on_air_end[$d][0], + 'on_air' => true, + 'title' => $post->post_title, + 'excerpt' => $post->post_excerpt, + 'thumb_url' => get_the_post_thumbnail_url($post->ID, 'full'), + 'the_permalink' => get_permalink($post->ID), + ) + ); } } @@ -41,7 +47,7 @@ function show_palinsesto($args) $rerun_day[] = get_post_meta($post->ID, 'rerun_day_'.$d, false); $rerun_start[] = get_post_meta($post->ID, 'rerun_start_'.$d, false); $rerun_end[] = get_post_meta($post->ID, 'rerun_end_'.$d, false); - if (!empty($rerun_day[$d][0])&&!empty($rerun_start[$d][0])&&!empty($rerun_end[$d][0])) { + if (!empty($rerun_day[$d][0]) && !empty($rerun_start[$d][0]) && !empty($rerun_end[$d][0])) { $palinsesto[$rerun_day[$d][0]][(string) $rerun_start[$d][0]] = array( 'ID' => $post->ID, @@ -66,36 +72,37 @@ function show_palinsesto($args) for ($x=1;$x<=7;$x++) { - /*echo '
';
-    echo("$today,$x");
-    echo '
';*/ + /*echo '
';
+        echo("$today,$x");
+        echo '
';*/ - if ($x == $today) - $tabs .= "
  • ".$week_days[$x-1]."
  • "; - else - $tabs .= "
  • ".$week_days[$x-1]."
  • "; + if ($x == $today) + $tabs .= "
  • ".$week_days[$x-1]."
  • "; + else + $tabs .= "
  • ".$week_days[$x-1]."
  • "; - $content .= '
  • '; - if (!empty($palinsesto[$x])) { - ksort($palinsesto[$x]); - foreach ($palinsesto[$x] as $key => $broadcast) { - $content .= '
    '; - //$content .= '

    '.$broadcast['thumb_url'].'

    '; - $content .= ''; - /* $content .= ''.$broadcast['title'].''; */ - $content .= '

    '.$broadcast['title'].'

    '; - $content .= '
    '; - /* Indico sotto al titolo se la trasmissione è una replica o una diretta */ - $content .= (!$broadcast['on_air']) ? "[replica]" : "[diretta]"; - $content .= '

    '.$broadcast['start'].' - '.$broadcast['end'].'

    '; - $content .= '

    '.$broadcast['excerpt'].'

    '; - //$content .= '

    '.$broadcast['the_permalink'].'

    '; - $content .= "
    "; + $content .= '
  • '; + if (!empty($palinsesto[$x])) { + ksort($palinsesto[$x]); + foreach ($palinsesto[$x] as $broadcast_list) + foreach ( $key => $broadcast) { + $content .= '
    '; + //$content .= '

    '.$broadcast['thumb_url'].'

    '; + $content .= ''; + /* $content .= ''.$broadcast['title'].''; */ + $content .= '

    '.$broadcast['title'].'

    '; + $content .= '
    '; + /* Indico sotto al titolo se la trasmissione è una replica o una diretta */ + $content .= (!$broadcast['on_air']) ? "[replica]" : "[diretta]"; + $content .= '

    '.$broadcast['start'].' - '.$broadcast['end'].'

    '; + $content .= '

    '.$broadcast['excerpt'].'

    '; + //$content .= '

    '.$broadcast['the_permalink'].'

    '; + $content .= "
    "; + } } - } $content .= '
  • '; } ?>