SubmissionDAO::getAssignedToUser PHP Метод

getAssignedToUser() публичный Метод

Get all submissions that are considered assigned to the passed user, excluding author participation.
public getAssignedToUser ( $userId, $contextId = null, $title = null, $author = null, $stageId = null, $rangeInfo = null ) : DAOResultFactory
$userId int
$contextId int optional
$title string|null optional Filter by title.
$author string|null optional Filter by author.
$stageId int|null optional Filter by stage id.
$rangeInfo DBResultRange optional
Результат DAOResultFactory
    function getAssignedToUser($userId, $contextId = null, $title = null, $author = null, $stageId = null, $rangeInfo = null)
    {
        $params = array_merge(array(ROLE_ID_AUTHOR), $this->getFetchParameters(), array((int) STATUS_DECLINED, (int) $userId, (int) $userId));
        if ($contextId) {
            $params[] = (int) $contextId;
        }
        if ($title) {
            $params[] = 'title';
            $params[] = '%' . $title . '%';
        }
        if ($author) {
            array_push($params, $authorQuery = '%' . $author . '%', $authorQuery, $authorQuery);
        }
        if ($stageId) {
            $params[] = (int) $stageId;
        }
        $result = $this->retrieveRange($sql = 'SELECT s.*, ps.date_published,
				' . $this->getFetchColumns() . '
			FROM submissions s
				LEFT JOIN published_submissions ps ON (s.submission_id = ps.submission_id)
				' . $this->getCompletionJoins() . '
				LEFT JOIN stage_assignments sa ON (s.submission_id = sa.submission_id)
				LEFT JOIN user_groups aug ON (sa.user_group_id = aug.user_group_id AND aug.role_id = ?)
				LEFT JOIN submission_files sf ON (s.submission_id = sf.submission_id)
				LEFT JOIN review_assignments ra ON (s.submission_id = ra.submission_id AND ra.declined = 0)
				' . ($title ? ' LEFT JOIN submission_settings ss ON (s.submission_id = ss.submission_id)' : '') . '
				' . ($author ? ' LEFT JOIN authors au ON (s.submission_id = au.submission_id)' : '') . $this->getFetchJoins() . ' WHERE s.date_submitted IS NOT NULL
				AND ' . $this->getCompletionConditions(false) . '
				AND s.status <> ?
				AND aug.user_group_id IS NULL
				AND (sa.user_id = ? OR ra.reviewer_id = ?)' . ($contextId ? ' AND s.context_id = ?' : '') . ($title ? ' AND (ss.setting_name = ? AND ss.setting_value LIKE ?)' : '') . ($author ? ' AND (ra.submission_id IS NULL AND (au.first_name LIKE ? OR au.middle_name LIKE ? OR au.last_name LIKE ?))' : '') . ($stageId ? ' AND s.stage_id = ?' : '') . ' GROUP BY ' . $this->getGroupByColumns(), $params, $rangeInfo);
        return new DAOResultFactory($result, $this, '_fromRow');
    }