/**
  * Delete a scheduled conference.
  * @param $args array first parameter is the ID of the scheduled conference to delete
  */
 function deleteSchedConf($args)
 {
     $this->validate();
     $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $schedConfId = $args[0];
         $schedConf =& $schedConfDao->getSchedConf($schedConfId);
         // Look up the scheduled conference path before we delete the scheduled conference.
         import('file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $schedConfFilesPath = $publicFileManager->getSchedConfFilesPath($schedConfId);
         if ($schedConfDao->deleteSchedConfById($schedConfId)) {
             // Delete scheduled conference file tree
             // FIXME move this somewhere better.
             import('file.FileManager');
             $fileManager = new FileManager();
             $schedConfPath = Config::getVar('files', 'files_dir') . '/conferences/' . $schedConf->getConferenceId() . '/schedConfs/' . $schedConfId;
             $fileManager->rmtree($schedConfPath);
             $publicFileManager->rmtree($schedConfFilesPath);
         }
     }
     Request::redirect(null, null, null, 'schedConfs');
 }
 /**
  * Delete a journal.
  * @param $args array first parameter is the ID of the journal to delete
  * @param $request object
  */
 function deleteJournal($args, &$request)
 {
     $this->validate();
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $journalId = $args[0];
         if ($journalDao->deleteJournalById($journalId)) {
             // Delete journal file tree
             // FIXME move this somewhere better.
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $journalPath = Config::getVar('files', 'files_dir') . '/journals/' . $journalId;
             $fileManager->rmtree($journalPath);
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $publicFileManager->rmtree($publicFileManager->getJournalFilesPath($journalId));
         }
     }
     $request->redirect(null, null, 'journals');
 }
 /**
  * Delete a conference.
  * @param $args array first parameter is the ID of the conference to delete
  */
 function deleteConference($args, &$request)
 {
     $this->validate();
     $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $conferenceId = $args[0];
         if ($conferenceDao->deleteConferenceById($conferenceId)) {
             // Delete conference file tree
             // FIXME move this somewhere better.
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $conferencePath = Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId;
             $fileManager->rmtree($conferencePath);
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $publicFileManager->rmtree($publicFileManager->getConferenceFilesPath($conferenceId));
         }
     }
     $request->redirect(null, null, null, 'conferences');
 }
 /**
  * Delete a journal.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function deleteContext($args, $request)
 {
     // Identify the journal Id.
     $journalId = $request->getUserVar('rowId');
     $journalDao = DAORegistry::getDAO('JournalDAO');
     $journal = $journalDao->getById($journalId);
     if ($journal) {
         $journalDao->deleteById($journalId);
         // Delete journal file tree
         // FIXME move this somewhere better.
         import('lib.pkp.classes.file.FileManager');
         $fileManager = new FileManager($journalId);
         $journalPath = Config::getVar('files', 'files_dir') . '/journals/' . $journalId;
         $fileManager->rmtree($journalPath);
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->rmtree($publicFileManager->getJournalFilesPath($journalId));
         return DAO::getDataChangedEvent($journalId);
     }
     return new JSONMessage(false);
 }
 /**
  * Delete a press.
  * @param $args array first parameter is the ID of the press to delete
  */
 function deletePress($args)
 {
     $this->validate();
     $pressDao =& DAORegistry::getDAO('PressDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $pressId = $args[0];
         if ($pressDao->deletePressById($pressId)) {
             // Delete press file tree
             // FIXME move this somewhere better.
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $pressPath = Config::getVar('files', 'files_dir') . '/presses/' . $pressId;
             $fileManager->rmtree($pressPath);
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $publicFileManager->rmtree($publicFileManager->getPressFilesPath($pressId));
         }
     }
     Request::redirect(null, null, 'presses');
 }
 /**
  * Delete a press.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function deleteContext($args, $request)
 {
     // Identify the current context.
     $context = $request->getContext();
     // Identify the press Id.
     $pressId = $request->getUserVar('rowId');
     $pressDao = DAORegistry::getDAO('PressDAO');
     $press = $pressDao->getById($pressId);
     if ($pressId) {
         $pressDao->deleteById($pressId);
         // Add publication formats tombstones for all press published monographs.
         import('classes.publicationFormat.PublicationFormatTombstoneManager');
         $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
         $publicationFormatTombstoneMgr->insertTombstonesByPress($press);
         // Delete press file tree
         // FIXME move this somewhere better.
         import('lib.pkp.classes.file.ContextFileManager');
         $pressFileManager = new ContextFileManager($pressId);
         $pressFileManager->rmtree($pressFileManager->getBasePath());
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->rmtree($publicFileManager->getPressFilesPath($pressId));
         // If user is deleting the same press where he is...
         if ($context && $context->getId() == $pressId) {
             // return a redirect js event to index handler.
             $dispatcher = $request->getDispatcher();
             $url = $dispatcher->url($request, ROUTE_PAGE, null, 'index');
             return $request->redirectUrlJson($url);
         }
         return DAO::getDataChangedEvent($pressId);
     }
     return new JSONMessage();
 }
 /**
  * Delete a conference.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function deleteContext($args, &$request)
 {
     // Identify the current context.
     $context =& $request->getContext();
     // Identify the conference Id.
     $conferenceId = $request->getUserVar('rowId');
     $conferenceDao = DAORegistry::getDAO('ConferenceDAO');
     $conference =& $conferenceDao->getById($conferenceId);
     if ($conference) {
         $conferenceDao->deleteById($conferenceId);
         // Delete conference file tree
         // FIXME move this somewhere better.
         import('lib.pkp.classes.file.FileManager');
         $fileManager = new FileManager($conferenceId);
         $conferencePath = Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId;
         $fileManager->rmtree($conferencePath);
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->rmtree($publicFileManager->getConferenceFilesPath($conferenceId));
         return DAO::getDataChangedEvent($conferenceId);
     }
     $json = new JSONMessage(false);
     return $json->getString();
 }