| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/governmentgrants.us/vx/usa/calendar/ |
Upload File : |
<?php
session_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/ua.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/func.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx_/site_info.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
$user = $_SESSION['user'];
$monthlySubscription = ($_SESSION['subscriptions'][2]) ? 1 : 0;
ob_start();
track_member_action('Page Visit','Grant Deadline Calendar');
$not_ignored_where = " AND gg.grants_id NOT IN (SELECT grants_id FROM grdb.grd_usa_ignored_grants WHERE site_code='".$db->clean($siteCode)."' AND client_id='".$db->clean($_SESSION['user'])."')";
if(!empty($_GET['ignored'])) {
$not_ignored_where = " AND gg.grants_id IN (SELECT grants_id FROM grdb.grd_usa_ignored_grants WHERE site_code='".$db->clean($siteCode)."' AND client_id='".$db->clean($_SESSION['user'])."')";
}
$num_months_showing = 6;
$end_deadline = date('Y-m').'-01';
$start_deadline = $end_deadline;
$end_deadline = date('Y-m-d',strtotime('-1 day',strtotime('+1 month',strtotime($end_deadline))));
if(!empty($_REQUEST['date'])) {
$end_deadline = date('Y-m-d',strtotime(str_replace('_','-',$_REQUEST['date']).'-01'));
$start_deadline = $end_deadline;
$end_deadline = date('Y-m-d',strtotime('-1 day',strtotime('+1 month',strtotime($end_deadline))));
} else {
$_REQUEST['date'] = date('Y_m',strtotime($end_deadline));
}
$page = 1;
$per_page = 20;
if(!empty($_REQUEST['page'])) {
$page = $_REQUEST['page'];
}
$total_count_res = $db->get_results("SELECT COUNT(*) as c
FROM grdb.grd_grants AS gg
WHERE gg.deadline >= CURDATE()
AND gg.deadline >= '".clean($start_deadline)."'
AND gg.deadline <= '".clean($end_deadline)."'
AND gg.bad_url=0
{$not_ignored_where}");
$total_count = $total_count_res[0]->c;
$max_page = ceil($total_count/$per_page);
if($page<1) {
$page = 1;
}
if($page>$max_page) {
$page = $max_page;
}
$limit = '';
if($total_count >= $per_page) {
$limit = "LIMIT ".(($page-1)*$per_page).", ".$per_page;
}
$grant_list = $db->get_results("SELECT gg.*,
gusg.id AS favorite,
gt.name AS grant_type,
IF(gg.deadline='0000-00-00',1,0) as no_deadline,
ggl.bg_color_hex,
ggl.logo_url
FROM grdb.grd_grants AS gg
LEFT JOIN grdb.grd_usa_saved_grants AS gusg
ON gg.grants_id = gusg.grants_id
AND gusg.client_id = '$user'
AND gusg.site_code = '$siteCode'
LEFT JOIN grdb.grd_types AS gt
ON gt.types_id = gg.types_id
LEFT JOIN grdb.grd_site_logos ggl ON ggl.site_domain=gg.base_url AND ggl.status='active'
WHERE gg.deadline >= CURDATE()
AND gg.deadline >= '".clean($start_deadline)."'
AND gg.deadline <= '".clean($end_deadline)."'
AND gg.bad_url=0
{$not_ignored_where}
GROUP BY gg.grants_id
ORDER BY deadline ASC
{$limit}");
/*
$grants = $db->query("SELECT g.deadline,g.name,g.amount,g.description,g.grants_id,GROUP_CONCAT(bc.category_name ORDER BY bc.category_name ASC SEPARATOR ', ') as bread_crumbs
FROM grdb.grd_grants g
LEFT JOIN grdb.bread_crumbs_grants bcg ON bcg.grants_id=g.grants_id
LEFT JOIN grdb.bread_crumbs bc ON bc.id=bcg.bread_crumbs_id
WHERE g.deadline<>'0000-00-00'
AND g.deadline >= CURDATE()
AND g.deadline <= '".date('Y-m-d',strtotime('+'.$num_months_showing.' month'))."'
GROUP BY g.grants_id
ORDER BY deadline ASC");
*/
if(empty($_SESSION['subscriptions']['2'])) {
$page_title = 'Grant Deadline Calendar';
$page_title_html = '<img src="/vx/usa/calendar/calendar.png" style="float:left;margin-right:5px;" />
<div style="padding-top:23px;text-align:left;">
<h2>The Grant Deadline Calendar is for VIP Members!</h2>
<p>Let our <strong>Grant Deadline Calendar</strong> help you keep track of the upcoming application deadlines, so you don\' have to! New grant sources and new grant applications are being added all the time!</p>
</div>
<div style="clear:both;"></div>';
$redir_location = '/vx/usa/calendar/';
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/usa/subscribe/v14.php');
} ?>
<style>
h1,h2,h3 {
font-family:Helvetica;
}
.calendar_icon {
display:inline-block;
width:168px;
margin-right:5px;
vertical-align:top;
}
.calendar_icon_small {
display:none;
width:60px;
}
.calendar_text {
display:inline-block;
vertical-align:top;
padding-top:10px;
width: calc(100% - 180px);
}
.warning_bubble {
background: #f7f6f6;
border: 1px solid #c0c0c0;
border-radius: 5px;
padding: 5px;
min-height:60px;
}
.warning_message {
font-style:italic;
font-size:12px;
}
.warning_sign {
float:left;
width:47px;
margin-right: 10px;
}
.warning_sign img {
width:100%;
}
.deadline_table_container {
}
.results_text {
color:#7a7a7a;
font-style:italic;
float:right;
}
.deadline_table {
width:100%;
margin-top:5px;
}
.deadline_table th {
background:#c3c3c3;
padding:5px;
}
.deadline_table td {
border-bottom:1px solid black;
vertical-align:top;
background:white;
padding:5px;
}
.deadline_table td a {
color:blue;
}
.grant_logo_image {
max-width:160px;
max-height:100px;
}
.no_border {
border:none;
}
.deadline_month_filter {
display:inline-block;
padding:5px;
border:1px solid black;
background:white;
cursor:pointer;
}
.deadline_month_filter_select {
background:#8ac9ff;
color:white;
font-weight:bold;
}
@media screen and (max-width: 600px) {
.calendar_icon {
display:none;
}
.calendar_icon_small {
display:inline-block;
}
.calendar_text {
display:block;
padding-top:0px;
width: auto;
}
.deadline_month_filter {
display:block;
width:90%;
text-align:center;
margin:2px auto;
}
}
</style>
<script type="text/javascript">
function filter_deadline_month(me,month) {
window.location = "/vx/usa/calendar/?date=" + encodeURIComponent(month);
}
function make_internal_popup(data) {
$('body').append('<div id="id-popup-overlay"></div>');
$('body').append('<div id="id-popup-container"></div>');
$('#id-popup-overlay').attr('style','z-index:10012;position:fixed;top:0px;left:0px;bottom:0px;right:0px;background:rgba(0,0,0,.6);');
$('#id-popup-container').attr('style','z-index:10013;position:fixed;top:0px;left:0px;background:white;border-radius:16px;padding:15px;overflow:auto;');
$('#id-popup-container').html('<i class="fas fa-circle-xmark" style="color:#993333;font-size:24px;position:absolute;top:4px;right:5px;cursor:pointer;" id="id-popup-close-button" onclick="$(\'#id-popup-container\').remove(); $(\'#id-popup-overlay\').remove();" />');
$('#id-popup-container').append('<div style="padding:5px;">' + data + '</div>');
$('#id-popup-container').css('max-height',$(window).height()*0.9);
$('#id-popup-container').css('max-width',$(window).width()*0.9);
$('#id-popup-container').css('left',$(window).width()*0.9/2 - $('#id-popup-container').width()*0.9/2);
$('#id-popup-container').css('top',$(window).height()*0.9/2 - $('#id-popup-container').height()*0.9/2);
}
function resize_internal_popup() {
$('#id-popup-container').css('max-height',$(window).height()*0.9);
$('#id-popup-container').css('max-width',$(window).width()*0.9);
$('#id-popup-container').css('left',$(window).width()*0.9/2 - $('#id-popup-container').width()*0.9/2);
$('#id-popup-container').css('top',$(window).height()*0.9/2 - $('#id-popup-container').height()*0.9/2);
}
$('document').ready(function() {
$(window).resize(function() {
if($('#id-popup-container').length>0) {
resize_internal_popup();
}
});
});
function play_tutorial_video(file_location,grants_id) {
$('#overlayMessageTitle').html('Loading');
$('#overlayMessageSubtitle').html('Loading Video');
$('#showOverlayMessage').show();
var querystring = "file=" + encodeURIComponent(file_location) + "&grants_id=" + grants_id;
$.ajax({
url:"/vx/usa/functions/load_amazon_video_file.php",
cache: false,
type: "GET",
data: querystring,
success: function(results) {
var html = '<div id="video_tutorial_player_container" style="max-width:100%;">' +
<?php if(empty($_SESSION['subscriptions']['2'])) { ?>
'<video style="width:100%;" id="video_tutorial_player" autoplay controls ontimeupdate="load_upsell_page(this);" onended="track_tutorial_video_ended(\'' + grants_id + '\',\'ended\');" />' +
<?php } else { ?>
'<video style="width:100%;" id="video_tutorial_player" autoplay controls onended="track_tutorial_video_ended(\'' + grants_id + '\',\'ended\');" />' +
<?php } ?>
'</div>' +
'<div class="tutorial_video_feedback" style="text-align:center;margin-top:10px;font-size:20px;">' +
'<input type="hidden" name="grants_id" value="' + grants_id + '" />' +
'<input id="video_tutorial_thumbs_up_input" type="hidden" name="thumbs_up" value="" />' +
'<div style="margin:0px auto;width:335px;">' +
'<div style="text-align:left;">' +
'<div class="rib" style="vertical-align:middle;">Was this <strong>video</strong> helpful?</div>' +
'<i class="fal fa-thumbs-down" style="cursor:pointer;vertical-align:middle;font-size:36px;margin:13px 7px 0px 7px;" onclick="video_tutorial_thumb_clicked(this,\'down\'); return false;"></i>' +
'<i class="fal fa-thumbs-up" style="cursor:pointer;vertical-align:middle;font-size:36px;margin:0px 7px 7px 7px;" onclick="video_tutorial_thumb_clicked(this,\'up\'); return false;"></i>' +
'</div>' +
'<div id="how_can_we_make_it_better" style="display:none;text-align:left;">' +
'<div style="font-size:18px;"><i>How can we make it better?</i></div>' +
'<div>' +
'<div class="rib" style="vertical-align:top;"><textarea name="notes" id="video_tutorial_notes" onblur="save_tutorial_video_feedback(this);" style="font-size:12px;width:220px;height:50px;" placeholder="Type your response here"></textarea></div>' +
'<div class="rib" style="vertical-align:top;margin-left:10px;margin-top:3px;"><button onclick="$(\'.tutorial_video_feedback\').html(\'<p>Thank you for your feedback.</p>\'); return false;" style="padding:5px;">SEND</button></div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
make_internal_popup(html);
$('#video_tutorial_player').attr('src',results);
var vid = document.getElementById("video_tutorial_player");
vid.onloadedmetadata = function() {
$('#video_tutorial_player_container').css('width',this.videoWidth + 'px');
resize_internal_popup();
};
$('#showOverlayMessage').hide();
track_tutorial_video_ended(grants_id,'started');
}
});
}
function video_tutorial_thumb_clicked(me,direction) {
$(me).parent().find('.fas').removeClass('fas').addClass('fal');
$(me).removeClass('fal').addClass('fas');
$('#video_tutorial_thumbs_up_input').val(direction);
$('#how_can_we_make_it_better').show();
resize_internal_popup();
$('#video_tutorial_notes').focus();
}
function save_tutorial_video_feedback(me) {
var querystring = "";
$(me).parents('.tutorial_video_feedback:first').find('input,textarea').each(function() {
querystring += (querystring=='') ? '' : '&';
querystring += encodeURIComponent(this.name) + '=' + encodeURIComponent($(this).val());
});
$.ajax({
url:"/vx/usa/functions/save_tutorial_video_feedback.php",
cache: false,
type: "POST",
data: querystring,
success: function(results) {
}
});
}
function track_tutorial_video_ended(grants_id,which_field) {
var querystring = "grants_id=" + encodeURIComponent(grants_id) + "&which_field=" + encodeURIComponent(which_field);
$.ajax({
url:"/vx/usa/functions/save_tutorial_video_feedback_watched.php",
cache: false,
type: "POST",
data: querystring,
success: function(results) {
}
});
}
</script>
<div class="rb p20 top">
<div class="rb">
<div class="calendar_icon"><img src="calendar.png" /></div>
<div class="calendar_text">
<div class="rb">
<div class="rb <?=$phone ? 'pt20' : ''?> f24 bold left">
<div class="relative iblock" style="top:-1px; margin-left:7px;">
<img src="calendar.png" class="calendar_icon_small" />
<?=$phone ? 'Deadline Calendar' : 'Grant Deadline Calendar'?>
</div>
</div>
</div>
<div class="rb">
Don't miss another deadline!! Let our Grant Deadline Calendar help keep track of the upcoming deadlines so you won't be caught unprepared. New Grant Sources are being added all the time. Check back often to view new deadlines. Remember, NEW Sources are being added all the time!
</div>
<div class="warning_bubble">
<div class="warning_sign"><img src="warning.png" /></div>
<div class="warning_message">
<strong>Warning!! Not all Grant Sources have Deadlines.</strong> Many applications are "ongoing" or don't have deadlines so you can apply for them throughout the year. <strong>The calendars below only show grants WITH deadlines based on the main categories below. This DOES NOT CONTAIN all of the grant applications in our Database.</strong>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="deadline_table_container">
<div class="results_text">Results showing next <?= $num_months_showing;?> months</div>
<h3>Upcoming Deadlines</h3>
<div class="deadline_filters">
<?php for($i=0;$i<=$num_months_showing;$i++) {
$month_date = ($i==0) ? date('Y_m') : date('Y_m',strtotime('+'.$i.' month'));
?>
<div class="deadline_month_filter <?= ($_REQUEST['date']==$month_date) ? 'deadline_month_filter_select' : '';?>" onclick="filter_deadline_month(this,'<?= ($i==0) ? date('Y_m') : date('Y_m',strtotime('+'.$i.' month'));?>'); return false;">
<?= ($i==0) ? date('F Y') : date('F Y',strtotime('+'.$i.' month'));?>
</div>
<?php } ?>
<div><i>**This list only show grants with deadlines. Many grants don't have deadlines so you can apply for them throughout the year.</i></div>
</div>
</div>
<?php
if(empty($grant_list)) {
?>
<center><h3 style="color:#cc3333;">No grants matched your search criteria.</h3></center>
<?php
} else {
if(!empty($limit)) {
?>
<div class="paging">
<center>
<h3><?= paging_title($page,$total_count,$per_page);?> of <?= number_format($total_count);?></h3>
<button onclick="grant_list_change_page('1'); return false;" title="<?= paging_title(1,$total_count,$per_page);?>"><<</button>
<button onclick="grant_list_change_page('<?= $page-1;?>'); return false;" title="<?= paging_title($page-1,$total_count,$per_page);?>"><</button>
<?php for($i=$page-5;$i<$page+5;$i++) {
if($i>=1 && $i<=$max_page) { ?>
<button onclick="grant_list_change_page('<?= $i;?>'); return false;" <?= ($i==$page) ? 'class="selected_page"' : '';?> title="<?= paging_title($i,$total_count,$per_page);?>"><?= $i;?></button>
<?php } ?>
<?php } ?>
<button onclick="grant_list_change_page('<?= $page+1;?>'); return false;" title="<?= paging_title($page+1,$total_count,$per_page);?>">></button>
<button onclick="grant_list_change_page('<?= $max_page;?>'); return false;" title="<?= paging_title($max_page,$total_count,$per_page);?>">>></button>
</center>
</div>
<?php } ?>
<div id="grantList">
<?php if($phone) {
include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/inc/non_angular_grant_list_mobile.php');
} else {
include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/inc/non_angular_grant_list.php');
} ?>
</div>
<?php
if(!empty($limit)) {
?>
<div class="paging">
<center>
<h3><?= paging_title($page,$total_count,$per_page);?> of <?= number_format($total_count);?></h3>
<button onclick="grant_list_change_page('1'); return false;" title="<?= paging_title(1,$total_count,$per_page);?>"><<</button>
<button onclick="grant_list_change_page('<?= $page-1;?>'); return false;" title="<?= paging_title($page-1,$total_count,$per_page);?>"><</button>
<?php for($i=$page-5;$i<$page+5;$i++) {
if($i>=1 && $i<=$max_page) { ?>
<button onclick="grant_list_change_page('<?= $i;?>'); return false;" <?= ($i==$page) ? 'class="selected_page"' : '';?> title="<?= paging_title($i,$total_count,$per_page);?>"><?= $i;?></button>
<?php } ?>
<?php } ?>
<button onclick="grant_list_change_page('<?= $page+1;?>'); return false;" title="<?= paging_title($page+1,$total_count,$per_page);?>">></button>
<button onclick="grant_list_change_page('<?= $max_page;?>'); return false;" title="<?= paging_title($max_page,$total_count,$per_page);?>">>></button>
</center>
</div>
<?php }
} ?>
</div>
<?php
$body = ob_get_clean();
$title = "Favorite Grants : ".$_SESSION['site_name'];
include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/non_angular_layout.php');
?>