/**
  * Save changes to a archive's settings.
  * @param $args array
  * @param $request object
  */
 function updateArchive($args, &$request)
 {
     $this->validate();
     $this->setupTemplate();
     import('classes.admin.form.ArchiveForm');
     $archiveId = (int) $request->getUserVar('archiveId');
     $archiveForm = new ArchiveForm($archiveId, true);
     $archiveForm->initData();
     $archiveForm->readInputData();
     $dataModified = false;
     if ($request->getUserVar('uploadArchiveImage')) {
         if (!$archiveForm->uploadArchiveImage()) {
             $archiveForm->addError('archiveImage', Locale::translate('archive.image.profileImageInvalid'));
         }
         $dataModified = true;
     } else {
         if ($request->getUserVar('deleteArchiveImage')) {
             $archiveForm->deleteArchiveImage();
             $dataModified = true;
         }
     }
     if (!$dataModified && $archiveForm->validate()) {
         $archiveForm->execute();
         import('lib.pkp.classes.notification.NotificationManager');
         $notificationManager = new NotificationManager();
         $notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
         $request->redirect(null, 'archives');
     } else {
         $this->setupTemplate(true);
         $archiveForm->display();
     }
 }
 /**
  * Save changes to a archive's settings.
  */
 function updateArchive()
 {
     $this->validate();
     $this->setupTemplate();
     import('admin.form.ArchiveForm');
     $archiveId = (int) Request::getUserVar('archiveId');
     $archiveForm = new ArchiveForm($archiveId, true);
     $archiveForm->initData();
     $archiveForm->readInputData();
     $dataModified = false;
     if (Request::getUserVar('uploadArchiveImage')) {
         if (!$archiveForm->uploadArchiveImage()) {
             $archiveForm->addError('archiveImage', Locale::translate('archive.image.profileImageInvalid'));
         }
         $dataModified = true;
     } else {
         if (Request::getUserVar('deleteArchiveImage')) {
             $archiveForm->deleteArchiveImage();
             $dataModified = true;
         }
     }
     if (!$dataModified && $archiveForm->validate()) {
         $archiveForm->execute();
         Request::redirect('admin', 'manage', $archiveId);
     } else {
         $this->setupTemplate(true);
         $archiveForm->display();
     }
 }
예제 #3
0
 /**
  * Save changes to an archive's settings.
  */
 function updateArchive($args, $request)
 {
     $archiveId = $request->getUserVar('archiveId');
     if (empty($archiveId)) {
         $archiveId = null;
     } else {
         $archiveId = (int) $archiveId;
     }
     $this->validate($archiveId);
     $this->setupTemplate($request, true);
     import('classes.admin.form.ArchiveForm');
     $archiveForm = new ArchiveForm($archiveId);
     $archiveForm->initData();
     $archiveForm->readInputData();
     $dataModified = false;
     if ($request->getUserVar('uploadArchiveImage')) {
         if (!$archiveForm->uploadArchiveImage()) {
             $archiveForm->addError('archiveImage', __('archive.image.profileImageInvalid'));
         }
         $dataModified = true;
     } else {
         if ($request->getUserVar('deleteArchiveImage')) {
             $archiveForm->deleteArchiveImage();
             $dataModified = true;
         }
     }
     if (!$dataModified && $archiveForm->validate()) {
         $archiveForm->execute();
         $request->redirect('submitter', $archiveId);
     } else {
         $archiveForm->display();
     }
 }