本文整理汇总了PHP中UsersHelper类的典型用法代码示例。如果您正苦于以下问题:PHP UsersHelper类的具体用法?PHP UsersHelper怎么用?PHP UsersHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UsersHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = UsersHelper::getActions();
JToolBarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('user.add');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('user.edit');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
JToolBarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
JToolBarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
JToolBarHelper::divider();
}
if ($canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'users.delete');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_users');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_USERS_USER_MANAGER');
}
示例2: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/users.php';
// Load the submenu.
UsersHelper::addSubmenu(JRequest::getCmd('view', 'users'));
$view = JRequest::getCmd('view', 'users');
$layout = JRequest::getCmd('layout', 'default');
$id = JRequest::getInt('id');
if (!$this->canView($view)) {
JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
// Check for edit form.
if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_users.edit.user', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=users', false));
return false;
} elseif ($view == 'group' && $layout == 'edit' && !$this->checkEditId('com_users.edit.group', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=groups', false));
return false;
} elseif ($view == 'level' && $layout == 'edit' && !$this->checkEditId('com_users.edit.level', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=levels', false));
return false;
}
return parent::display();
}
示例3: defaultTpl
function defaultTpl($tpl = null)
{
JToolBarHelper::title(JText::_('STOP WORDS'), 'tag.png');
$canDo = UsersHelper::getActions();
if ($canDo->get('core.create')) {
JToolBarHelper::apply();
JToolBarHelper::spacer();
JToolBarHelper::save();
JToolBarHelper::spacer();
JToolBarHelper::custom('restore', 'default', '', JText::_('RESTORE DEFAULT'), false);
JToolBarHelper::spacer();
}
JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
$lang = strval(JFactory::getLanguage()->getDefault());
$file = JPATH_ADMINISTRATOR . '/components/com_cedtag/stopwords/stopwords_' . $lang . '.php';
if (!is_file($file)) {
JFile::copy(JPATH_ADMINISTRATOR . '/components/com_cedtag/stopwords/stopwords_en-GB-default.php', $file);
}
$isWritable = is_writable($file);
$FileContent = trim(file_get_contents($file));
$this->assign('isWritable', $isWritable);
$this->assignRef('FileName', $file);
$this->assignRef('FileContent', $FileContent);
parent::display($tpl);
}
示例4: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
Request::setVar('hidemainmenu', 1);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = UsersHelper::getActions();
Toolbar::title(Lang::txt($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
Toolbar::apply('level.apply');
Toolbar::save('level.save');
}
if ($canDo->get('core.create')) {
Toolbar::save2new('level.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
Toolbar::save2copy('level.save2copy');
}
if (empty($this->item->id)) {
Toolbar::cancel('level.cancel');
} else {
Toolbar::cancel('level.cancel', 'JTOOLBAR_CLOSE');
}
Toolbar::divider();
Toolbar::help('level');
}
示例5: display
/**
* Method to display the view.
*
* @param string The template file to include
* @since 1.5
*/
public function display($tpl = null)
{
// Get the view data.
$this->user = JFactory::getUser();
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->params = $this->state->get('params');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout'])) {
$this->setLayout($active->query['layout']);
}
require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
$tfa = UsersHelper::getTwoFactorMethods();
$this->tfa = is_array($tfa) && count($tfa) > 1;
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
$this->prepareDocument();
parent::display($tpl);
}
示例6: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', 1);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = UsersHelper::getActions();
JToolBarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
JToolBarHelper::apply('level.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('level.save', 'JTOOLBAR_SAVE');
}
if ($canDo->get('core.create')) {
JToolBarHelper::custom('level.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('level.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('level.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('level.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_USERS_ACCESS_LEVELS_EDIT');
}
示例7: addToolbar
/**
* Display the toolbar.
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', 1);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
JToolbarHelper::title(JText::_('COM_USERS_NOTES'), 'users user');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_users', 'core.create')))) {
JToolbarHelper::apply('note.apply');
JToolbarHelper::save('note.save');
}
if (!$checkedOut && count($user->getAuthorisedCategories('com_users', 'core.create'))) {
JToolbarHelper::save2new('note.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && count($user->getAuthorisedCategories('com_users', 'core.create')) > 0) {
JToolbarHelper::save2copy('note.save2copy');
}
if (empty($this->item->id)) {
JToolbarHelper::cancel('note.cancel');
} else {
if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
JToolbarHelper::versions('com_users.note', $this->item->id);
}
JToolbarHelper::cancel('note.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_USERS_USER_NOTES_EDIT');
}
示例8: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = UsersHelper::getActions();
JToolbarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
JToolbarHelper::apply('level.apply');
JToolbarHelper::save('level.save');
}
if ($canDo->get('core.create')) {
JToolbarHelper::save2new('level.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolbarHelper::save2copy('level.save2copy');
}
if (empty($this->item->id)) {
JToolbarHelper::cancel('level.cancel');
} else {
JToolbarHelper::cancel('level.cancel', 'JTOOLBAR_CLOSE');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_USERS_ACCESS_LEVELS_EDIT');
}
示例9: display
/**
* Override the display method for the view.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Initialise view variables.
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->user = $this->get('User');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
UsersHelper::addSubmenu('notes');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
throw new Exception(implode("\n", $errors), 500);
}
// Get the component HTML helpers
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Turn parameters into registry objects
foreach ($this->items as $item) {
$item->cparams = new Registry();
$item->cparams->loadString($item->category_params);
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例10: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', 1);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$canDo = UsersHelper::getActions();
JToolBarHelper::title(JText::_($isNew ? 'COM_USERS_VIEW_NEW_GROUP_TITLE' : 'COM_USERS_VIEW_EDIT_GROUP_TITLE'), 'groups-add');
if ($canDo->get('core.edit') || $canDo->get('core.create')) {
JToolBarHelper::apply('group.apply');
JToolBarHelper::save('group.save');
}
if ($canDo->get('core.create')) {
JToolBarHelper::save2new('group.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::save2copy('group.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('group.cancel');
} else {
JToolBarHelper::cancel('group.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_USERS_GROUPS_EDIT');
}
示例11: _setToolbar
/**
* Setup the Toolbar.
*/
protected function _setToolbar()
{
$canDo = UsersHelper::getActions();
JToolBarHelper::title(JText::_('Users_View_Users_Title'), 'user');
if ($canDo->get('core.edit.state')) {
JToolBarHelper::custom('users.activate', 'publish.png', 'publish_f2.png', 'Activate', true);
JToolBarHelper::custom('users.block', 'unpublish.png', 'unpublish_f2.png', 'Block', true);
JToolBarHelper::divider();
}
if ($canDo->get('core.create')) {
JToolBarHelper::custom('user.add', 'new.png', 'new_f2.png', 'New', false);
}
if ($canDo->get('core.edit')) {
JToolBarHelper::custom('user.edit', 'edit.png', 'edit_f2.png', 'Edit', true);
}
if ($canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'users.delete');
}
JToolBarHelper::divider();
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_users');
}
JToolBarHelper::divider();
JToolBarHelper::help('screen.users.users');
}
示例12: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = UsersHelper::getActions();
JToolbarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE'), 'user');
if ($canDo->get('core.create')) {
JToolbarHelper::addNew('user.add');
}
if ($canDo->get('core.edit')) {
JToolbarHelper::editList('user.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::divider();
JToolbarHelper::publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
JToolbarHelper::unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
JToolbarHelper::custom('users.unblock', 'unblock.png', 'unblock_f2.png', 'COM_USERS_TOOLBAR_UNBLOCK', true);
JToolbarHelper::divider();
}
if ($canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'users.delete');
JToolbarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_users');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_USERS_USER_MANAGER');
JHtmlSidebar::setAction('index.php?option=com_users&view=users');
JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_STATE'), 'filter_state', JHtml::_('select.options', UsersHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_ACTIVE'), 'filter_active', JHtml::_('select.options', UsersHelper::getActiveOptions(), 'value', 'text', $this->state->get('filter.active')));
JHtmlSidebar::addFilter(JText::_('COM_USERS_FILTER_USERGROUP'), 'filter_group_id', JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $this->state->get('filter.group_id')));
JHtmlSidebar::addFilter(JText::_('COM_USERS_OPTION_FILTER_DATE'), 'filter_range', JHtml::_('select.options', Usershelper::getRangeOptions(), 'value', 'text', $this->state->get('filter.range')));
}
示例13: addToolbar
function addToolbar()
{
JToolBarHelper::title(JText::_('EXPORT TAGS TO OTHER COMPONENTS'), 'tag.png');
$canDo = UsersHelper::getActions();
if ($canDo->get('core.create')) {
$bar = JToolBar::getInstance('toolbar');
$bar->appendButton('Confirm', JText::_('Are you sure you want to export?'), 'default', JText::_('Export'), 'export', false);
JToolBarHelper::spacer();
}
JToolBarHelper::back(JText::_('CEDTAG_CONTROL_PANEL'), 'index.php?option=com_cedtag');
}
示例14: prepareValueForDisplay
public function prepareValueForDisplay($value, $field)
{
$value = (array) $value;
JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php');
$texts = array();
foreach (UsersHelper::getGroups() as $group) {
if (in_array($group->value, $value)) {
$texts[] = parent::prepareValueForDisplay(trim($group->text, '- '), $field);
}
}
return parent::prepareValueForDisplay($texts, $field);
}
示例15: tfaEnabled
/**
* Check if the two factor authentication by Joomla! is enabled
*/
public static function tfaEnabled()
{
//tfa is not supported before 3.2
if (version_compare(JVERSION, '3.2', '<')) {
return false;
}
//check for two way authentication
require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
$tfa = UsersHelper::getTwoFactorMethods();
if (isset($tfa) && is_array($tfa) && count($tfa) > 1) {
return true;
}
return false;
}