SubmissionDAO::getBySubEditorId PHP Метод

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

Get all unassigned submissions for a context or all contexts
public getBySubEditorId ( $contextId, $subEditorId = null, $includeDeclined = true, $includePublished = true, $title = null, $author = null, $stageId = null, $rangeInfo = null ) : DAOResultFactory
$contextId int optional the ID of the context to query.
$subEditorId int optional the ID of the sub editor whose section will be included in the results (excluding others).
$includeDeclined boolean optional include submissions which have STATUS_DECLINED
$includePublished boolean optional include submissions which are published
$title string|null optional Filter by title.
$author string|null optional Filter by author.
$stageId int|null optional Filter by stage id.
$rangeInfo DBRangeInfo
Результат DAOResultFactory containing matching Submissions
    function getBySubEditorId($contextId, $subEditorId = null, $includeDeclined = true, $includePublished = true, $title = null, $author = null, $stageId = null, $rangeInfo = null)
    {
        $params = $this->getFetchParameters();
        if ($subEditorId) {
            $params[] = (int) $subEditorId;
        }
        $params[] = (int) $contextId;
        $params[] = (int) ROLE_ID_MANAGER;
        $params[] = (int) ROLE_ID_SUB_EDITOR;
        if ($title) {
            $params[] = 'title';
            $params[] = '%' . $title . '%';
        }
        if ($author) {
            array_push($params, $authorQuery = '%' . $author . '%', $authorQuery, $authorQuery);
        }
        if ($stageId) {
            $params[] = (int) $stageId;
        }
        $result = $this->retrieveRange('SELECT	s.*, ps.date_published,
				' . $this->getFetchColumns() . '
			FROM	submissions s
				LEFT JOIN published_submissions ps ON s.submission_id = ps.submission_id
				' . $this->getCompletionJoins() . '
				' . ($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() . '
				' . ($subEditorId ? ' ' . $this->getSubEditorJoin() : '') . '
			WHERE	s.date_submitted IS NOT NULL AND
				s.context_id = ? AND
				(SELECT COUNT(sa.stage_assignment_id) FROM stage_assignments sa LEFT JOIN user_groups g ON sa.user_group_id = g.user_group_id WHERE
					sa.submission_id = s.submission_id AND (g.role_id = ? OR g.role_id = ?)) = 0' . (!$includeDeclined ? ' AND s.status <> ' . STATUS_DECLINED : '') . (!$includePublished ? ' AND ' . $this->getCompletionConditions(false) : '') . ($contextId && is_array($contextId) ? ' AND s.context_id IN  (' . join(',', array_map(array($this, '_arrayWalkIntCast'), $contextId)) . ')' : '') . ($title ? ' AND (ss.setting_name = ? AND ss.setting_value LIKE ?)' : '') . ($author ? ' 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');
    }