[ PHPXref.com ] [ Generated: Sun Jul 20 20:12:55 2008 ] [ Scout Tracker 0.13 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/includes/ -> bs_info.php (source)

   1  <?php
   2  
   3  if ($rowid == "" && $user_group > "2") {
   4   print "<meta http-equiv=\"refresh\" content=\"0; URL=./index.php\">";
   5   exit;    
   6  }
   7  
   8  if ($print != "Y" ) {
   9      $show_print = "Y";
  10      $print_ins = "bs_info=Y";
  11      $show_modify_scout = "Y";
  12      $show_merit_badge = "Y";
  13  }
  14  
  15  if ($rank_update == "Y") {
  16      include ('includes/bs_rank_update.php');
  17  }
  18  
  19  # Beginning of Scout Personal information.

  20  $sql_out = mysql_query("Select first_name,last_name,patrol from tbl_scout where record_key = $rowid;");
  21  $row = mysql_fetch_assoc($sql_out);
  22  extract($row);
  23  mysql_free_result($sql_out);
  24  
  25  $sql_out = mysql_query("select position from tbl_scout_leadership where scout_key=$rowid and enddate='0000-00-00';");
  26  $row = mysql_fetch_assoc($sql_out);
  27  $position = $row['position'];
  28  mysql_free_result($sql_out);
  29              
  30  print "<center><h2><b>$position $first_name $last_name</b></center></h2>";
  31  if ($patrol != "" ) {
  32      print "<center><b>Patrol: $patrol</b></center><br>";
  33  }
  34  
  35  
  36  $sql_out = mysql_query("Select max(rank_key) as current_rank from tbl_scout_rank where scout_key = $rowid AND req_num=\"0\" group by scout_key;");
  37  if ($sql_out) {
  38   $row = mysql_fetch_assoc($sql_out);
  39   if ($row) {
  40    extract($row);
  41   }
  42   mysql_free_result($sql_out);
  43  }
  44  
  45  $sql_out = mysql_query("Select date as current_rank_date from tbl_scout_rank where scout_key = $rowid AND req_num=\"0\" AND rank_key = $current_rank;");
  46  if ($sql_out) {
  47   $row = mysql_fetch_assoc($sql_out);
  48   extract($row);
  49   mysql_free_result($sql_out);
  50  }
  51  list ($current_rank_date_year, $current_rank_date_month, $current_rank_date_day) = split('-', $current_rank_date);
  52  
  53  $sql_out = mysql_query("Select rank_name as current_rank_name,image_number as rank_image_number from tbl_rank where record_key = $current_rank;");
  54  if ($sql_out) {
  55   $row = mysql_fetch_assoc($sql_out);
  56   extract($row);
  57   mysql_free_result($sql_out);
  58  }
  59  if ($current_rank >= 1 ) {
  60      print "<center><b>Current Rank : $current_rank_name";
  61      if ($user != 'serverscript') {
  62      print "<img src=$image_dir/$rank_image_number.GIF width=75 height=100>";
  63      }
  64      print " Received on : $current_rank_date_month\\$current_rank_date_day\\$current_rank_date_year</center></b>";
  65  } else {
  66      print "<center><b>Current Rank : New Scout</b>";
  67  }
  68  
  69  $sql_out = mysql_query("select sum(days) as camping_nights from tbl_scout_camping where scout_key=$rowid");
  70  $row = mysql_fetch_assoc($sql_out);
  71  extract($row);
  72  mysql_free_result($sql_out);
  73  
  74  
  75  $sql_out = mysql_query("select sum(hours) as service_hours from tbl_scout_service where scout_key=$rowid and date >= '$current_rank_date'");
  76  $row = mysql_fetch_assoc($sql_out);
  77  extract($row);
  78  mysql_free_result($sql_out);
  79  
  80  print "<table align=center class=white border=1>
  81    <tr>
  82     <td><b>Total Camping Nights</td>
  83     <td><b>Total Service Hours For Next Rank</td>
  84    </tr>
  85    <tr>
  86     <td align=center>$camping_nights</td>
  87     <td align=center>$service_hours</td>
  88   </table>";
  89   
  90  $rank_position = "left";
  91  if ($show_all_ranks != 'Y' ) {
  92   $i_count = $current_rank + 1; # use this if you want to eliminate passed ranks from showing

  93   if ($print !="Y") {
  94    print "<center><a href=./index.php?bs_info=Y&show_print=Y&print_ins=bs_info=Y&show_modify_scout=Y&rowid=$rowid&show_all_ranks=Y>Show All Ranks</a></center>\n<p>";
  95   }
  96  } else {
  97   $i_count = 1; # use this if you want all ranks to show.

  98  }
  99  
 100  if ($user_group <= 1 && $print != "Y"  && $current_rank < 7) {
 101      print "<form method=POST action=./index.php?bs_info=Y&show_print=Y&print_ins=bs_info=Y>
 102      <center><input type=hidden name=rank_update value=Y>
 103      <input type=hidden name=rowid value=$rowid><input type=submit value=Submit></center>\n";
 104  }
 105  
 106  #print "<table align=center border=1 width=100%><tr><td width=50% valign=top >\n";

 107  print "<table align=center border=1 ><tr><td width=50% valign=top >\n";
 108  
 109  
 110  while ($i_count < 8 ) {
 111      rank_table($i_count, $rowid);
 112      if ($rank_position == "left") {
 113          print "</td></tr>\n<td width=50% valign=top>";
 114      } else {
 115      print "</td>\n<td width=50% valign=top >";
 116      }
 117      $i_count = $i_count + 1;
 118  }
 119  
 120  
 121  print "</td></tr>\n</table>";
 122  if ($user_group <= 1 && $print != "Y" && $current_rank < 7) {
 123      print "<center><input type=submit value=Submit></form>";
 124  }
 125  
 126  print "\n<center><table class=white border=1><tr align=center><td><h2>Service</td><td><h2>Camping</td></tr>";
 127  print "\n<tr><td valign=top>";
 128  
 129  print "\n<table class=white align=center border=1><tr align=center><td><b>Service</td><td><b>Date</td><td><b>Hours</td></tr>";
 130  $total_hours = 0;
 131  
 132  $sql_out = mysql_query("select record_key as service_key,date as service_date,service as service_activity,hours as service_hours from tbl_scout_service where scout_key=$rowid order by date");
 133  
 134  while ($row = mysql_fetch_assoc($sql_out)) {
 135   extract($row);
 136   $total_hours = $total_hours + $service_hours;
 137   print "\n<tr><td>$service_activity</td><td>$service_date</td><td align=center><b>$service_hours</td></tr>";
 138  }
 139  mysql_free_result($sql_out);
 140  
 141  print "\n</table>";
 142  print "\n</td><td valign=top>";
 143  
 144  print "\n<table class=white border=1><tr align=center><td><h3>Date</td><td><h3>Nights</td><td><h3>Location</td></tr>";
 145  $sql_out = mysql_query("select record_key as location_key,location as location_title,date as location_date,days from tbl_scout_camping where scout_key = $rowid order by date");
 146  while ($row = mysql_fetch_assoc($sql_out)) {
 147   extract($row);
 148   print "\n<tr><td>$location_date</td><td>$days</td><td>$location_title</td></tr>";
 149  }
 150  print "\n</table>";
 151  print "\n</td></table><table class=white border=1><tr align=center><td><h2>Activity</td><td><h2>Leadership</td></tr><td valign=top>";
 152  
 153  print "\n<table class=white border=1><tr align=center><td><h3>Date</td><td><h3>Activity</td></tr>";
 154  $sql_out = mysql_query("select record_key as activity_key,activity,date as activity_date from tbl_scout_activity where scout_key = $rowid order by date");
 155  while ($row = mysql_fetch_assoc($sql_out)) {
 156   extract($row);
 157   print "\n<tr><td>$activity_date</td><td>$activity</td></tr>";
 158  }
 159  print "\n</table>";
 160  print "\n</td><td valign=top>";
 161  
 162  print "\n<table class=white align=center border=1><tr align=center><td><b>Position</td><td><b>Start Date</td><td><b>End Date</td><td><b>Months</td></tr>";
 163  $total_length = 0;
 164  $sql_out = mysql_query("select record_key as leadership_key,startdate,enddate,position from tbl_scout_leadership where scout_key=$rowid order by startdate");
 165  while ($row = mysql_fetch_assoc($sql_out)) {
 166   extract($row);
 167   list($start_year,$start_month,$start_day) = explode('-',$startdate);
 168   if ($enddate != "0000-00-00") {
 169    $current = "";
 170    list($end_year,$end_month,$end_day) = explode('-',$enddate);
 171   } else {
 172    $enddate = 'Present';
 173    list($end_year,$end_month,$end_day) = explode('-',date("Y-m-d",time()));
 174    $current = "To Date:";
 175   }
 176   $length = ($end_year * 12 + $end_month) - ($start_year * 12 + $start_month);
 177   $total_length = $total_length + $length;
 178   print "\n<tr><td>$position</td><td>$startdate</td><td>$enddate</td><td align=center><b>$length</td></tr>";
 179  }
 180  
 181  print "\n</table></td></tr></table><table class=white border=1><tr><td colspan=2 align=center><h2>Misc. Requirements</h2></td></tr>";
 182  print "\n<tr><td align=center><h3>Name</td><td><h3>Description</td></tr>";
 183  $sql_out = mysql_query("select record_key as misc_key,title as misc_title,description as misc_description from tbl_misc_requirements where scout_key = $rowid order by record_key");
 184  while ($row = mysql_fetch_assoc($sql_out)) {
 185   extract($row);
 186   print "<tr><td>$misc_title</td><td>$misc_description</td></tr>";
 187  }
 188  print "\n</td></tr></table>";
 189  
 190  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]