[ PHPXref.com ] [ Generated: Sun Jul 20 19:19:23 2008 ] [ PBS Helpdesk 0.93 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> checklist.php3 (source)

   1  <?php ;
   2  include  "init.php3";
   3  
   4  
   5  
   6  Function c_init($db_name,$mydate) {
   7  include  "environment.php3";
   8  include "$language.php3";
   9  
  10  
  11  if($mydate==0) $rdate=date(Ymd);
  12   else $rdate=$mydate;
  13   
  14  $res0 = mysql_query_wrap("select * from $db_name.routine where rdate=$rdate");
  15  if(mysql_num_rows ($res0)>0) {
  16    $row0 = mysql_fetch_row($res0);
  17    
  18    $id=$row0[1];
  19    $res99 = mysql_query_wrap("select name from $db_name.users where users_id=$id");
  20    if(mysql_num_rows ($res99)>0) {
  21     $row99 = mysql_fetch_row($res99);
  22    }
  23  }
  24  
  25  if($users_id=="") $users_id=get_login_id();
  26  
  27  $command="select ugroup from $db_name.users where users_id=$users_id";  
  28  $res1=mysql_query_wrap($command);  
  29  $row = mysql_fetch_row($res1); 
  30  $ugroup=$row[0];
  31  
  32  echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
  33  <html><BODY onLoad=\"parent.frames['PBStop'].location.href='top.php3?function=init'\"
  34  background=\"$pbs_background1\">
  35  <head>
  36  <meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\">
  37  <title>Hauptseite-Frame - Projects</title>
  38  <!base target=\"PBS\">
  39  </head>
  40  <body>
  41  
  42  <CENTER>
  43  <TABLE border=1   ALIGN=CENTER >
  44          <tr>
  45      <FORM ACTION=checklist.php3?function=change METHOD=POST>
  46      <td><small>last update: $row99[0]</small><td>
  47         <td>$pbsl_date:<input type=\"text\" name=\"mydate\" size=10 value=$rdate></td>
  48          </tr>
  49      </FORM>
  50      </table>
  51      <TABLE border=1 width=700  ALIGN=CENTER> 
  52          <tr>
  53         <th>$pbsl_when</td>
  54         <th>$pbsl_what</td>
  55         <th>$pbsl_done</td>
  56         <th>$pbsl_remark</td>
  57         <th>$pbsl_like</td>
  58         <th>$pbsl_responsible</td>
  59         <th>$pbsl_extra</td>
  60      </tr><p>";    
  61  
  62  
  63  echo "<FORM ACTION=checklist.php3?function=store METHOD=POST>";
  64  
  65  $res1 = mysql_query_wrap("select * from $db_name.routine_jobs where active<>0 order by rgroup");
  66  
  67  $i=0;
  68  $i1=0;
  69  while ($i < mysql_num_rows ($res1)) {
  70    $row = mysql_fetch_row($res1);
  71    $rem="rem".$i;
  72    $active="active".$i;
  73     echo "<tr>";
  74     echo
  75   "<td><small>$row[1]</small></td><td>$row[2]</td>";
  76  /* $row0[i] */
  77  $i1=$i1+2;
  78  $i2=$i1+1;
  79  if($row0[$i1]==1) echo " <td><input type=checkbox name=\"$active\"   checked value=1></td>";
  80   else echo " <td><input type=checkbox name=\"$active\"  value=1></td>";
  81  
  82  echo "<td><textarea  name=\"$rem\"  rows=4 cols=20 wrap=physical>$row0[$i2]</textarea></td>
  83   <td><small>$row[3]</small></td><td><small>$row[4]</small></td><td><small>$row[5]</small></td></tr>";
  84   $i++;
  85  }    
  86  
  87  /* You can only change the current day ****************************/
  88  if($rdate==date(Ymd) && $ugroup>=10){
  89  echo "<tr><td></td><td><input type=\"submit\" name=\"action\" value=\"$pbsl_store\"></td><input
  90  type=\"hidden\" name=\"ccount\" value=$i></tr>";
  91  }    
  92  echo "</TABLE></form>";
  93  
  94  echo "</body></html>";
  95  }
  96  
  97  Function show_standby($db_name) {
  98  include  "environment.php3";
  99  include "$language.php3";
 100  
 101  mytop();
 102  echo "<TABLE border=1  WIDTH=600 >";
 103  
 104  
 105  echo "<tr><th>$pbsfrom</td><th>$pbsplandate2</td><th></td><th></td></tr><p>";    
 106  
 107  
 108  $res1 = mysql_query_wrap("select *, curdate() from standby where  suntil>= curdate() order by sfrom");
 109  
 110  $i=0;
 111  while ($i < mysql_num_rows ($res1)) {
 112    $row = mysql_fetch_row($res1);
 113  
 114    echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td></tr>";
 115  
 116   $i++;
 117  }    
 118  echo "</TABLE></form>";
 119  echo "</body></html>";
 120  
 121  }
 122  
 123  
 124  if($function=="init") c_init($db_name,0);
 125  if($function=="change") c_init($db_name,$mydate);
 126  if($function=="showstandby") show_standby($db_name);
 127  
 128  if($function=="store"){
 129  
 130  $rdate=date(Ymd);
 131  $users_id=get_login_id();
 132  
 133  $res0 = mysql_query_wrap("select * from $db_name.routine where rdate=$rdate");
 134  if(mysql_num_rows ($res0)>0) {
 135  /**** UPDATE **********************************************/
 136  
 137  /* echo "store update $ccount<br>"; */
 138   $command1="update routine set ";
 139   $command2=" where rdate=$rdate";
 140   for($i=0;$i<$ccount;$i++){
 141    $rem=${"rem".$i};
 142    $active=${"active".$i};
 143   if($active<>1) $active=0; 
 144    $command1=$command1."r".$i."=".intval($active).", "."r".$i."rem"."=".sql_str($rem);
 145    if($i<$ccount-1)$command1=$command1.",";
 146    
 147  /* echo "$active - $rem<br>"; */
 148   } 
 149   $command=$command1." ".$command2;
 150  /*  echo "$command<br>"; */
 151  $res1 = mysql_query_wrap($command); 
 152  /**** UPDATE END **********************************************/
 153  
 154  
 155  }
 156  else{
 157  /**** INSERT **********************************************/
 158  /* echo "store $ccount<br>"; */
 159   $command1="insert into routine (rdate, users_id,";
 160   $command2=" values($rdate,$users_id,";
 161   for($i=0;$i<$ccount;$i++){
 162    $rem=${"rem".$i};
 163    $active=${"active".$i};
 164   if($active<>1) $active=0; 
 165    $command1=$command1."r".$i.","."r".$i."rem";
 166    if($i<$ccount-1)$command1=$command1.",";
 167    $command2=$command2.intval($active).",".sql_str($rem);
 168    if($i<$ccount-1)$command2=$command2.",";
 169    
 170  /*  echo "$active - $rem<br>"; */
 171   } 
 172   $command=$command1.") ".$command2.")";
 173  /*  echo "$command<br>"; */
 174  $res1 = mysql_query_wrap($command); 
 175  /**** INSERT END **********************************************/
 176  }
 177  if(mysql_errno()) echo $pbsl_errormsg;
 178   else if($action<>"Neue Aktion") echo "<p>$pbsl_success !"; 
 179  
 180  }
 181  
 182  
 183  ?>


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