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

title

Body

[close]

/includes/ -> activity_log.php (source)

   1  <?php
   2  if ($script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]) == "camping_log.php" ) {
   3   print "<meta http-equiv=\"refresh\" content=\"0; URL=../index.php\">";
   4   exit;
   5  }
   6  print "</center>";
   7  
   8  
   9  if ($activity_update == 'Y' && $user_group <= 2) {
  10   foreach ($activity as $activity_key => $activity_data) {
  11    $check_date = $activity_date[$activity_key];
  12    if ($activity_key == '000' && $activity_data != '') {
  13     mysql_query("insert into tbl_scout_activity
  14                   (scout_key
  15                   ,activity
  16                   ,date
  17                   ) values
  18                   (\"$rowid\"
  19                   ,\"$activity_data\"
  20                   ,\"$check_date\"
  21                   )
  22                 ");
  23    }
  24    if ($activity_key != '000') {
  25     if ($delete[$activity_key] == 'Y') {
  26      mysql_query("delete from tbl_scout_activity
  27                    where record_key = \"$activity_key\"
  28                  ");
  29     } else {
  30      mysql_query("update tbl_scout_activity
  31                    set
  32                    activity = \"" . $activity_data . "\"
  33                    ,date = \"" . $check_date . "\"
  34                    where record_key = \"$activity_key\"
  35                  ");  
  36     }
  37    } 
  38   }
  39  }
  40  
  41  $sql = mysql_query("select first_name, last_name from tbl_scout where record_key=$rowid");
  42  extract(mysql_fetch_assoc($sql));
  43  mysql_free_result($sql);
  44  
  45  $sql = mysql_query("select position from tbl_scout_leadership where scout_key=$rowid and enddate='0000-00-00'");
  46  extract(mysql_fetch_assoc($sql));
  47  mysql_free_result($sql);
  48  
  49  print "<center><h2>$position $first_name $last_name</h2></center>";
  50  print "<center><h3>Activity Log</h3></center>";
  51  
  52  if ($user_group < 2 && $print != 'Y') {
  53   print "\n<center><form method=POST action=./index.php>
  54   <input type=hidden name=rowid value=$rowid>
  55   <input type=hidden name=activity_log value=Y>
  56   <input type=hidden name=activity_update value=Y>
  57   <input type=submit value=Submit></center><p>";
  58  }
  59  
  60  print "<center><table class=white border=1><tr align=center><td><h3>Date</td><td><h3>Activity</td>";
  61  if ($user_group < 2 && $print != 'Y') {
  62   print "<td>Delete?</td>";
  63  }
  64  print "</tr>";
  65  
  66  $i = 3;
  67  
  68  $sql = mysql_query("select record_key as activity_key,activity,date as activity_date from tbl_scout_activity where scout_key = $rowid order by date");
  69  
  70  while ($row = mysql_fetch_assoc($sql)) {
  71   extract($row);
  72   if ($user_group >= 2 or $print == 'Y') {
  73    print "\n<tr><td>$activity_date</td><td>$activity</td></tr>";
  74   }
  75   if ($user_group < 2 && $print != 'Y') {
  76    $i = $i + 1;
  77    print "\n<tr><td><input type=text size=10 maxlength=10 name=activity_date[$activity_key] value=\"$activity_date\"
  78           onChange=\"var box=document.forms[0].elements[$i];var d=parseDate(box.value);
  79                           if(d==null){
  80                            alert('Date string not recognizable!');
  81                            box.value='';
  82                            box.focus();
  83                           } else {
  84                            box.value=formatDate(d,'yyyy-MM-dd');
  85                           }\"></td>
  86    <td><input type=text size=25 name=activity[$activity_key] value=\"$activity\"></td>
  87    <td><input type=checkbox name=delete[$activity_key] value=Y></td></tr>";
  88   }
  89   $i = $i + 2;
  90  }
  91  
  92  if ($user_group < 2 && $print != 'Y') {
  93   $i = $i + 1;
  94   print "\n<tr><td><input type=text size=10 maxlength=10 name=activity_date[000]
  95            onChange=\"var box=document.forms[0].elements[$i];var d=parseDate(box.value);
  96                           if(d==null){
  97                            alert('Date string not recognizable!');
  98                            box.value='';
  99                            box.focus();
 100                           } else {
 101                            box.value=formatDate(d,'yyyy-MM-dd');
 102                           }\"></td>
 103   <td><input type=text size=25 name=activity[000]</td></tr>";
 104  }
 105  mysql_free_result($sql);
 106  print "</table>";
 107  
 108  if ($user_group < 2 && $print != 'Y') {
 109   print "\n<input type=submit value=Submit></form></center>";
 110  }
 111  
 112  
 113  ?>


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