'; $html[] = JHtml::_('tabs.start', 'acl-rules-' . $assetId, array('useCookie' => 1)); $html[] = JHtml::_('tabs.panel', JText::_('JLIB_HTML_ACCESS_SUMMARY'), 'summary'); $html[] = '

' . JText::_('JLIB_HTML_ACCESS_SUMMARY_DESC') . '

'; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; foreach ($actions as $i => $action) { $html[] = ' '; } $html[] = ' '; foreach ($groups as $i => $group) { $html[] = ' '; $html[] = ' '; foreach ($actions as $j => $action) { $html[] = ' '; } $html[] = ' '; } $html[] = '
' . JText::_('JLIB_HTML_ACCESS_SUMMARY_DESC_CAPTION') . '
' . JText::_('JLIB_RULES_GROUPS') . '' . JText::_($action->title) . '
' . $group->text . '' . ($assetId ? ($inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny']) : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '
'; foreach ($actions as $action) { $actionTitle = JText::_($action->title); $actionDesc = JText::_($action->description); $html[] = JHtml::_('tabs.panel', $actionTitle, $action->name); $html[] = '

' . $actionDesc . '

'; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; foreach ($groups as $i => $group) { $selected = $rules->allow($action->name, $group->value); $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; } $html[] = '
' . JText::_('JLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_ACL') . ' ' . $actionTitle . ' ' . JText::_('JLIB_HTML_ACCESS_MODIFY_DESC_CAPTION_TABLE') . '
' . JText::_('JLIB_RULES_GROUP') . '' . JText::_('JLIB_RULES_INHERIT') . '' . JText::_('JMODIFY') . '' . JText::_('JCURRENT') . '
' . $group->text . '' . ($inheriting->allow($action->name, $group->identities) ? $images['allow-i'] : $images['deny-i']) . ''; $html[] = ' '; $html[] = ' ' . ($assetId ? ($inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny']) : ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '
'; } $html[] = JHtml::_('tabs.end'); // Build the footer with legend and special purpose buttons. $html[] = '
'; $html[] = ' '; $html[] = ''; return implode("\n", $html); } /** * Get the id of the parent asset * * @param integer $assetId The asset for which the parentid will be returned * * @return integer The id of the parent asset * * @since 1.6 */ protected static function _getParentAssetId($assetId) { // Get a database object. $db = JFactory::getDbo(); $query = $db->getQuery(true); // Get the user groups from the database. $query->select($db->quoteName('parent_id')) ->from($db->quoteName('#__assets')) ->where($db->quoteName('id') . ' = ' . (int) $assetId); $db->setQuery($query); return (int) $db->loadResult(); } /** * Get the user groups * * @return array Array of user groups * * @since 1.6 */ protected static function _getUserGroups() { // Get a database object. $db = JFactory::getDbo(); // Get the user groups from the database. $db->setQuery( 'SELECT a.id AS value, a.title AS text, b.id as parent' . ' FROM #__usergroups AS a LEFT JOIN #__usergroups AS b ON a.lft >= b.lft AND a.rgt <= b.rgt' . ' ORDER BY a.lft ASC, b.lft ASC' ); $result = $db->loadObjectList(); $options = array(); // Pre-compute additional values. foreach ($result as $option) { $end = end($options); if ($end === false || $end->value != $option->value) { $end = $option; $end->level = 0; $options[] = $end; } else { $end->level++; } $end->identities[] = $option->parent; } return $options; } /** * Get the array of images associate with specific permissions * * @return array An associative array of permissions and images * * @since 1.6 */ protected static function _getImagesArray() { $images['allow-l'] = ''; $images['deny-l'] = ''; $images['allow'] = ' '; $images['deny'] = ' '; $images['allow-i'] = ' '; $images['deny-i'] = ' '; return $images; } }