Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
ArticleDAO.inc.php
1 <?php
2 
18 import('classes.article.Article');
19 
20 class ArticleDAO extends DAO {
21  var $authorDao;
22 
23  var $cache;
24 
25  function _cacheMiss(&$cache, $id) {
26  $article =& $this->getArticle($id, null, false);
27  $cache->setCache($id, $article);
28  return $article;
29  }
30 
31  function &_getCache() {
32  if (!isset($this->cache)) {
33  $cacheManager =& CacheManager::getManager();
34  $this->cache =& $cacheManager->getObjectCache('articles', 0, array(&$this, '_cacheMiss'));
35  }
36  return $this->cache;
37  }
38 
42  function ArticleDAO() {
43  parent::DAO();
44  $this->authorDao =& DAORegistry::getDAO('AuthorDAO');
45  }
46 
51  function getLocaleFieldNames() {
52  return array(
53  'title', 'cleanTitle', 'abstract', 'coverPageAltText', 'showCoverPage', 'hideCoverPageToc', 'hideCoverPageAbstract', 'originalFileName', 'fileName', 'width', 'height',
54  'discipline', 'subjectClass', 'subject', 'coverageGeo', 'coverageChron', 'coverageSample', 'type', 'sponsor'
55  );
56  }
57 
64  $additionalFields = parent::getAdditionalFieldNames();
65  // FIXME: Move this to a PID plug-in.
66  $additionalFields[] = 'pub-id::publisher-id';
67  return $additionalFields;
68  }
69 
74  function updateLocaleFields(&$article) {
75  $this->updateDataObjectSettings('article_settings', $article, array(
76  'article_id' => $article->getId()
77  ));
78  }
79 
87  function &getArticle($articleId, $journalId = null, $useCache = false) {
88  if ($useCache) {
89  $cache =& $this->_getCache();
90  $returner = $cache->get($articleId);
91  if ($returner && $journalId != null && $journalId != $returner->getJournalId()) $returner = null;
92  return $returner;
93  }
94 
95  $primaryLocale = AppLocale::getPrimaryLocale();
96  $locale = AppLocale::getLocale();
97  $params = array(
98  'title',
99  $primaryLocale,
100  'title',
101  $locale,
102  'abbrev',
103  $primaryLocale,
104  'abbrev',
105  $locale,
106  $articleId
107  );
108  $sql = 'SELECT a.*,
109  COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
110  COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
111  FROM articles a
112  LEFT JOIN sections s ON s.section_id = a.section_id
113  LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
114  LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
115  LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
116  LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
117  WHERE article_id = ?';
118  if ($journalId !== null) {
119  $sql .= ' AND a.journal_id = ?';
120  $params[] = $journalId;
121  }
122 
123  $result =& $this->retrieve($sql, $params);
124 
125  $returner = null;
126  if ($result->RecordCount() != 0) {
127  $returner =& $this->_returnArticleFromRow($result->GetRowAssoc(false));
128  }
129 
130  $result->Close();
131  unset($result);
132 
133  return $returner;
134  }
135 
136 
145  function &getBySetting($settingName, $settingValue, $journalId = null, $rangeInfo = null) {
146  $primaryLocale = AppLocale::getPrimaryLocale();
147  $locale = AppLocale::getLocale();
148 
149  $params = array(
150  'title',
151  $primaryLocale,
152  'title',
153  $locale,
154  'abbrev',
155  $primaryLocale,
156  'abbrev',
157  $locale,
158  $settingName
159  );
160 
161  $sql = 'SELECT a.*,
162  COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
163  COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
164  FROM articles a
165  LEFT JOIN sections s ON s.section_id = a.section_id
166  LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
167  LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
168  LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
169  LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?) ';
170  if (is_null($settingValue)) {
171  $sql .= 'LEFT JOIN article_settings ast ON a.article_id = ast.article_id AND ast.setting_name = ?
172  WHERE (ast.setting_value IS NULL OR ast.setting_value = "")';
173  } else {
174  $params[] = $settingValue;
175  $sql .= 'INNER JOIN article_settings ast ON a.article_id = ast.article_id
176  WHERE ast.setting_name = ? AND ast.setting_value = ?';
177  }
178  if ($journalId) {
179  $params[] = (int) $journalId;
180  $sql .= ' AND a.journal_id = ?';
181  }
182  $sql .= ' ORDER BY a.journal_id, a.article_id';
183  $result =& $this->retrieveRange($sql, $params, $rangeInfo);
184 
185  $returner = new DAOResultFactory($result, $this, '_returnArticleFromRow');
186  return $returner;
187  }
188 
194  function &_returnArticleFromRow(&$row) {
195  $article = new Article();
196  $this->_articleFromRow($article, $row);
197  return $article;
198  }
199 
205  function _articleFromRow(&$article, &$row) {
206  $article->setId($row['article_id']);
207  $article->setLocale($row['locale']);
208  $article->setUserId($row['user_id']);
209  $article->setJournalId($row['journal_id']);
210  $article->setSectionId($row['section_id']);
211  $article->setSectionTitle($row['section_title']);
212  $article->setSectionAbbrev($row['section_abbrev']);
213  $article->setLanguage($row['language']);
214  $article->setCommentsToEditor($row['comments_to_ed']);
215  $article->setCitations($row['citations']);
216  $article->setDateSubmitted($this->datetimeFromDB($row['date_submitted']));
217  $article->setDateStatusModified($this->datetimeFromDB($row['date_status_modified']));
218  $article->setLastModified($this->datetimeFromDB($row['last_modified']));
219  $article->setStatus($row['status']);
220  $article->setSubmissionProgress($row['submission_progress']);
221  $article->setCurrentRound($row['current_round']);
222  $article->setSubmissionFileId($row['submission_file_id']);
223  $article->setRevisedFileId($row['revised_file_id']);
224  $article->setReviewFileId($row['review_file_id']);
225  $article->setEditorFileId($row['editor_file_id']);
226  $article->setPages($row['pages']);
227  $article->setFastTracked($row['fast_tracked']);
228  $article->setHideAuthor($row['hide_author']);
229  $article->setCommentsStatus($row['comments_status']);
230 
231  $this->getDataObjectSettings('article_settings', 'article_id', $row['article_id'], $article);
232 
233  HookRegistry::call('ArticleDAO::_returnArticleFromRow', array(&$article, &$row));
234 
235  }
236 
241  function insertArticle(&$article) {
242  $article->stampModified();
243  $this->update(
244  sprintf('INSERT INTO articles
245  (locale, user_id, journal_id, section_id, language, comments_to_ed, citations, date_submitted, date_status_modified, last_modified, status, submission_progress, current_round, submission_file_id, revised_file_id, review_file_id, editor_file_id, pages, fast_tracked, hide_author, comments_status)
246  VALUES
247  (?, ?, ?, ?, ?, ?, ?, %s, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
248  $this->datetimeToDB($article->getDateSubmitted()), $this->datetimeToDB($article->getDateStatusModified()), $this->datetimeToDB($article->getLastModified())),
249  array(
250  $article->getLocale(),
251  $article->getUserId(),
252  $article->getJournalId(),
253  $article->getSectionId(),
254  $article->getLanguage(),
255  $article->getCommentsToEditor(),
256  $article->getCitations(),
257  $article->getStatus() === null ? STATUS_QUEUED : $article->getStatus(),
258  $article->getSubmissionProgress() === null ? 1 : $article->getSubmissionProgress(),
259  $article->getCurrentRound() === null ? 1 : $article->getCurrentRound(),
260  $this->nullOrInt($article->getSubmissionFileId()),
261  $this->nullOrInt($article->getRevisedFileId()),
262  $this->nullOrInt($article->getReviewFileId()),
263  $this->nullOrInt($article->getEditorFileId()),
264  $article->getPages(),
265  (int) $article->getFastTracked(),
266  (int) $article->getHideAuthor(),
267  (int) $article->getCommentsStatus()
268  )
269  );
270 
271  $article->setId($this->getInsertArticleId());
272  $this->updateLocaleFields($article);
273 
274  // Insert authors for this article
275  $authors =& $article->getAuthors();
276  for ($i=0, $count=count($authors); $i < $count; $i++) {
277  $authors[$i]->setSubmissionId($article->getId());
278  $this->authorDao->insertAuthor($authors[$i]);
279  }
280 
281  return $article->getId();
282  }
283 
288  function updateArticle(&$article) {
289  $article->stampModified();
290  $this->update(
291  sprintf('UPDATE articles
292  SET locale = ?,
293  user_id = ?,
294  section_id = ?,
295  language = ?,
296  comments_to_ed = ?,
297  citations = ?,
298  date_submitted = %s,
299  date_status_modified = %s,
300  last_modified = %s,
301  status = ?,
302  submission_progress = ?,
303  current_round = ?,
304  submission_file_id = ?,
305  revised_file_id = ?,
306  review_file_id = ?,
307  editor_file_id = ?,
308  pages = ?,
309  fast_tracked = ?,
310  hide_author = ?,
311  comments_status = ?
312  WHERE article_id = ?',
313  $this->datetimeToDB($article->getDateSubmitted()), $this->datetimeToDB($article->getDateStatusModified()), $this->datetimeToDB($article->getLastModified())),
314  array(
315  $article->getLocale(),
316  (int) $article->getUserId(),
317  (int) $article->getSectionId(),
318  $article->getLanguage(),
319  $article->getCommentsToEditor(),
320  $article->getCitations(),
321  (int) $article->getStatus(),
322  (int) $article->getSubmissionProgress(),
323  (int) $article->getCurrentRound(),
324  $this->nullOrInt($article->getSubmissionFileId()),
325  $this->nullOrInt($article->getRevisedFileId()),
326  $this->nullOrInt($article->getReviewFileId()),
327  $this->nullOrInt($article->getEditorFileId()),
328  $article->getPages(),
329  (int) $article->getFastTracked(),
330  (int) $article->getHideAuthor(),
331  (int) $article->getCommentsStatus(),
332  $article->getId()
333  )
334  );
335 
336  $this->updateLocaleFields($article);
337 
338  // update authors for this article
339  $authors =& $article->getAuthors();
340  for ($i=0, $count=count($authors); $i < $count; $i++) {
341  if ($authors[$i]->getId() > 0) {
342  $this->authorDao->updateAuthor($authors[$i]);
343  } else {
344  $this->authorDao->insertAuthor($authors[$i]);
345  }
346  }
347 
348  // Update author sequence numbers
349  $this->authorDao->resequenceAuthors($article->getId());
350 
351  $this->flushCache();
352  }
353 
358  function deleteArticle(&$article) {
359  return $this->deleteArticleById($article->getId());
360  }
361 
366  function deleteArticleById($articleId) {
367  $this->authorDao->deleteAuthorsByArticle($articleId);
368 
369  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
370  $publishedArticleDao->deletePublishedArticleByArticleId($articleId);
371 
372  $commentDao =& DAORegistry::getDAO('CommentDAO');
373  $commentDao->deleteBySubmissionId($articleId);
374 
375  $noteDao =& DAORegistry::getDAO('NoteDAO');
376  $noteDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
377 
378  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
379  $sectionEditorSubmissionDao->deleteDecisionsByArticle($articleId);
380  $sectionEditorSubmissionDao->deleteReviewRoundsByArticle($articleId);
381 
382  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
383  $reviewAssignmentDao->deleteBySubmissionId($articleId);
384 
385  $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
386  $editAssignmentDao->deleteEditAssignmentsByArticle($articleId);
387 
388  // Delete copyedit, layout, and proofread signoffs
389  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
390  $copyedInitialSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
391  $copyedAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
392  $copyedFinalSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId);
393  $layoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
394  $proofreadAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
395  $proofreadProofreaderSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
396  $proofreadLayoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
397  $signoffs = array($copyedInitialSignoffs, $copyedAuthorSignoffs, $copyedFinalSignoffs, $layoutSignoffs,
398  $proofreadAuthorSignoffs, $proofreadProofreaderSignoffs, $proofreadLayoutSignoffs);
399  foreach ($signoffs as $signoff) {
400  if ( $signoff ) $signoffDao->deleteObject($signoff);
401  }
402 
403  $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
404  $articleCommentDao->deleteArticleComments($articleId);
405 
406  $articleGalleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
407  $articleGalleyDao->deleteGalleysByArticle($articleId);
408 
409  $articleSearchDao =& DAORegistry::getDAO('ArticleSearchDAO');
410  $articleSearchDao->deleteArticleKeywords($articleId);
411 
412  $articleEventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
413  $articleEventLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
414 
415  $articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
416  $articleEmailLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
417 
418  $notificationDao =& DAORegistry::getDAO('NotificationDAO');
419  $notificationDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
420 
421  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
422  $suppFileDao->deleteSuppFilesByArticle($articleId);
423 
424  // Delete article files -- first from the filesystem, then from the database
425  import('classes.file.ArticleFileManager');
426  $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
427  $articleFiles =& $articleFileDao->getArticleFilesByArticle($articleId);
428 
429  $articleFileManager = new ArticleFileManager($articleId);
430  foreach ($articleFiles as $articleFile) {
431  $articleFileManager->deleteFile($articleFile->getFileId());
432  }
433 
434  $articleFileDao->deleteArticleFiles($articleId);
435 
436  // Delete article citations.
437  $citationDao =& DAORegistry::getDAO('CitationDAO');
438  $citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
439 
440  $this->update('DELETE FROM article_settings WHERE article_id = ?', $articleId);
441  $this->update('DELETE FROM articles WHERE article_id = ?', $articleId);
442 
443  import('classes.search.ArticleSearchIndex');
444  $articleSearchIndex = new ArticleSearchIndex();
445  $articleSearchIndex->articleDeleted($articleId);
446  $articleSearchIndex->articleChangesFinished();
447 
448  $this->flushCache();
449  }
450 
456  function &getArticlesByJournalId($journalId = null) {
457  $primaryLocale = AppLocale::getPrimaryLocale();
458  $locale = AppLocale::getLocale();
459 
460  $params = array(
461  'title',
462  $primaryLocale,
463  'title',
464  $locale,
465  'abbrev',
466  $primaryLocale,
467  'abbrev',
468  $locale
469  );
470  if ($journalId !== null) $params[] = (int) $journalId;
471 
472  $result =& $this->retrieve(
473  'SELECT a.*,
474  COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
475  COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
476  FROM articles a
477  LEFT JOIN sections s ON s.section_id = a.section_id
478  LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
479  LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
480  LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
481  LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
482  ' . ($journalId !== null ? 'WHERE a.journal_id = ?' : ''),
483  $params
484  );
485 
486  $returner = new DAOResultFactory($result, $this, '_returnArticleFromRow');
487  return $returner;
488  }
489 
494  function deleteArticlesByJournalId($journalId) {
495  $articles = $this->getArticlesByJournalId($journalId);
496 
497  while (!$articles->eof()) {
498  $article =& $articles->next();
499  $this->deleteArticleById($article->getId());
500  }
501  }
502 
509  function &getArticlesByUserId($userId, $journalId = null) {
510  $primaryLocale = AppLocale::getPrimaryLocale();
511  $locale = AppLocale::getLocale();
512  $params = array(
513  'title',
514  $primaryLocale,
515  'title',
516  $locale,
517  'abbrev',
518  $primaryLocale,
519  'abbrev',
520  $locale,
521  $userId
522  );
523  if ($journalId) $params[] = $journalId;
524  $articles = array();
525 
526  $result =& $this->retrieve(
527  'SELECT a.*,
528  COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
529  COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
530  FROM articles a
531  LEFT JOIN sections s ON s.section_id = a.section_id
532  LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
533  LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
534  LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
535  LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
536  WHERE a.user_id = ?' .
537  (isset($journalId)?' AND a.journal_id = ?':''),
538  $params
539  );
540 
541  while (!$result->EOF) {
542  $articles[] =& $this->_returnArticleFromRow($result->GetRowAssoc(false));
543  $result->MoveNext();
544  }
545 
546  $result->Close();
547  unset($result);
548 
549  return $articles;
550  }
551 
557  function getArticleJournalId($articleId) {
558  $result =& $this->retrieve(
559  'SELECT journal_id FROM articles WHERE article_id = ?', $articleId
560  );
561  $returner = isset($result->fields[0]) ? $result->fields[0] : false;
562 
563  $result->Close();
564  unset($result);
565 
566  return $returner;
567  }
568 
576  function incompleteSubmissionExists($articleId, $userId, $journalId) {
577  $result =& $this->retrieve(
578  'SELECT submission_progress FROM articles WHERE article_id = ? AND user_id = ? AND journal_id = ? AND date_submitted IS NULL',
579  array($articleId, $userId, $journalId)
580  );
581  $returner = isset($result->fields[0]) ? $result->fields[0] : false;
582 
583  $result->Close();
584  unset($result);
585 
586  return $returner;
587  }
588 
594  function changeArticleStatus($articleId, $status) {
595  $this->update(
596  'UPDATE articles SET status = ? WHERE article_id = ?', array((int) $status, (int) $articleId)
597  );
598 
599  $this->flushCache();
600  }
601 
610  function updateSetting($articleId, $name, $value, $type, $isLocalized = false) {
611  // Check and prepare setting data.
612  if ($isLocalized) {
613  if (is_array($value)) {
614  $values =& $value;
615  } else {
616  // We expect localized data to come in as an array.
617  assert(false);
618  return;
619  }
620  } else {
621  // Normalize non-localized data to an array so that
622  // we can treat updates uniformly.
623  $values = array('' => $value);
624  }
625  unset($value);
626 
627  // Update setting values.
628  $keyFields = array('setting_name', 'locale', 'article_id');
629  foreach ($values as $locale => $value) {
630  // Locale-specific entries will be deleted when no value exists.
631  // Non-localized settings will always be set.
632  if ($isLocalized) {
633  $this->update(
634  'DELETE FROM article_settings WHERE article_id = ? AND setting_name = ? AND locale = ?',
635  array($articleId, $name, $locale)
636  );
637  if (empty($value)) continue;
638  }
639 
640  // Convert the new value to the correct type.
641  $value = $this->convertToDB($value, $type);
642 
643  // Update the database.
644  $this->replace('article_settings',
645  array(
646  'article_id' => $articleId,
647  'setting_name' => $name,
648  'setting_value' => $value,
649  'setting_type' => $type,
650  'locale' => $locale
651  ),
652  $keyFields
653  );
654  }
655  $this->flushCache();
656  }
657 
666  function changePubId($articleId, $pubIdType, $pubId) {
667  $this->updateSetting($articleId, 'pub-id::'.$pubIdType, $pubId, 'string');
668  }
669 
681  function pubIdExists($pubIdType, $pubId, $articleId, $journalId) {
682  $result =& $this->retrieve(
683  'SELECT COUNT(*)
684  FROM article_settings ast
685  INNER JOIN articles a ON ast.article_id = a.article_id
686  WHERE ast.setting_name = ? and ast.setting_value = ? and ast.article_id <> ? AND a.journal_id = ?',
687  array(
688  'pub-id::'.$pubIdType,
689  $pubId,
690  (int) $articleId,
691  (int) $journalId
692  )
693  );
694  $returner = $result->fields[0] ? true : false;
695  $result->Close();
696  return $returner;
697  }
698 
703  function removeArticlesFromSection($sectionId) {
704  $this->update(
705  'UPDATE articles SET section_id = null WHERE section_id = ?', $sectionId
706  );
707 
708  $this->flushCache();
709  }
710 
718  function deleteAllPubIds($journalId, $pubIdType) {
719  $journalId = (int) $journalId;
720  $settingName = 'pub-id::'.$pubIdType;
721 
722  $articles =& $this->getArticlesByJournalId($journalId);
723  while ($article =& $articles->next()) {
724  $this->update(
725  'DELETE FROM article_settings WHERE setting_name = ? AND article_id = ?',
726  array(
727  $settingName,
728  (int)$article->getId()
729  )
730  );
731  unset($article);
732  }
733  $this->flushCache();
734  }
735 
740  function getInsertArticleId() {
741  return $this->getInsertId('articles', 'article_id');
742  }
743 
744  function flushCache() {
745  // Because both publishedArticles and articles are cached by
746  // article ID, flush both caches on update.
747  $cache =& $this->_getCache();
748  $cache->flush();
749  unset($cache);
750 
751  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
752  $cache =& $publishedArticleDao->_getPublishedArticleCache();
753  $cache->flush();
754  unset($cache);
755  }
756 }
757 
758 ?>
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:29
removeArticlesFromSection($sectionId)
_articleFromRow(&$article, &$row)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:83
deleteArticle(&$article)
changeArticleStatus($articleId, $status)
& getArticlesByJournalId($journalId=null)
getInsertId($table= '', $id= '', $callHooks=true)
Definition: DAO.inc.php:252
Article class.
Definition: Article.inc.php:47
& getBySetting($settingName, $settingValue, $journalId=null, $rangeInfo=null)
& getArticlesByUserId($userId, $journalId=null)
updateDataObjectSettings($tableName, &$dataObject, $idArray)
Definition: DAO.inc.php:460
insertArticle(&$article)
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:176
datetimeFromDB($dt)
Definition: DAO.inc.php:316
updateLocaleFields(&$article)
incompleteSubmissionExists($articleId, $userId, $journalId)
changePubId($articleId, $pubIdType, $pubId)
Wrapper around ADORecordSet providing &quot;factory&quot; features for generating objects from DAOs...
updateSetting($articleId, $name, $value, $type, $isLocalized=false)
& getDAO($name, $dbconn=null)
& _returnArticleFromRow(&$row)
deleteArticlesByJournalId($journalId)
Class defining operations for article file management.
convertToDB($value, &$type)
Definition: DAO.inc.php:394
call($hookName, $args=null)
& getArticle($articleId, $journalId=null, $useCache=false)
Class to maintain the article search index.
replace($table, $arrFields, $keyCols)
Definition: DAO.inc.php:240
Operations for retrieving and modifying Article objects.
deleteAllPubIds($journalId, $pubIdType)
datetimeToDB($dt)
Definition: DAO.inc.php:296
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:211
pubIdExists($pubIdType, $pubId, $articleId, $journalId)
deleteArticleById($articleId)
getArticleJournalId($articleId)
updateArticle(&$article)
getAdditionalFieldNames()