Open Journal Systems  3.0.0
 All Classes Namespaces Functions Variables Groups Pages
OpenAIREDAO.inc.php
1 <?php
2 
16 import('classes.oai.ojs.OAIDAO');
17 
18 
19 class OpenAIREDAO extends OAIDAO {
20 
24  function OpenAIREDAO() {
25  parent::OAIDAO();
26  }
27 
32  function setOAI(&$oai) {
33  $this->oai = $oai;
34  }
35 
36  //
37  // Records
38  //
39 
51  function &getOpenAIRERecordsOrIdentifiers($setIds, $from, $until, $offset, $limit, &$total, $funcName) {
52  $records = array();
53 
54  $result = $this->_getRecordsRecordSet($setIds, $from, $until, null);
55 
56  $total = $result->RecordCount();
57 
58  $result->Move($offset);
59  for ($count = 0; $count < $limit && !$result->EOF; $count++) {
60  $row = $result->GetRowAssoc(false);
61  if ($this->isOpenAIRERecord($row)) {
62  $records[] = $this->_returnRecordFromRow($row);
63  }
64  $result->MoveNext();
65  }
66 
67  $result->Close();
68  return $records;
69  }
70 
76  function isOpenAIRERecord($row) {
77  if (!isset($row['tombstone_id'])) {
78  $params = array('projectID', (int) $row['submission_id']);
79  $result = $this->retrieve(
80  'SELECT COUNT(*) FROM submission_settings WHERE setting_name = ? AND setting_value IS NOT NULL AND setting_value <> \'\' AND submission_id = ?',
81  $params
82  );
83  $returner = (isset($result->fields[0]) && $result->fields[0] == 1) ? true : false;
84  $result->Close();
85  return $returner;
86  } else {
87  $dataObjectTombstoneSettingsDao = DAORegistry::getDAO('DataObjectTombstoneSettingsDAO');
88  return $dataObjectTombstoneSettingsDao->getSetting($row['tombstone_id'], 'openaire');
89  }
90  }
91 
97  function isOpenAIREArticle($articleId) {
98  $params = array('projectID', (int) $articleId);
99  $result = $this->retrieve(
100  'SELECT COUNT(*) FROM submission_settings WHERE setting_name = ? AND setting_value IS NOT NULL AND setting_value <> \'\' AND submission_id = ?',
101  $params
102  );
103  $returner = (isset($result->fields[0]) && $result->fields[0] == 1) ? true : false;
104  $result->Close();
105  return $returner;
106  }
107 }
108 
109 ?>
static & getDAO($name, $dbconn=null)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:84
DAO operations for OpenAIRE.
& _getRecordsRecordSet($setIds, $from, $until, $set)
DAO operations for the OJS OAI interface.
Definition: OAIDAO.inc.php:20
isOpenAIRERecord($row)
& getOpenAIRERecordsOrIdentifiers($setIds, $from, $until, $offset, $limit, &$total, $funcName)
isOpenAIREArticle($articleId)
& _returnRecordFromRow($row)