Open Journal Systems  3.3.0
ArticleTombstoneManager.inc.php
1 <?php
2 
21  function __construct() {
22  }
23 
24  function insertArticleTombstone(&$article, &$journal) {
25  $sectionDao = DAORegistry::getDAO('SectionDAO'); /* @var $sectionDao SectionDAO */
26  $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO'); /* @var $tombstoneDao DataObjectTombstoneDAO */
27  // delete article tombstone -- to ensure that there aren't more than one tombstone for this article
28  $tombstoneDao->deleteByDataObjectId($article->getId());
29  // insert article tombstone
30  $section = $sectionDao->getById($article->getSectionId());
31  $setSpec = urlencode($journal->getPath()) . ':' . urlencode($section->getLocalizedAbbrev());
32  $oaiIdentifier = 'oai:' . Config::getVar('oai', 'repository_id') . ':' . 'article/' . $article->getId();
33  $OAISetObjectsIds = array(
34  ASSOC_TYPE_JOURNAL => $journal->getId(),
35  ASSOC_TYPE_SECTION => $section->getId(),
36  );
37 
38  $articleTombstone = $tombstoneDao->newDataObject();
39  $articleTombstone->setDataObjectId($article->getId());
40  $articleTombstone->stampDateDeleted();
41  $articleTombstone->setSetSpec($setSpec);
42  $articleTombstone->setSetName($section->getLocalizedTitle());
43  $articleTombstone->setOAIIdentifier($oaiIdentifier);
44  $articleTombstone->setOAISetObjectsIds($OAISetObjectsIds);
45  $tombstoneDao->insertObject($articleTombstone);
46 
47  if (HookRegistry::call('ArticleTombstoneManager::insertArticleTombstone', array(&$articleTombstone, &$article, &$journal))) return;
48  }
49 }
50 
51 
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
ArticleTombstoneManager
Class defining basic operations for article tombstones.
Definition: ArticleTombstoneManager.inc.php:17
Config\getVar
static getVar($section, $key, $default=null)
Definition: Config.inc.php:35
ArticleTombstoneManager\__construct
__construct()
Definition: ArticleTombstoneManager.inc.php:21
HookRegistry\call
static call($hookName, $args=null)
Definition: HookRegistry.inc.php:86
ArticleTombstoneManager\insertArticleTombstone
insertArticleTombstone(&$article, &$journal)
Definition: ArticleTombstoneManager.inc.php:24