[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_users/views/user/ -> view.html.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: view.html.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @subpackage    Users
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is included in Joomla!
  16  defined('_JEXEC') or die( 'Restricted access' );
  17  
  18  jimport( 'joomla.application.component.view');
  19  
  20  /**
  21   * HTML View class for the Users component
  22   *
  23   * @static
  24   * @package        Joomla
  25   * @subpackage    Users
  26   * @since 1.0
  27   */
  28  class UsersViewUser extends JView
  29  {
  30  	function display($tpl = null)
  31      {
  32          $cid        = JRequest::getVar( 'cid', array(0), '', 'array' );
  33          $edit        = JRequest::getVar('edit',true);
  34          $me         = JFactory::getUser();
  35          JArrayHelper::toInteger($cid, array(0));
  36  
  37          $db         =& JFactory::getDBO();
  38          if($edit)
  39              $user         =& JUser::getInstance( $cid[0] );
  40          else
  41              $user         =& JUser::getInstance();
  42  
  43          $myuser        =& JFactory::getUser();
  44          $acl        =& JFactory::getACL();
  45  
  46          // Check for post data in the event that we are returning
  47          // from a unsuccessful attempt to save data
  48          $post = JRequest::get('post');
  49          if ( $post ) {
  50              $user->bind($post);
  51          }
  52  
  53          if ( $user->get('id'))
  54          {
  55              $query = 'SELECT *'
  56              . ' FROM #__contact_details'
  57              . ' WHERE user_id = '.(int) $cid[0]
  58              ;
  59              $db->setQuery( $query );
  60              $contact = $db->loadObjectList();
  61          }
  62          else
  63          {
  64              $contact     = NULL;
  65              // Get the default group id for a new user
  66              $config        = &JComponentHelper::getParams( 'com_users' );
  67              $newGrp        = $config->get( 'new_usertype' );
  68              $user->set( 'gid', $acl->get_group_id( $newGrp, null, 'ARO' ) );
  69          }
  70  
  71          $userObjectID     = $acl->get_object_id( 'users', $user->get('id'), 'ARO' );
  72          $userGroups     = $acl->get_object_groups( $userObjectID, 'ARO' );
  73          $userGroupName     = strtolower( $acl->get_group_name( $userGroups[0], 'ARO' ) );
  74  
  75          $myObjectID     = $acl->get_object_id( 'users', $myuser->get('id'), 'ARO' );
  76          $myGroups         = $acl->get_object_groups( $myObjectID, 'ARO' );
  77          $myGroupName     = strtolower( $acl->get_group_name( $myGroups[0], 'ARO' ) );;
  78  
  79          // ensure user can't add/edit group higher than themselves
  80          /* NOTE : This check doesn't work commented out for the time being
  81          if ( is_array( $myGroups ) && count( $myGroups ) > 0 )
  82          {
  83              $excludeGroups = (array) $acl->get_group_children( $myGroups[0], 'ARO', 'RECURSE' );
  84          }
  85          else
  86          {
  87              $excludeGroups = array();
  88          }
  89  
  90          if ( in_array( $userGroups[0], $excludeGroups ) )
  91          {
  92              echo 'not auth';
  93              $mainframe->redirect( 'index.php?option=com_users', JText::_('NOT_AUTH') );
  94          }
  95          */
  96  
  97          /*
  98          if ( $userGroupName == 'super administrator' )
  99          {
 100              // super administrators can't change
 101               $lists['gid'] = '<input type="hidden" name="gid" value="'. $currentUser->gid .'" /><strong>'. JText::_( 'Super Administrator' ) .'</strong>';
 102          }
 103          else if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' ) {
 104          */
 105  
 106          if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' )
 107          {
 108              // administrators can't change each other
 109              $lists['gid'] = '<input type="hidden" name="gid" value="'. $user->get('gid') .'" /><strong>'. JText::_( 'Administrator' ) .'</strong>';
 110          }
 111          else
 112          {
 113              $gtree = $acl->get_group_children_tree( null, 'USERS', false );
 114  
 115              // remove users 'above' me
 116              //$i = 0;
 117              //while ($i < count( $gtree )) {
 118              //    if ( in_array( $gtree[$i]->value, (array)$excludeGroups ) ) {
 119              //        array_splice( $gtree, $i, 1 );
 120              //    } else {
 121              //        $i++;
 122              //    }
 123              //}
 124  
 125              $lists['gid']     = JHTML::_('select.genericlist',   $gtree, 'gid', 'size="10"', 'value', 'text', $user->get('gid') );
 126          }
 127  
 128          // build the html select list
 129          $lists['block']     = JHTML::_('select.booleanlist',  'block', 'class="inputbox" size="1"', $user->get('block') );
 130  
 131          // build the html select list
 132          $lists['sendEmail'] = JHTML::_('select.booleanlist',  'sendEmail', 'class="inputbox" size="1"', $user->get('sendEmail') );
 133  
 134          $this->assignRef('me',         $me);
 135          $this->assignRef('lists',    $lists);
 136          $this->assignRef('user',    $user);
 137          $this->assignRef('contact',    $contact);
 138  
 139          parent::display($tpl);
 140      }
 141  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1