Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JFormFieldRules
+ Graphe d'héritage de JFormFieldRules:
+ Graphe de collaboration de JFormFieldRules:

Liste de tous les membres

Fonctions membres publiques

 __get ($name)
 __set ($name, $value)
 setup (SimpleXMLElement $element, $value, $group=null)
- Fonctions membres publiques inherited from JFormField
 __construct ($form=null)
 setForm (JForm $form)
 setValue ($value)
 getAttribute ($name, $default=null)
 getControlGroup ()

Fonctions membres protégées

 getInput ()
 getUserGroups ()
- Fonctions membres protégées inherited from JFormField
 getId ($fieldId, $fieldName)
 getTitle ()
 getLabel ()
 getName ($fieldName)
 getFieldName ($fieldName)

Attributs protégés

 $type = 'Rules'
 $section
 $component
 $assetField
- Attributs protégés inherited from JFormField
 $description
 $hint
 $autocomplete = 'on'
 $spellcheck = true
 $autofocus = false
 $element
 $form
 $formControl
 $hidden = false
 $translateLabel = true
 $translateDescription = true
 $translateHint = true
 $id
 $input
 $label
 $multiple = false
 $pattern
 $name
 $fieldname
 $group
 $required = false
 $disabled = false
 $readonly = false
 $validate
 $value
 $default
 $size
 $class
 $labelClass
 $onchange
 $onclick

Additional Inherited Members

- Attributs publics inherited from JFormField
 $repeat = false
- Attributs protégés statiques inherited from JFormField
static $count = 0
static $generated_fieldname = '__field'

Description détaillée

Définition à la ligne 21 du fichier rules.php.


Documentation des fonctions membres

JFormFieldRules::__get (   $name)

Method to get certain otherwise inaccessible properties from the form field object.

Paramètres:
string$nameThe property name for which to the the value.
Renvoie:
mixed The property value or null.
Depuis:
3.2

Réimplémentée à partir de JFormField.

Définition à la ligne 64 du fichier rules.php.

{
switch ($name)
{
case 'section':
case 'component':
case 'assetField':
return $this->$name;
}
}
JFormFieldRules::__set (   $name,
  $value 
)

Method to set certain otherwise inaccessible properties of the form field object.

Paramètres:
string$nameThe property name for which to the the value.
mixed$valueThe value of the property.
Renvoie:
void
Depuis:
3.2

Réimplémentée à partir de JFormField.

Définition à la ligne 87 du fichier rules.php.

{
switch ($name)
{
case 'section':
case 'component':
case 'assetField':
$this->$name = (string) $value;
break;
default:
}
}
JFormFieldRules::getInput ( )
protected

Method to get the field input markup for Access Control Lists. Optionally can be associated with a specific component and section.

Renvoie:
string The field input markup.
Depuis:
11.1
A faire:
: Add access check.

Réimplémentée à partir de JFormField.

Définition à la ligne 139 du fichier rules.php.

Références JText\_(), JAccess\checkGroup(), JAccess\getActions(), JAccess\getAssetRules(), JFactory\getDbo(), et JText\sprintf().

{
JHtml::_('bootstrap.tooltip');
// Initialise some field attributes.
// Get the actions for the asset.
// Iterate over the children and add to the actions.
foreach ($this->element->children() as $el)
{
if ($el->getName() == 'action')
{
$actions[] = (object) array('name' => (string) $el['name'], 'title' => (string) $el['title'],
'description' => (string) $el['description']);
}
}
// Get the explicit rules for this asset.
if ($section == 'component')
{
// Need to find the asset id by the name of the component.
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$assetId = (int) $db->loadResult();
}
else
{
// Find the asset id of the content.
// Note that for global configuration, com_config injects asset_id = 1 into the form.
$assetId = $this->form->getValue($assetField);
}
// Full width format.
// Get the rules for just this asset (non-recursive).
$assetRules = JAccess::getAssetRules($assetId);
// Get the available user groups.
$groups = $this->getUserGroups();
// Prepare output
$html = array();
// Description
$html[] = '<p class="rule-desc">' . JText::_('JLIB_RULES_SETTINGS_DESC') . '</p>';
// Begin tabs
$html[] = '<div id="permissions-sliders" class="tabbable tabs-left">';
// Building tab nav
$html[] = '<ul class="nav nav-tabs">';
foreach ($groups as $group)
{
// Initial Active Tab
$active = "";
if ($group->value == 1)
{
$active = "active";
}
$html[] = '<li class="' . $active . '">';
$html[] = '<a href="#permission-' . $group->value . '" data-toggle="tab">';
$html[] = str_repeat('<span class="level">&ndash;</span> ', $curLevel = $group->level) . $group->text;
$html[] = '</a>';
$html[] = '</li>';
}
$html[] = '</ul>';
$html[] = '<div class="tab-content">';
// Start a row for each user group.
foreach ($groups as $group)
{
// Initial Active Pane
$active = "";
if ($group->value == 1)
{
$active = " active";
}
$html[] = '<div class="tab-pane' . $active . '" id="permission-' . $group->value . '">';
$html[] = '<table class="table table-striped">';
$html[] = '<thead>';
$html[] = '<tr>';
$html[] = '<th class="actions" id="actions-th' . $group->value . '">';
$html[] = '<span class="acl-action">' . JText::_('JLIB_RULES_ACTION') . '</span>';
$html[] = '</th>';
$html[] = '<th class="settings" id="settings-th' . $group->value . '">';
$html[] = '<span class="acl-action">' . JText::_('JLIB_RULES_SELECT_SETTING') . '</span>';
$html[] = '</th>';
// The calculated setting is not shown for the root group of global configuration.
$canCalculateSettings = ($group->parent_id || !empty($component));
if ($canCalculateSettings)
{
$html[] = '<th id="aclactionth' . $group->value . '">';
$html[] = '<span class="acl-action">' . JText::_('JLIB_RULES_CALCULATED_SETTING') . '</span>';
$html[] = '</th>';
}
$html[] = '</tr>';
$html[] = '</thead>';
$html[] = '<tbody>';
foreach ($actions as $action)
{
$html[] = '<tr>';
$html[] = '<td headers="actions-th' . $group->value . '">';
$html[] = '<label for="' . $this->id . '_' . $action->name . '_' . $group->value . '" class="hasTooltip" title="'
. htmlspecialchars(JText::_($action->title) . ' ' . JText::_($action->description), ENT_COMPAT, 'UTF-8') . '">';
$html[] = JText::_($action->title);
$html[] = '</label>';
$html[] = '</td>';
$html[] = '<td headers="settings-th' . $group->value . '">';
$html[] = '<select class="input-small" name="' . $this->name . '[' . $action->name . '][' . $group->value . ']" id="' . $this->id . '_' . $action->name
. '_' . $group->value . '" title="'
. JText::sprintf('JLIB_RULES_SELECT_ALLOW_DENY_GROUP', JText::_($action->title), trim($group->text)) . '">';
$inheritedRule = JAccess::checkGroup($group->value, $action->name, $assetId);
// Get the actual setting for the action for this group.
$assetRule = $assetRules->allow($action->name, $group->value);
// Build the dropdowns for the permissions sliders
// The parent group has "Not Set", all children can rightly "Inherit" from that.
$html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>'
. JText::_(empty($group->parent_id) && empty($component) ? 'JLIB_RULES_NOT_SET' : 'JLIB_RULES_INHERITED') . '</option>';
$html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . JText::_('JLIB_RULES_ALLOWED')
. '</option>';
$html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . JText::_('JLIB_RULES_DENIED')
. '</option>';
$html[] = '</select>&#160; ';
// If this asset's rule is allowed, but the inherited rule is deny, we have a conflict.
if (($assetRule === true) && ($inheritedRule === false))
{
$html[] = JText::_('JLIB_RULES_CONFLICT');
}
$html[] = '</td>';
// Build the Calculated Settings column.
// The inherited settings column is not displayed for the root group in global configuration.
if ($canCalculateSettings)
{
$html[] = '<td headers="aclactionth' . $group->value . '">';
// This is where we show the current effective settings considering currrent group, path and cascade.
// Check whether this is a component or global. Change the text slightly.
if (JAccess::checkGroup($group->value, 'core.admin', $assetId) !== true)
{
if ($inheritedRule === null)
{
$html[] = '<span class="label label-important">' . JText::_('JLIB_RULES_NOT_ALLOWED') . '</span>';
}
elseif ($inheritedRule === true)
{
$html[] = '<span class="label label-success">' . JText::_('JLIB_RULES_ALLOWED') . '</span>';
}
elseif ($inheritedRule === false)
{
if ($assetRule === false)
{
$html[] = '<span class="label label-important">' . JText::_('JLIB_RULES_NOT_ALLOWED') . '</span>';
}
else
{
$html[] = '<span class="label"><i class="icon-lock icon-white"></i> ' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED')
. '</span>';
}
}
}
elseif (!empty($component))
{
$html[] = '<span class="label label-success"><i class="icon-lock icon-white"></i> ' . JText::_('JLIB_RULES_ALLOWED_ADMIN')
. '</span>';
}
else
{
// Special handling for groups that have global admin because they can't be denied.
// The admin rights can be changed.
if ($action->name === 'core.admin')
{
$html[] = '<span class="label label-success">' . JText::_('JLIB_RULES_ALLOWED') . '</span>';
}
elseif ($inheritedRule === false)
{
// Other actions cannot be changed.
$html[] = '<span class="label label-important"><i class="icon-lock icon-white"></i> '
. JText::_('JLIB_RULES_NOT_ALLOWED_ADMIN_CONFLICT') . '</span>';
}
else
{
$html[] = '<span class="label label-success"><i class="icon-lock icon-white"></i> ' . JText::_('JLIB_RULES_ALLOWED_ADMIN')
. '</span>';
}
}
$html[] = '</td>';
}
$html[] = '</tr>';
}
$html[] = '</tbody>';
$html[] = '</table></div>';
}
$html[] = '</div></div>';
$html[] = '<div class="alert">';
if ($section == 'component' || $section == null)
{
$html[] = JText::_('JLIB_RULES_SETTING_NOTES');
}
else
{
$html[] = JText::_('JLIB_RULES_SETTING_NOTES_ITEM');
}
$html[] = '</div>';
return implode("\n", $html);
}

+ Voici le graphe d'appel pour cette fonction :

JFormFieldRules::getUserGroups ( )
protected

Get a list of the user groups.

Renvoie:
array
Depuis:
11.1

Définition à la ligne 393 du fichier rules.php.

Références JFactory\getDbo().

{
$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level, a.parent_id')
->from('#__usergroups AS a')
->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt')
->group('a.id, a.title, a.lft, a.rgt, a.parent_id')
->order('a.lft ASC');
$db->setQuery($query);
$options = $db->loadObjectList();
return $options;
}

+ Voici le graphe d'appel pour cette fonction :

JFormFieldRules::setup ( SimpleXMLElement  $element,
  $value,
  $group = null 
)

Method to attach a JForm object to the field.

Paramètres:
SimpleXMLElement$elementThe SimpleXMLElement object representing the <field> tag for the form field object.
mixed$valueThe form field value to validate.
string$groupThe field name group control value. This acts as as an array container for the field. For example if the field has name="foo" and the group value is set to "bar" then the full field name would end up being "bar[foo]".
Renvoie:
boolean True on success.
Voir également:
JFormField::setup()
Depuis:
3.2

Réimplémentée à partir de JFormField.

Définition à la ligne 116 du fichier rules.php.

{
if ($return)
{
$this->section = $this->element['section'] ? (string) $this->element['section'] : '';
$this->component = $this->element['component'] ? (string) $this->element['component'] : '';
$this->assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
}
return $return;
}

Documentation des données membres

JFormFieldRules::$assetField
protected

Définition à la ligne 53 du fichier rules.php.

JFormFieldRules::$component
protected

Définition à la ligne 45 du fichier rules.php.

JFormFieldRules::$section
protected

Définition à la ligne 37 du fichier rules.php.

JFormFieldRules::$type = 'Rules'
protected

Réimplémentée à partir de JFormField.

Définition à la ligne 29 du fichier rules.php.


La documentation de cette classe a été générée à partir du fichier suivant :