Source for file user.php
Documentation is available at user.php
* @package FrameworkOnFramework
* @copyright Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
// Protect from unauthorized access
require_once JPATH_LIBRARIES .
'/cms/form/field/user.php';
* Form Field class for the FOF framework
* A user selection box / display field
* @package FrameworkOnFramework
/** @var FOFTable The item being rendered in a repeatable form field */
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
* Method to get certain otherwise inaccessible properties from the form field object.
* @param string $name The property name for which to the the value.
* @return mixed The property value or null.
public function __get($name)
return parent::__get($name);
* Get the rendering of this field type for static display, e.g. in a single
* item view (typically a "read" task).
* @return string The field HTML
// Get the field parameters
$class =
' class="' . (string)
$this->element['class'] .
'"';
if ($this->element['show_username'] ==
'false')
if ($this->element['show_email'] ==
'true')
if ($this->element['show_name'] ==
'true')
if ($this->element['show_id'] ==
'true')
$html =
'<div id="' .
$this->id .
'" ' .
$class .
'>';
$html .=
'<span class="fof-userfield-username">' .
$user->username .
'</span>';
$html .=
'<span class="fof-userfield-id">' .
$user->id .
'</span>';
$html .=
'<span class="fof-userfield-name">' .
$user->name .
'</span>';
$html .=
'<span class="fof-userfield-email">' .
$user->email .
'</span>';
* Get the rendering of this field type for a repeatable (grid) display,
* e.g. in a view listing many item (typically a "browse" task)
* @return string The field HTML
$avatar_method =
'gravatar';
// Get the field parameters
$class =
' class="' . (string)
$this->element['class'] .
'"';
if ($this->element['show_username'] ==
'false')
if ($this->element['show_email'] ==
'false')
if ($this->element['show_name'] ==
'false')
if ($this->element['show_id'] ==
'false')
if ($this->element['show_avatar'] ==
'false')
if ($this->element['avatar_method'])
$avatar_size =
$this->element['avatar_size'];
if ($this->element['show_link'] ==
'true')
$link_url =
$this->element['link_url'];
// If no link is defined in the back-end, assume the user edit
// link in the User Manager component
$link_url =
'index.php?option=com_users&task=user.edit&id=[USER:ID]';
// If no link is defined in the front-end, we can't create a
// default link. Therefore, show no link.
// Post-process the link URL
'[USER:ID]' =>
$user->id,
'[USER:USERNAME]' =>
$user->username,
'[USER:EMAIL]' =>
$user->email,
'[USER:NAME]' =>
$user->name,
foreach ($replacements as $key =>
$value)
// Get the avatar image, if necessary
if ($avatar_method ==
'plugin')
// Use the user plugins to get an avatar
foreach ($jResponse as $response)
// Fall back to the Gravatar method
$md5 =
md5($user->email);
$scheme =
JURI::getInstance()->getScheme();
$avatar_url =
'http://www.gravatar.com/avatar/' .
$md5 .
'.jpg?s='
.
$avatar_size .
'&d=mm';
$avatar_url =
'https://secure.gravatar.com/avatar/' .
$md5 .
'.jpg?s='
.
$avatar_size .
'&d=mm';
$html =
'<div id="' .
$this->id .
'" ' .
$class .
'>';
$html .=
'<img src="' .
$avatar_url .
'" align="left" class="fof-usersfield-avatar" />';
$html .=
'<a href="' .
$link_url .
'">';
$html .=
'<span class="fof-usersfield-username">' .
$user->username
$html .=
'<span class="fof-usersfield-id">' .
$user->id
$html .=
'<span class="fof-usersfield-name">' .
$user->name
$html .=
'<span class="fof-usersfield-email">' .
$user->email
Documentation generated on Tue, 19 Nov 2013 15:16:30 +0100 by phpDocumentor 1.4.3