|
|
| 17 |
|
17 |
|
| 18 |
|
18 |
|
| 19 |
import('submission.editor.EditorSubmission'); |
19 |
import('submission.editor.EditorSubmission'); |
| 20 |
import('submission.author.AuthorSubmission'); // Bring in editor decision constants |
20 |
|
|
|
21 |
// Bring in editor decision constants |
| 22 |
import('submission.common.Action'); |
| 23 |
import('submission.author.AuthorSubmission'); |
| 21 |
|
24 |
|
| 22 |
class EditorSubmissionDAO extends DAO { |
25 |
class EditorSubmissionDAO extends DAO { |
| 23 |
var $articleDao; |
26 |
var $articleDao; |
|
|
| 574 |
* Function used for counting purposes for right nav bar |
577 |
* Function used for counting purposes for right nav bar |
| 575 |
*/ |
578 |
*/ |
| 576 |
function &getEditorSubmissionsCount($journalId) { |
579 |
function &getEditorSubmissionsCount($journalId) { |
| 577 |
|
|
|
| 578 |
$submissionsCount = array(); |
580 |
$submissionsCount = array(); |
| 579 |
for($i = 0; $i < 3; $i++) { |
581 |
for($i = 0; $i < 3; $i++) { |
| 580 |
$submissionsCount[$i] = 0; |
582 |
$submissionsCount[$i] = 0; |
| 581 |
} |
583 |
} |
| 582 |
|
584 |
|
| 583 |
$result =& $this->getUnfilteredEditorSubmissions($journalId); |
585 |
// Fetch a count of unassigned submissions. |
| 584 |
|
586 |
// "e2" and "e" are used to fetch only a single assignment |
| 585 |
while (!$result->EOF) { |
587 |
// if several exist. |
| 586 |
$editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false)); |
588 |
$result =& $this->retrieve( |
| 587 |
|
589 |
'SELECT COUNT(*) AS unassigned_count |
| 588 |
// check if submission is still in review |
590 |
FROM articles a |
| 589 |
$inReview = true; |
591 |
LEFT JOIN edit_assignments e ON (a.article_id = e.article_id) |
| 590 |
$notDeclined = true; |
592 |
LEFT JOIN edit_assignments e2 ON (a.article_id = e2.article_id AND e.edit_id < e2.edit_id) |
| 591 |
$decisions = $editorSubmission->getDecisions(); |
593 |
WHERE a.journal_id = ? |
| 592 |
$decision = array_pop($decisions); |
594 |
AND a.submission_progress = 0 |
| 593 |
if (!empty($decision)) { |
595 |
AND a.status = ' . STATUS_QUEUED . ' |
| 594 |
$latestDecision = array_pop($decision); |
596 |
AND e2.edit_id IS NULL |
| 595 |
import('submission.common.Action'); |
597 |
AND e.edit_id IS NULL', |
| 596 |
if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) { |
598 |
array((int) $journalId) |
| 597 |
$inReview = false; |
599 |
); |
| 598 |
} |
600 |
$submissionsCount[0] = $result->Fields('unassigned_count'); |
| 599 |
} |
601 |
$result->Close(); |
| 600 |
|
602 |
|
| 601 |
// used to check if editor exists for this submission |
603 |
// Fetch a count of submissions in review. |
| 602 |
$editAssignments = $editorSubmission->getEditAssignments(); |
604 |
// "e2" and "e" are used to fetch only a single assignment |
|
|
605 |
// if several exist. |
| 606 |
// "d2" and "d" are used to fetch the single most recent |
| 607 |
// editor decision. |
| 608 |
$result =& $this->retrieve( |
| 609 |
'SELECT COUNT(*) AS review_count |
| 610 |
FROM articles a |
| 611 |
LEFT JOIN edit_assignments e ON (a.article_id = e.article_id) |
| 612 |
LEFT JOIN edit_assignments e2 ON (a.article_id = e2.article_id AND e.edit_id < e2.edit_id) |
| 613 |
LEFT JOIN edit_decisions d ON (a.article_id = d.article_id) |
| 614 |
LEFT JOIN edit_decisions d2 ON (a.article_id = d2.article_id AND d.date_decided < d2.date_decided) |
| 615 |
WHERE a.journal_id = ? |
| 616 |
AND a.submission_progress = 0 |
| 617 |
AND a.status = ' . STATUS_QUEUED . ' |
| 618 |
AND e2.edit_id IS NULL |
| 619 |
AND e.edit_id IS NOT NULL |
| 620 |
AND d2.date_decided IS NULL |
| 621 |
AND d.decision <> ' . SUBMISSION_EDITOR_DECISION_ACCEPT, |
| 622 |
array((int) $journalId) |
| 623 |
); |
| 624 |
$submissionsCount[1] = $result->Fields('review_count'); |
| 625 |
$result->Close(); |
| 603 |
|
626 |
|
| 604 |
if (empty($editAssignments)) { |
627 |
// Fetch a count of submissions in editing. |
| 605 |
// unassigned submissions |
628 |
// "e2" and "e" are used to fetch only a single assignment |
| 606 |
$submissionsCount[0] += 1; |
629 |
// if several exist. |
| 607 |
} else { |
630 |
// "d2" and "d" are used to fetch the single most recent |
| 608 |
if ($inReview) { |
631 |
// editor decision. |
| 609 |
if ($notDeclined) { |
632 |
$result =& $this->retrieve( |
| 610 |
// in review submissions |
633 |
'SELECT COUNT(*) AS editing_count |
| 611 |
$submissionsCount[1] += 1; |
634 |
FROM articles a |
| 612 |
} |
635 |
LEFT JOIN edit_assignments e ON (a.article_id = e.article_id) |
| 613 |
} else { |
636 |
LEFT JOIN edit_assignments e2 ON (a.article_id = e2.article_id AND e.edit_id < e2.edit_id) |
| 614 |
// in editing submissions |
637 |
LEFT JOIN edit_decisions d ON (a.article_id = d.article_id) |
| 615 |
$submissionsCount[2] += 1; |
638 |
LEFT JOIN edit_decisions d2 ON (a.article_id = d2.article_id AND d.date_decided < d2.date_decided) |
| 616 |
} |
639 |
WHERE a.journal_id = ? |
| 617 |
} |
640 |
AND a.submission_progress = 0 |
| 618 |
unset($editorSubmission); |
641 |
AND a.status = ' . STATUS_QUEUED . ' |
| 619 |
$result->MoveNext(); |
642 |
AND e2.edit_id IS NULL |
| 620 |
} |
643 |
AND e.edit_id IS NOT NULL |
|
|
644 |
AND d2.date_decided IS NULL |
| 645 |
AND d.decision = ' . SUBMISSION_EDITOR_DECISION_ACCEPT, |
| 646 |
array((int) $journalId) |
| 647 |
); |
| 648 |
$submissionsCount[2] = $result->Fields('editing_count'); |
| 621 |
$result->Close(); |
649 |
$result->Close(); |
| 622 |
unset($result); |
|
|
| 623 |
|
650 |
|
| 624 |
return $submissionsCount; |
651 |
return $submissionsCount; |
| 625 |
} |
652 |
} |