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

   // Select who is invited
   //
   // Version: $Revision: 1.5 $
   // Date: $Date: 2007/09/05 11:27:46 $
   //
   // Copyright (c) 2006 - 2007 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.

$auth_required = 1;
include "../lib/mrsbs.inc";
$pgtitle = $tx['who.edit'];
$pgtype = "schedule";

if(!authorize("schedule", "who", $rvar_mtgid))
  mexit($tx['op.err.perm'], 1);
$mtg = get_meeting_info($rvar_mtgid);
if(!$mtg)
  mexit($tx['op.err.nomtg'], 1);

if(isset($rvar_next))
  $nexturi = $rvar_next;
else
  $nexturi = "who2.php?mtgid=" . $rvar_mtgid;
?>
<HTML>
<HEAD>
<TITLE><?PHP print $pgtitle;?></TITLE>
</HEAD>

<BODY>
<TABLE CLASS="main">
 <?PHP include "../lib/titlebar.php";?>
 <TR>
  <TD CLASS="main">
   <TABLE CLASS="form">
    <TR>
     <TD CLASS="formheader">
      <?PHP print $tx['sd.mtgid'] . ' <A HREF="review.php?mtgid=' .
        hstr($rvar_mtgid) . '">' . hstr($rvar_mtgid) . "</A>";?>
     </TD>
    </TR>
    <FORM NAME="whonew" ACTION="schedule-op-handler.php" METHOD="post">
    <INPUT TYPE="hidden" NAME="op" VALUE="whonew">
    <INPUT TYPE="hidden" NAME="mtgid" VALUE="<?PHP print hstr($rvar_mtgid);?>">
    <INPUT TYPE="hidden" NAME="return" VALUE="who.php?mtgid=<?PHP print hstr($rvar_mtgid);?>">
    <INPUT TYPE="hidden" NAME="mreturn" VALUE="who-multiple.php?mtgid=<?PHP print hstr($rvar_mtgid);?>">
    <INPUT TYPE="hidden" NAME="nreturn" VALUE="../admin/contact.php?contactid=new&mtgid=<?PHP print hstr($rvar_mtgid);?>">
    <TR>
     <TD CLASS="formheader2">
      <?PHP print $tx['sd.invitees.new'];?><BR>
      <FONT CLASS="note"><?PHP print $tx['sd.invitees.new.desc'];?></FONT>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formfield2">
      <INPUT TYPE="text" SIZE="70" MAXLENGTH="80" NAME="invitee">
      <SELECT NAME="status">
      <OPTION VALUE="R"<?PHP print ($rvar_itype == "R" ? " SELECTED" : "");?>><?PHP print $tx['sd.invitees.req'];?></OPTION>
      <OPTION VALUE="O"<?PHP print ($rvar_itype == "O" ? " SELECTED" : "");?>><?PHP print $tx['sd.invitees.opt'];?></OPTION>
      <OPTION VALUE="N"<?PHP print ($rvar_itype == "N" ? " SELECTED" : "");?>><?PHP print $tx['sd.invitees.non'];?></OPTION>
      </SELECT>
      <BR />
      <FONT CLASS="note"><?PHP print $tx['op.add.desc.inv'];?></FONT>
      <BR />
      <INPUT TYPE="submit" VALUE="<?PHP print $tx['op.add'];?>">
     </TD>
    </TR>
    </FORM>
    <?PHP
      $rinvs = get_recent_invitees($_SESSION['contactid']);

      if($rinvs && $rinvs['count'] > 0)
      {
	$dinvs = array();
	$dinvs['count'] = 0;

	// Don't offer an option for people already on the invite list.
	// This code could be optimized with a hash table.
	
	for($i = 0;$i < $rinvs['count'];$i++)
	{
	  $skip = 0;
	  
	  for($j = 0;$j < $mtg['invitees']['count'];$j++)
	  {
	    if($rinvs[$i]['contactid'] == $mtg['invitees'][$j]['contactid'])
	    {
	      $skip++;
	      break;
	    }
	  }
	  
	  if(!$skip)
	  {
	    $c = $dinvs['count'];
	    $dinvs[$c]['contactid'] = $rinvs[$i]['contactid'];
	    $dinvs[$c]['givenname'] = $rinvs[$i]['givenname'];
	    $dinvs[$c]['sn'] = $rinvs[$i]['sn'];
	    $dinvs[$c]['mail'] = $rinvs[$i]['mail'];
	    $dinvs['count']++;
	  }
	}

	if($dinvs['count'] > 0)
	{
	  print '
    <FORM NAME="whorecent" ACTION="schedule-op-handler.php" METHOD="post">
    <INPUT TYPE="hidden" NAME="op" VALUE="whorecent">
    <INPUT TYPE="hidden" NAME="mtgid" VALUE="' . hstr($rvar_mtgid) . '">
    <INPUT TYPE="hidden" NAME="return" VALUE="who.php?mtgid=' .
	    hstr($rvar_mtgid) . '">
    <TR>
     <TD CLASS="formheader2">
      ' . $tx['sd.invitees.recent'] . '<BR>
      <FONT CLASS="note">' . $tx['sd.invitees.recent.desc'] . '</FONT>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formfield2">
      <SELECT NAME="invitees[]" MULTIPLE>
        '  ;
	
	  for($i = 0;$i < $dinvs['count'];$i++)
	  {
	    print '<OPTION VALUE="' . $dinvs[$i]['contactid'] . '">' .
	      render_name("full", $dinvs[$i]['givenname'],
			  $dinvs[$i]['sn'], $dinvs[$i]['mail']) .
	      '</OPTION>\n';
	  }

	  print '
      </SELECT>
      <BR />
      <SELECT NAME="status">
      <OPTION VALUE="R"' . ($rvar_itype == "R" ? " SELECTED" : "") . '>' .
	    $tx['sd.invitees.req'] . '</OPTION>
      <OPTION VALUE="O"' . ($rvar_itype == "O" ? " SELECTED" : "") . '>' .
	    $tx['sd.invitees.opt'] . '</OPTION>
      <OPTION VALUE="N"' . ($rvar_itype == "N" ? " SELECTED" : "") . '>' .
	    $tx['sd.invitees.non'] . '</OPTION>
      </SELECT>
      <BR />
      <FONT CLASS="note">' . $tx['op.add.desc.recent'] . '</FONT>
      <BR />
      <INPUT TYPE="submit" VALUE="' . $tx['op.add'] . '">
     </TD>
    </TR>
    </FORM>
	  ';
	}
      }

      if($mtg['invitees']['count'] > 0)
        print '
    <FORM NAME="who" ACTION="schedule-op-handler.php" METHOD="post">
    <INPUT TYPE="hidden" NAME="op" VALUE="who">
    <INPUT TYPE="hidden" NAME="mtgid" VALUE="' . hstr($rvar_mtgid) . '">
    <INPUT TYPE="hidden" NAME="return" VALUE="who.php?mtgid=' .
	  hstr($rvar_mtgid) . '">
    <TR>
     <TD CLASS="formheader2">
      ' . $tx['sd.invitees'] . '<BR>
      <FONT CLASS="note">' . $tx['sd.invitees.desc'] . '</FONT>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formfield2">
      <TABLE>
       <TR>
        <TD CLASS="formheader">' . $tx['sd.invitee'] . '</TD>
        <TD CLASS="formheader">' . $tx['sd.status'] . '</TD>
        <TD CLASS="formheader">' . $tx['op.remove'] . '</TD>
       </TR>
       ';

        for($i = 0;$i < $mtg['invitees']['count'];$i++)
	  print '
       <TR>
        <INPUT TYPE="hidden" NAME="inviteid[]"
	 VALUE="' . $mtg['invitees'][$i]['inviteid'] . '">
        <INPUT TYPE="hidden" NAME="curstatus[]"
	 VALUE="' . $mtg['invitees'][$i]['status'] . '">
	<TD CLASS="' . ($rvar_itype == $mtg['invitees'][$i]['status'] ?
				 "notice" : "formfield") . '">' .
	  render_name("full",
		      $mtg['invitees'][$i]['givenname'],
		      $mtg['invitees'][$i]['sn'],
		      $mtg['invitees'][$i]['mail'])
	   . '</TD>
	<TD CLASS="formfield">
         <SELECT NAME="status[]">
         <OPTION VALUE="R"' .
	  ($mtg['invitees'][$i]['status'] == "R" ? " SELECTED" : "") . '>' .
	  $tx['sd.invitees.req'] . '</OPTION>
         <OPTION VALUE="O"' .
	  ($mtg['invitees'][$i]['status'] == "O" ? " SELECTED" : "") . '>' .
	  $tx['sd.invitees.opt'] . '</OPTION>
         <OPTION VALUE="N"' .
	  ($mtg['invitees'][$i]['status'] == "N" ? " SELECTED" : "") . '>' .
	  $tx['sd.invitees.non'] . '</OPTION>
         </SELECT>
	</TD>
	<TD CLASS="formfield">
	 <INPUT TYPE="checkbox" NAME="remove[]" VALUE="' .
	  $mtg['invitees'][$i]['inviteid'] . '">
	</TD>
       </TR>';

       if($mtg['invitees']['count'] > 0)
          print '
      </TABLE>
      <FONT CLASS="note">' . $tx['op.update.desc.inv'] . '</FONT>
      <BR />
      <INPUT TYPE="submit" VALUE="' . $tx['op.update'] . '">
      </FORM>
     </TD>
    </TR>
       ';
       ?>
    <TR>
     <TD CLASS="formfield2">
     <FORM NAME="whenc" ACTION="schedule-op-handler.php" METHOD="get">
     <INPUT TYPE="hidden" NAME="op" VALUE="null">
     <INPUT TYPE="hidden" NAME="mtgid" VALUE="<?PHP print hstr($rvar_mtgid);?>">
     <INPUT TYPE="hidden" NAME="return" VALUE="<?PHP print hstr($nexturi);?>">
     <FONT CLASS="note"><?PHP print $tx['op.continue.desc.inv'];?></FONT>
     <BR />
     <INPUT TYPE="submit" VALUE="<?PHP print $tx['op.continue'];?>">
     </FORM>
     </TD>
    </TR>
   </TABLE>
  </TD>
 </TR>
</TABLE>
</BODY>
</HTML>
Return current item: Meeting Request Scheduling and Booking System