Open Journal Systems  2.4.4
 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->$funcName($row);
63  }
64  $result->moveNext();
65  }
66 
67  $result->Close();
68  unset($result);
69 
70  return $records;
71  }
72 
78  function isOpenAIRERecord($row) {
79  if (!isset($row['tombstone_id'])) {
80  $params = array('projectID', (int) $row['article_id']);
81  $result =& $this->retrieve(
82  'SELECT COUNT(*) FROM article_settings WHERE setting_name = ? AND setting_value IS NOT NULL AND setting_value <> \'\' AND article_id = ?',
83  $params
84  );
85  $returner = (isset($result->fields[0]) && $result->fields[0] == 1) ? true : false;
86  $result->Close();
87  unset($result);
88 
89  return $returner;
90  } else {
91  $dataObjectTombstoneSettingsDao =& DAORegistry::getDAO('DataObjectTombstoneSettingsDAO');
92  return $dataObjectTombstoneSettingsDao->getSetting($row['tombstone_id'], 'openaire');
93  }
94  }
95 
101  function isOpenAIREArticle($articleId) {
102  $params = array('projectID', (int) $articleId);
103  $result =& $this->retrieve(
104  'SELECT COUNT(*) FROM article_settings WHERE setting_name = ? AND setting_value IS NOT NULL AND setting_value <> \'\' AND article_id = ?',
105  $params
106  );
107  $returner = (isset($result->fields[0]) && $result->fields[0] == 1) ? true : false;
108  $result->Close();
109  unset($result);
110 
111  return $returner;
112  }
113 
114 
115 }
116 
117 ?>
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:83
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)
& getDAO($name, $dbconn=null)