Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/security/group/user/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/security/group/user/getlist.class.php
<?php
/**
 * Gets a list of users in a usergroup
 *
 * @param boolean $combo (optional) If true, will append a (anonymous) row
 * @param integer $start (optional) The record to start at. Defaults to 0.
 * @param integer $limit (optional) The number of records to limit to. Defaults
 * to 10.
 * @param string $sort (optional) The column to sort by. Defaults to name.
 * @param string $dir (optional) The direction of the sort. Defaults to ASC.
 *
 * @package modx
 * @subpackage processors.security.group
 */
class modUserGroupUserGetListProcessor extends modObjectGetListProcessor {
    public $classKey = 'modUser';
    public $defaultSortField = 'username';
    public $permission = 'usergroup_user_list';
    public $languageTopics = array('user');

    public function initialize() {
        $this->setDefaultProperties(array(
            'usergroup' => false,
            'username' => '',
        ));
        return parent::initialize();
    }

    public function prepareQueryBeforeCount(xPDOQuery $c) {
        $c->innerJoin('modUserGroupMember','UserGroupMembers');
        $c->innerJoin('modUserGroup','UserGroup','UserGroupMembers.user_group = UserGroup.id');
        $c->leftJoin('modUserGroupRole','UserGroupRole','UserGroupMembers.role = UserGroupRole.id');

        $userGroup = $this->getProperty('usergroup',0);
        $c->where(array(
            'UserGroupMembers.user_group' => $userGroup,
        ));

        $username = $this->getProperty('username','');
        if (!empty($username)) {
            $c->where(array(
                'modUser.username:LIKE' => '%'.$username.'%',
            ));
        }
        return $c;
    }

    public function prepareQueryAfterCount(xPDOQuery $c) {
        $c->select($this->modx->getSelectColumns('modUser','modUser'));
        $c->select(array(
            'usergroup' => 'UserGroup.id',
            'usergroup_name' => 'UserGroup.name',
            'role' => 'UserGroupRole.id',
            'role_name' => 'UserGroupRole.name',
            'authority' => 'UserGroupRole.authority',
        ));
        if ($this->getProperty('sort') !== 'authority') {
            $c->sortby('authority','ASC');
        }
        return $c;
    }

    public function prepareRow(xPDOObject $object) {
        $objectArray = $object->toArray();
        $objectArray['role_name'] .= ' - '.$objectArray['authority'];
        return $objectArray;
    }
}
return 'modUserGroupUserGetListProcessor';

Spamworldpro Mini