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

<?php $__env->startSection('header'); ?>
	View/Edit Activity Programs
<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>    	
	
	$('table tbody tr:even').css('background-color', '#f2f2f2');	

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

<?php $__env->startSection('content'); ?>
<div class="admin_page" style="height:100%; font-size:11pt; padding: 1em 1.4em; background-color:#ffffff;">


<?php		
	$information = array ();
	
	$letter = Input::get('view', 'A');

	// Get a list of school IDs that are full members for this year
	$school_ids = schooldemographic::where('is_retired', '=', 0)->where('school_year', '=', '2013')->where('is_associate_member', '=', '0')->lists('school');

	// Get the school information
	$schools = school::whereIn('id', $school_ids)->where('name', 'like', $letter . '%')->orderBy('short_name')->get();
	
	// Get all activity programs for this year
	foreach ($schools as $school)		
	{		
		$temp = array();
		$temp['school'] = $school;
		
		$temp['activity_programs'] = $temp['school']->getHostedActivityPrograms('2013');		

		$information[] = $temp;		
	}

	$all_leagues = league::where('is_retired', '=', 0)->get();
	$leagues = array();
	$leagues[0] = 'None / Independent';
	foreach ($all_leagues as $league)
	{
		$leagues[$league->slug] = $league->slug . ' ' . $league->name;
	}
?>

<h1>2013-14 Activity Programs</h1>
<p>
	View: <a href="<?php echo url(Request::path() . '?view=A'); ?>">A</a> |
		  <a href="<?php echo url(Request::path() . '?view=B'); ?>">B</a> |
		  <a href="<?php echo url(Request::path() . '?view=C'); ?>">C</a> |
		  <a href="<?php echo url(Request::path() . '?view=D'); ?>">D</a> |
		  <a href="<?php echo url(Request::path() . '?view=E'); ?>">E</a> |
		  <a href="<?php echo url(Request::path() . '?view=F'); ?>">F</a> |
		  <a href="<?php echo url(Request::path() . '?view=G'); ?>">G</a> |
		  <a href="<?php echo url(Request::path() . '?view=H'); ?>">H</a> |
		  <a href="<?php echo url(Request::path() . '?view=I'); ?>">I</a> |
		  <a href="<?php echo url(Request::path() . '?view=J'); ?>">J</a> |
		  <a href="<?php echo url(Request::path() . '?view=K'); ?>">K</a> |
		  <a href="<?php echo url(Request::path() . '?view=L'); ?>">L</a> |
		  <a href="<?php echo url(Request::path() . '?view=M'); ?>">M</a> |
		  <a href="<?php echo url(Request::path() . '?view=N'); ?>">N</a> |
		  <a href="<?php echo url(Request::path() . '?view=O'); ?>">O</a> |
		  <a href="<?php echo url(Request::path() . '?view=P'); ?>">P</a> |
		  <a href="<?php echo url(Request::path() . '?view=Q'); ?>">Q</a> |
		  <a href="<?php echo url(Request::path() . '?view=R'); ?>">R</a> |
		  <a href="<?php echo url(Request::path() . '?view=S'); ?>">S</a> |
		  <a href="<?php echo url(Request::path() . '?view=T'); ?>">T</a> |
		  <a href="<?php echo url(Request::path() . '?view=U'); ?>">U</a> |
		  <a href="<?php echo url(Request::path() . '?view=V'); ?>">V</a> |
		  <a href="<?php echo url(Request::path() . '?view=W'); ?>">W</a> |
		  <a href="<?php echo url(Request::path() . '?view=X'); ?>">X</a> |
		  <a href="<?php echo url(Request::path() . '?view=Y'); ?>">Y</a> |
		  <a href="<?php echo url(Request::path() . '?view=Z'); ?>">Z</a>
</p>

<?php foreach ($information as $info): ?>
	<h2><?php echo $info['school']->short_name; ?></h2>

	<table id="school_<?php echo $info['school']->id; ?>" style="width:100%;">
		<thead class="ui-tabs-nav ui-widget-header ui-corner-all" >
			<tr>
				<th style="width:235px;">Activity</th>
				<th style="width:50px;">ID</th>			
				<th style="width:140px;">Division</th>
				<th style="">League</th>
				<th style="width:50px;">Coop</th>				
				<th style="width:18px;"></th>
			</tr>
		</thead>

		<tbody>	
		
			<?php foreach ($info['activity_programs'] as $ap): ?>
				<tr style="height:2em;" data-activity-program="<?php echo $ap->id; ?>">
					<?php echo Form::open(array('url' => url('/admin/update'), 'class' => 'adminUpdate', 'id' => 'update_' . $ap->id)); ?>
						
						<?php echo Form::hidden('table', 'activity_programs'); ?>
						<?php echo Form::hidden('activity_program_id', $ap->id); ?>
						<?php echo Form::hidden('return_url', Request::path()); ?>
						
						<td><b><?php echo Helpers::getActivityName($ap->activity); ?></b></td>
						<td><?php echo $ap->id; ?></td>		          		            
						<td><?php echo $ap->division; ?></td>
						<td><?php echo Form::select('league', $leagues, $ap->league); ?></td>				
						<td><?php echo $ap->cooperation; ?></td>						
						<td><div class="button save submit_form" data-form-id="update_<?php echo $ap->id; ?>" style="font-size:8pt;">Save</div></td>
					<?php echo Form::close(); ?>						
				</tr>
			<?php endforeach; ?>

		</tbody>

	</table>

	<div class="horizontal_divider" style="width:100%; margin:1.5em 0;"></div>
	
<?php endforeach; ?>

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






<?php /* 









































 */ ?>