<?php include ("_website_init.php"); 
// Adde padding line 107 9-20-18 279, 306 last comment out
// load records 
  list($listen_liveRecords, $listen_liveMetaData) = getRecords(array(
    'tableName'   => 'listen_live',
	 
  ));
  
   // load record from 'listen_live_presets'
  list($listen_live_presetsRecords, $listen_live_presetsMetaData) = getRecords(array(
    'tableName'   => 'listen_live_presets',
    'where'       => '', // load first record
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $listen_live_presetsRecord = @$listen_live_presetsRecords[0]; // get first record
  
   // load records from 'musicians_lisings'
  list($musicians_lisingsRecords, $musicians_lisingsMetaData) = getRecords(array(
    'tableName'   => 'musicians_lisings',
    'loadUploads' => true,
    'allowSearch' => false,
	//'orderBy' => 'concert_lineup_order DESC',
  ));


  $listen_liveRecord = @$listen_liveRecords[0]; // get first record
  $musician_array = array_filter(explode("\t", $listen_liveRecord['performers']));
  $musician_implode = implode(",", $musician_array);
  $listen_performers = mysql_select('musicians_lisings', 'num IN ('.$musician_implode.') ORDER BY concert_lineup_order DESC');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $organization_informationRecord['organization_name'] ?></title>
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes" />
<link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
<link href="css/gvff.css.php" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/fonts.css.php" />
<?php include ("_preload.php"); ?>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=<?php 
    $output = ''; 
    foreach ($google_font_namesRecords as $record) { $record['name'] = preg_replace("/[, ]/", "+", $record['name']);
      $output .= $record['name'] . "|"; 
    } 
    $output = rtrim($output,"|"); // remove trailing pipe 
    print $output; 
?>">
</head>

<body <?php include ("_page_background.php"); ?>  >
<p>&nbsp;</p>
<table class="shadow3" width="65%" border="0" align="center" cellpadding="0">
<tr>
  <td  colspan="2" ><?php include ("_masthead.php");?></td>
</tr>
<tr>
  <td class="shadow3"  width="20%" rowspan="4" align="right" valign="top"  ><?php include ("_mainnavmenu.php"); ?></td>
  <td width="82%"></td>
</tr>
<tr>
  <td valign="top" colspan="2" align="center"><!--Active Code --> 
    <br />
    <br />
    <?PHP
function maxWords($textOrHtml, $maxWords) {
$text = strip_tags($textOrHtml, "<b></b><i></i>");
$words = preg_split("/\s+/", $text, $maxWords+1);
if (count($words) > $maxWords) { unset($words[$maxWords]); }
$output = join(' ', $words);

return $output;
}
?>
    <?php
$count_my_page = ("listen_live_counter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);?>
    <table width="100%" border="0" cellpadding="10">
      <tr>
        <td><?php
    list($listen_liveRecords, $listen_liveMetaData) = getRecords(array(
    'tableName'   => 'listen_live',
	  'where' => '((NOW() + INTERVAL 31 DAY) >= presentation_date AND presentation_date >= TIMESTAMP(CURDATE(), "00:00:00"))',   
	  
	  'orderBy'=> 'presentation_date ASC',
	  ));  
	  
	?>
          <table width="100%" align="center">
            <?php if ($listen_liveRecords): ?>
            <tr>
              <td valign="top" colspan="2"><?php if ($common_informationRecord['show_special_announcement'] == '1'): ?>
                <br />
                <div align="center" style="width:100%;" class="alt_heading_font"><?php echo $common_informationRecord['announcement_head'] ?></div>
                <div align="center" style="width:100%;" class="alt_text_font"><br />
                  <?PHP echo $common_informationRecord['announcement'];
?> -
                  <?php include ("_donate.php"); ?>
                  <br />
                </div>
                <?php endif ?></td>
            </tr>
            <tr>
              <td valign="top" colspan="2"><hr class="active" width="50%"/></td>
            </tr>
            <tr >
              <td valign="top" colspan="2" class="heading_font" style="text-align:center">Our Next Live Streamed Concert<br /></td>
            </tr>
            <tr>
              <td valign="top" colspan="2"><hr class="active" width="50%"/></td>
            </tr>
            <?php foreach (@$listen_liveRecords as $record): ?>
            <tr>
              <td colspan="2"> <hr class="active" width="75%"/></td>
            </tr>
            <tr>
              <td valign="top" width="25%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <?php @$placeholder = @$record['images'][0]?>
                  <tr>
                    <td align="right" valign="middle"><?php if($placeholder == true):?>
                      <div align="center" style="vertical-align:middle"><a style="text-decoration:none;" href="<?php echo $masterurl ?>/listen-liveb.php?<?php echo $record['num'] ?>"><img src="<?php foreach ($record['images'] as $index => $upload1): ?><?php echo $upload1['thumbUrlPath3'] ?>" width="<?php echo $upload1['thumbWidth3'] ?>" height="<?php echo $upload1['thumbHeight3'] ?>" alt="Video Image" style="padding-right:30px"/>
                        <?php endforeach ?>
                        </a></div>
                      <?php else :?>
                      <div align="center" style="vertical-align:middle"><a style="text-decoration:none;" href="<?php echo $masterurl ?>/listen-liveb.php?<?php echo $record['num'] ?>"><img src="<?php foreach ($common_informationRecord['generic_event_image'] as $upload): ?><?php echo $upload['thumbUrlPath2'] ?><?php endforeach ?>" alt="Concert Image" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" style="padding-right:30px"/></a></div>
                      <?php endif ?>
                      <?php break ?>
                      <?php endforeach ?></td>
                  </tr>
                </table></td>
              <td width="75%" height="200"><div  align="left" style="text-align:left">
                  <?php if($record['event_title']): ?>
                  <span class="alt_heading_font" style="font-size:2em;"><?php echo $record['event_title'] ?><br />
                  </span>
                  <?php endif ?>
                </div>
                <a style="text-decoration:none;" href="<?php echo $masterurl ?>/listen-liveb.php?<?php echo @$record['num'] ?>"><span class="alt_heading_font" ><?php echo date("l, M jS, Y", strtotime(@$record['presentation_date'])); ?>
                <?php $concert_date = date("m-d-y", strtotime(@$record['presentation_date'])); ?>
                <br />
                <br />
                7:00 - 10:00 p.m. Eastern time (USA)</span></a><br />
                <?php if (@$record['special_announcement']): ?>
                <br />
                <div style="text-align:left; width:100%"> <span class="alt_text_font">
                  <?PHP  echo strtoupper(@$record['special_announcement']); ?>
                  </span></a> </div>
                <?php endif; ?>
                <?php if ($record['upcoming_event_status'] == 0 || $record['upcoming_event_status'] == ''):?>
                <iframe src="https://free.timeanddate.com/countdown/i5vb8ayi/n5348/cf0/cm0/cu4/ct0/cs1/ca0/co0/cr0/ss0/cac01E064/cpcfff/pct/tcfff/fs200/szw320/szh90/iso<?php echo date("Y-m-d", strtotime($record['presentation_date'])) ?>T19:00:00" allowTransparency="true" frameborder="0" width="320" height="50" ></iframe>
                <br />
                <a class="alt_sub_heading_font" style="text-decoration:underline;" href="listen-liveb.php?<?php echo $record['num'] ?>"><span class="alt_text_font">CLICK/TAP FOR THE LIVE STREAM</span></a><br />
                <br /></td>
            </tr>
          </table>
          <table width="100%" border="0" align="center">
            <tr>
              <td colspan="2"><?php if (@$record['announcement_lead']): ?>
                <div style="text-align:left;" class="text_font">
                  <hr class="active" />
                  <?PHP   echo (@$record['announcement_lead']); 
?>
                </div></td>
            </tr>
            <tr>
            <tr>
              <td>
                <!-- BEGIN TEST PERFORMER LISTING CODE -->
				<?php  if (empty($listen_performers)): ?>
                <span class="alt_text_font"><br>
                Information About The Performers For This Concert Will Be Available Soon.</span>
                <?php else: ?>
                <?php foreach ($listen_performers as $performer): ?>
                <span class="alt_heading_font">FEATURING TEST:</span>
                
                </td>
            </tr><tr><td colspan="2"><hr class="active" /></td></tr>
            <?php break ?>
                <?php endforeach ?>
            
            <?php

                foreach ($listen_performers as $performer):
                    $performer_upload_results = mysql_select('cmsb_uploads', 'fieldName="list_page_image" AND recordNum="'.$performer['num'].'"');
                ?>    
            <tr>
              <td width="25%"><a href="<?php echo $common_informationRecord['master_url'] ?>/musicians_detail.php?<?php echo $performer['num'] ?>">
                <?php foreach ($performer_upload_results as $upload): ?>
                <img style="border:hidden" src="<?php echo CMS_ASSETS_URL.'/uploads/'.$upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
                <?php endforeach ?>
                </a></td>
              <td><a href="<?php echo $common_informationRecord['master_url'] ?>/musicians_detail.php?<?php echo $performer['num'] ?>"><span class="sub_heading_font" style="text-decoration:underline"> <?php echo $performer['full_performer_or_group_name'] ?> </span> <br />
                </a></td>
            </tr>
            <tr>
              <td colspan="2"><hr class="active" /></td>
            </tr>
            <?php endforeach ?>
            
            <?php endif ?>
            <!--  END TEST PERFORMER LISTING CODE -->
            
            <!--  BEGIN OLD PERFORMER LISTING CODE -->
            <?php foreach ($musicians_lisingsRecords as $record): ?>
            <?php $dateList = join(', ', $record['concert_date:labels']); ?>
            <?php if(strpos($dateList, $concert_date) !== false):?>
            <tr>
              <td colspan="2" class="alt_sub_heading_font"><br />
                FEATURING:
                <hr class="active" /></td>
            </tr>
            <?php endif ?>
            <?php break ?>
            <?php endforeach ?>
            <?php foreach ($musicians_lisingsRecords as $record): ?>
            <?php  $dateList2 = join(', ', $record['concert_date:labels']) ?>
            <?php if (strpos($dateList2, $concert_date) !== false):?>
            <tr>
              <td width="25%"><?php foreach ($record['list_page_image'] as $upload): ?>
                <a href="<?php echo $common_informationRecord['master_url'] ?>/musicians_detail.php?<?php echo $record['num'] ?>"> <img style="border:hidden" src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" />
                <?php endforeach ?>
                </a></td>
              <td><a href="<?php echo $common_informationRecord['master_url'] ?>/musicians_detail.php?<?php echo $record['num'] ?>"><span class="sub_heading_font" style="text-decoration:underline">
                <?php if($record['first_name']):?>
                <?php echo $record['first_name'] ?>
                <?php endif ?>
                <?php if($record['middle_name']):?>
                <?php echo $record['middle_name'] ?>
                <?php endif ?>
                <?php if($record['last_name']):?>
                <?php echo $record['last_name'] ?>
                <?php endif ?>
                <?php if($record['group_name']):?>
                <?php echo $record['group_name'] ?>
                <?php endif ?>
                </span> <br />
                </a></td>
            </tr>
            <tr>
              <td colspan="2"><hr class="active" /></td>
            </tr>
            <?php endif ?>
            <?php endforeach ?>
          </table>
          <br />
          <br />
          <?php else : ?>
          <div style="text-align:center; width:80%" class="text_font"><br />
            More Information Coming Soon.<br />
            <br />
          </div>
          <?php endif; ?>
          <?php elseif ($record['upcoming_event_status'] == 1):?>
          <span class="alt_sub_heading_font"><?php echo $listen_live_presetsRecord['upcoming_event_no_stream_text'] ?></span>
          <?php elseif ($record['upcoming_event_status'] == 2):?>
          <span class=" alt_sub_heading_font"><?php echo $listen_live_presetsRecord['upcoming_event_no_event_text'] ?></span>
          </div>
          <?php endif?>
          <br />
          <br />
          <?php else: ?>
      <tr>
        <td class="heading_font">More Information Coming Soon
          <?php endif ?>
          <!--  END OLD PERFORMER LISTING CODE --></td>
      </tr>
      <tr>
        <td><?php include ("_footera.php");?></td>
      </tr>
      <?php // endforeach ?>
    </table>
</body>
</html>
