ArticleGalleyForm::execute PHP Méthode

execute() public méthode

Save changes to the galley.
public execute ( $request ) : ArticleGalley
$request PKPRequest
Résultat ArticleGalley The resulting article galley.
    function execute($request)
    {
        import('classes.file.IssueFileManager');
        $journal = $request->getJournal();
        $articleGalley = $this->_articleGalley;
        $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
        if ($articleGalley) {
            $articleGalley->setLabel($this->getData('label'));
            $articleGalley->setLocale($this->getData('galleyLocale'));
            $articleGalley->setRemoteURL($this->getData('remoteURL'));
            // Update galley in the db
            $articleGalleyDao->updateObject($articleGalley);
        } else {
            // Create a new galley
            $articleGalley = $articleGalleyDao->newDataObject();
            $articleGalley->setSubmissionId($this->_submission->getId());
            $articleGalley->setLabel($this->getData('label'));
            $articleGalley->setLocale($this->getData('galleyLocale'));
            $articleGalley->setRemoteURL($this->getData('remoteURL'));
            // Insert new galley into the db
            $articleGalleyDao->insertObject($articleGalley);
            $this->_articleGalley = $articleGalley;
        }
        return $articleGalley;
    }

Usage Example

 /**
  * Update a format
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateFormat($args, $request)
 {
     $submission = $this->getSubmission();
     $representationDao = Application::getRepresentationDAO();
     $representation = $representationDao->getById($request->getUserVar('representationId'), $submission->getId());
     import('controllers.grid.articleGalleys.form.ArticleGalleyForm');
     $articleGalleyForm = new ArticleGalleyForm($request, $submission, $representation);
     $articleGalleyForm->readInputData();
     if ($articleGalleyForm->validate($request)) {
         $articleGalleyForm->execute($request);
         return DAO::getDataChangedEvent();
     }
     return new JSONMessage(true, $articleGalleyForm->fetch($request));
 }
All Usage Examples Of ArticleGalleyForm::execute