home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / admin / viewuser.php < prev    next >
Encoding:
PHP Script  |  2003-11-13  |  4.9 KB  |  142 lines

  1. <?php /* ADMIN $Id: viewuser.php,v 1.27 2003/11/13 19:41:53 gregorerhardt Exp $ */
  2. $AppUI->savePlace();
  3.  
  4. $user_id = isset( $_GET['user_id'] ) ? $_GET['user_id'] : 0;
  5.  
  6. if (isset( $_GET['tab'] )) {
  7.     $AppUI->setState( 'UserVwTab', $_GET['tab'] );
  8. }
  9. $tab = $AppUI->getState( 'UserVwTab' ) !== NULL ? $AppUI->getState( 'UserVwTab' ) : 0;
  10.  
  11. // pull data
  12. $sql = "
  13. SELECT users.*, 
  14.     company_id, company_name, 
  15.     dept_name, dept_id
  16. FROM users
  17. LEFT JOIN companies ON user_company = companies.company_id
  18. LEFT JOIN departments ON dept_id = user_department
  19. WHERE user_id = $user_id
  20. ";
  21. if (!db_loadHash( $sql, $user )) {
  22.     $titleBlock = new CTitleBlock( 'Invalid User ID', 'helix-setup-user.png', $m, "$m.$a" );
  23.     $titleBlock->addCrumb( "?m=admin", "users list" );
  24.     $titleBlock->show();
  25. } else {
  26.  
  27. // setup the title block
  28.     $titleBlock = new CTitleBlock( 'View User', 'helix-setup-user.png', $m, "$m.$a" );
  29.     if ($canRead) {
  30.       $titleBlock->addCrumb( "?m=admin", "users list" );
  31.     }
  32.     if ($canEdit || $user_id == $AppUI->user_id) {
  33.           $titleBlock->addCrumb( "?m=admin&a=addedituser&user_id=$user_id", "edit this user" );
  34.           $titleBlock->addCrumb( "?m=system&a=addeditpref&user_id=$user_id", "edit preferences" );
  35.           $titleBlock->addCrumbRight(
  36.             '<a href="#" onclick="popChgPwd();return false">' . $AppUI->_('change password') . '</a>'
  37.           );
  38.     }
  39.     $titleBlock->show();
  40. ?>
  41. <script language="javascript">
  42. function popChgPwd() {
  43.     window.open( './index.php?m=public&a=chpwd&dialog=1', 'chpwd', 'top=250,left=250,width=350, height=220, scollbars=false' );
  44. }
  45. </script>
  46.  
  47. <table border="0" cellpadding="4" cellspacing="0" width="100%" class="std">
  48. <tr valign="top">
  49.     <td width="50%">
  50.         <table cellspacing="1" cellpadding="2" border="0" width="100%">
  51.         <tr>
  52.             <td align="right" nowrap><?php echo $AppUI->_('Login Name');?>:</td>
  53.             <td class="hilite" width="100%"><?php echo $user["user_username"];?></td>
  54.         </tr>
  55.         <tr>
  56.             <td align="right" nowrap><?php echo $AppUI->_('User Type');?>:</td>
  57.             <td class="hilite" width="100%"><?php echo $utypes[$user["user_type"]];?></td>
  58.         </tr>
  59.         <tr>
  60.             <td align="right" nowrap><?php echo $AppUI->_('Real Name');?>:</td>
  61.             <td class="hilite" width="100%"><?php echo $user["user_first_name"].' '.$user["user_last_name"];?></td>
  62.         </tr>
  63.         <tr>
  64.             <td align="right" nowrap><?php echo $AppUI->_('Company');?>:</td>
  65.             <td class="hilite" width="100%">
  66.                 <a href="?m=companies&a=view&company_id=<?php echo @$user["company_id"];?>"><?php echo @$user["company_name"];?></a>
  67.             </td>
  68.         </tr>
  69.         <tr>
  70.             <td align="right" nowrap><?php echo $AppUI->_('Department');?>:</td>
  71.             <td class="hilite" width="100%">
  72.                 <a href="?m=departments&a=view&dept_id=<?php echo @$user["dept_id"];?>"><?php echo $user["dept_name"];?></a>
  73.             </td>
  74.         </tr>
  75.         <tr>
  76.             <td align="right" nowrap><?php echo $AppUI->_('Phone');?>:</td>
  77.             <td class="hilite" width="100%"><?php echo @$user["user_phone"];?></td>
  78.         </tr>
  79.         <tr>
  80.             <td align="right" nowrap><?php echo $AppUI->_('Home Phone');?>:</td>
  81.             <td class="hilite" width="100%"><?php echo @$user["user_home_phone"];?></td>
  82.         </tr>
  83.         <tr>
  84.             <td align="right" nowrap><?php echo $AppUI->_('Mobile');?>:</td>
  85.             <td class="hilite" width="100%"><?php echo @$user["user_mobile"];?></td>
  86.         </tr>
  87.         <tr valign=top>
  88.             <td align="right" nowrap><?php echo $AppUI->_('Address');?>:</td>
  89.             <td class="hilite" width="100%"><?php
  90.                 echo @$user["user_address1"]
  91.                     .( ($user["user_address2"]) ? '<br />'.$user["user_address2"] : '' )
  92.                     .'<br />'.$user["user_city"]
  93.                     .'  '.$user["user_state"]
  94.                     .'  '.$user["user_zip"]
  95.                     .'<br />'.$user["user_country"]
  96.                     ;
  97.             ?></td>
  98.         </tr>
  99.         </table>
  100.  
  101.     </td>
  102.     <td width="50%">
  103.         <table width="100%">
  104.         <tr>
  105.             <td align="right" nowrap><?php echo $AppUI->_('Birthday');?>:</td>
  106.             <td class="hilite" width="100%"><?php echo @$user["user_birthday"];?></td>
  107.         </tr>
  108.         <tr>
  109.             <td align="right" nowrap>ICQ#:</td>
  110.             <td class="hilite" width="100%"><?php echo @$user["user_icq"];?></td>
  111.         </tr>
  112.         <tr>
  113.             <td align="right" nowrap>AOL Nick:</td>
  114.             <td class="hilite" width="100%"><a href="aim:<?php echo @$user["user_aol"];?>"><?php echo @$user["user_aol"];?></a></td>
  115.         </tr>
  116.         <tr>
  117.             <td align="right" nowrap><?php echo $AppUI->_('Email');?>:</td>
  118.             <td class="hilite" width="100%"><?php echo '<a href="mailto:'.@$user["user_email"].'">'.@$user["user_email"].'</a>';?></td>
  119.         </tr>
  120.         <tr>
  121.             <td colspan="2"><strong><?php echo $AppUI->_('Signature');?>:</strong></td>
  122.         </tr>
  123.         <tr>
  124.             <td class="hilite" width="100%" colspan="2">
  125.                 <?php echo str_replace( chr(10), "<br />", $user["user_signature"]);?> 
  126.             </td>
  127.         </tr>
  128.         </table>
  129.     </td>
  130. </tr>
  131. </table>
  132.  
  133. <?php    
  134.     // tabbed information boxes
  135.     $tabBox = new CTabBox( "?m=admin&a=viewuser&user_id=$user_id", "{$AppUI->cfg['root_dir']}/modules/admin/", $tab );
  136.     $tabBox->add( 'vw_usr_proj', 'Owned Projects' );
  137.     $tabBox->add( 'vw_usr_perms', 'Permissions' );
  138.     //$tabBox->add( 'vw_usr_roles', 'Roles' );    // under development
  139.     $tabBox->show();
  140. }
  141. ?>
  142.