Loads the data required to render the user_evidence_list_page template.

@param int $userid User id.
@return boolean
350559
public static function data_for_user_evidence_list_page($userid) {
        global $PAGE;
        $params = self::validate_parameters(self::data_for_user_evidence_list_page_parameters(),
            array('userid' => $userid));

        $context = context_user::instance($params['userid']);
        self::validate_context($context);
        $output = $PAGE->get_renderer('tool_lp');

        $renderable = new \tool_lp\output\user_evidence_list_page($params['userid']);
        return $renderable->export_for_template($output);
    }
368231
public function loadByCustomerId($customerId)
    {
        $collection = $this->addFieldToFilter('customer_id', $customerId)
            ->setPageSize(1);

        if ($collection->getSize()) {
            return $collection->getFirstItem();
        }

        return false;
    }
181552
public static function get_children_of_user($userid) {
        global $DB;

        // Get users that the user has role assignments to.
        $allusernames = get_all_user_name_fields(true, 'u');
        $sql = "SELECT u.id, $allusernames
                  FROM {role_assignments} ra, {context} c, {user} u
                 WHERE ra.userid = :userid
                       AND ra.contextid = c.id
                       AND c.instanceid = u.id
                       AND c.contextlevel = :contextlevel";
        $params = [
            'userid' => $userid,
            'contextlevel' => CONTEXT_USER
        ];

        // The final list of users that we will return.
        $finalresults = [];

        // Our prospective list of users.
        if ($candidates = $DB->get_records_sql($sql, $params)) {
            foreach ($candidates as $key => $child) {
                $childcontext = \context_user::instance($child->id);
                if (has_capability('tool/dataprivacy:makedatarequestsforchildren', $childcontext, $userid)) {
                    $finalresults[$key] = $child;
                }
            }
        }
        return $finalresults;
    }
548188
public function addUser($userId)
    {
        if (true === is_numeric($userId) && false === in_array($userId, $this->users)) {
            $this->users[] = (int)$userId;
        }
        return $this;
    }
969799
public function hasParticipant($userId)
    {
        $participants = $this->participants()->where('user_id', '=', $userId);
        if ($participants->count() > 0) {
            return true;
        }

        return false;
    }
1074203
public static function read_user_evidence($id) {
        global $PAGE;
        $params = self::validate_parameters(self::read_user_evidence_parameters(), array('id' => $id));

        $userevidence = api::read_user_evidence($params['id']);
        $context = $userevidence->get_context();
        self::validate_context($context);
        $output = $PAGE->get_renderer('core');

        $exporter = new user_evidence_exporter($userevidence, array('context' => $context,
            'competencies' => $userevidence->get_competencies()));
        return $exporter->export($output);
    }
776976
public static function loadUserInfoBypass($user_id)
    {
        global $CFG, $PDOX, $CONTEXT;
        $cacheloc = 'lti_user';
        $row = Cache::check($cacheloc, $user_id);
        if ( $row != false ) return $row;
        $stmt = $PDOX->queryDie(
            "SELECT displayname, email, user_key FROM {$CFG->dbprefix}lti_user AS U
            JOIN {$CFG->dbprefix}lti_membership AS M
            ON U.user_id = M.user_id AND M.context_id = :CID
            WHERE U.user_id = :UID",
            array(":UID" => $user_id, ":CID" => $CONTEXT->id)
        );
        $row = $stmt->fetch(\PDO::FETCH_ASSOC);
        if ( strlen($row['displayname']) < 1 && strlen($row['user_key']) > 0 ) {
            $row['displayname'] = 'user_key:'.substr($row['user_key'],0,25);
        }
        Cache::set($cacheloc, $user_id, $row);
        return $row;
    }
584220
public function load($userid, $apikey, $scope, $name, $args)
    {
        $key = $this->getKey($userid, $apikey, $scope, $name, $args);
        if (!$xml = $this->adapter->load($key)) {
            return false;
        }

        if ($this->validateCache($xml)) {
            return $xml;
        }

        return false;
    }
384784
public function participantsUserIds($userId = null)
    {
        $users = $this->participants()->lists('user_id');

        if ($userId) {
            $users[] = $userId;
        }

        return $users;
    }
842579
public function load($userid, $apikey, $scope, $name, $args)
    {
        $this->prepareStatements();

        $argumentString = $this->serializeArguments($args);

        $statement = $this->statements['load'];
        /* @var $statement \PDOStatement */

        if ($userid === null) {
            // Fix for null value userids
            // e. g. for global calls to /eve/
            $userid = 0;
        }

        try {
            $statement->execute(
                array(
                    ':userId' => $userid,
                    ':scope'  => $scope,
                    ':name'   => $name,
                    ':args'   => $argumentString,
                )
            );

            $result = $statement->fetch();
        } catch (\PDOException $e) {
            throw new PhealException('Loading from cache failed!', null, $e);
        }

        if (empty($result)) {
            return false;
        }

        if (!$this->validateCache($result['cachedUntil'])) {
            return false;
        }

        return $result['xml'];
    }
1208156
protected static function transform_user_evidence($userid, user_evidence $ue) {
        $options = ['context' => $ue->get_context()];
        return [
            'name' => format_string($ue->get('name'), true, $options),
            'description' => format_text($ue->get('description'), $ue->get('descriptionformat'), $options),
            'url' => $ue->get('url'),
            'timecreated' => $ue->get('timecreated') ? transform::datetime($ue->get('timecreated')) : '-',
            'timemodified' => $ue->get('timemodified') ? transform::datetime($ue->get('timemodified')) : '-',
            'created_or_modified_by_you' => transform::yesno($ue->get('usermodified') == $userid),
            'competencies' => []
        ];
    }
586815
public function loadPoliciesByUserId($userId)
    {
        $groupIds = $this->fetchUserGroups($userId);
        $groupIds[] = $userId;

        return $this->loadRolesForContentObjects($groupIds);
    }
832026
public function findByUserId($userId)
    {
        $select = $this->getSelect();
        $select->where(array('user_id' => $userId));

        return $this->select($select);
    }
86424
public static function get_contexts_for_userid(int $userid) : \core_privacy\local\request\contextlist {
        // We cannot associate files with a particular user as it would require to know all the details about
        // the source file, which only the component owning it knows about. And, the 'usermodified' attribute
        // of the conversion class is not an identifier of data ownership, merely that this user was logged in
        // when the conversion was requested. As such, as the owning component should declare the source file,
        // and we can't make sense of 'usermodified', we will not be reporting anything here. Also note that
        // the clean up task will ensure that whenever a source file is delete, its conversions also are.
        return new \core_privacy\local\request\contextlist();
    }
416853
public static function get_contexts_for_userid(int $userid) : contextlist {
        $sql = "SELECT id
                  FROM {context}
                 WHERE instanceid = :userid
                       AND contextlevel = :contextlevel";

        $contextlist = new contextlist();
        $contextlist->set_component('tool_dataprivacy');
        $contextlist->add_from_sql($sql, ['userid' => $userid, 'contextlevel' => CONTEXT_USER]);
        return $contextlist;
    }
413137
public function loadUser($userId)
    {
        $user = $this->userService->loadUser($userId, Language::ALL);

        $userContentInfo = $user->getVersionInfo()->getContentInfo();
        $contentType = $this->contentTypeService->loadContentType($userContentInfo->contentTypeId);

        try {
            $userMainLocation = $this->locationService->loadLocation($userContentInfo->mainLocationId);
            $relations = $this->contentService->loadRelations($user->getVersionInfo());
        } catch (UnauthorizedException $e) {
            // TODO: Hack for special case to allow current logged in user to load him/here self (but not relations)
            if ($user->id == $this->repository->getCurrentUser()->id) {
                $userMainLocation = $this->repository->sudo(
                    function () use ($userContentInfo) {
                        return $this->locationService->loadLocation($userContentInfo->mainLocationId);
                    }
                );
                // user may not have permissions to read related content, for security reasons do not use sudo().
                $relations = array();
            } else {
                throw $e;
            }
        }

        return new Values\CachedValue(
            new Values\RestUser(
                $user,
                $contentType,
                $userContentInfo,
                $userMainLocation,
                $relations
            ),
            array('locationId' => $userContentInfo->mainLocationId)
        );
    }
1202168
private static function generateUserCacheData( $userId )
    {
        $user = eZUser::fetch( $userId );
        if ( !$user instanceof eZUser )
        {
            return null;
        }

        // user info (session: eZUserInfoCache)
        $data['info'][$userId] = array( 'contentobject_id'   => $user->attribute( 'contentobject_id' ),
                                        'login'              => $user->attribute( 'login' ),
                                        'email'              => $user->attribute( 'email' ),
                                        'is_enabled'         => $user->isEnabled( false ),
                                        'password_hash'      => $user->attribute( 'password_hash' ),
                                        'password_hash_type' => $user->attribute( 'password_hash_type' ) );

        // function groups relies on caching. The function generateUserCacheData relies on function groups.
        // To avoid an infinitive loop, the code is disabling caching in function generateUserCacheData.
        // At the end of this method flag is set to previous value again
        $previousCachingState = $user->setCachingEnabled( false );
        // user groups list (session: eZUserGroupsCache)
        $groups = $user->groups(); 
        $data['groups'] = $groups;

        // role list (session: eZRoleIDList)
        $groups[] = $userId;
        $data['roles'] = eZRole::fetchIDListByUser( $groups );

        // role limitation list (session: eZRoleLimitationValueList)
        $limitList = $user->limitList();
        foreach ( $limitList as $limit )
        {
            $data['role_limitations'][] = $limit['limit_value'];
        }

        // access array (session: AccessArray)
        $data['access_array'] = $user->generateAccessArray();

        // discount rules (session: eZUserDiscountRules<userId>)
        $data['discount_rules'] = eZUserDiscountRule::generateIDListByUserID( $userId );

        $user->setCachingEnabled( $previousCachingState );

        return $data;
    }