Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_community/views/users/view.html.php
Ðазад
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView; use Joomla\CMS\Table\Table; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Version; // Disallow direct access to this file defined('_JEXEC') or die('Restricted access'); jimport( 'joomla.application.component.view' ); require_once( JPATH_ROOT . '/components/com_community/libraries/core.php' ); require_once( JPATH_ROOT . '/components/com_community/libraries/apps.php' ); require_once( JPATH_ROOT . '/components/com_community/libraries/profile.php' ); /** * Configuration view for JomSocial */ class CommunityViewUsers extends HtmlView { /** * 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 ) { // Trigger load default library. CAssets::getInstance(); if( $this->getLayout() == 'edit' ) { $this->_displayEditLayout( $tpl ); return; } $mainframe = Factory::getApplication(); $jinput = $mainframe->input; // Set the titlebar text ToolbarHelper::title( Text::_('COM_COMMUNITY_USERS'), 'users' ); // Add the necessary buttons ToolBarHelper::custom( 'import' , 'file' , 'csv' , Text::_( 'COM_COMMUNITY_USERS_IMPORT_FROM_CSV' ), false ); ToolBarHelper::custom( 'export' , 'file' , 'csv' , Text::_( 'COM_COMMUNITY_USERS_EXPORT_TO_CSV' ), false ); ToolBarHelper::trash('delete', Text::_('COM_COMMUNITY_DELETE')); ToolBarHelper::custom('approveselected','publish','', Text::_('COM_COMMUNITY_APPROVE_SELECTED')); $search = $mainframe->getUserStateFromRequest("com_community.users.search", 'search', '', 'string'); $model = $this->getModel( 'Users' ); $users = $model->getAllUsers(); $pagination = $model->getPagination(); $filter_order = $mainframe->getUserStateFromRequest( "com_community.users.filter_order", 'filter_order', 'registerDate', 'cmd' ); $filter_order_Dir = $mainframe->getUserStateFromRequest( "com_community.users.filter_order_Dir", 'filter_order_Dir', 'DESC', 'word' ); foreach($users as $key=>$data) { $users[$key] = CFactory::getUser($data->id); } //var_dump($users);exit; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $session = Factory::getSession(); $usertype = $jinput->get('usertype' , $session->get('user_type_filter', 'all') , 'STRING'); $multiprofileModel = $this->getModel( 'Multiprofile' ); $profileTypes = $multiprofileModel->getMultiprofiles(); $profileType = $jinput->get('profiletype', $session->get('user_profile_filter', 'all') , 'NONE'); $this->set( 'profileType' , $profileType ); $this->set( 'profileTypes', $profileTypes ); $this->set( 'search' , $search ); $this->set( 'usertype' , $usertype ); $this->set( 'users' , $users ); $this->set( 'lists' , $lists ); $this->set( 'pagination' , $pagination ); parent::display( $tpl ); } public function element( $tpl = null ) { if( $this->getLayout() == 'edit' ) { $this->_displayEditLayout( $tpl ); return; } $mainframe = Factory::getApplication(); $jinput = $mainframe->input; // Set the titlebar text ToolBarHelper::title( Text::_('COM_COMMUNITY_USERS'), 'users' ); // Add the necessary buttons ToolBarHelper::back( Text::_('COM_COMMUNITY_HOME') , 'index.php?option=com_community'); ToolBarHelper::divider(); ToolBarHelper::custom( 'export' , 'csv' , 'csv' , Text::_( 'COM_COMMUNITY_USERS_EXPORT_TO_CSV' ) ); ToolBarHelper::trash('delete', Text::_('COM_COMMUNITY_DELETE')); $search = $jinput->get('search', '', 'STRING'); $model =& $this->getModel( 'Users' ); $users =& $model->getAllUsers(); $pagination =& $model->getPagination(); $filter_order = $mainframe->getUserStateFromRequest( "com_community.users.filter_order", 'filter_order', 'a.name', 'cmd' ); $filter_order_Dir = $mainframe->getUserStateFromRequest( "com_community.users.filter_order_Dir", 'filter_order_Dir', '', 'word' ); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $usertype = $jinput->post->get('usertype' , 'all', 'NONE'); $multiprofileModel = & $this->getModel( 'Multiprofile' ); $profileTypes = $multiprofileModel->getMultiprofiles(); $profileType = $jinput->post->get('profiletype' , 'all', 'NONE'); $this->set( 'profileType' , $profileType ); $this->set( 'profileTypes', $profileTypes ); $this->set( 'search' , $search ); $this->set( 'usertype' , $usertype ); $this->set( 'users' , $users ); $this->set( 'lists' , $lists ); $this->set( 'pagination' , $pagination ); parent::display( $tpl ); } public function _displayEditLayout( $tpl ) { // Load frontend language file. $lang = Factory::getLanguage(); $lang->load('com_community' , JPATH_ROOT ); $lang->load( 'com_community.country',JPATH_ROOT); //Load com user language file for J!1.6 $lang->load('com_users' , JPATH_ROOT); $mainframe = Factory::getApplication(); $jinput = $mainframe->input; $userId = $jinput->request->get('id' , '', 'INT'); $user = CFactory::getUser( $userId ); // Set the titlebar text ToolBarHelper::title( $user->username , 'users' ); // Add the necessary buttons ToolBarHelper::cancel('removeavatar',Text::_('COM_COMMUNITY_USERS_REMOVE_AVATAR') ); ToolBarHelper::save(); ToolBarHelper::save( 'saveonly', Text::_('COM_COMMUNITY_SAVE') ); ToolBarHelper::cancel(); $model = CFactory::getModel( 'Profile' ); $ptype = $model->getProfileTypes(); $profile = $model->getEditableProfile( $user->id , $user->getProfileType() ); $config = CFactory::getConfig(); $params = $user->getParams(); $userDST = $params->get('daylightsavingoffset' ); $offset = (!empty($userDST) ) ? $userDST : $config->get( 'daylightsavingoffset' ); $counter = -4; $options = array(); for( $i=0 ; $i <= 8; $i++ , $counter++ ) { $options[] = HTMLHelper::_( 'select.option' , $counter , $counter ); } $offsetList = HTMLHelper::_( 'select.genericlist', $options , 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $offset ); $session = Factory::getSession(); $sessionData = $session->get('postData'); $session->clear('postData'); if(isset($sessionData)) { foreach($profile['fields'] as $key=>$field) { foreach($field as $_key=>$_field) { if(isset($sessionData['field'.$_field['id']])) { if(is_array($sessionData['field'.$_field['id']])) { if($_field['type']=='birthdate') { $sessionData['field'.$_field['id']] = implode('-',$sessionData['field'.$_field['id']]); } if($_field['type']=='url') { $sessionData['field'.$_field['id']] = implode('',$sessionData['field'.$_field['id']]); } if( $_field['type'] == 'checkbox') { $sessionData['field'.$_field['id']] = implode(',',$sessionData['field'.$_field['id']]); } } $profile['fields'][$key][$_key]['value'] = $sessionData['field'.$_field['id']]; } } } } $user->profile = $profile; $this->set( 'user' , $user ); if (version_compare(JVERSION, '4', '>=')) { $params = CJForm::getInstance('editDetails', JPATH_ADMINISTRATOR.'/components/com_users/forms/user.xml'); $this->setLayout('edit_j4'); } else { $params = CJForm::getInstance('editDetails', JPATH_ADMINISTRATOR.'/components/com_users/models/forms/user.xml'); } $vals = $user->getParams(); $vals = $vals->toArray(); $userParams = Factory::getUser($user->id)->params; $userParams = json_decode($userParams); //set data for the form foreach($userParams as $k => $v){ $params->setValue($k , 'params' , $v); } $options = array(); foreach($ptype as $pr){ $options[] = HTMLHelper::_( 'select.option' , $pr->id , $pr->name ); } if($options){ $profilelist = HTMLHelper::_('select.genericlist', $options , 'profiletype', 'class="inputbox" size="1"', 'value', 'text', $user->getProfileType() ); }else{ $profilelist = ''; } $this->set( 'params' , $params ); $this->set( 'profilelist' , $profilelist ); $this->set( 'offsetList' , $offsetList ); parent::display( $tpl ); } /** * Method to get the publish status HTML * * @param object Field object * @param string Type of the field * @param string The ajax task that it should call * @return string HTML source **/ public function getPublish( &$row , $type , $ajaxTask ) { $version = new Version(); $currentV = $version->getHelpVersion(); $class = 'jgrid'; $alt = $row->$type ? Text::_('COM_COMMUNITY_PUBLISHED') : Text::_('COM_COMMUNITY_UNPUBLISH'); $state = $row->$type == 0 ? 'publish' : 'unpublish'; $span = '<span class="state '.$state.'"><span class="text">'.$alt.'</span></span></a>'; if($currentV >= '0.30') { $class = $row->$type == 0 ? 'disabled jgrid': ''; $span = '<i class="icon-'.$state.'""></i>'; } $href = '<a class="'.$class.'" href="javascript:void(0);" onclick="azcommunity.togglePublish(\'' . $ajaxTask . '\',\'' . $row->id . '\',\'' . $type . '\');">'; $href .= $span; // Check: ACL if (!CFactory::getUser()->authorise('community.profileeditstate', 'com_community') || COwnerHelper::isCommunityAdmin($row->id)) { return '<i class="icon-'.$state.'"></i>'; } return $href; } public function getConnectType( $userId ) { $model = $this->getModel( 'Users' ); $type = $model->getUserConnectType( $userId ); $image = ''; switch( $type ) { case 'facebook': $image = '<img src="' . rtrim( Uri::root() , '/' ) . '/administrator/components/com_community/assets/icons/facebook.gif" />'; break; case 'joomla': default: $image = '<img src="' . rtrim( Uri::root() , '/' ) . '/administrator/components/com_community/assets/icons/joomla-icon.png" />'; break; } return $image; } public function getProfileName($obj) { $profileId = $obj->getProfileType(); $profile = Table::getInstance('MultiProfile', 'CTable'); $profile->load($profileId); return $profile->getName(); } /** * Private method to set the toolbar for this view * * @access private * * @return null **/ public function setToolBar() { } public function _getStatusHTML() { // Check if there are any categories selected $session = Factory::getSession(); $mainframe = Factory::getApplication(); $jinput = $mainframe->input; $status = $jinput->get('status', $session->get('user_status_filter', 2)); $select = '<select class="no-margin" name="status" onchange="document.adminForm.submit();">'; $statusArray = array(2=>Text::_('COM_COMMUNITY_ALL_USER'),0=>Text::_('COM_COMMUNITY_ACTIVITIES_ACTIVE'),1=>Text::_('COM_COMMUNITY_PENDING')); foreach($statusArray as $key=>$array) { $selected = ($status == $key) ? 'selected="true"' : ''; $select .='<option value="'.$key.'"'.$selected.' >'.Text::_($array).'</option>'; } $select .= '</select>'; return $select; } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка