/** * @see Form::execute() */ function execute() { $reviewAssignment =& $this->getReviewAssignment(); if ($reviewAssignment->getReviewFormId()) { $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO'); /* FIXME #5123: Include when review form infrastructure is in place $reviewFormResponses = $this->getData('reviewFormResponses'); if (is_array($reviewFormResponses)) foreach ($reviewFormResponses as $reviewFormElementId => $reviewFormResponseValue) { $reviewFormResponse =& $reviewFormResponseDao->getReviewFormResponse($reviewAssignment->getReviewId(), $reviewFormElementId); if (!isset($reviewFormResponse)) { $reviewFormResponse = new ReviewFormResponse(); } $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO'); $reviewFormElement = $reviewFormElementDao->getReviewFormElement($reviewFormElementId); $elementType = $reviewFormElement->getElementType(); switch ($elementType) { case REVIEW_FORM_ELEMENT_TYPE_SMALL_TEXT_FIELD: case REVIEW_FORM_ELEMENT_TYPE_TEXT_FIELD: case REVIEW_FORM_ELEMENT_TYPE_TEXTAREA: $reviewFormResponse->setResponseType('string'); $reviewFormResponse->setValue($reviewFormResponseValue); break; case REVIEW_FORM_ELEMENT_TYPE_RADIO_BUTTONS: case REVIEW_FORM_ELEMENT_TYPE_DROP_DOWN_BOX: $reviewFormResponse->setResponseType('int'); $reviewFormResponse->setValue($reviewFormResponseValue); break; case REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES: $reviewFormResponse->setResponseType('object'); $reviewFormResponse->setValue($reviewFormResponseValue); break; } if ($reviewFormResponse->getReviewFormElementId() != null && $reviewFormResponse->getReviewId() != null) { $reviewFormResponseDao->updateObject($reviewFormResponse); } else { $reviewFormResponse->setReviewFormElementId($reviewFormElementId); $reviewFormResponse->setReviewId($reviewAssignment->getReviewId()); $reviewFormResponseDao->insertObject($reviewFormResponse); } } */ } else { // Create a monograph comment with the review. $comment = new MonographComment(); $comment->setCommentType(COMMENT_TYPE_PEER_REVIEW); $comment->setRoleId(ROLE_ID_REVIEWER); $comment->setAssocId($reviewAssignment->getId()); $comment->setMonographId($reviewAssignment->getSubmissionId()); $comment->setAuthorId($reviewAssignment->getReviewerId()); $comment->setComments($this->getData('comments')); $comment->setCommentTitle(''); $comment->setViewable(true); $comment->setDatePosted(Core::getCurrentDate()); // Persist the monograph comment. $commentDao =& DAORegistry::getDAO('MonographCommentDAO'); $commentDao->insertMonographComment($comment); } // Set review to next step. $this->updateReviewStepAndSaveSubmission($this->getReviewerSubmission()); // Mark the review assignment as completed. $reviewAssignment->setDateCompleted(Core::getCurrentDate()); $reviewAssignment->stampModified(); // Persist the updated review assignment. $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignmentDao->updateObject($reviewAssignment); }
/** * Creates and returns a monograph comment object from a row * @param $row array * @return MonographComment object */ function &_returnMonographCommentFromRow($row) { $monographComment = new MonographComment(); $monographComment->setCommentId($row['comment_id']); $monographComment->setCommentType($row['comment_type']); $monographComment->setRoleId($row['role_id']); $monographComment->setMonographId($row['monograph_id']); $monographComment->setAssocId($row['assoc_id']); $monographComment->setAuthorId($row['author_id']); $monographComment->setCommentTitle($row['comment_title']); $monographComment->setComments($row['comments']); $monographComment->setDatePosted($this->datetimeFromDB($row['date_posted'])); $monographComment->setDateModified($this->datetimeFromDB($row['date_modified'])); $monographComment->setViewable($row['viewable']); HookRegistry::call('MonographCommentDAO::_returnMonographCommentFromRow', array(&$monographComment, &$row)); return $monographComment; }