/** * Internal function to return a ReviewFormElement object from a row. * @param $row array * @return ReviewFormElement */ function &_returnReviewFormElementFromRow(&$row) { $reviewFormElement = new ReviewFormElement(); $reviewFormElement->setId($row['review_form_element_id']); $reviewFormElement->setReviewFormId($row['review_form_id']); $reviewFormElement->setSequence($row['seq']); $reviewFormElement->setElementType($row['element_type']); $reviewFormElement->setRequired($row['required']); $this->getDataObjectSettings('review_form_element_settings', 'review_form_element_id', $row['review_form_element_id'], $reviewFormElement); HookRegistry::call('ReviewFormElementDAO::_returnReviewFormElementFromRow', array(&$reviewFormElement, &$row)); return $reviewFormElement; }
/** * Save review form element. */ function execute() { $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO'); if ($this->reviewFormElementId != null) { $reviewFormElement =& $reviewFormElementDao->getReviewFormElement($this->reviewFormElementId); } if (!isset($reviewFormElement)) { $reviewFormElement = new ReviewFormElement(); $reviewFormElement->setReviewFormId($this->reviewFormId); $reviewFormElement->setSequence(REALLY_BIG_NUMBER); } $reviewFormElement->setQuestion($this->getData('question'), null); // Localized $reviewFormElement->setRequired($this->getData('required') ? 1 : 0); $reviewFormElement->setIncluded($this->getData('included') ? 1 : 0); $reviewFormElement->setElementType($this->getData('elementType')); if (in_array($this->getData('elementType'), ReviewFormElement::getMultipleResponsesElementTypes())) { $reviewFormElement->setPossibleResponses($this->getData('possibleResponses'), null); // Localized } else { $reviewFormElement->setPossibleResponses(null, null); } if ($reviewFormElement->getId() != null) { $reviewFormElementDao->deleteSetting($reviewFormElement->getId(), 'possibleResponses'); $reviewFormElementDao->updateObject($reviewFormElement); $this->reviewFormElementId = $reviewFormElement->getId(); } else { $this->reviewFormElementId = $reviewFormElementDao->insertObject($reviewFormElement); $reviewFormElementDao->resequenceReviewFormElements($this->reviewFormId); } }
function importReviewForms() { assert($this->xml->name == 'reviewForms'); $journal = $this->journal; $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO'); $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO'); $this->nextElement(); while ($this->xml->name == 'reviewForm') { $reviewFormXML = $this->getCurrentElementAsDom(); $reviewForm = new ReviewForm(); $reviewForm->setSequence((int) $reviewFormXML->sequence); $reviewForm->setActive((int) $reviewFormXML->active); $reviewForm->setAssocType(ASSOC_TYPE_JOURNAL); $reviewForm->setAssocId($this->journal->getId()); $reviewFormDao->insertObject($reviewForm); $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_REVIEW_FORM, (int) $reviewFormXML->oldId, $reviewForm->getId()); foreach ($reviewFormXML->reviewElement as $reviewElementXML) { $reviewFormElement = new ReviewFormElement(); $reviewFormElement->setReviewFormId($reviewForm->getId()); $reviewFormElement->setSequence((int) $reviewElementXML->sequence); $reviewFormElement->setElementType((int) $reviewElementXML->elementType); $reviewFormElement->setRequired((int) $reviewElementXML->required); $reviewFormElement->setIncluded((int) $reviewElementXML->included); $reviewFormElementDao->insertObject($reviewFormElement); $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_REVIEW_FORM_ELEMENT, (int) $reviewElementXML->oldId, $reviewFormElement->getId()); $this->restoreDataObjectSettings($reviewFormElementDao, $reviewElementXML->settings, 'review_form_element_settings', 'review_form_element_id', $reviewFormElement->getId()); } $this->restoreDataObjectSettings($reviewFormDao, $reviewFormXML->settings, 'review_form_settings', 'review_form_id', $reviewForm->getId()); $this->nextElement(); } }