b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: admin ] [ index: admin ] [ all elements ]

Source for file _users_list.php

Documentation is available at _users_list.php

  1. <?php
  2. /**
  3.  * Displays groups/users list for editing
  4.  *
  5.  * b2evolution - {@link http://b2evolution.net/}
  6.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  7.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *
  9.  * @package admin
  10.  */
  11. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  12. ?>
  13. <div class="panelblock">
  14. <h2><?php echo T_('Groups &amp; Users'?></h2>
  15. <table class="grouped" cellspacing="0">
  16.     <tr>
  17.         <th class="firstcol"><?php echo T_('ID'?></th>
  18.         <th><?php /* TRANS: table header for user list */ echo T_('Login '?></th>
  19.         <th><?php echo T_('Nickname'?></th>
  20.         <th><?php echo T_('Name'?></th>
  21.         <th><?php echo T_('Email'?></th>
  22.         <th><?php echo T_('URL'?></th>
  23.         <th<?php
  24.             if$current_User->check_perm'users''edit'false ) )
  25.             // extra table cell for +/-
  26.                 echo ' colspan="2"';
  27.             }
  28.             echo '>'.T_('Level'?></th>
  29.         <?php
  30.             if$current_User->check_perm'users''edit'false ) )
  31.             {
  32.                 echo '<th>'.T_('Edit').'</th>';
  33.             }
  34.         ?>
  35.     </tr>
  36.     <?php
  37.  
  38.     $loop_prev_grp_ID 0;
  39.  
  40.     ifcount($userlist) )
  41.     {
  42.         // query which groups have users
  43.         $query "SELECT grp_ID FROM $tablegroups$tableusers
  44.                             WHERE user_grp_ID = grp_ID
  45.                             GROUP BY grp_ID";
  46.         $usedgroups $DB->get_col($query);
  47.  
  48.         $count 0;
  49.         foreach$userlist as $row )
  50.         {    // For each line (can be a user/group or just an empty group)
  51.             $loop_grp_ID $row['grp_ID'];
  52.  
  53.             if$loop_prev_grp_ID != $loop_grp_ID )
  54.             {    // ---------- We just entered a new group! ----------
  55.                 ?>
  56.                 <tr class="group">
  57.                     <td colspan="7">
  58.                         <strong><a href="b2users.php?group=<?php echo $loop_grp_ID ?>"><img src="img/properties.png" width="18" height="13" class="middle" alt="<?php echo T_('Properties'?>" /> <?php echo format_to_output$row['grp_name']'htmlbody' )?></a></strong>
  59.                         <?php
  60.                             if$loop_grp_ID == $Settings->get('newusers_grp_ID') )
  61.                             {
  62.                                 echo '<span class="notes">('.T_('default group for new users').')</span>';
  63.                             }
  64.                         ?>
  65.                     </td>
  66.                     <?php
  67.                     if$current_User->check_perm'users''edit'false ) )
  68.                     {    // copy ?>
  69.                         <td>&nbsp;</td>
  70.                         <td>
  71.                             <a href="b2users.php?group=<?php echo $loop_grp_ID ?>"><img src="img/properties.png" width="18" height="13" class="middle" alt="<?php echo T_('Properties'?>" /></a>
  72.  
  73.                             <a href="b2users.php?action=newgroup&amp;template=<?php echo $loop_grp_ID ?>" title="<?php echo T_('Copy group'?>"><img src="img/copy.gif" width="13" height="13" class="middle" alt="<?php echo T_('Copy'?>" title="<?php echo T_('Copy group'?>" /></a>
  74.                         <?php
  75.                         if( ($loop_grp_ID != 1&& ($loop_grp_ID != $Settings->get('newusers_grp_ID'))
  76.                                 && !in_array$loop_grp_ID$usedgroups ) )
  77.                         // delete
  78.                             ?>
  79.                             <a href="b2users.php?action=deletegroup&amp;id=<?php echo $loop_grp_ID ?>" title="<?php echo T_('Delete group'?>"><img src="img/xross.gif" width="13" height="13" class="middle" alt="<?php echo /* TRANS: Abbrev. for Delete */ T_('Del'?>" title="<?php echo T_('Delete group'?>" /></a>
  80.                             <?php
  81.                         }
  82.                         echo '</td>';
  83.                     }
  84.                     ?>
  85.                 </tr>
  86.                 <?php
  87.                 $loop_prev_grp_ID $loop_grp_ID;
  88.             }
  89.  
  90.             if!empty$row['ID') )
  91.             {    // We have a user here: (i-e group was not empty)
  92.                 $loop_User new User$row );
  93.                 if$count%== )
  94.                     echo "<tr class=\"odd\">\n";
  95.                 else
  96.                     echo "<tr>\n";
  97.                 $email $loop_User->get('email');
  98.                 $url $loop_User->get('url');
  99.                 echo '<td class="firstcol">'$loop_User->get('ID')"</td>\n";
  100.                 echo '<td><a href="b2users.php?user='$loop_User->get('ID')'">';
  101.                 echo '<img src="img/properties.png" width="18" height="13" class="middle" alt="'T_('Properties')'" /> ';
  102.                 echo $loop_User->get('login')"</a></td>\n";
  103.                 ?>
  104.                 <td><?php $loop_User->disp('nickname'?></td>
  105.                 <?php
  106.                 echo '<td>'$loop_User->get('firstname').'&nbsp;'.$loop_User->get('lastname')."</td>\n";
  107.                 echo '<td>&nbsp;';
  108.                 if!empty($email) )
  109.                 {
  110.                     echo '<a href="mailto:'.$email.'" title="e-mail: '.$email.'"><img src="img/email.gif"  alt="e-mail: '.$email.'" class="middle" /></a>&nbsp;';
  111.                 }
  112.                 echo '</td><td>&nbsp;';
  113.                 if (($url != 'http://'and ($url != ''))
  114.                 {
  115.                     if!preg_match('#://#'$url) )
  116.                     {
  117.                         $url 'http://'.$url;
  118.                     }
  119.                     echo "<a href=\"$url\" title=\"website: $url\"><img src=\"img/url.gif\" alt=\"website: $url\" class=\"middle\" /></a>&nbsp;";
  120.                 }
  121.                 echo "</td>\n";
  122.  
  123.                 echo "<td>".$loop_User->get('level');
  124.  
  125.                 if$current_User->check_perm'users''edit'false ) )
  126.                 // edit actions
  127.  
  128.                     echo '</td><td align="right">';
  129.                     if( ($loop_User->get('level'0) )
  130.                     // prom=down
  131.                         echo ' <a href="b2users.php?action=promote&amp;id='$loop_User->get('ID')'&amp;prom=down'
  132.                                     .'" title="'.T_('decrease user level').'">-</a> ';
  133.                     }
  134.                     if( ($loop_User->get('level'10 ) )
  135.                     // prom=up
  136.                         echo ' <a href="b2users.php?action=promote&amp;id='$loop_User->get('ID')'&amp;prom=up'
  137.                                     .'" title="'.T_('increase user level').'">+</a> ';
  138.                     }
  139.  
  140.                     echo '</td><td>';
  141.  
  142.                     // edit user
  143.                     echo ' <a href="b2users.php?user='$loop_User->get('ID')'"><img src="img/properties.png" width="18" height="13" class="middle" alt="'T_('Properties')'" /></a> ';
  144.  
  145.                     // copy user
  146.                     echo ' <a href="b2users.php?action=newuser&amp;template='.$loop_User->get('ID').'"><img src="img/copy.gif" width="13" height="13" class="middle" alt="'.T_('Copy').'" /></a> ';
  147.  
  148.                     if( ($loop_User->ID != 1&& ($loop_User->ID != $current_User->ID) )
  149.                     // delete
  150.                         ?>
  151.                         <a href="b2users.php?action=deleteuser&amp;id=<?php echo $loop_User->get('ID'?>" title="<?php echo T_('Delete user'?>"  onclick="return confirm('<?php echo /* TRANS: Warning this is a javascript string */ T_('Are you sure you want to delete this user?\\nWarning: all his posts will be deleted too!'?>')"><img src="img/xross.gif" width="13" height="13" class="middle" alt="<?php echo /* TRANS: Abbrev. for Delete */ T_('Del'?>" title="<?php echo T_('Delete user'?>" /></a>
  152.                         <?php
  153.                     }
  154.                 }
  155.                 echo "</td>\n";
  156.                 echo "</tr>\n";
  157.                 $count++;
  158.             }
  159.         }
  160.  
  161.         echo "\n</table>";
  162.     }
  163.  
  164. if$current_User->check_perm'users''edit'false ) )
  165. // create new user link
  166.     ?>
  167.     <p class="center">
  168.         <a href="b2users.php?action=newuser"><img src="img/new.gif" width="13" height="13" class="middle" alt="" /> <?php echo T_('New user...'?></a>
  169.         &middot;
  170.         <a href="b2users.php?action=newgroup"><img src="img/new.gif" width="13" height="13" class="middle" alt="" /> <?php echo T_('New group...'?></a>
  171.     </p>
  172.     <?php
  173. }
  174. ?>
  175. </div>

Documentation generated on Tue, 20 May 2008 01:55:58 +0200 by phpDocumentor 1.4.2