/** * Remove this page from archive * * @param void * @return null */ function unarchive() { if ($this->active_page->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_page->canEdit($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { $this->active_page->setIsArchived(false); $save = $this->active_page->save(); if ($save && !is_error($save)) { if ($this->request->isApiCall()) { $this->serveData($this->active_page, 'page'); } else { flash_success('Page ":name" has been archived', array('name' => $this->active_page->getName())); } // if } else { if ($this->request->isApiCall()) { $this->serveData($save); } else { flash_error('Failed to archive ":name" page', array('name' => $this->active_page->getName())); } // if } // if $this->redirectToUrl($this->active_page->getViewUrl()); } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }