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

   // Render meeting information
   //
   //  $mtg should be valid, as returned from get_meeting_info()
   //  $retedit if set, says where to return to after edit
   //
   // Version: $Revision: 1.9 $
   // Date: $Date: 2008/06/20 01:22:08 $
   //
   // Copyright (c) 2006 - 2007 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.

  if(isset($retedit))
    $nexturi = "&next=" . urlencode($retedit);
  else
    $nexturi = "";
?>
  <TR>
   <TD CLASS="formheader">
    <?PHP print $tx['sd.mtginfo']; ?><BR>
    <FONT CLASS="note"><?PHP print $tx['sd.mtgid'] . " " . $mtg['mtgid']; ?>
    </FONT>
    <?PHP
     print '<FONT CLASS="note"> | </FONT>';

     if(authorize("schedule", "history", $mtg['mtgid']))
       print '<A CLASS="note" HREF="history.php?mtgid=' . $mtg['mtgid'] .
	 '">' . $tx['op.view.history'] . '</A>';

     print '<FONT CLASS="note"> | </FONT>';

     if(authorize("schedule", "begin", $mtg['mtgid']))
       print '<A CLASS="note" HREF="schedule-op-handler.php?op=begin&cloneid=' .
	 $mtg['mtgid'] . '&return=what.php">' . $tx['op.newmtg.clone'] . '</A>';
    ?>
   </TD>
  </TR>
  <TR>
   <TD CLASS="<?PHP print ($mtg['status'] == 'B' ? 'notice' : 'main'); ?>">
    <TABLE CLASS="form">
     <TR>
      <TD CLASS="infoheader">
       <?PHP print $tx['sd.status']; ?>
       <?PHP
       if(authorize("schedule", "where", $mtg['mtgid']))
       {
	 if(ctype_upper($mtg['status']))
	 {
	   if(($mtg['status'] == 'S' || $mtg['status'] == 'I'
	       || $mtg['status'] == 'F')
	      && authorize("schedule", "recalculate", $mtg['mtgid']))
	     print '<A CLASS="note" HREF="confirm.php?mtgid=' .
	       $mtg['mtgid'] . '&op=' .
	       ($mtg['status'] == 'I' ?
		'calculate">' . $tx['op.calculate'] :
		'recalculate">' . $tx['op.recalculate']) .
	       '</A> <FONT CLASS="note"> | </FONT>';

	   print '<A CLASS="note" HREF="confirm.php?mtgid=' . $mtg['mtgid'] .
	     '&op=cancel">' . $tx['op.cancel'] . '</A>';
	 }
	 else
	   print '<A CLASS="note" HREF="confirm.php?mtgid=' . $mtg['mtgid'] .
	     '&op=uncancel">' . $tx['op.uncancel'] . '</A>';
       }
       ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <?PHP
         if($mtg['status'] == 'F')
	   print '<FONT CLASS="error">' . $tx['sd.status.F'] . '</FONT>';
         elseif(ctype_upper($mtg['status']))
	   print $tx['sd.status.'.$mtg['status']];
         else
	   print '<FONT CLASS="error">' . $tx['op.canceled.mtg'] . '</FONT>';

       if($mtg['status'] == 'S')
       {
	 // Check to see if the invitee is an invitee or the contactid

         $inv = -1;

         for($i = 0;$i < $mtg['invitees']['count'];$i++)
	 {
	   if($mtg['invitees'][$i]['contactid'] == $_SESSION['contactid'])
	   {
	     $inv = $mtg['invitees'][$i]['inviteid'];
	     break;
	   }
	 }
	      
	 print '<BR /><A CLASS="note" HREF="ics.php?mtgid=' . $mtg['mtgid']
	   . '">' . $tx['op.download.ics'] . '</A>';
       }
       ?>
      </TD>
     </TR>
     <?PHP
      if($mtg['status'] == 'S' || $mtg['status'] == 's')
      {
	print '
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note">' . $tx['sd.loc'] . '</FONT>
        ';

	if(authorize("schedule", "where", $mtg['mtgid']))
	{
	  print '<A CLASS="note" HREF="location.php?mtgid=' . $mtg['mtgid'] .
	    '">' . $tx['op.change'] . "</A>\n";

	  if($mtg['locationstatus'] == 'T')
	    print '<FONT CLASS="note">|</FONT>
            <A CLASS="note" HREF="schedule-op-handler.php?op=confirmloc&mtgid='
	      . $mtg['mtgid'] . '&return='
	      . urlencode("review.php?mtgid=" . $mtg['mtgid'])
	      . '">' . $tx['op.confirm'] . "</A>\n";
	}
	    
	print '<BR />
         ' . render_location($mtg['location'],
			     $mtg['locinfo'],
			     $mtg['locationstatus']) . '
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note">' . $tx['sd.time'] . '</FONT><BR />
         ' . $tx['sd.from'] . " " . strftime('%c %Z', $mtg['scheduledfor'])
	   . " " . $tx['sd.until'] . " " .
	  strftime('%c %Z', ($mtg['scheduledfor'] + ($mtg['duration'] * 60)))
	   . '
      </TD>
     </TR>
        ';
      }
     ?>
    </TABLE>
   </TD>
  </TR>
  <TR>
   <TD CLASS="main">
    <TABLE CLASS="form">
     <TR>
      <TD CLASS="infoheader">
       <?PHP print $tx['what']; ?>
       <?PHP
        if(authorize("schedule", "what", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="what.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.summary']; ?></FONT><BR>
       <?PHP print $mtg['summary']; ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.desc']; ?></FONT><BR>
       <?PHP print nl2br($mtg['description']); ?>
      </TD>
     </TR>
    </TABLE>
    <P>
    <TABLE CLASS="form">
     <TR>
      <TD CLASS="infoheader">
       <?PHP print $tx['who']; ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.owner']; ?></FONT>
       <?PHP
        if(authorize("schedule", "owner", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="who2.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
       <BR />
       <?PHP print render_name("compact",
			       $mtg['contactgivenname'],
			       $mtg['contactsn'],
			       $mtg['contactmail']); ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.host']; ?></FONT>
       <?PHP
        if(authorize("schedule", "who", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="who2.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
       <BR />
       <?PHP print render_name("compact",
			       $mtg['hostgivenname'],
			       $mtg['hostsn'],
			       $mtg['hostmail']); ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <TABLE>
        <?PHP
         for($i = 0;$i < 3;$i++)
	 {
	   switch($i)
	   {
	   case 0:
	     $itx = $tx['sd.invitees.req'];
	     $istat = 'R';
	     break;
	   case 1:
	     $itx = $tx['sd.invitees.opt'];
	     $istat = 'O';
	     break;
	   case 2:
	     $itx = $tx['sd.invitees.non'];
	     $istat = 'N';
	     break;
	   }
	   
	   print '
         <TR>
          <TH CLASS="timebar">
           ' . $itx . " " . $tx['sd.invitees'];

	   if(authorize("schedule", "who", $mtg['mtgid']))
	     print ' <A CLASS="note" HREF="who.php?mtgid=' . $mtg['mtgid'] .
	       "&itype=" . $istat . $nexturi . '">' . $tx['op.edit'] . '</A>';

	   print '
          </TH>
          <TH CLASS="timebar">' . $tx['sd.status'] . '</TH>
         </TR>
           ';
	   
	   for($j = 0;$j < $mtg['invitees']['count'];$j++)
	     if($mtg['invitees'][$j]['status'] == $istat)
	     {
	       $s = ($mtg['status'] == 'B' ?
		     $tx['sd.status.noinvite'] :
		     $tx['sd.status.noreply']);
	       $c = "";

	       switch($mtg['invitees'][$j]['reply'])
	       {
	       case 'A':
		 $s = $tx['sd.status.attend'];
		 $c = "a";
		 break;
	       case 'D':
		 $s = $tx['sd.status.noattend'];
		 $c = "na";
		 break;
	       }

	       if(authorize("schedule", "viewreply", $mtg['mtgid']))
	       {
		 $s = '<A HREF="../reply/reply.php?inviteid=' .
		   $mtg['invitees'][$j]['inviteid'] .
		   '&return=' . urlencode("../schedule/review.php?mtgid=" .
					  $mtg['mtgid']) . '">' . $s . "</A>";
	       }
	    
	       print '
         <TR>
          <TD CLASS="formfield2">
           ' . render_name("full",
			   $mtg['invitees'][$j]['givenname'],
			   $mtg['invitees'][$j]['sn'],
			   $mtg['invitees'][$j]['mail']) . '
          </TD>
          <TD CLASS="timebar' . $c . '">
           ' . $s . '
          </TD>
         </TR>
               ';
	     }
	 }
       ?>
      </TABLE>
      <?PHP
        if(authorize("schedule", "viewreply", $mtg['mtgid']))
	  print '
       <P>
        <FONT CLASS="note">' . $tx['sd.status.host.note'] . '</FONT>
       </P>
	  ';
      ?>
      </TD>
     </TR>
    </TABLE>
    <P>
    <TABLE CLASS="form">
     <TR>
      <TD CLASS="infoheader">
       <?PHP print $tx['when']; ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.time.duration']; ?></FONT>
       <?PHP
        if(authorize("schedule", "when", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="when2.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
       <BR>
       <?PHP print $mtg['duration'] . " " . $tx['sd.mins']; ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.time.replyby']; ?></FONT>
       <?PHP
        if(authorize("schedule", "when", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="when2.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
       <BR>
       <?PHP print strftime('%c %Z', $mtg['replyby']); ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <FONT CLASS="note"><?PHP print $tx['sd.times']; ?></FONT>
       <?PHP
        if(authorize("schedule", "when", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="when.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
       <BR>
       <OL>
       <?PHP
	// Build list to be rendered

        $l = array();
        $l['column']['count'] = 2;
	$l['column'][0]['title'] = $tx['sd.from'];
	$l['column'][0]['sortable'] = 'N';
	$l['column'][1]['title'] = $tx['sd.until'];
	$l['column'][1]['sortable'] = 'N';
 	$l['row']['count'] = $mtg['windows']['count'];
      
        // Don't add %Z to strftime since it won't adjust for crossing
	// daylight savings -- XXX but we need to display timezone for
        // multi-timezone scheduling.
       
        for($i = 0;$i < $mtg['windows']['count'];$i++)
	{
	  $l['row'][$i][0]['value'] =
	    strftime('%c %Z', $mtg['windows'][$i]['begin']);
	  $l['row'][$i][0]['sortval'] = $mtg['windows'][$i]['begin'];
	  
	  $l['row'][$i][1]['value'] =
	    strftime('%c %Z', $mtg['windows'][$i]['end']);
	  $l['row'][$i][1]['sortval'] = $mtg['windows'][$i]['end'];
	}

	// Prep standard values to render the list.  We don't allow
        // sorting or pagination since we're embedded.

        render_list($l, "", 1, "asc", 1, $l['row']['count'], true);
       ?>
       </OL>
      </TD>
     </TR>
    </TABLE>
    <P>
    <TABLE CLASS="form">
     <TR>
      <TD CLASS="infoheader">
       <?PHP print $tx['where']; ?>
       <?PHP
        if(authorize("schedule", "where", $mtg['mtgid']))
	  print '<A CLASS="note" HREF="where.php?mtgid=' . $mtg['mtgid'] .
	    $nexturi . '">' . $tx['op.edit'] . '</A>';
       ?>
      </TD>
     </TR>
     <TR>
      <TD CLASS="infofield">
       <?PHP
         switch($mtg['location'])
	 {
	 case -2:
	   print $tx['sd.locs.tbd'];
	   break;	   
	 case -1:
	   print $tx['sd.locs.no'];
	   break;
	 default:
	   if($mtg['location'] > 0 && $mtg['locations']['count']==0)
	   {
	     print render_location($mtg['location'],
				   $mtg['locinfo'],
				   $mtg['locationstatus']);
 	   }
	   else
	   {
	     print '<FONT CLASS="note">' . $tx['sd.locs'] . "</FONT><BR>
             <OL>\n";
	     for($i = 0;$i < $mtg['locations']['count'];$i++)
	     {
	       if($mtg['locations'][$i]['pref'] > 0)
	       {
		 print "<LI>" . $mtg['locations'][$i]['desc'];
		 
		 if($mtg['locations'][$i]['pref'] == 2)
		   print " (" . $tx['sd.locs.pref'] . ")";
		 
		 print "</LI>\n";
	       }
	     }
	     print "</OL>\n";
	   }
	   break;
	 }
       ?>
      </TD>
     </TR>
    </TABLE>
   </TD>
  </TR>
  
Return current item: Meeting Request Scheduling and Booking System