<form action="index.php?option=<?php echo $option?>" method="post" name="adminForm" enctype="multipart/form-data">
<table>
<tr>
<td width="100">
<?php echo JText::_( 'Team' ); ?>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Team(s)' ); ?>::<?php echo JText::_( 'Select Player team(s)' );?>"><img src="components/com_bearleague/img/quest.jpg" border="0" /></span>
</td>
<td>
<table style="border:thin #cdcdcd solid;margin:1em 0 1em 0;">
<?php
//test for and current team associations (if the players is in the roster table)
if (!count($lists['currentTeams'])) {
//if the player is not on a team already then just display check boxes for all potential teams
for($i=0;$i<count($lists['teams']);$i++) {
if ($i<=2) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".$i."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
if ($i>2 and $i<=5) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+1)."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
if ($i>5 and $i<=8) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+2)."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
if ($i>8 and $i<=11) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+3)."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
}
}
else {
//show all of the team checkboxes and if the player is on that team, set value to checked
for($i=0;$i<count($lists['teams']);$i++) {
if ($i<=2) {
//check to see if the player is a current member of this team, if so, place a check in the checkbox
for($j=0;$j<count($lists['currentTeams']);$j++) {
if ($lists['currentTeams'][$j]->team_id == $lists['teams'][$i]->id) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".$i."]' value='".$lists['teams'][$i]->id."' checked/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
else {
echo "<tr><td><input type='checkbox' name='assignedTeams[".$i."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
}
}
if ($i>2 and $i<=5) {
//check to see if the player is a current member of this team, if so, place a check in the checkbox
for($j=0;$j<count($lists['currentTeams']);$j++) {
if ($lists['currentTeams'][$j]->team_id == $lists['teams'][$i]->id) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+1)."]' value='".$lists['teams'][$i]->id."' checked/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
else {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+1)."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
}
}
if ($i>5 and $i<=8) {
//check to see if the player is a current member of this team, if so, place a check in the checkbox
for($j=0;$j<count($lists['currentTeams']);$j++) {
if ($lists['currentTeams'][$j]->team_id == $lists['teams'][$i]->id) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+2)."]' value='".$lists['teams'][$i]->id."' checked/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
else {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+2)."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
}
}
if ($i>8 and $i<=11) {
//check to see if the player is a current member of this team, if so, place a check in the checkbox
for($j=0;$j<count($lists['currentTeams']);$j++) {
if ($lists['currentTeams'][$j]->team_id == $lists['teams'][$i]->id) {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+3)."]' value='".$lists['teams'][$i]->id."' checked/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
else {
echo "<tr><td><input type='checkbox' name='assignedTeams[".($i+3)."]' value='".$lists['teams'][$i]->id."'/></td><td>".$lists['teams'][$i]->t_name."</td></tr>";
}
}
}
}
}
?>
</table>
<input type="hidden" name="option" value="<?php echo $option?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $row->id?>" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
|