00001 <?php
00002
00016
00017
00018
00019 import('article.PublishedArticle');
00020
00021 class PublishedArticleDAO extends DAO {
00022 var $articleDao;
00023 var $authorDao;
00024 var $galleyDao;
00025 var $suppFileDao;
00026
00030 function PublishedArticleDAO() {
00031 parent::DAO();
00032 $this->articleDao = &DAORegistry::getDAO('ArticleDAO');
00033 $this->authorDao = &DAORegistry::getDAO('AuthorDAO');
00034 $this->galleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
00035 $this->suppFileDao = &DAORegistry::getDAO('SuppFileDAO');
00036 }
00037
00045 function &getPublishedArticles($issueId, $limit = NULL, $simple = false) {
00046 $primaryLocale = Locale::getPrimaryLocale();
00047 $locale = Locale::getLocale();
00048 $func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
00049 $publishedArticles = array();
00050
00051 $params = array(
00052 $issueId,
00053 'title',
00054 $primaryLocale,
00055 'title',
00056 $locale,
00057 'abbrev',
00058 $primaryLocale,
00059 'abbrev',
00060 $locale,
00061 $issueId
00062 );
00063
00064 $sql = 'SELECT DISTINCT
00065 pa.*,
00066 a.*,
00067 COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
00068 COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev,
00069 COALESCE(o.seq, s.seq) AS section_seq,
00070 pa.seq
00071 FROM published_articles pa,
00072 articles a LEFT JOIN sections s ON s.section_id = a.section_id
00073 LEFT JOIN custom_section_orders o ON (a.section_id = o.section_id AND o.issue_id = ?)
00074 LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
00075 LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
00076 LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
00077 LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
00078 WHERE pa.article_id = a.article_id
00079 AND pa.issue_id = ?
00080 AND a.status <> ' . STATUS_ARCHIVED . '
00081 ORDER BY section_seq ASC, pa.seq ASC';
00082
00083 if (isset($limit)) $result = &$this->retrieveLimit($sql, $params, $limit);
00084 else $result = &$this->retrieve($sql, $params);
00085
00086 while (!$result->EOF) {
00087 $publishedArticles[] = &$this->$func($result->GetRowAssoc(false));
00088 $result->moveNext();
00089 }
00090
00091 $result->Close();
00092 unset($result);
00093
00094 return $publishedArticles;
00095 }
00096
00100 function getPublishedArticleCountByJournalId($journalId) {
00101 $result =& $this->retrieve(
00102 'SELECT count(*) FROM published_articles pa, articles a WHERE pa.article_id = a.article_id AND a.journal_id = ? AND a.status <> ' . STATUS_ARCHIVED,
00103 $journalId
00104 );
00105 list($count) = $result->fields;
00106 $result->Close();
00107 return $count;
00108 }
00109
00117 function &getPublishedArticlesByJournalId($journalId, $rangeInfo = null, $simple = false) {
00118 $primaryLocale = Locale::getPrimaryLocale();
00119 $locale = Locale::getLocale();
00120 $func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
00121 $result =& $this->retrieveRange(
00122 'SELECT pa.*,
00123 a.*,
00124 COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
00125 COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
00126 FROM published_articles pa,
00127 articles a
00128 LEFT JOIN sections s ON s.section_id = a.section_id
00129 LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
00130 LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
00131 LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
00132 LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
00133 WHERE pa.article_id = a.article_id
00134 AND a.journal_id = ?
00135 AND a.status <> ' . STATUS_ARCHIVED,
00136 array(
00137 'title',
00138 $primaryLocale,
00139 'title',
00140 $locale,
00141 'abbrev',
00142 $primaryLocale,
00143 'abbrev',
00144 $locale,
00145 $journalId
00146 ),
00147 $rangeInfo
00148 );
00149
00150 $returner =& new DAOResultFactory($result, $this, $func);
00151 return $returner;
00152 }
00153
00160 function &getPublishedArticlesInSections($issueId, $simple = false) {
00161 $primaryLocale = Locale::getPrimaryLocale();
00162 $locale = Locale::getLocale();
00163 $func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
00164 $publishedArticles = array();
00165
00166 $result = &$this->retrieve(
00167 'SELECT DISTINCT
00168 pa.*,
00169 a.*,
00170 COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
00171 COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev,
00172 s.abstracts_not_required AS abstracts_not_required,
00173 s.hide_title AS section_hide_title,
00174 s.hide_author AS section_hide_author,
00175 COALESCE(o.seq, s.seq) AS section_seq,
00176 pa.seq
00177 FROM published_articles pa,
00178 articles a
00179 LEFT JOIN sections s ON s.section_id = a.section_id
00180 LEFT JOIN custom_section_orders o ON (a.section_id = o.section_id AND o.issue_id = ?)
00181 LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
00182 LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
00183 LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
00184 LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
00185 WHERE pa.article_id = a.article_id
00186 AND pa.issue_id = ?
00187 AND a.status <> ' . STATUS_ARCHIVED . '
00188 ORDER BY section_seq ASC, pa.seq ASC',
00189 array(
00190 $issueId,
00191 'title',
00192 $primaryLocale,
00193 'title',
00194 $locale,
00195 'abbrev',
00196 $primaryLocale,
00197 'abbrev',
00198 $locale,
00199 $issueId
00200 )
00201 );
00202
00203 $currSectionId = 0;
00204 while (!$result->EOF) {
00205 $row = &$result->GetRowAssoc(false);
00206 $publishedArticle = &$this->$func($row);
00207 if ($publishedArticle->getSectionId() != $currSectionId) {
00208 $currSectionId = $publishedArticle->getSectionId();
00209 $publishedArticles[$currSectionId] = array(
00210 'articles'=> array(),
00211 'title' => '',
00212 'abstractsNotRequired' => $row['abstracts_not_required'],
00213 'hideAuthor' => $row['section_hide_author']
00214 );
00215
00216 if (!$row['section_hide_title']) {
00217 $publishedArticles[$currSectionId]['title'] = $publishedArticle->getSectionTitle();
00218 }
00219 }
00220 $publishedArticles[$currSectionId]['articles'][] = $publishedArticle;
00221 $result->moveNext();
00222 }
00223
00224 $result->Close();
00225 unset($result);
00226
00227 return $publishedArticles;
00228 }
00229
00237 function &getPublishedArticlesBySectionId($sectionId, $issueId, $simple = false) {
00238 $primaryLocale = Locale::getPrimaryLocale();
00239 $locale = Locale::getLocale();
00240 $func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
00241 $publishedArticles = array();
00242
00243 $result = &$this->retrieve(
00244 'SELECT pa.*,
00245 a.*,
00246 COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
00247 COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
00248 FROM published_articles pa,
00249 articles a,
00250 sections s
00251 LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
00252 LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
00253 LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
00254 LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
00255 WHERE a.section_id = s.section_id
00256 AND pa.article_id = a.article_id
00257 AND a.section_id = ?
00258 AND pa.issue_id = ?
00259 AND a.status <> ' . STATUS_ARCHIVED . '
00260 ORDER BY pa.seq ASC',
00261 array(
00262 'title',
00263 $primaryLocale,
00264 'title',
00265 $locale,
00266 'abbrev',
00267 $primaryLocale,
00268 'abbrev',
00269 $locale,
00270 $sectionId,
00271 $issueId
00272 )
00273 );
00274
00275 $currSectionId = 0;
00276 while (!$result->EOF) {
00277 $publishedArticle = &$this->$func($result->GetRowAssoc(false));
00278 $publishedArticles[] = $publishedArticle;
00279 $result->moveNext();
00280 }
00281
00282 $result->Close();
00283 unset($result);
00284
00285 return $publishedArticles;
00286 }
00287
00294 function &getPublishedArticleById($pubId, $simple = false) {
00295 $result = &$this->retrieve(
00296 'SELECT * FROM published_articles WHERE pub_id = ?', $pubId
00297 );
00298 $row = $result->GetRowAssoc(false);
00299
00300 $publishedArticle = &new PublishedArticle();
00301 $publishedArticle->setPubId($row['pub_id']);
00302 $publishedArticle->setArticleId($row['article_id']);
00303 $publishedArticle->setIssueId($row['issue_id']);
00304 $publishedArticle->setDatePublished($this->datetimeFromDB($row['date_published']));
00305 $publishedArticle->setSeq($row['seq']);
00306 $publishedArticle->setViews($row['views']);
00307 $publishedArticle->setAccessStatus($row['access_status']);
00308
00309 if (!$simple) $publishedArticle->setSuppFiles($this->suppFileDao->getSuppFilesByArticle($row['article_id']));
00310
00311 $result->Close();
00312 unset($result);
00313
00314 return $publishedArticle;
00315 }
00316
00324 function &getPublishedArticleByArticleId($articleId, $journalId = null, $simple = false) {
00325 $primaryLocale = Locale::getPrimaryLocale();
00326 $locale = Locale::getLocale();
00327 $params = array(
00328 'title',
00329 $primaryLocale,
00330 'title',
00331 $locale,
00332 'abbrev',
00333 $primaryLocale,
00334 'abbrev',
00335 $locale,
00336 $articleId
00337 );
00338 if ($journalId) $params[] = $journalId;
00339
00340 $func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
00341 $result = &$this->retrieve(
00342 'SELECT pa.*,
00343 a.*,
00344 COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
00345 COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
00346 FROM published_articles pa,
00347 articles a
00348 LEFT JOIN sections s ON s.section_id = a.section_id
00349 LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
00350 LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
00351 LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
00352 LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
00353 WHERE pa.article_id = a.article_id
00354 AND a.article_id = ?' .
00355 (isset($journalId)?' AND a.journal_id = ?':''),
00356 $params
00357 );
00358
00359 $publishedArticle = null;
00360 if ($result->RecordCount() != 0) {
00361 $publishedArticle = &$this->$func($result->GetRowAssoc(false));
00362 }
00363
00364 $result->Close();
00365 unset($result);
00366
00367 return $publishedArticle;
00368 }
00369
00377 function &getPublishedArticleByPublicArticleId($journalId, $publicArticleId, $simple = false) {
00378 $primaryLocale = Locale::getPrimaryLocale();
00379 $locale = Locale::getLocale();
00380 $func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
00381 $result = &$this->retrieve(
00382 'SELECT pa.*,
00383 a.*,
00384 COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
00385 COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
00386 FROM published_articles pa,
00387 articles a
00388 LEFT JOIN sections s ON s.section_id = a.section_id
00389 LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
00390 LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
00391 LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
00392 LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
00393 WHERE pa.article_id = a.article_id
00394 AND pa.public_article_id = ?
00395 AND a.journal_id = ?',
00396 array(
00397 'title',
00398 $primaryLocale,
00399 'title',
00400 $locale,
00401 'abbrev',
00402 $primaryLocale,
00403 'abbrev',
00404 $locale,
00405 $publicArticleId,
00406 $journalId
00407 )
00408 );
00409
00410 $publishedArticle = null;
00411 if ($result->RecordCount() != 0) {
00412 $publishedArticle = &$this->$func($result->GetRowAssoc(false));
00413 }
00414
00415 $result->Close();
00416 unset($result);
00417
00418 return $publishedArticle;
00419 }
00420
00429 function &getPublishedArticleByBestArticleId($journalId, $articleId, $simple = false) {
00430 $article = &$this->getPublishedArticleByPublicArticleId($journalId, $articleId, $simple);
00431 if (!isset($article)) $article = &$this->getPublishedArticleByArticleId((int) $articleId, $journalId, $simple);
00432 return $article;
00433 }
00434
00443 function &getPublishedArticleIdsAlphabetizedByJournal($journalId = null, $useCache = true) {
00444 $params = array(
00445 'title', Locale::getLocale(),
00446 'title', Locale::getPrimaryLocale()
00447 );
00448 if (isset($journalId)) $params[] = $journalId;
00449
00450 $articleIds = array();
00451 $functionName = $useCache?'retrieveCached':'retrieve';
00452 $result = &$this->$functionName(
00453 'SELECT a.article_id AS pub_id,
00454 COALESCE(atl.setting_value, atpl.setting_value) AS article_title
00455 FROM published_articles pa,
00456 articles a
00457 LEFT JOIN sections s ON s.section_id = a.section_id
00458 LEFT JOIN article_settings atl ON (a.article_id = atl.article_id AND atl.setting_name = ? AND atl.locale = ?)
00459 LEFT JOIN article_settings atpl ON (a.article_id = atpl.article_id AND atpl.setting_name = ? AND atpl.locale = ?)
00460 WHERE pa.article_id = a.article_id
00461 AND s.section_id IS NOT NULL' .
00462 (isset($journalId)?' AND a.journal_id = ?':'') . ' ORDER BY article_title',
00463 $params
00464 );
00465
00466 while (!$result->EOF) {
00467 $row = $result->getRowAssoc(false);
00468 $articleIds[] = $row['pub_id'];
00469 $result->moveNext();
00470 }
00471
00472 $result->Close();
00473 unset($result);
00474
00475 return $articleIds;
00476 }
00477
00486 function &getPublishedArticleIdsByJournal($journalId = null, $useCache = true) {
00487 $articleIds = array();
00488 $functionName = $useCache?'retrieveCached':'retrieve';
00489 $result = &$this->$functionName(
00490 'SELECT a.article_id AS pub_id FROM published_articles pa, articles a LEFT JOIN sections s ON s.section_id = a.section_id WHERE pa.article_id = a.article_id' . (isset($journalId)?' AND a.journal_id = ?':'') . ' ORDER BY pa.date_published DESC',
00491 isset($journalId)?$journalId:false
00492 );
00493
00494 while (!$result->EOF) {
00495 $row = $result->getRowAssoc(false);
00496 $articleIds[] = $row['pub_id'];
00497 $result->moveNext();
00498 }
00499
00500 $result->Close();
00501 unset($result);
00502
00503 return $articleIds;
00504 }
00505
00512 function &_returnPublishedArticleFromRow($row, $callHooks = true) {
00513 $publishedArticle =& $this->_returnSimplePublishedArticleFromRow($row, false);
00514
00515 $publishedArticle->setSuppFiles($this->suppFileDao->getSuppFilesByArticle($row['article_id']));
00516
00517 if ($callHooks) HookRegistry::call('PublishedArticleDAO::_returnPublishedArticleFromRow', array(&$publishedArticle, &$row));
00518 return $publishedArticle;
00519 }
00520
00527 function &_returnSimplePublishedArticleFromRow($row, $callHooks = true) {
00528 $publishedArticle = &new PublishedArticle();
00529 $publishedArticle->setPubId($row['pub_id']);
00530 $publishedArticle->setIssueId($row['issue_id']);
00531 $publishedArticle->setDatePublished($this->datetimeFromDB($row['date_published']));
00532 $publishedArticle->setSeq($row['seq']);
00533 $publishedArticle->setViews($row['views']);
00534 $publishedArticle->setAccessStatus($row['access_status']);
00535 $publishedArticle->setPublicArticleId($row['public_article_id']);
00536
00537 $publishedArticle->setGalleys($this->galleyDao->getGalleysByArticle($row['article_id']));
00538
00539
00540 $this->articleDao->_articleFromRow($publishedArticle, $row);
00541
00542 if ($callHooks) HookRegistry::call('PublishedArticleDAO::_returnSimplePublishedArticleFromRow', array(&$publishedArticle, &$row));
00543
00544 return $publishedArticle;
00545 }
00546
00553 function insertPublishedArticle(&$publishedArticle) {
00554 $this->update(
00555 sprintf('INSERT INTO published_articles
00556 (article_id, issue_id, date_published, seq, access_status, public_article_id)
00557 VALUES
00558 (?, ?, %s, ?, ?, ?)',
00559 $this->datetimeToDB($publishedArticle->getDatePublished())),
00560 array(
00561 $publishedArticle->getArticleId(),
00562 $publishedArticle->getIssueId(),
00563 $publishedArticle->getSeq(),
00564 $publishedArticle->getAccessStatus(),
00565 $publishedArticle->getPublicArticleId()
00566 )
00567 );
00568
00569 $publishedArticle->setPubId($this->getInsertPublishedArticleId());
00570 return $publishedArticle->getPubId();
00571 }
00572
00577 function getInsertPublishedArticleId() {
00578 return $this->getInsertId('published_articles', 'pub_id');
00579 }
00580
00585 function deletePublishedArticleById($pubId) {
00586 $this->update(
00587 'DELETE FROM published_articles WHERE pub_id = ?', $pubId
00588 );
00589 }
00590
00596 function deletePublishedArticleByArticleId($articleId) {
00597 return $this->update(
00598 'DELETE FROM published_articles WHERE article_id = ?', $articleId
00599 );
00600 }
00601
00606 function deletePublishedArticlesBySectionId($sectionId) {
00607 $result = &$this->retrieve(
00608 'SELECT pa.article_id AS article_id FROM published_articles pa, articles a WHERE pa.article_id = a.article_id AND a.section_id = ?', $sectionId
00609 );
00610
00611 while (!$result->EOF) {
00612 $row = $result->GetRowAssoc(false);
00613 $this->update(
00614 'DELETE FROM published_articles WHERE article_id = ?', $row['article_id']
00615 );
00616 }
00617
00618 $result->Close();
00619 unset($result);
00620 }
00621
00626 function deletePublishedArticlesByIssueId($issueId) {
00627 return $this->update(
00628 'DELETE FROM published_articles WHERE issue_id = ?', $issueId
00629 );
00630 }
00631
00636 function updatePublishedArticle($publishedArticle) {
00637 $this->update(
00638 sprintf('UPDATE published_articles
00639 SET
00640 article_id = ?,
00641 issue_id = ?,
00642 date_published = %s,
00643 seq = ?,
00644 access_status = ?,
00645 public_article_id = ?
00646 WHERE pub_id = ?',
00647 $this->datetimeToDB($publishedArticle->getDatePublished())),
00648 array(
00649 $publishedArticle->getArticleId(),
00650 $publishedArticle->getIssueId(),
00651 $publishedArticle->getSeq(),
00652 $publishedArticle->getAccessStatus(),
00653 $publishedArticle->getPublicArticleId(),
00654 $publishedArticle->getPubId()
00655 )
00656 );
00657 }
00658
00665 function updatePublishedArticleField($pubId, $field, $value) {
00666 $this->update(
00667 "UPDATE published_articles SET $field = ? WHERE pub_id = ?", array($value, $pubId)
00668 );
00669 }
00670
00674 function resequencePublishedArticles($sectionId, $issueId) {
00675 $result = &$this->retrieve(
00676 'SELECT pa.pub_id FROM published_articles pa, articles a WHERE a.section_id = ? AND a.article_id = pa.article_id AND pa.issue_id = ? ORDER BY pa.seq',
00677 array($sectionId, $issueId)
00678 );
00679
00680 for ($i=1; !$result->EOF; $i++) {
00681 list($pubId) = $result->fields;
00682 $this->update(
00683 'UPDATE published_articles SET seq = ? WHERE pub_id = ?',
00684 array($i, $pubId)
00685 );
00686
00687 $result->moveNext();
00688 }
00689
00690 $result->close();
00691 unset($result);
00692 }
00693
00699 function getPublishedArticleAuthors($issueId) {
00700 $authors = array();
00701 $result = &$this->retrieve(
00702 'SELECT aa.* FROM article_authors aa, published_articles pa WHERE aa.article_id = pa.article_id AND pa.issue_id = ? ORDER BY pa.issue_id', $issueId
00703 );
00704
00705 while (!$result->EOF) {
00706 $row = $result->GetRowAssoc(false);
00707 $author = &new Author();
00708 $author->setAuthorId($row['author_id']);
00709 $author->setArticleId($row['article_id']);
00710 $author->setFirstName($row['first_name']);
00711 $author->setMiddleName($row['middle_name']);
00712 $author->setLastName($row['last_name']);
00713 $author->setAffiliation($row['affiliation']);
00714 $author->setEmail($row['email']);
00715 $author->setBiography($row['biography']);
00716 $author->setPrimaryContact($row['primary_contact']);
00717 $author->setSequence($row['seq']);
00718 $authors[] = $author;
00719 $result->moveNext();
00720 }
00721
00722 $result->Close();
00723 unset($result);
00724
00725 return $authors;
00726 }
00727
00732 function incrementViewsByArticleId($articleId) {
00733 return $this->update(
00734 'UPDATE published_articles SET views = views + 1 WHERE article_id = ?',
00735 $articleId
00736 );
00737 }
00738
00744 function publicArticleIdExists($publicArticleId, $articleId, $journalId) {
00745 $result = &$this->retrieve(
00746 'SELECT COUNT(*) FROM published_articles pa, articles a WHERE pa.article_id = a.article_id AND a.journal_id = ? AND pa.public_article_id = ? AND pa.article_id <> ?',
00747 array($journalId, $publicArticleId, $articleId)
00748 );
00749 $returner = $result->fields[0] ? true : false;
00750
00751 $result->Close();
00752 unset($result);
00753
00754 return $returner;
00755 }
00756 }
00757
00758 ?>