[ PHPXref.com ] [ Generated: Sun Jul 20 20:33:10 2008 ] [ TaskFreak! 0.1.4 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> user_details.php (source)

   1  <?php
   2  /****************************************************************************\
   3  * TaskFreak!                                                                 *
   4  * multi user                                                                 *
   5  ******************************************************************************
   6  * Version: 0.1.4                                                             *
   7  * Release date: 18 May 2006                                                  *
   8  * Authors: Stan Ozier <taskfreak@gmail.com>                                  *
   9  * License:  http://www.gnu.org/licenses/gpl.txt (GPL)                        *
  10  ******************************************************************************
  11  * This file is part of "TaskFreak! multi user" program.                      *
  12  *                                                                            *
  13  * TaskFreak! multi user is free software; you can redistribute it and/or     *
  14  * modify it under the terms of the GNU General Public License as published   *
  15  * by the Free Software Foundation; either version 2 of the License, or (at   *  
  16  * your option) any later version.                                            *
  17  *                                                                            *
  18  * TaskFreak! multi user is distributed in the hope that it will be           *
  19  * useful, 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
  26  \****************************************************************************/
  27  
  28  include  '_common.php';
  29  
  30  /* --- LOAD USER --------------------------------------------------- */
  31  
  32  $objItem = new Member();
  33  
  34  if ($_REQUEST['id'] && $objUser->checkLevel(1)) {
  35      // admin loads specific user
  36      $objItem->setUid($_REQUEST['id']);
  37      $objItem->load();
  38  }
  39  if (!$objItem->isLoaded()) {
  40      // user is viewing himself
  41      $objItem =& $objUser;
  42  }
  43  
  44  /* --- ACTIONS -------------------------------------------------------- */
  45  
  46  $pUserIsAdmin = false; // -TODO- enable actions
  47  
  48  /*
  49  if ($pUserIsAdmin) {
  50  
  51      // ----- remove user from team -----
  52      
  53      if ($_REQUEST['delete']) {
  54          $objMemberTeam = new MemberProject();
  55          $objMemberTeam->initObjectProperties();
  56          $objMemberTeam->member->id = $objItem->id;
  57          $objMemberTeam->project->setUid($_REQUEST['delete']);
  58          if ($objMemberTeam->delete()) {
  59              $pMessageStatus = 'Member removed from team!';
  60          } else {
  61              $pMessageStatus = 'ERROR:Member can not be removed or has already been removed';
  62          }
  63      }
  64      
  65      // ----- update position ----
  66      
  67      foreach ($_REQUEST as $key => $value) {
  68          if (ereg('^position-',$key)) {
  69              $id = intval(substr($key,9));
  70              $objMemberTeam = new MemberProject();
  71              if ($objMemberTeam->loadPosition($id,$objItem->id))
  72              {
  73                  if ($objMemberTeam->position != $value) {
  74                      // update database
  75                      $objMemberTeam->position = $value;
  76                      $objMemberTeam->getConnection();
  77                      $objMemberTeam->update('position');
  78                  }
  79              }
  80          }
  81      }
  82  
  83  }
  84  */
  85  
  86  
  87  /* --- LOAD STATES ---------------------------------------------------- */
  88  
  89  $objStateList = new UsState();
  90  
  91  /* --- LOAD TEAMS ----------------------------------------------------- */
  92  
  93  $objMemberList = new MemberProject();
  94  $objMemberList->addWhere($objMemberList->gTable('memberProject').'.memberId = '.$objItem->id);
  95  $objMemberList->addOrder('position DESC, member.lastName ASC');
  96  $objMemberList->loadList();
  97  
  98  /* --- HTML ----------------------------------------------------------- */
  99  
 100  $pJScript = 'team.js';
 101  $pCss = 'levels.css';
 102  
 103  include PRJ_INCLUDE_PATH.'html/header.php';
 104  ?>
 105  <div align="center">
 106    <div id="horiz">
 107      <fieldset>
 108          <legend><?php 
 109              echo $langUser['information'].' ('.$objItem->username.')'; 
 110              if (($objItem->id == $objUser->id) || ($objUser->checkLevel(3))) {
 111                  echo ' <a href="user_edit.php?id='.$objItem->id.'" class="discrete"><img src="skins/'.FRK_SKIN_FOLDER.'/images/b_edit.png" width="20" height="16" border="0" alt="edit" /></a>';
 112              }
 113          ?></legend>
 114          <div align="right"><small>Created on <?php echo $objItem->getDte('creationDate','SHT'); ?> 
 115          by <?php echo $objItem->author->getShortName(); ?></small></div>
 116          <table cellpadding="2" cellspacing="1" border="0" class="form">
 117              <tr>
 118                  <th width="100"><?php echo $langUser['name']; ?>:</th>
 119                  <td><big><?php echo $objItem->getName(); ?></big></td>
 120              </tr>
 121              <tr valign="top">
 122                  <th><?php echo $langUser['address']; ?>:</th>
 123                  <td><?php 
 124                      if ($objItem->city) {
 125                          $objItem->p('city');
 126                      }
 127                      if ($objItem->stateCode) {
 128                          echo ' '.$objItem->stateCode;
 129                      }
 130                      if ($objItem->city || $objItem->stateCode) {
 131                          echo '<br />';
 132                      }
 133                      echo strtoupper($objItem->country->name);
 134                  ?></td>
 135              </tr>
 136              <tr>
 137                  <th><?php echo $langUser['position']; ?>:</th>
 138                  <td><?php
 139                      if (!$objItem->enabled) {
 140                          echo ' <span class="disabled">Account is disabled!</span>';
 141                      } else {
 142                          foreach ($GLOBALS['langGlobalPosition'] as $key => $label) {
 143                              if ($key == $objItem->level) {
 144                                  echo '<span class="level_high level_'.$key.'">';
 145                              } else {
 146                                  echo '<span class="level_pad level_0">';
 147                              }
 148                              echo $label.'</span> ';
 149                          }
 150                      }
 151                  ?></td>
 152              </tr>
 153          </table>
 154          <?php
 155              if ($objUser->checkLevel(1)) {
 156          ?>
 157          <div style="margin-top:12px; text-align:right;">
 158              <input type="button" value="<?php echo $langButton['back']; ?>" onClick="window.location.href='user_list.php'" />
 159          </div>
 160          <?php
 161              }
 162          ?>
 163      </fieldset>
 164      <br />
 165      <fieldset>
 166          <legend><?php echo $langProject['projects']; ?></legend>
 167          <form action="user_details.php">
 168              <?php $objItem->qHidden('id'); ?>
 169          <?php
 170          if ($objMemberList->rMore()) {
 171          ?>
 172          <table cellspacing="0" cellpadding="3" border="0" width="100%" class="data">
 173              <thead>
 174                  <tr align="left">
 175                      <th width="<?php echo ($pUserCanEdit)?'34':'40'; ?>%"><?php echo $langUser['name']; ?></th>
 176                      <th width="18%"><?php echo $langProject['position']; ?></th>
 177                      <?php 
 178                          if ($pUserIsAdmin) { 
 179                              // user has rights to edit/delete users
 180                      ?>
 181                      <th width="12%"><?php echo $langProject['action']; ?></th>
 182                      <?php
 183                          }
 184                      ?>
 185                  </tr>
 186              </thead>
 187              <tbody>
 188          <?php
 189          $rowStyle = 'first';
 190          while ($objMemberTeam = $objMemberList->rNext()) {
 191              $rowStyle = ($rowStyle)?'':' class="odd"';
 192          ?>
 193                  <tr<?php echo $rowStyle; ?>>
 194                      <td><a href="project_edit.php?id=<?php echo $objMemberTeam->project->id; ?>"<?php
 195                          if (!$objMemberTeam->position) {
 196                              echo ' class="disabled"';
 197                          }
 198                      ?>><?php 
 199                          echo $objMemberTeam->project->get('name');
 200                      ?></a></td>
 201                      <td id="pos-<?php echo $objMemberTeam->project->id; ?>"><?php $objMemberTeam->pPosition(); ?></td>
 202                      <?php 
 203                          if ($pUserIsAdmin) { 
 204                              // user has rights to edit/delete users
 205                      ?>
 206                      <td id="but-<?php echo $objMemberTeam->project->id; ?>">
 207                          <?php
 208                              if ((($objUser->id != $objMemberTeam->member->id)
 209                                  && ($objMemberTeam->position < $objUserTeam->position))
 210                                  || $objUser->checkLevel(8))
 211                              { 
 212                          ?>
 213                          <a href="javascript:edit(<?php echo $objMemberTeam->project->id.','.$objMemberTeam->position.',4' ?>)"><img src="skins/<?php echo FRK_SKIN_FOLDER; ?>/images/b_edit.png" width="20" height="16" border="0" /></a>
 214                          <a href="user_details.php?id=<?php echo $objItem->id; ?>&delete=<?php echo $objMemberTeam->project->id; ?>" onclick="return confirm('<?php echo $langProject['remove_confirm']; ?>');"><img src="skins/<?php echo FRK_SKIN_FOLDER; ?>/images/b_dele.png" width="20" height="16" border="0" /></a>
 215                          <?php
 216                              } else {
 217                                  echo '-';
 218                              }
 219                          ?>
 220                      </td>
 221                      <?php 
 222                          } 
 223                      ?>
 224                  </tr>
 225          <?php
 226          }
 227          ?>
 228              </tbody>
 229          </table>
 230          <?php
 231          } else {
 232          ?>
 233          <p>&nbsp;</p>
 234          <p align="center">- <?php echo $langProject['user_no_project']; ?> -</p>
 235          <p>&nbsp;</p>
 236          <?php
 237          }
 238          ?>
 239          </form>
 240      </fieldset>
 241    </div>
 242  </div>
 243  <?php
 244  include PRJ_INCLUDE_PATH.'html/footer.php';
 245  ?>


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