WebCalendar PHP Cross Reference Groupware Applications

Source: /usersel.php - 128 lines - 3795 bytes - Summary - Text - Print

   1  <?php
   2  /* $Id: usersel.php,v 1.34.2.3 2008/10/15 03:05:11 cknudsen Exp $ */
   3  include_once  'includes/init.php';
   4  
   5  // input args in URL
   6  // users:  list of comma-separated users
   7  // form:   name of form on parent page
   8  // listid: element id of user selection object in form
   9  //         ... to be used like form.elements[$listid]
  10  $users = getGetValue ( 'users' );
  11  $form = getGetValue ( 'form' );
  12  $listid = getGetValue ( 'listid' );
  13  $progErrStr = translate ( 'Program Error No XXX specified!' );
  14  if ( empty ( $form ) ) {
  15    echo str_replace ( 'XXX', translate ( 'form' ), $progErrStr );
  16    exit;
  17  }
  18  if ( empty ( $listid ) ) {
  19    echo str_replace ( 'XXX', translate ( 'listid' ), $progErrStr );
  20    exit;
  21  }
  22  
  23  // Parse $users.
  24  $exp = split ( ',', $users );
  25  $groups = $selected = $sql_params = array ();
  26  for ( $i = 0, $cnt = count ( $exp ); $i < $cnt; $i++ ) {
  27    $selected[$exp[$i]] = 1;
  28  }
  29  
  30  $owner = ( $is_nonuser_admin || $is_assistant ? $user : $login );
  31  
  32  // Load list of groups.
  33  $sql = 'SELECT wg.cal_group_id, wg.cal_name FROM webcal_group wg';
  34  
  35  if ( $USER_SEES_ONLY_HIS_GROUPS == 'Y' ) {
  36    $sql .= ', webcal_group_user wgu WHERE wg.cal_group_id = wgu.cal_group_id
  37      AND wgu.cal_login = ?';
  38    $sql_params[] = $owner;
  39  }
  40  
  41  $res = dbi_execute ( $sql . ' ORDER BY wg.cal_name', $sql_params );
  42  
  43  if ( $res ) {
  44    while ( $row = dbi_fetch_row ( $res ) ) {
  45      $groups[] = array (
  46        'cal_group_id' => $row[0],
  47        'cal_name' => $row[1]
  48        );
  49    }
  50    dbi_free_result ( $res );
  51  }
  52  
  53  print_header ( '', '', '', true, false, true );
  54  
  55  ob_start ();
  56  
  57  echo '
  58      <script language="javascript" type="text/javascript">';
  59  
  60  include  'includes/js/usersel.php';
  61  
  62  echo '
  63      </script>
  64      <center>
  65        <form action="#" name="userselform">
  66          <table style="borderh: 0; width: 100%;">
  67            <tr>
  68              <td class="aligntop">
  69                <b>' . translate ( 'Users' ) . ':</b><br />
  70                <select name="users" size="15" multiple="multiple">';
  71  
  72  $users = get_my_users ();
  73  if ( $NONUSER_ENABLED == 'Y' ) {
  74    $nonusers = get_my_nonusers ( $login, true );
  75    $users = ( $NONUSER_AT_TOP == 'Y'
  76      ? array_merge ( $nonusers, $users ) : array_merge ( $users, $nonusers ) );
  77  }
  78  for ( $i = 0, $cnt = count ( $users ); $i < $cnt; $i++ ) {
  79    $u = $users[$i]['cal_login'];
  80    echo '
  81                  <option value="' . $u . '"'
  82     . ( ! empty ( $selected[$u] ) ? ' selected="selected"' : '' )
  83     . '>' . $users[$i]['cal_fullname'] . '</option>';
  84  }
  85  
  86  echo '
  87                </select><br />
  88                <input type="button" value="' . translate ( 'All' )
  89   . '" onclick="selectAll( true )" />
  90                <input type="button" value="' . translate ( 'None' )
  91   . '" onclick="selectAll( false )" />
  92                <input type="reset" value="' . translate ( 'Reset' ) . '" />
  93              </td>
  94              <td valign="top">
  95                <b>' . translate ( 'Groups' ) . ':</b><br />
  96                <select name="groups" size="15">';
  97  
  98  for ( $i = 0, $cnt = count ( $groups ); $i < $cnt; $i++ ) {
  99    echo '
 100                  <option value="' . $groups[$i]['cal_group_id'] . '">'
 101     . $groups[$i]['cal_name'] . '</option>';
 102  }
 103  
 104  echo '
 105                </select><br />
 106                <input type="button" value="' . translate ( 'Add' )
 107   . '" onclick="toggleGroup( true );" />
 108                <input type="button" value="' . translate ( 'Remove' )
 109   . '" onclick="toggleGroup( false );" />
 110              </td>
 111            </tr>
 112            <tr>
 113              <td style="text-align:center;" colspan="2"><br /><br />
 114                <input type="button" value="' . translate ( 'OK' )
 115   . '" onclick="OkButton()" />
 116                <input type="button" value="' . translate ( 'Cancel' )
 117   . '" onclick="window.close()" />
 118              </td>
 119            </tr>
 120          </table>
 121        </form
 122      </center>';
 123  
 124  ob_end_flush ();
 125  
 126  echo print_trailer ( false, true, true );
 127  
 128  ?>

title

Description

title

Description

title

Description

title

title

Body