Skip to content

Commit

Permalink
#5051# added sorting to getPublishedArticlesByJournalId
Browse files Browse the repository at this point in the history
Merge branch 'bug5051'

* bug5051:
  #5051# added sort parameter to publishedarticledao method
  • Loading branch information
jalperin committed Jan 26, 2010
1 parent 3a7085a commit 280424d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions classes/article/PublishedArticleDAO.inc.php
Expand Up @@ -114,7 +114,7 @@ function getPublishedArticleCountByJournalId($journalId) {
* @param $simple boolean Whether or not to skip fetching dependent objects; default false
* @return object
*/
function &getPublishedArticlesByJournalId($journalId, $rangeInfo = null, $simple = false) {
function &getPublishedArticlesByJournalId($journalId, $rangeInfo = null, $simple = false, $reverse = false) {
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$func = $simple?'_returnSimplePublishedArticleFromRow':'_returnPublishedArticleFromRow';
Expand All @@ -123,16 +123,18 @@ function &getPublishedArticlesByJournalId($journalId, $rangeInfo = null, $simple
a.*,
COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
FROM published_articles pa,
articles a
FROM published_articles pa
LEFT JOIN articles a ON pa.article_id = a.article_id
LEFT JOIN issues i ON pa.issue_id = i.issue_id
LEFT JOIN sections s ON s.section_id = a.section_id
LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
WHERE pa.article_id = a.article_id
AND a.journal_id = ?
AND a.status <> ' . STATUS_ARCHIVED,
WHERE a.journal_id = ?
AND i.published = 1
AND a.status <> ' . STATUS_ARCHIVED . '
ORDER BY date_published '. ($reverse?'DESC':'ASC'),
array(
'title',
$primaryLocale,
Expand Down
2 changes: 1 addition & 1 deletion plugins/generic/webFeed/WebFeedGatewayPlugin.inc.php
Expand Up @@ -126,7 +126,7 @@ function fetch($args) {
if ($displayItems == 'recent' && $recentItems > 0) {
import('db.DBResultRange');
$rangeInfo = new DBResultRange($recentItems, 1);
$publishedArticleObjects =& $publishedArticleDao->getPublishedArticlesByJournalId($journal->getId(), $rangeInfo);
$publishedArticleObjects =& $publishedArticleDao->getPublishedArticlesByJournalId($journal->getId(), $rangeInfo, null, true);
while ($publishedArticle =& $publishedArticleObjects->next()) {
$publishedArticles[]['articles'][] =& $publishedArticle;
unset($publishedArticle);
Expand Down

0 comments on commit 280424d

Please sign in to comment.