コード例 #1
0
 /**
  * Delete version
  *
  * @param void
  * @return null
  */
 function delete()
 {
     if ($this->request->isSubmitted()) {
         if (!$this->active_page_version->canDelete($this->logged_user)) {
             $this->httpError(HTTP_ERR_FORBIDDEN);
         }
         // if
         $delete = $this->active_page_version->delete();
         if ($delete && !is_error($delete)) {
             if ($this->request->isAsyncCall()) {
                 $this->httpOk();
             } else {
                 flash_success('Version #:version has been deleted', array('version' => $this->active_page_version->getVersion()));
             }
             // if
         } else {
             if ($this->request->isAsyncCall()) {
                 $this->httpError(HTTP_ERR_OPERATION_FAILED);
             } else {
                 flash_success('Failed to delete version #:version', array('version' => $this->active_page_version->getVersion()));
             }
             // if
         }
         // if
         $this->redirectToUrl($this->active_page->getViewUrl());
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
コード例 #2
0
 /**
  * Get revert to URL
  *
  * @param PageVersion $version
  * @return string
  */
 function getRevertUrl($version)
 {
     return assemble_url('project_page_revert', array('project_id' => $this->getProjectId(), 'page_id' => $this->getId(), 'to' => $version->getVersion()));
 }