[ PHPXref.com ] [ Generated: Sun Jul 20 20:04:03 2008 ] [ PMtool 1.2.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> groups.php (source)

   1  <?PHP
   2  /***************************************************************************

   3   * $Source: /cvsroot/pmtool/pmtool/groups.php,v $

   4   * $Revision: 1.4 $

   5   * $Date: 2003/11/18 01:00:36 $

   6   * $Author: willuhn $

   7   * $Locker:  $

   8   * $State: Exp $

   9   *

  10   * Copyright (c) by willuhn.webdesign

  11   * All rights reserved

  12   *

  13   *  This program is free software; you can redistribute it and/or modify

  14   *  it under the terms of the GNU General Public License as published by

  15   *  the Free Software Foundation; either version 2 of the License, or

  16   *  (at your option) any later version.

  17   *

  18   *  This program is distributed in the hope that it will be useful,

  19   *  but WITHOUT ANY WARRANTY; without even the implied warranty of

  20   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  21   *  GNU General Public License for more details.

  22   *

  23   *  You should have received a copy of the GNU General Public License

  24   *  along with this program; if not, write to the Free Software

  25   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

  26   ***************************************************************************/
  27  ?>
  28  
  29  <?PHP
  30  #######################################################################

  31  ## check login again

  32  if (!$loginInst->id) {
  33    echo $lang['common_accessDenied']."\n";
  34    exit;
  35  }
  36  ?>
  37  
  38  <h1><?PHP echo $lang['common_groups'];?></h1>
  39  
  40  <?PHP
  41  $recordType = "new";
  42  $accessInst = new access();
  43  
  44  #######################################################################

  45  ## perform action

  46  
  47  if (tool::securePost('id')) {
  48    $accessInst->activate(tool::securePost('id'));
  49    if (!DEMO_MODE) {
  50      if (tool::securePost('remove')) $accessInst->removeUser(tool::securePost('remove'));
  51      if (tool::securePost('add')) $accessInst->addUser(tool::securePost('add'));
  52    }
  53    else {
  54      $toolInst->errorStatus("not allowed in this demo. Sorry ;)");
  55    }
  56  }
  57  if (tool::securePost('action') == "update") {
  58    $recordType = "edit";
  59    $accessInst->fill(tool::securePostAll());
  60    if (!DEMO_MODE) {
  61      if ($accessInst->update()) {
  62        $accessInst->clear();
  63        $recordType = "new";
  64      }
  65    }
  66    else {
  67      $toolInst->errorStatus("not allowed in this demo. Sorry ;)");
  68    }
  69  }
  70  if (tool::securePost('action') == "new") {
  71    $accessInst->fill(tool::securePostAll());
  72    if ($accessInst->insert()) {
  73      $accessInst->clear();
  74      $recordType = "new";
  75    }
  76    else {
  77      $recordType = "edit";
  78    }
  79  }
  80  if (tool::securePost('action') == "delete") {
  81    $accessInst->id = tool::securePost('id');
  82    if (!DEMO_MODE) {
  83      $accessInst->delete();
  84    }
  85    else {
  86      $toolInst->errorStatus("not allowed in this demo. Sorry ;)");
  87    }
  88  }
  89  if (tool::securePost('action') == "edit") {
  90    $recordType = "edit";
  91  }
  92  
  93  #######################################################################

  94  ## make edit / new form

  95  
  96  ?>
  97  
  98  <h2><?PHP echo $recordType;?> <?PHP echo $lang['common_group'];?>
  99    <?PHP
 100      if ($recordType == "edit") {
 101        ?>(<a href="javascript:document.form1.submit();"><?PHP echo $lang['common_newGroup'];?></a>)<?PHP
 102      }
 103    ?>
 104  </h2>
 105  <form method="post" name="form2">
 106  <input type="hidden" name="action" value="edit">
 107  <input type="hidden" name="id" value="<?PHP echo tool::securePost('id');?>">
 108  <table border="0" cellpadding="2" cellspacing="0">
 109    <tr>
 110      <td><?PHP echo $lang['group_name'];?>:&nbsp;</td>
 111      <td colspan="2"><input type="text" name="name" value="<?PHP echo $accessInst->name;?>" size="<?PHP echo $htmlconfig['text_size1'];?>"></td>
 112    </tr>
 113    <tr><td>&nbsp;</td>
 114    <?PHP if ($recordType == "edit" || $recordType == "update") {?>
 115      <td colspan="2"><input type="submit" value="<?PHP echo $lang['common_save'];?>" onclick="document.form2.action.value='update'"><input type="reset" value="<?PHP echo $lang['common_reset'];?>"></td>
 116    <?PHP } else {?>
 117      <td colspan="2"><input type="submit" value="<?PHP echo $lang['common_insert'];?>" onclick="document.form2.action.value='new'"><input type="reset" value="<?PHP echo $lang['common_reset'];?>"></td>
 118    <?PHP }?>
 119    </tr>
 120    <tr>
 121      <td><b><?PHP echo $lang['common_users'];?></b></td>
 122      <td>&nbsp;</td>
 123      <td><b><?PHP echo $lang['common_members'];?></b></td>
 124    </tr>
 125    <tr>
 126      <td>
 127        <select name="add" size="10">
 128        <?PHP
 129          $list = $accessInst->getNotUsers();
 130          while ($element = current($list)) {
 131            $userInst = new user($element);
 132            echo "<option value=\"".$userInst->id."\">".$userInst->name."\n";
 133            next($list);
 134          }
 135        ?>
 136        </select>
 137      </td>
 138      <td align="center">
 139        <input type="submit" value="&lt; <?PHP echo $lang['common_switch'];?> &gt;">
 140      </td>
 141      <td>
 142        <select name="remove" size="10">
 143        <?PHP
 144          $list = $accessInst->getUsers();
 145          while ($element = current($list)) {
 146            $userInst = new user($element);
 147            echo "<option value=\"".$userInst->id."\">".$userInst->name."\n";
 148            next($list);
 149          }
 150        ?>
 151        </select>
 152      </td>
 153    </tr>
 154  </table>
 155  </form>
 156  
 157  <?PHP
 158  
 159  #######################################################################

 160  ## list existing records

 161  ?>
 162  
 163  <br><br>
 164  <h2><?PHP echo $lang['group_available'];?></h2>
 165  <form method="post" name="form1">
 166  <input type=hidden name="id">
 167  <input type=hidden name="action">
 168  <table border="0" cellpadding="2" cellspacing="1" width="99%" bgcolor="#ffffff">
 169    <tr>
 170      <th width="40%"><?PHP echo $lang['group_name'];?></th>
 171      <th width="50%"><?PHP echo $lang['common_members'];?></th>
 172      <th colspan=2><?PHP echo $lang['common_action'];?></th>
 173    </tr>
 174    <?PHP
 175  
 176    $list = $accessInst->getList();
 177    $style = "light";
 178    while ($element = current($list)) {
 179      $accessInst->activate($element);
 180      ?><tr class="<?PHP echo $style;?>" onmouseover="this.style.backgroundColor='#fafafa'" onmouseout="this.style.backgroundColor=''"><?PHP
 181      echo "<td>".$accessInst->name."</td>\n";
 182      echo "<td>";
 183      $userList = $accessInst->getUsers();
 184      while ($userElement = current($userList)) {
 185        $userInst = new user($userElement);
 186        echo $userInst->name."<br>";
 187        next($userList);
 188      }
 189      echo "</td>\n";
 190      echo "<td align=center><input type=submit value=\"".$lang['common_delete']."\" onclick=\"document.form1.id.value='".$element."';document.form1.action.value='delete';return Check()\"></td>\n";
 191      echo "<td align=center><input type=submit value=\"".$lang['common_edit']."\" onclick=\"document.form1.id.value='".$element."';document.form1.action.value='edit'\"></td>\n";
 192      echo "</tr>\n";
 193      next($list);
 194      if ($style == "light") $style = "dark";
 195      else $style = "light";
 196    }
 197  ?>
 198  
 199  </table>
 200  </form>
 201  
 202  <?PHP
 203  /***************************************************************************

 204   * $Log: groups.php,v $
 205   * Revision 1.4  2003/11/18 01:00:36  willuhn
 206   * *** empty log message ***
 207   *

 208   * Revision 1.3  2003/09/27 19:15:50  willuhn

 209   * @B fix on logon page (empty passwords enabled again)

 210   * @N added DEMO_MODE

 211   *

 212   * Revision 1.2  2003/09/27 18:23:44  willuhn

 213   * *** empty log message ***

 214   *

 215   * Revision 1.1.1.1  2003/07/28 19:22:29  willuhn

 216   * reimport

 217   *

 218   * Revision 1.5  2002/04/01 23:17:22  willuhn

 219   * @N added some language stuff

 220   *

 221   * Revision 1.4  2002/03/31 17:17:52  willuhn

 222   * @N added some more colors ;)

 223   *

 224   * Revision 1.3  2002/02/09 19:38:27  willuhn

 225   * @N added CVS log

 226   * @N added french language file

 227   *

 228   *

 229   ***************************************************************************/
 230  ?>


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