示例#1
0
 /**
  * Produces archival package for publication
  * Redirects to edit task for the resource
  *
  * @return  void
  */
 public function archiveTask()
 {
     // Incoming
     $pid = Request::getInt('pid', 0);
     $vid = Request::getInt('vid', 0);
     $version = Request::getVar('version', 'default');
     // Load publication
     $pub = new Models\Publication($pid, $version, $vid);
     if (!$pub->exists()) {
         throw new Exception(Lang::txt('COM_PUBLICATIONS_NOT_FOUND'), 404);
     }
     $url = Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=edit' . '&id[]=' . $pid . '&version=' . $version, false);
     // Get attachments
     $pub->attachments();
     // Get authors
     $pub->authors();
     // Set pub assoc and load curation
     $pub->setCuration();
     // Produce archival package
     if (!$pub->_curationModel->package()) {
         // Checkin the resource
         $pub->publication->checkin();
         // Redirect
         App::redirect($url, Lang::txt('COM_PUBLICATIONS_ERROR_ARCHIVAL'), 'error');
         return;
     }
     // Checkin the resource
     $pub->publication->checkin();
     // Redirect
     App::redirect($url, Lang::txt('COM_PUBLICATIONS_SUCCESS_ARCHIVAL'));
 }