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