| 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/newusafunding.com/vx/usa/master/ |
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');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/States.php');
$user = $_SESSION['user'];
if(empty($_GET['gid'])) {
header("Location: /vx/usa/master/");
exit(0);
} else {
$cat_id = $_GET['gid'];
}
ob_start();
track_member_action('Page Visit','Master Application Question Vault');
$gets_new_stuff = '';
if(empty($_SESSION['subscriptions'][2])) {
$gets_new_stuff = " AND gg.ts < '".date('Y-m-d',strtotime('-30 day'))." 00:00:00'";
}
$apps = array();
if($cat_id=='all') {
$res = $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,
gcn.category_name
FROM grdb.master_grant_app_grants mga
LEFT JOIN grdb.grant_categories_new_grants gbg ON gbg.grants_id=mga.grants_id
LEFT JOIN grdb.grant_categories_new gcn ON gbg.grant_categories_id=gcn.id
LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
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='0000-00-00'
AND gg.bad_url=0
{$gets_new_stuff}
GROUP BY gg.grants_id
UNION 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,
gcn.category_name
FROM grdb.master_grant_app_grants mga
LEFT JOIN grdb.grant_categories_new_grants gbg ON gbg.grants_id=mga.grants_id
LEFT JOIN grdb.grant_categories_new gcn ON gbg.grant_categories_id=gcn.id
LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
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.bad_url=0
{$gets_new_stuff}
GROUP BY gg.grants_id
ORDER BY no_deadline ASC, deadline ASC");
} else {
$res = $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,
gcn.category_name
FROM grdb.master_grant_app_grants mga
LEFT JOIN grdb.grant_categories_new_grants gbg ON gbg.grants_id=mga.grants_id
LEFT JOIN grdb.grant_categories_new gcn ON gbg.grant_categories_id=gcn.id
LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
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
mga.master_question_id='".$db->clean($cat_id)."'
AND gg.deadline='0000-00-00'
AND gg.bad_url=0
{$gets_new_stuff}
GROUP BY gg.grants_id
UNION 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,
gcn.category_name
FROM grdb.master_grant_app_grants mga
LEFT JOIN grdb.grant_categories_new_grants gbg ON gbg.grants_id=mga.grants_id
LEFT JOIN grdb.grant_categories_new gcn ON gbg.grant_categories_id=gcn.id
LEFT JOIN grdb.grd_grants AS gg ON gbg.grants_id=gg.grants_id
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
mga.master_question_id='".$db->clean($cat_id)."'
AND gg.deadline >= CURDATE()
AND gg.bad_url=0
{$gets_new_stuff}
GROUP BY gg.grants_id
ORDER BY no_deadline ASC, deadline ASC");
}
if(!empty($res)) {
foreach($res as $r) {
$apps[] = $r;
}
}
ksort($apps);
?>
<script type="text/javascript">
function copy_description(me) {
navigator.clipboard.writeText($(me).parents('.master_questions:first').find('.question_answer').html());
$(me).parents('.character_count_parent:first').find('.copied').show();
}
function show_hide_app_questions(me) {
$(me).parents('.question_parent').find('.master_questions').toggle();
if($(me).parents('.question_parent').find('.master_questions').is(':visible')) {
$(me).find('.action_text').html('Hide Application Questions');
} else {
$(me).find('.action_text').html('View Application Questions');
}
}
</script>
<style type="text/css">
.question_parent .big_number {
font-size:30px;
display:inline-block;
vertical-align:middle;
width:40px;
}
.question_parent .question {
font-size:15px;
display:inline-block;
vertical-align:middle;
width:calc(100% - 150px);
}
.character_limits {
color:#7a7a7a;
font-style:italic;
font-size:8px;
float:left;
}
.last_saved {
color:#7a7a7a;
font-style:italic;
font-size:8px;
float:right;
}
.question_parent {
font-family:Helvetica;
width:700px;
margin:10px 0px 20px 0px;
}
.master_questions {
background:#f6f6f6;
border:1px solid black;
padding:10px;
margin-top:10px;
margin-left:52px;
position:relative;
}
.action_icon {
font-size:28px;
}
.action_text {
font-size:13px;
}
.go_to_app_link {
position:absolute;
top:5px;
right:5px;
}
@media only screen and (max-width: 500px) {
.question_parent {
width:100%;
}
.master_questions {
margin-left:0px;
}
.action_icon {
font-size:20px;
}
.action_text {
font-size:11px;
}
}
</style>
<div>
<h2><span class="fas fa-lock" style="color:black;"></span> Master Application Question Vault</h2>
<hr />
<?php if(!empty($apps)) { ?>
<div style="margin:10px 0px;">
<?php $i=0; foreach($apps as $grant) { $i++; ?>
<div class="question_parent">
<div>
<div class="big_number"><?= $i;?></div>
<div class="question" style="width:calc(100% - 50px);">
<div style="display:inline-block;width:30%;vertical-align:middle;">
<?php if(!empty($grant->logo_url)) { ?>
<img src="<?= $grant->logo_url;?>" loading="lazy" style="width:100%;<?= (!empty($grant->bg_color_hex)) ? 'background:'.$grant->bg_color_hex : '';?>" onerror="$(this).remove();" />
<?php } else { ?>
<img src="https://surfcrm.com/images/grdb/<?= $grant->base_url;?>.jpg" loading="lazy" style="width:100%;" onerror="$(this).remove();" />
<?php } ?>
</div>
<div style="display:inline-block;width:66%;font-size:14px;padding:0px;font-weight:bold;vertical-align:middle;">
<?php
$grant_name = strip_imported_junk($grant->name);
echo $grant_name;
?>
</div>
</div>
</div>
<div style="margin-bottom:20px;">
<div class="grant_description_area">
<div><?= $grant->brief_summary;?></div>
</div>
<div style="text-align:right;">
<div style="padding:0px;cursor:pointer;" onclick="show_hide_app_questions(this); return false;">
<div class="rib center-center">
<span class="fas fa-eye action_icon" style="color:#91e4fb;vertical-align:middle;"></span>
<div class="rib action_text" style="vertical-align:middle;">
View Application Questions
</div>
</div>
</div>
</div>
<div class="master_questions" style="display:none;">
<div class="go_to_app_link">
<div>
<a href="<?= $grant->url;?>" target="_blank" style="padding:0px;">
<img src="/vx/usa/master/gotosite.png" style="vertical-align:middle;width:28px;" />
<div class="rib " style="vertical-align:middle;font-size:13px;color:#005399;">
Go To App
</div>
</a>
</div>
<div>
<div style="margin-top:10px;padding:0px;cursor:pointer;" onclick="mark_as_favorite(this,'<?= $grant->grants_id;?>'); return false;">
<div class="rib center-center">
<span style="margin-top:-5px;" class="f28 glyphicons gray action_icon <?= (!empty($grant->favorite)) ? 'favoriteSelected glyphicons-heart' : 'favorite glyphicons-heart-empty';?>"></span>
<div class="rib action_text" style="vertical-align:middle;font-size:13px;">
Favorite
</div>
</div>
</div>
</div>
</div>
<div style="width:215px;">
<div><strong style="font-size:20px;">Application Questions</strong></div>
<div style="color:#7a7a7a;font-size:12px;font-style:italic;">Here are the application questions you'll be asked on the actual application.</div>
</div>
<?php $app_questions = $db->get_results("SELECT * FROM grdb.master_grant_app_grants WHERE grants_id='".$db->clean($grant->grants_id)."' ORDER BY sort_order ASC");
$j=0; foreach($app_questions as $q) { $j++;
$answer = '';
$last_saved = '';
if(!empty($q->master_question_id)) {
$answer_res = $db->get_results("SELECT answer,ts FROM grdb.master_grant_app_answers
WHERE site_code='".$db->clean($siteCode)."'
AND client_id='".$db->clean($user)."'
AND master_question_id='".$db->clean($q->master_question_id)."'");
if(!empty($answer_res)) {
$answer = $answer_res[0]->answer;
$last_saved = '<div style="display:inline-block;vertical-align:middle;padding-right:20px;">Saved '.date('M d, Y g:i a',strtotime($answer_res[0]->ts)).'</div> <span onclick="copy_description(this); return false" style="cursor:pointer;"><i class="fad fa-copy" style="vertical-align:middle;font-size:18px;"></i> Copy Text</span> <span class="copied" style="display:none;">Copied</span>';
} else {
$answer = '<div style="font-style:italic;font-size:10px;"><a href="/vx/usa/master/" target="_blank" style="color:blue;">Click here to fill out this question on the <strong>Master Grant Applications Template.</strong></a></div>';
}
}
?>
<div>
<div>
<div style="padding:5px;"><strong><?= $j.'. '.$q->question;?></strong></div>
</div>
</div>
<div style="margin-bottom:10px;">
<div>
<?php if(empty($answer)) { ?>
<div style="padding-left:20px;color:#C07070;font-style:italic;font-size:10px;" class="question_answer">This question is unique to this application and will need to be filled out on the actual application when you click on the "Go to App" link.</div>
<?php } else { ?>
<div style="padding-left:20px;color:#7a7a7a;" class="question_answer"><?= nl2br($answer);?></div>
<?php } ?>
<div class="character_count_parent">
<div class="last_saved"><?= $last_saved;?></div>
<div style="clear:both;"></div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
$body = ob_get_clean();
$title = "Video Tutorials: ".$_SESSION['site_name'];
include($_SERVER['DOCUMENT_ROOT'].'/vx/usa/layout/non_angular_layout.php');
?>