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

   // Location editor
   //
   // Version: $Revision: 1.3 $
   // Date: $Date: 2008/04/22 01:04:22 $
   //
   // Copyright (c) 2006 - 2008 Benjamin Oshrin
   // License restrictions apply, see LICENSE for details.
   
$auth_required = 1;
include "../lib/mrsbs.inc";
$pgtitle = $tx['lc.loc.edit'];
$pgtype = "admin";

if($rvar_locationid == "new")
{
  if(!authorize("admin", "locnew", $rvar_locationid))
    mexit($tx['op.err.perm'], 1);

  $loc = array("locationid" => "new",
               "contactid" => $_SESSION['contactid'],
               "givenname" => $_SESSION['givenname'],
               "sn" => $_SESSION['sn'],
	       "mail" => $_SESSION['mail']);
}
else
{
  if(!authorize("admin", "location", $rvar_locationid))
    mexit($tx['op.err.perm'], 1);

  $loc = get_location($rvar_locationid);
  
  if(!$loc)
    mexit($tx['op.err.noloc'], 1);
}

if(isset($rvar_return))
  $returi = $rvar_return;
else
  $returi = "locations.php";
?>
<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="locform" ACTION="admin-op-handler.php" METHOD="post">
    <INPUT TYPE="hidden" NAME="op" VALUE="location">
    <INPUT TYPE="hidden" NAME="locationid"
      VALUE="<?PHP print hstr($rvar_locationid);?>">
    <INPUT TYPE="hidden" NAME="return" VALUE="<?PHP print hstr($returi);?>">
    <TR>
     <TD CLASS="formheader" COLSPAN="2">
      <?PHP
        if($rvar_locationid == "new")
	  print $tx['lc.loc.new'];
	else
          print $tx['lc.loc.edit'] . " " . hstr($rvar_locationid);
      ?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader2">
      <?PHP print $tx['lc.desc'];?><BR>
      <FONT CLASS="note"><?PHP print $tx['lc.desc.desc'];?></FONT>
     </TD>
     <TD CLASS="formfield2">
      <INPUT TYPE="text" SIZE="70" MAXLENGTH="80" NAME="description"
       VALUE="<?PHP print $loc['description'];?>">
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader2">
      <?PHP print $tx['lc.capacity'];?><BR>
      <FONT CLASS="note"><?PHP print $tx['lc.capacity.desc'];?></FONT>
     </TD>
     <TD CLASS="formfield2">
      <INPUT TYPE="text" SIZE="4" MAXLENGTH="4" NAME="capacity"
       VALUE="<?PHP print $loc['capacity'];?>">
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader2">
      <?PHP print $tx['lc.owner'];?><BR>
     </TD>
     <TD CLASS="formfield2">
      <?PHP
       if(authorize("admin", "locationowner", $rvar_locationid))
       {
	 $cts = get_contacts();

	 print '
       <SELECT NAME="owner">
         ';
	 
	 render_contacts_select($cts, false, $loc['contactid']);

	 print '
       </SELECT>
         ';
       }
       else
	 print render_name("compact",
			   $loc['givenname'],
			   $loc['sn'],
			   $loc['mail']);
      ?>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formheader2">
      <?PHP print $tx['lc.perm'];?><BR>
      <FONT CLASS="note"><?PHP print $tx['lc.perm.desc'];?></FONT>
     </TD>
     <?PHP
      $chkd = 'u';

      if(isset($loc['acls']['a']) && $loc['acls']['a']==1)
	$chkd = "a";
      elseif(isset($loc['acls']['g']) && $loc['acls']['g']['count'] > 0)
	$chkd = "g";
     ?>
     <TD CLASS="formfield2">
      <TABLE CLASS="form">
       <TR>
        <TD CLASS="formfield">
         <INPUT TYPE="radio" NAME="acl" VALUE="u"
	  <?PHP
	    if($chkd == 'u')
	      print "CHECKED";
	  ?>
	 >
	</TD>
        <TD CLASS="formfield">
         <?PHP
           print render_name("compact",
			     $loc['givenname'],
			     $loc['sn'],
			     $loc['mail']);
         ?>
	</TD>
       </TR>
       <TR>
        <TD CLASS="formfield">
         <INPUT TYPE="radio" NAME="acl" VALUE="a"
	  <?PHP
	    if($chkd == 'a')
	      print "CHECKED";
	  ?>
	 >
	</TD>
        <TD CLASS="formfield">
         <?PHP print $tx['pm.anyone'];?>
	</TD>
       </TR>
       <TR>
        <TD CLASS="formfield">
         <INPUT TYPE="radio" NAME="acl" VALUE="g"
	  <?PHP
	    if($chkd == 'g')
	      print "CHECKED";
	  ?>
	 >
	</TD>
        <TD CLASS="formfield">
         <?PHP print $tx['pm.groups'];?><BR>
         <SELECT NAME="groups[]" MULTIPLE
	  ONCLICK='document.locform.acl[2].checked="true"'>
         <?PHP
           for($i = 0;$i < count($_SESSION['groups']);$i++)
	   {
	     print "<OPTION";
	     
	     if(isset($loc['acls']['g']))
	       for($j = 0;$j < $loc['acls']['g']['count'];$j++)
	       {
	         if($loc['acls']['g'][$j]['who'] == $_SESSION['groups'][$i]
		    && $loc['acls']['g'][$j]['perm'] == 1)
		   print " SELECTED";
	       }
		   
	     print ">" . $_SESSION['groups'][$i] . "</OPTION>\n";
           }
         ?>
         </SELECT>
	</TD>
       </TR>
      </TABLE>
     </TD>
    </TR>
    <TR>
     <TD CLASS="formfield2" COLSPAN="2">
      <INPUT TYPE="submit" VALUE="<?PHP print $tx['op.continue'];?>">
     </TD>
    </TR>
    </FORM>
   </TABLE>
  </TD>
 </TR>
</TABLE>
</BODY>
</HTML>
Return current item: Meeting Request Scheduling and Booking System