<?php $__env->startSection('page_title'); ?>
    OSAA - Activities
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_sub_title'); ?>    
    OSAA Cross Country Entries
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    @parent

    <style type="text/css">

      h3 {
          color: #990000 !important;
      }

    </style>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>
    
    $('.tabs').tabs();
    $('.nav_button').button({ icons : {primary : 'ui-icon-arrowthick-1-w'}});

<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_functions'); ?>

    <a class="nav_button" href="<?php echo url('/activities/bxc'); ?>" style="font-size:9pt;">Back</a>
    
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content'); ?>    	

    <?php

        // Get XC sanctioned activity records
        $sas = sanctionedactivity::where('school_year', '=', intval(Helpers::getCurrentYear()))
                                 ->whereIn('activity', array('BXC', 'GXC'))                                 
                                 ->remember(30)
                                 ->get();

        // Sort by division then gender
        $sas->sort(function($a, $b)
        {
            $a2 = intval(substr($a->division, 0, 1));
            $b2 = intval(substr($b->division, 0, 1));

            if ($a2 > $b2)
            {
                return -1;
            }
            elseif ($a2 < $b2)
            {
                return 1;
            }


            $a1 = $a->activity;
            $b1 = $b->activity;

            $cmp = strcasecmp($a1, $b1);

            if ($cmp < 0)
            {
                return -1;
            }
            elseif ($cmp > 0)
            {
                return 1;
            }            

            return 0;
        });
    ?>

    <?php /*  Entries Tabs  */ ?>
    <div class="tabs awards" style="min-height: 650px;">
        
        <?php /*  Tab List  */ ?>
        <ul style="padding-left:5px;">            
            <?php foreach ($sas as $index => $sa): ?>
                <li><a href="#tabs-<?php echo $index; ?>"><?php echo $sa->division; ?> <?php echo (Helpers::strEqual($sa->activity, 'BXC')) ? 'Boys' : 'Girls'; ?></a></li>
            <?php endforeach; ?>            
        </ul>

        <?php /*  Div/Gender Tab  */ ?>
        <?php foreach ($sas as $index => $sa): ?>

            <?php                
                $gender = (Helpers::strEqual($sa->activity, 'BXC')) ? 'Boys' : 'Girls';
                $directory = '/docs/' . strtolower($sa->activity) . '/';
                $server_path = public_path() . $directory;                
                $entries_file_name = strtolower(str_replace('/', '', $sa->division) . substr($gender, 0, 1) . 'ent.txt');                
            ?>

            <div id="tabs-<?php echo $index; ?>">

                <?php /*  Promotions  */ ?>
                <div class="float_right text_center" style="margin-left: 10px;">
                    <a href="http://4nsp.com/PhotosAction.aspx" target="_blank">
                        <img src="<?php echo asset('/images/ads/sponsors/NSP_111x50px.png'); ?>" alt="" title="" style="float: right;" />
                    </a>
                    <br />
                    <a href="http://4nsp.com/PhotosAction.aspx" target="_blank">Photos</a>
                </div>

                <div class="float_right text_center" style="margin-left: 10px;">
                    <a href="http://www.osaastore.com" target="_blank">
                        <img src="<?php echo asset('/images/ads/sponsors/SportsU_111x50px.png'); ?>" alt="" title="" style="float: right;" />
                    </a>
                    <br />
                    <a href="http://www.osaastore.com" target="_blank">Merchandise</a>                
                </div>

                <div class="float_right text_center">
                    <a href="http://www.osaa.org/programs" target="_blank">
                        <img src="<?php echo asset('/images/ads/sponsors/Digital_Programs_111x50.jpg'); ?>" alt="" title="" style="float: right;" />
                    </a>
                    <br />          
                    <a href="http://www.osaa.org/programs" target="_blank">Digital Program</a>              
                </div>


                <?php /*  Results Heading  */ ?>
                <h1 style="line-height: 1.25em;"><?php echo Helpers::getCurrentYear(); ?> OSAA / OnPoint Community Credit Union Cross Country State Championships</h1>
                
                <h3>Saturday, November 3, 2018<br />Lane Community College, Eugene, OR</h3>

                <?php /*  Instructions  */ ?>
                <div style="font-size: 10pt;">
                    <p>
                        Entries will be posted by 4pm on Sunday, October 28.
                    </p>
                    <p>
                        Please check for correct spelling of participant's name, year in school, school name, and district meet place as this information will appear the same way in the souvenir program and in the championship results, unless corrected.
                    </p>
                    <h4>Corrections</h4>
                    <p>                    
                        Sunday, October 28, 4pm-8pm: Call William Wyckoff at (541) 484-9883.<br />
                        Monday-Friday: Contact Brad Garrett at the OSAA office via email at <?php echo Helpers::obfuscateEmailLink ("bradg@osaa.org"); ?>.<br /><br />                    
                        NOTE: Corrections made after 2pm on Tuesday, October 30 will not appear in the program.
                    </p>
                    <h4>Substitutions</h4>
                    <p>
                        (1) Individuals: Substitutions for individual qualifiers not members of a qualifying team are not permitted.<br />
                        (2) Team: Substitutions on qualified teams may be made up to 30 minutes prior to the start of the state championship race at that classification. A team may enter a maximum of seven participants with its top five finishers counting toward team standings.
                    </p>
                </div>

                <h2><?php echo $sa->division; ?> <?php echo $gender; ?> Entries</h2>
            
                <?php /*  Entries Text Files  */ ?>
                <div style="font-size: 10pt;">

                    <?php /*  Display entries, if they exist  */ ?>
                    <?php if (file_exists($server_path . $entries_file_name)): ?>
                        <?php echo file_get_contents($server_path . $entries_file_name); ?>                        
                    <?php else: ?>
                        Entries will be posted by 4pm on Sunday, October 28.

                        <?php if (Auth::check() and Auth::user()->isOsaaUser()): ?>

                            <br /><br />

                            <b>OSAA Staff:</b><br />
                            The team results file should be named "<b><?php echo $entries_file_name; ?></b>" and uploaded via FileZilla to the folder <b><?php echo str_replace('/home/osaa/web_app/demo', '', $server_path); ?></b>.

                        <?php endif; ?>

                    <?php endif; ?>

                    
                </div>

            </div>
        <?php endforeach; ?>

    </div>	
	
<?php $__env->stopSection(); ?>
