<?PHP

#
#   FILE:  SPT--Home.html
#
#   REQUIRED FUNCTIONS:
#       PrintAnnouncementRow($Headline, $DatePosted, $PosterName, $Text, 
#                   $EditOkay, $EditLink)
#           - called to print line in News & Announcements table
#       PrintNoAnnouncementsMessage()
#           - called to print message that there were no announcements
#       PrintNewResourceRow($Title, $Description, $FullRecordLink, $Url, 
#                   $DateOfRecordCreation, $DateRecordAdded, $Contributor, 
#                   $EditOkay, $EditUrl, $DateLastVerified, $DateLastModified,
#                   $CumulativeRating)
#           - called to print line in New Resources table
#       PrintNoResourcesMessage()
#           - called to print message that there were no resources to display
#
#   OPTIONAL FUNCTIONS:
#       SupplyResourceDisplayQuery($MaxDaysToGoBack, $MaxItems)
#       SupplyAnnouncementDisplayQuery($MaxDaysToGoBack, $MaxItems)
#           - can be used to specify SQL query for selecting what items
#                   to display on front page
#


function PrintAnnouncementRow(
        $Headline, $DatePosted, $PosterName, $Text, $EditOkay, $EditLink)
{
?>

    <div style="width: 174px; float: left; padding: 10px">
        <div class="header">
		<?php  if ($EditOkay) {  ?>
            <div class="editbutton">
                <a href="<?PHP print $EditLink; ?>">Edit</a>
            </div>            
		<?php  } ?>
            <?PHP  print($Headline);  ?>
        </div>
        <p class="text">
            <?PHP  print($Text);  ?>
        </p>
    </div>

<?PHP
}

function PrintNewResourceRow($Resource, $FullRecordLink, $EditOkay, $EditLink,
                             $CumulativeRating)
{
    PrintResource($Resource, $FullRecordLink, $EditOkay, $EditLink, 
                  $CumulativeRating);
}

function PrintNoResourcesMessage()
{
?>
<div style="margin-top: 20px; margin-bottom: 30px;"><b>No new resources</b>.</div>
<?PHP
}

function PrintNoAnnouncementsMessage()
{
?>
<div style="margin-top: 20px; margin-bottom: 30px;"><br>&nbsp;&nbsp;&nbsp;&nbsp;<b>No new announcements.</b>.</div>
<?PHP
}


?>

<?PHP  if(AnnouncementsEnabled()) {  ?>
    <?PHP if ( $User->HasPriv(PRIV_NEWSADMIN) && NumAnnouncementRows() < $SysConfig->NumAnnounceOnHomePage() )
        {
    ?>
        <div class="editbutton" style="float: none;">
            <a href="index.php?P=EditAnnouncement">Add New Announcement</a>
        </div>
    <?PHP
        }
    ?>
<div id="contentbox" style="width: 580px; margin-bottom: 20px; overflow: hidden;">  

	  <div style="width: 174px; float: left; padding-top: 10px;"><img src="<?PHP  $AF->PUIFile("feature.jpg");  ?>"></div>
	  <?php  PrintAnnouncementsTableRows();  ?>

    <div style="clear:both; line-height: 1px">&nbsp;</div>
</div>
<?PHP  }  ?>

<div id="contentbox">  

	  <div id="ResourceBox">
<?PHP  if ($User->HasPriv(PRIV_RESOURCEADMIN)) {  ?>
	  <div class="editbutton"><a href="index.php?P=EditResource&amp;ID=NEW">Add Resource</a></div>
<?PHP  }  ?>
	  <div id="ResourceHeaderBox">New Resources</div>
	  
	  <div style="padding: 10px;">
	 
	  <?PHP  PrintNewResourceTableRows();  ?>
	  
<div class="AdvSearchBox">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%">
<?PHP
if(NextResourcesAvailable())
{
?>
<a href="<?PHP PrintNextResourceLink(); ?>" class="link">&lt;&lt;&lt; Previous <?PHP PrintNumberOfResources(); ?> Resources</a>
<?PHP } ?>
</td>
<td width="40%" align="center"><a href="index.php?P=LeaveFeedback&amp;FT=ResourceSuggestion">Suggest a New Resource</a></td>
<td width="30%" align="right">
<?PHP
if(PreviousResourcesAvailable())
{
?>
<a href="<?PHP PrintPrevResourceLink(); ?>" class="link">Next <?PHP PrintNumberOfResources(); ?>  Resources &gt;&gt;&gt;</a>
<?PHP
}
?>
</td>
</tr>
</table>
</div>
</div>

</div>

</div>
