[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/admin/ -> vw_usr_roles.php (source)

   1  <?php /* ADMIN $Id: vw_usr_roles.php,v 1.10.8.2 2007/03/06 00:34:40 merlinyoda Exp $ */
   2  global $AppUI, $user_id, $canEdit, $canDelete, $tab;
   3  
   4  if (!defined('W2P_BASE_DIR')) {
   5      die('You should not access this file directly.');
   6  }
   7  
   8  //$roles
   9  // Create the roles class container
  10  require_once  W2P_BASE_DIR . "/modules/system/roles/roles.class.php";
  11  
  12  $perms = &$AppUI->acl();
  13  $user_roles = $perms->getUserRoles($user_id);
  14  $crole = &new CRole;
  15  $roles = $crole->getRoles();
  16  // Format the roles for use in arraySelect
  17  $roles_arr = array();
  18  foreach ($roles as $role) {
  19      $roles_arr[$role['id']] = $role['name'];
  20  }
  21  
  22  ?>
  23  
  24  <script language="javascript">
  25  <?php
  26  // security improvement:
  27  // some javascript functions may not appear on client side in case of user not having write permissions
  28  // else users would be able to arbitrarily run 'bad' functions
  29  if ($canEdit) {
  30  ?>
  31  function delIt(id) {
  32      if (confirm( 'Are you sure you want to delete this role?' )) {
  33          var f = document.frmPerms;
  34          f.del.value = 1;
  35          f.role_id.value = id;
  36          f.submit();
  37      }
  38  }
  39  <?php
  40  } ?>
  41  
  42  </script>
  43  
  44  <table width="100%" border="0" cellpadding="2" cellspacing="0">
  45  <tr><td width="50%" valign="top">
  46  
  47  <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
  48  <tr>
  49      <th width="100%"><?php echo $AppUI->_('Role'); ?></th>
  50      <th>&nbsp;</th>
  51  </tr>
  52  
  53  <?php
  54  foreach ($user_roles as $row) {
  55      $buf = '';
  56  
  57      $style = '';
  58      $buf .= "<td>" . $row['name'] . "</td>";
  59  
  60      $buf .= '<td nowrap>';
  61      if ($canEdit) {
  62          $buf .= "<a href=\"javascript:delIt({$row['id']});\" title=\"" . $AppUI->_('delete') . "\">" . w2PshowImage('icons/stock_delete-16.png', 16, 16, '') . '</a>';
  63      }
  64      $buf .= '</td>';
  65  
  66      echo "<tr>$buf</tr>";
  67  }
  68  ?>
  69  </table>
  70  
  71  </td><td width="50%" valign="top">
  72  
  73  <?php if ($canEdit) { ?>
  74  
  75  <table cellspacing="1" cellpadding="2" border="0" class="std" width="100%">
  76  <form name="frmPerms" method="post" action="?m=admin">
  77      <input type="hidden" name="del" value="0" />
  78      <input type="hidden" name="dosql" value="do_userrole_aed" />
  79      <input type="hidden" name="user_id" value="<?php echo $user_id; ?>" />
  80      <input type="hidden" name="user_name" value="<?php echo $user_name; ?>" />
  81      <input type="hidden" name="role_id" value="" />
  82  <tr>
  83      <th colspan='2'><?php echo $AppUI->_('Add Role'); ?></th>
  84  </tr>
  85  <tr>
  86      <td colspan='2' width="100%"><?php echo arraySelect($roles_arr, 'user_role', 'size="1" class="text"', '', true); ?></td>
  87  </tr>
  88  <tr>
  89      <td>
  90          <input type="reset" value="<?php echo $AppUI->_('clear'); ?>" class="button" name="sqlaction" onclick="clearIt();" />
  91      </td>
  92      <td align="right">
  93          <?php
  94      if (!count($user_roles)) {
  95          echo $AppUI->_('Notify New User Activation'); ?> 
  96                  <input type='checkbox' name='notify_new_user' />&nbsp;&nbsp;&nbsp;&nbsp;
  97          <?php
  98      }
  99  ?>
 100          <input type="submit" value="<?php echo $AppUI->_('add'); ?>" class="button" name="sqlaction2" />
 101      </td>
 102  </tr>
 103  </table>
 104  </form>
 105  
 106  <?php } ?>
 107  
 108  </td>
 109  </tr>
 110  </table>


Generated: Wed Jan 7 03:00:01 2009 Cross-referenced by PHPXref 0.7