Location: PHPKode > projects > Meeting Request Scheduling and Booking System > mrsbs/php/reply/reply.php
<?PHP

   // Reply to invitation
   //
   // Version: $Revision: 1.7 $
   // Date: $Date: 2008/06/20 01:22:08 $
   //
   // Copyright (c) 2006 - 2008 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.

$auth_required = 0;
include "../lib/mrsbs.inc";
$pgtitle = $tx['rp.invite'];
$pgtype = "reply";

// We don't call authorize since the inviteid is effectively an
// implied authorization, and anyway we need it to get the mtgid.

// We also don't treat the user as "logged in" since it would then
// be easier to spoof someone for schedule/* (ie: all you'd need is
// an email copy of an invite).

$inv = get_invite_info($rvar_inviteid, "begin");
if(!$inv)
  mexit($tx['op.err.noinv'], 1);

if(isset($rvar_return))
  $returi = $rvar_return;
else
  $returi = "acknowledge.php?inviteid=" . $rvar_inviteid;
?>
<HTML>
<HEAD>
<TITLE><?PHP print $pgtitle;?></TITLE>
</HEAD>

<BODY>
<TABLE CLASS="main">
 <?PHP include "../lib/titlebar.php";?>
 <TR>
  <TD CLASS="main">
   <TABLE CLASS="form">
    <FORM NAME="reply" ACTION="reply-op-handler.php" METHOD="post">
    <INPUT TYPE="hidden" NAME="op" VALUE="reply">
    <INPUT TYPE="hidden" NAME="inviteid" VALUE="<?PHP print hstr($rvar_inviteid);?>">
    <INPUT TYPE="hidden" NAME="return" VALUE="<?PHP print hstr($returi);?>">
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.status'];?><BR>
     </TD>
     <TD CLASS="formfield">
      <?PHP
        if(ctype_upper($inv['mtg']['status']))
	  print $tx['sd.status.'.$inv['mtg']['status']];
	else
	  print '<FONT CLASS="error">' . $tx['op.canceled.mtg'] . '</FONT>';

        if($inv['mtg']['status'] == 'S')
         print '<BR /><A CLASS="note" HREF="ics.php?inviteid=' .
	   $inv['inviteid'] . '">' . $tx['op.download.ics'] . '</A>';

        if($inv['mtg']['status'] == 'S' || $inv['mtg']['status'] == 's' ||
	   $inv['mtg']['locationstatus'] == 'C')
	{
	  print '<BR />
       <BR />
       <FONT CLASS="note">' . $tx['sd.loc'] . '</FONT><BR />
         ' . render_location($inv['mtg']['location'],
			     $inv['mtg']['locinfo'],
			     $inv['mtg']['locationstatus']);

	  if($inv['mtg']['status'] == 'S' || $inv['mtg']['status'] == 's')
	     print '<BR />
       <FONT CLASS="note">' . $tx['sd.time'] . '</FONT><BR />
         ' . $tx['sd.from'] . " "
	   . strftime('%c %Z', $inv['mtg']['scheduledfor'])
	   . " " . $tx['sd.until'] . " " .
	  strftime('%c %Z', ($inv['mtg']['scheduledfor'] +
			     ($inv['mtg']['duration'] * 60))) . '
          ';
	}
      ?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.invitees'];?><BR>
     </TD>
     <TD CLASS="formfield">
      <?PHP print render_name("full",
			      $inv['givenname'],
			      $inv['sn'],
			      $inv['mail']);?>
      <A CLASS="note" HREF="contact.php?inviteid=<?PHP print $inv['inviteid'];?>&return=<?PHP print urlencode('reply.php?inviteid='.$inv['inviteid']);?>"><?PHP print $tx['op.edit.self'];?></A>
      <HR>
      <UL>
      <?PHP
        for($i = 0;$i < $inv['mtg']['invitees']['count'];$i++)
	  if($inv['mtg']['invitees'][$i]['contactid'] != $inv['contactid'])
	    print "<LI>" .
	      render_name("full",
			  $inv['mtg']['invitees'][$i]['givenname'], 
			  $inv['mtg']['invitees'][$i]['sn'], 
			  $inv['mtg']['invitees'][$i]['mail']) .
	      "</LI>\n";
      ?>
      </UL>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.summary'];?><BR>
     </TD>
     <TD CLASS="formfield">
      <?PHP print $inv['mtg']['summary'];?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.desc'];?><BR>
     </TD>
     <TD CLASS="formfield">
      <?PHP print $inv['mtg']['description'];?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.host'];?><BR>
     </TD>
     <TD CLASS="formfield">
      <?PHP print render_name("full",
			      $inv['mtg']['hostgivenname'],
			      $inv['mtg']['hostsn'],
			      $inv['mtg']['hostmail']);?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.time.duration'];?><BR>
     </TD>
     <TD CLASS="formfield">
      <?PHP print $inv['mtg']['duration'] . ' ' . $tx['sd.mins'];?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formfield2" COLSPAN="2">
      <TABLE>
       <TR>
        <TD CLASS="formfield2">
	 <INPUT TYPE="radio" NAME="attend" VALUE="D"
          <?PHP if($inv['reply'] == "D") print "CHECKED"; ?>
         >
	</TD>
        <TD CLASS="formfield2"><?PHP print $tx['rp.notattend'];?></TD>
       </TR>
       <TR>
        <TD CLASS="formfield2">
	 <INPUT TYPE="radio" NAME="attend" VALUE="A"
          <?PHP if($inv['reply'] != "D") print "CHECKED"; ?>
	 >
	</TD>
        <TD CLASS="formfield2">
	 <?PHP print $tx['rp.avail'];?>
	  <TABLE>
	   <TH CLASS="timebar">
	    <?PHP print $tx['rp.grid.time']; ?>
	   </TH>
	   <TH CLASS="timebar" WIDTH="15%">
	    <?PHP print $tx['rp.grid.pref']; ?>
	   </TH>
	   <TH CLASS="timebar" WIDTH="15%">
	    <?PHP print $tx['rp.grid.avail']; ?>
	   </TH>
	   <TH CLASS="timebar" WIDTH="15%">
	    <?PHP print $tx['rp.grid.npref']; ?>
	   </TH>
	   <TH CLASS="timebar" WIDTH="15%">
	    <?PHP print $tx['rp.grid.navail']; ?>
	   </TH>
	   <?PHP
	    $lastday = "";
	   
	    for($i = 0;$i < $inv['mtg']['windows']['count'];$i++)
	    {
	      for($j = $inv['mtg']['windows'][$i]['begin'];
		  $j < $inv['mtg']['windows'][$i]['end'];
		  $j += ($config['schedint'] * 60))
	      {
		$nj = $j + ($config['schedint'] * 60);
		
		$t = getdate($j);
		$u = getdate($nj);

		$tday = strftime('%a %d %b %Y %Z', $j);

		if($tday != $lastday)
		{
		  print '
		<TR>
		 <TH CLASS="timebar">
		  ' . $tday . '
		 </TH>
		 <TH CLASS="timebarp"></TH>
		 <TH CLASS="timebara"></TH>
		 <TH CLASS="timebarnp"></TH>
		 <TH CLASS="timebarna"></TH>
		</TR>
		  ';
		
		  $lastday = $tday;
		}

		$avail = determine_availability($inv['windows'], $j, $nj);
						
		print '
		<TR>
		 <TH CLASS="timebara">
		  <INPUT TYPE="hidden" NAME="slotid[]"
		   VALUE="s' . $i.'-'.$j . '">
		  <INPUT TYPE="hidden" NAME="sstart[]" VALUE="' . $j . '">
		  <INPUT TYPE="hidden" NAME="send[]" VALUE="' . $nj . '">
		   ' . render_time($t['hours'], $t['minutes']) . ' - ' .
		       render_time($u['hours'], $u['minutes']) . '
		 </TH>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="s' . $i.'-'.$j . '" VALUE="p" ' .
		   ($avail == 'p' ? " CHECKED" : "") . '>
		 </TD>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="s' . $i.'-'.$j . '" VALUE="a" ' .
		   ($avail == 'a' || $avail == 'u' ? " CHECKED" : "") . '>
		 </TD>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="s' . $i.'-'.$j . '" VALUE="P" ' .
		   ($avail == 'P' ? " CHECKED" : "") . '>
		 </TD>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="s' . $i.'-'.$j . '" VALUE="A" ' .
		   ($avail == 'A' ? " CHECKED" : "") . '>
		 </TD>
		</TR>
		  ';
	      }
	    }
	   ?>
	   <?PHP
	   if($inv['mtg']['locations']['count'] > 0)
	   {
	     print '
	   <TR>
	   <TH CLASS="timebar">' . $tx['sd.loc'] . '</TH>
	   <TH CLASS="timebar">' . $tx['sd.locs.pref'] . '</TH>
	   <TH CLASS="timebar">' . $tx['sd.locs.acpt'] . '</TH>
	   <TH CLASS="timebar">' . $tx['sd.locs.unac'] . '</TH>
	   </TR>
             ';
	     
	     for($i = 0;$i < $inv['mtg']['locations']['count'];$i++)
	     {
	       if($inv['mtg']['locations'][$i]['pref'] != 0)
	       {
		 $locpref = $inv['locations'][$inv['mtg']['locations'][$i]['locationid']]['pref'];
		 
		 print '
		<TR>
		 <TH CLASS="timebara">
		  <INPUT TYPE="hidden" NAME="locid[]"
                   VALUE="' . $inv['mtg']['locations'][$i]['locationid'] . '">
                   ' . $inv['mtg']['locations'][$i]['desc'] . '
		 </TH>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="l-'.$inv['mtg']['locations'][$i]['locationid'].'" VALUE="2"' .
		   ($locpref == '2' ? " CHECKED" : "") . '>
		 </TD>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="l-'.$inv['mtg']['locations'][$i]['locationid'].'" VALUE="1"' .
		   ($locpref == '1' || $locpref == '' ? " CHECKED" : "") . '>
		 </TD>
		 <TD CLASS="timebar">
		  <INPUT TYPE="radio" NAME="l-'.$inv['mtg']['locations'][$i]['locationid'].'" VALUE="0"' .
		   ($locpref == '0' ? " CHECKED" : "") . '>
		 </TD>
		</TR>
                 ';
	       }
	     }
	   }
	   ?>
	  </TABLE>
	</TD>
       </TR>
       <TR>
        <TD CLASS="formfield2" COLSPAN="2">
	 <FONT CLASS="note"><?PHP print $tx['rp.note'];?></FONT><BR>
         <TEXTAREA NAME="note" ROWS=10 COLS=70></TEXTAREA>
	</TD>
       </TR>
      </TABLE>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formfield2" COLSPAN="2">
      <INPUT TYPE="submit" VALUE="<?PHP print $tx['op.reply'];?>">
     </TD>
    </TR>
    </FORM>
   </TABLE>
  </TD>
 </TR>
</TABLE>
</BODY>
</HTML>
Return current item: Meeting Request Scheduling and Booking System