/**
  * Display layout editor submissions page.
  */
 function submissions($args)
 {
     LayoutEditorHandler::validate();
     LayoutEditorHandler::setupTemplate(true);
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $rangeInfo = Handler::getRangeInfo('submissions');
     $submissions = $layoutEditorSubmissionDao->getSubmissions($user->getUserId(), $journal->getJournalId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $active, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     import('issue.IssueAction');
     $issueAction =& new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', 'editorial.layoutEditorsRole.submissions');
     $templateMgr->display('layoutEditor/submissions.tpl');
 }
 /**
  * Sets the date of layout editor proofreading completion
  */
 function layoutEditorProofreadingComplete($args)
 {
     $articleId = Request::getUserVar('articleId');
     list($journal, $submission) = SubmissionLayoutHandler::validate($articleId);
     parent::setupTemplate(true, $articleId);
     $send = false;
     if (isset($args[0])) {
         $send = Request::getUserVar('send') ? true : false;
     }
     import('submission.proofreader.ProofreaderAction');
     if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_COMPLETE', $send ? '' : Request::url(null, 'layoutEditor', 'layoutEditorProofreadingComplete', 'send'))) {
         Request::redirect(null, null, 'submission', $articleId);
     }
 }
 /**
  * Delete comment.
  */
 function deleteComment($args)
 {
     LayoutEditorHandler::validate();
     LayoutEditorHandler::setupTemplate(true);
     $articleId = $args[0];
     $commentId = $args[1];
     list($journal, $submission) = SubmissionLayoutHandler::validate($articleId);
     list($comment) = SubmissionCommentsHandler::validate($commentId);
     LayoutEditorAction::deleteComment($commentId);
     // Redirect back to initial comments page
     if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
         Request::redirect(null, null, 'viewLayoutComments', $articleId);
     } else {
         if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
             Request::redirect(null, null, 'viewProofreadComments', $articleId);
         }
     }
 }