本文整理汇总了PHP中JFactory::getACL方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getACL方法的具体用法?PHP JFactory::getACL怎么用?PHP JFactory::getACL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::getACL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hikashopSubscriptionType
function hikashopSubscriptionType()
{
if (!HIKASHOP_PHP5) {
$acl =& JFactory::getACL();
} else {
$acl = JFactory::getACL();
}
if (!HIKASHOP_J16) {
$this->groups = $acl->get_group_children_tree(null, 'USERS', false);
} else {
$db = JFactory::getDBO();
$db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC');
$this->groups = $db->loadObjectList('id');
foreach ($this->groups as $id => $group) {
if (isset($this->groups[$group->parent_id])) {
$this->groups[$id]->level = intval(@$this->groups[$group->parent_id]->level) + 1;
$this->groups[$id]->text = str_repeat('- - ', $this->groups[$id]->level) . $this->groups[$id]->text;
}
}
}
$this->choice = array();
$this->choice[] = JHTML::_('select.option', 'none', JText::_('HIKA_NONE'));
$this->choice[] = JHTML::_('select.option', 'special', JText::_('HIKA_CUSTOM'));
$js = "function updateSubscription(map){\r\n\t\t\tchoice = document.adminForm['choice_'+map];\r\n\t\t\tchoiceValue = 'special';\r\n\t\t\tfor (var i=0; i < choice.length; i++){\r\n\t\t\t\tif (choice[i].checked){\r\n\t\t\t\t\tchoiceValue = choice[i].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\thiddenVar = document.getElementById('hidden_'+map);\r\n\t\t\tif(choiceValue != 'special'){\r\n\t\t\t\thiddenVar.value = choiceValue;\r\n\t\t\t\tif(hiddenVar.value == 'none') hiddenVar.value = '';\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = 'none';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('div_'+map).style.display = '';\r\n\t\t\t\tspecialVar = eval('document.adminForm.special_'+map);\r\n\t\t\t\tfinalValue = '';\r\n\t\t\t\tfor (var i=0; i < specialVar.length; i++){\r\n\t\t\t\t\tif (specialVar[i].checked){\r\n\t\t\t\t\t\tfinalValue += specialVar[i].value;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\thiddenVar.value = finalValue;\r\n\t\t\t}\r\n\t\t}";
if (!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addScriptDeclaration($js);
}
示例2: getInput15
function getInput15($name, $id, $value, $params, $children)
{
$this->params = $params;
$root = $this->def('root', 'USERS');
$showroot = $this->def('showroot');
if (strtoupper($root) == 'USERS' && $showroot == '') {
$showroot = 0;
}
$multiple = $this->def('multiple');
$notregistered = $this->def('notregistered');
$control = $name . '';
$acl =& JFactory::getACL();
$options = $acl->get_group_children_tree(null, $root, $showroot);
if ($notregistered) {
$option = new stdClass();
$option->value = 0;
$option->text = JText::_('NN_NOT_LOGGED_IN');
$option->disable = '';
array_unshift($options, $option);
}
foreach ($options as $i => $option) {
$item_name = $option->text;
$padding = 0;
if (strpos($item_name, ' ') === 0 || strpos($item_name, '- ') === 0) {
$item_name = preg_replace('#^-? #', '', $item_name);
} else {
if (strpos($item_name, '. ') === 0 || strpos($item_name, ' ') === 0) {
$item_name = preg_replace('#^\\. #', ' ', $item_name);
while (strpos($item_name, ' ') === 0) {
$padding++;
$item_name = substr($item_name, 36);
}
$item_name = preg_replace('#^- #', '', $item_name);
}
}
for ($p = 0; $p < $padding; $p++) {
$item_name = ' ' . $item_name;
}
$options[$i]->text = $item_name;
}
if ($multiple) {
$control .= '[]';
if (!is_array($value)) {
$value = explode(',', $value);
}
if (in_array(29, $value)) {
$value[] = 18;
$value[] = 19;
$value[] = 20;
$value[] = 21;
}
if (in_array(30, $value)) {
$value[] = 23;
$value[] = 24;
$value[] = 25;
}
}
require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'html.php';
return nnHTML::selectlist($options, $control, $value, $id, 5, $multiple, 0, 1);
}
示例3: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication('site');
$acl = JFactory::getACL();
$task = $mainframe->input->get('task', 'contests');
$this->task = $task;
$filter_order = $mainframe->getUserStateFromRequest('com_jvarcade.contests.filter_order', 'filter_order', 'startdatetime', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest('com_jvarcade.contests.filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter_order_Dir = $filter_order_Dir ? $filter_order_Dir : 'DESC';
// ensure filter_order has a valid value.
if (!in_array($filter_order, array('id', 'name', 'startdatetime', 'enddatetime', 'maxplaycount', 'published'))) {
$filter_order = 'startdatetime';
}
$model = $this->getModel();
$model->setOrderBy($filter_order);
$model->setOrderDir($filter_order_Dir);
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$this->lists = $lists;
$contests = $model->getContests();
$pagination = $model->getPagination();
$this->pagination = $pagination;
$this->contests = $contests;
//~ $this->permnames = $model->getAcl();
JToolBarHelper::title(JText::_('COM_JVARCADE_CONTESTS'), 'jvacontests');
JToolBarHelper::editList('editcontest', JText::_('COM_JVARCADE_CONTESTS_EDIT'));
JToolBarHelper::addNew('addcontest', JText::_('COM_JVARCADE_CONTESTS_ADD'));
JToolBarHelper::deleteList(JText::_('COM_JVARCADE_CONTESTS_ASK_DELETE'), 'deleteContest', JText::_('COM_JVARCADE_CONTESTS_DELETE'));
JToolBarHelper::publishList('contestPublish', JText::_('COM_JVARCADE_CONTESTS_PUBLISH'));
JToolBarHelper::unpublishList('contestUnpublish', JText::_('COM_JVARCADE_CONTESTS_UNPUBLISH'));
jvarcadeToolbarHelper::addSubmenu($this->getName());
$this->addSidebar('contests');
parent::display($tpl);
}
示例4: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
// Must load admin language files
$lang =& JFactory::getLanguage();
$lang->load("com_jevents", JPATH_ADMINISTRATOR);
// TODO 1.6 ACL VERSION OF THIS
if (JVersion::isCompatible("1.6.0")) {
return "";
}
$acl =& JFactory::getACL();
$gtree = $acl->get_group_children_tree(null, 'USERS', false);
foreach ($gtree as &$item) {
if ($item->value > 25) {
$item->disable = true;
}
}
unset($item);
$ctrl = $control_name . '[' . $name . ']';
$attribs = ' ';
if ($v = $node->attributes('size')) {
$attribs .= 'size="' . $v . '"';
}
if ($v = $node->attributes('class')) {
$attribs .= 'class="' . $v . '"';
} else {
$attribs .= 'class="inputbox"';
}
if ($m = $node->attributes('multiple')) {
$attribs .= 'multiple="multiple"';
$ctrl .= '[]';
//$value = implode( '|', )
}
//array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'SELECT_EDITOR' ) .' -' ) );
return JHTML::_('select.genericlist', $gtree, $ctrl, $attribs, 'value', 'text', $value, $control_name . $name);
}
示例5: assignPoint
/**
* add points to user based on the action.
*/
function assignPoint($action, $userId = null)
{
//get the rule points
//must use the JFactory::getUser to get the aid
$juser =& JFactory::getUser($userId);
if ($juser->id != 0) {
$aid = $juser->aid;
// if the aid is null, means this is not the current logged-in user.
// so we need to manually get this aid for this user.
if (is_null($aid)) {
$aid = 0;
//defautl to 0
// Get an ACL object
$acl =& JFactory::getACL();
$grp = $acl->getAroGroup($juser->id);
$group = 'USERS';
if ($acl->is_group_child_of($grp->name, $group)) {
$aid = 1;
// Fudge Authors, Editors, Publishers and Super Administrators into the special access group
if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
$aid = 2;
}
}
}
$points = CUserPoints::_getActionPoint($action, $aid);
$user = CFactory::getUser($userId);
$points += $user->getKarmaPoint();
$user->_points = $points;
$user->save();
}
}
示例6: display
public function display()
{
// Display the toolbar
$toolbar = $this->_createToolbar()->reset();
$this->toolbar = KFactory::get($this->getToolbar(), array('isGrid' => false))->append(KFactory::get('admin::com.ninja.toolbar.button.apply', array('isGrid' => false)));
KFactory::get('admin::com.ninja.helper.default')->css('/' . $this->getIdentifier()->application . '.' . $this->getName() . '.css');
KFactory::get('admin::com.ninja.helper.default')->js('/raphael.js');
KFactory::get('admin::com.ninja.helper.default')->js('/Mapper.js');
$acl = JFactory::getACL();
//die('<pre>'.print_r(get_class_methods($acl), true).'</pre>');
$acltree = (array) $acl->get_group_children_tree(null, 'USERS', false);
array_unshift($acltree, (object) array('value' => 0, 'text' => 'Unregistered', 'disabled' => false));
$this->acltree = $acltree;
$this->usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->limit(0)->getList();
$maps = array();
foreach (KFactory::tmp($this->getModel()->getIdentifier())->limit(0)->getList() as $map) {
$maps[$map->id] = $map->ninjaboard_gid;
}
$this->maps = $maps;
$display = parent::display();
if (KRequest::type() == 'AJAX') {
echo '<script type="text/javascript">
' . $this->_document->_script['text/javascript'] . '
</script>';
}
return $display;
}
示例7: display
function display($tpl = null)
{
$cid = JRequest::getVar('cid', array(0), 'get', 'array');
$edit = JRequest::getVar('edit', true);
$me = JFactory::getUser();
JArrayHelper::toInteger($cid, array(0));
$db = JFactory::getDBO();
$user = JTable::getInstance('ExtUser', 'KunenaImporterTable');
$user->load($cid[0]);
$importer = $this->getModel('import');
$items = $importer->findPotentialUsers($user, true);
$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);
}*/
// 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('items', $items);
JToolBarHelper::makeDefault('select', 'Select');
JToolBarHelper::back();
parent::display($tpl);
}
示例8: eb_acl
/**
* Sets the parent groups with the same acl
*
* @param $location
* @param $toplevel
* @return true
*/
function eb_acl($location, $lowerlevel)
{
// set it once so that we dont have to keep doing this
static $acl = null;
if (is_null($acl)) {
$acl =& JFactory::getACL();
}
//set acl for public access
if ($lowerlevel == 'Public') {
$acl->_mos_add_acl(EBOOK_COMPONENT, $location, 'users', 'Public');
}
//we set all of the parent groups to this same value
$AROs = array_reverse($acl->get_group_children_tree());
//looping through all of the group types
foreach ($AROs as $ARO) {
//getting the group names
$gname = $acl->get_group_name($ARO->value);
//some groups dont count
if ($gname == 'ROOT' || $gname == 'USERS' || $gname == 'Public Frontend' || $gname == 'Public Backend') {
continue;
}
//setting it as an acl
$acl->_mos_add_acl(EBOOK_COMPONENT, $location, 'users', $gname);
//quit if we're at the highest that we want to go
if ($lowerlevel == $gname) {
break;
}
}
return true;
}
示例9: display
function display($tpl = null)
{
$cid = JRequest::getVar('cid', array(0), '', 'array');
$id = intval($cid[0]);
$db =& JFactory::getDBO();
$acl = JFactory::getACL();
$query = "SELECT id, name FROM #__groups WHERE id = {$id}";
$db->setQuery($query);
$row = $db->loadObject();
$query = "SELECT id_group FROM #__noixacl_groups_level WHERE id_levels like '%{$id}%'";
$db->setQuery($query);
$rowGroups = $db->loadObjectList();
$levelGroups = JArrayHelper::getColumn($rowGroups, 'id_group');
/**
* get groups
*/
$aclGroups = $acl->sort_groups();
/**
* format groups
*/
$groups = $acl->format_groups($aclGroups, 'html', 28);
$this->assignRef('accesslevel', $row);
$this->assignRef('levelGroups', $levelGroups);
$this->assignRef('groups', $groups);
$text = !$cid[0] ? JText::_('NOIXACL_VIEW_ACCESSLEVEL_TEXT_EDIT') : JText::_('NOIXACL_VIEW_ACCESSLEVEL_TEXT_NEW');
JToolBarHelper::title(JText::_('NOIXACL_VIEW_ACCESSLEVEL_TEXT_GROUP') . ': <small><small>[ ' . $text . ' ]</small></small>', 'user.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
parent::display($tpl);
}
示例10: bind
/**
* Overloaded bind function to pre-process the params.
*
* @param array Named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = '')
{
$input = JFactory::getApplication()->input;
$task = $input->getString('task', '');
if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_dzproduct') && $array['state'] == 1)) {
$array['state'] = 0;
}
//Support for multiple or not foreign key field: itemid
if (isset($array['itemid'])) {
if (is_array($array['itemid'])) {
$array['itemid'] = implode(',', $array['itemid']);
} else {
if (strrpos($array['itemid'], ',') != false) {
$array['itemid'] = explode(',', $array['itemid']);
} else {
if (empty($array['itemid'])) {
$array['itemid'] = '';
}
}
}
}
//Support for multiple or not foreign key field: fieldid
if (isset($array['fieldid'])) {
if (is_array($array['fieldid'])) {
$array['fieldid'] = implode(',', $array['fieldid']);
} else {
if (strrpos($array['fieldid'], ',') != false) {
$array['fieldid'] = explode(',', $array['fieldid']);
} else {
if (empty($array['fieldid'])) {
$array['fieldid'] = '';
}
}
}
}
if (isset($array['params']) && is_array($array['params'])) {
$registry = new JRegistry();
$registry->loadArray($array['params']);
$array['params'] = (string) $registry;
}
if (isset($array['metadata']) && is_array($array['metadata'])) {
$registry = new JRegistry();
$registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry;
}
if (!JFactory::getUser()->authorise('core.admin', 'com_dzproduct.fielddata.' . $array['id'])) {
$actions = JFactory::getACL()->getActions('com_dzproduct', 'fielddata');
$default_actions = JFactory::getACL()->getAssetRules('com_dzproduct.fielddata.' . $array['id'])->getData();
$array_jaccess = array();
foreach ($actions as $action) {
$array_jaccess[$action->name] = $default_actions[$action->name];
}
$array['rules'] = $this->JAccessRulestoArray($array_jaccess);
}
//Bind the rules for ACL where supported.
if (isset($array['rules']) && is_array($array['rules'])) {
$this->setRules($array['rules']);
}
return parent::bind($array, $ignore);
}
示例11: create_joomla_user
static function create_joomla_user($user_info)
{
$usersConfig = JComponentHelper::getParams('com_users');
$authorize = JFactory::getACL();
$user = new JUser();
// Initialize new usertype setting
$newUsertype = $usersConfig->get('new_usertype');
if (!$newUsertype) {
$newUsertype = 'Registered';
}
// Bind the user_info array to the user object
if (!$user->bind($user_info)) {
JError::raiseError(500, $user->getError());
}
// Set some initial user values
$user->set('id', 0);
$user->set('usertype', $newUsertype);
$system = 2;
// ID of Registered
$user->groups = array();
$user->groups[] = $system;
$date = JFactory::getDate();
$user->set('registerDate', $date->toSql());
$parent = JFactory::getUser();
$user->setParam('u' . $parent->id . '_parent_id', $parent->id);
if ($user_info['block']) {
$user->set('block', '1');
}
// If there was an error with registration
if (!$user->save()) {
return false;
}
/* Update profile additional data */
return JoomdleHelperMappings::save_user_info($user_info);
}
示例12: display
/**
* The default method that will display the output of this view which is called by
* Joomla
*
* @param string template Template file name
**/
public function display($tpl = null)
{
global $option;
$mainframe =& JFactory::getApplication();
$userpoints = $this->get('UserPoints');
$pagination = $this->get('Pagination');
$ordering = $this->get('Ordering');
// Load tooltips
JHTML::_('behavior.tooltip', '.hasTip');
$acl =& JFactory::getACL();
// $gtree = $acl->get_group_children_tree( null, 'USERS', false );
// echo '<pre>';
// var_dump($gtree);
// echo '</pre>';
//$group = JHTML::_('select.genericlist', $gtree, 'gid', 'size="10"', 'value', 'text', 0 );
//var_dump($group);
//$myGroups = $acl->get_object_groups( 18, 'ARO' );
//$myGroupName = $acl->get_group_name( 18, 'ARO' );
//echo $myGroupName;
$this->assignRef('userpoints', $userpoints);
$this->assignRef('pagination', $pagination);
$this->assignRef('lists', $ordering);
$this->assignRef('acl', $acl);
parent::display($tpl);
}
示例13: parentGids
protected function parentGids()
{
// $hold = array();
if (count($this->gid)) {
foreach ($this->gid as $gid) {
if ($gid >= 5000) {
$gids = array();
while ($gid > 5000) {
try {
$gid = SPFactory::db()->select('pid', 'spdb_user_group', array('gid' => $gid, 'enabled' => 1))->loadResult();
$gids[] = $gid;
} catch (SPException $x) {
Sobi::Error('permissions', SPLang::e('Cannot load additional gids. %s', $x->getMessage()), SPC::WARNING, 0, __LINE__, __CLASS__);
}
}
$cgids = JFactory::getACL()->get_group_parents($gid, 'ARO', 'RECURSE');
$gids = array_merge($gids, $cgids);
} else {
$gids = JFactory::getACL()->get_group_parents($gid, 'ARO', 'RECURSE');
}
if (is_array($gids) && count($gids)) {
$this->gid = array_merge($gids, $this->gid);
}
}
}
// PHP 5.2.9 bug work-around
if (defined('PHP_VERSION_ID') && version_compare(PHP_VERSION, '5.2.9') < 0) {
$this->gid = array_unique($this->gid, SORT_STRING);
} else {
$this->gid = array_unique($this->gid);
}
}
示例14: bind
/**
* Overloaded bind function to pre-process the params.
*
* @param array Named array
*
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = '')
{
$input = JFactory::getApplication()->input;
$task = $input->getString('task', '');
if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_somosmaestros') && $array['state'] == 1)) {
$array['state'] = 0;
}
if ($array['id'] == 0) {
$array['created_by'] = JFactory::getUser()->id;
}
if (isset($array['params']) && is_array($array['params'])) {
$registry = new JRegistry();
$registry->loadArray($array['params']);
$array['params'] = (string) $registry;
}
if (isset($array['metadata']) && is_array($array['metadata'])) {
$registry = new JRegistry();
$registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry;
}
if (!JFactory::getUser()->authorise('core.admin', 'com_somosmaestros.video.' . $array['id'])) {
$actions = JFactory::getACL()->getActions('com_somosmaestros', 'video');
$default_actions = JFactory::getACL()->getAssetRules('com_somosmaestros.video.' . $array['id'])->getData();
$array_jaccess = array();
foreach ($actions as $action) {
$array_jaccess[$action->name] = $default_actions[$action->name];
}
$array['rules'] = $this->JAccessRulestoArray($array_jaccess);
}
//Bind the rules for ACL where supported.
if (isset($array['rules']) && is_array($array['rules'])) {
$this->setRules($array['rules']);
}
return parent::bind($array, $ignore);
}
示例15: image
public function image($value = null, $name = 'image', $title = 'Image')
{
$doc =& JFactory::getDocument();
$script = "\t" . 'function jInsertEditorText( image, e_name ) {
document.getElementById(e_name).value = image;
document.getElementById(e_name+\'preview\').innerHTML = image;
if(!image.test(\'http\'))
{
var el = $(e_name+\'preview\').getChildren().getLast();
var src = el.getProperty(\'src\');
el.setProperty(\'src\', \'' . JURI::root(true) . '/\'+src);
document.getElementById(e_name).value = document.getElementById(e_name+\'preview\').innerHTML;
}
}';
if (!defined('JELEMENT_IMAGE')) {
$doc->addScriptDeclaration($script);
define('JELEMENT_IMAGE', true);
}
$media =& JComponentHelper::getParams('com_media');
$ranks = array('publisher', 'editor', 'author', 'registered');
$acl =& JFactory::getACL();
for ($i = 0; $i < $media->get('allowed_media_usergroup', 3); $i++) {
$acl->addACL('com_media', 'popup', 'users', $ranks[$i]);
}
//Make sure the user is authorized to view this page
$user =& JFactory::getUser();
if (!$user->authorize('com_media', 'popup')) {
return JText::_('You\'re not authorized to access the media manager');
}
//Create the modal window link. &e_name let us have multiple instances of the modal window.
$link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name;
JHTML::_('behavior.modal');
return ' <input type="hidden" name="' . $name . '" id="' . $name . '" value="' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '" /><div class="button2-left"><div class="image"><a class="modal" title="' . JText::_($title) . '" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 570, y: 400}}">' . JText::_($title) . '</a></div></div><br /><div id="' . $name . 'preview" class="image-preview">' . $value . '</div>';
}