summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-08-30 23:09:01 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-08-30 23:09:01 +0000
commit6fd278e59e28cb45b746d29bcfec6ed6dc688ec2 (patch)
tree7ed5b5ca51a1b6585b3f29fe97dba423fb796563 /modules
parentd6cf45cf0a7290ed44b16d64d14e7dfdd30762aa (diff)
downloadarticles-6fd278e59e28cb45b746d29bcfec6ed6dc688ec2.tar.gz
articles-6fd278e59e28cb45b746d29bcfec6ed6dc688ec2.tar.bz2
articles-6fd278e59e28cb45b746d29bcfec6ed6dc688ec2.zip
articles module is up to par now
Diffstat (limited to 'modules')
-rw-r--r--modules/help_mod_artilces.tpl23
-rw-r--r--modules/mod_articles.php17
2 files changed, 38 insertions, 2 deletions
diff --git a/modules/help_mod_artilces.tpl b/modules/help_mod_artilces.tpl
new file mode 100644
index 0000000..6b1270e
--- /dev/null
+++ b/modules/help_mod_artilces.tpl
@@ -0,0 +1,23 @@
+{tr}<strong>Summary</strong>: Display a list of article titles.{/tr}<br />
+<table class="data">
+ <tr>
+ <th style="width:20%;">{tr}Parameter{/tr}</th>
+ <th style="width:20%;">{tr}Value{/tr}</th>
+ <th style="width:60%;">{tr}Description{/tr}</th>
+ </tr>
+ <tr class="odd">
+ <td>status</td>
+ <td>pending<br />approved</td>
+ <td>{tr}Decide on what type of articles you wish to display.<br />( default: approved ){/tr}</td>
+ </tr>
+ <tr class="even">
+ <td>sort_mode</td>
+ <td>last_modifed_desc<br />last_modifed_asc<br />...</td>
+ <td>{tr}Decide in what order you wish to display the articles.<br />( default: last_modified_desc ){/tr}</td>
+ </tr>
+ <tr class="odd">
+ <td>topic</td>
+ <td>( {tr}string{/tr} )</td>
+ <td>{tr}Display articles from a given topic only.{/tr}</td>
+ </tr>
+</table>
diff --git a/modules/mod_articles.php b/modules/mod_articles.php
index 035bb84..92a6135 100644
--- a/modules/mod_articles.php
+++ b/modules/mod_articles.php
@@ -1,5 +1,5 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_articles/modules/mod_articles.php,v 1.3 2005/08/30 22:25:50 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_articles/modules/mod_articles.php,v 1.4 2005/08/30 23:09:01 squareing Exp $
include_once( ARTICLES_PKG_PATH . 'BitArticle.php' );
global $module_rows, $module_params, $module_title;
@@ -11,9 +11,22 @@ if( !empty( $module_params['status'] ) && in_array( $module_params['status'], $s
$status_id = ARTICLE_STATUS_APPROVED;
}
+$sortPattern = array(
+ "/^last_modified_asc$/",
+ "/^last_modified_desc/",
+ "/^created_asc$/",
+ "/^created_desc$/",
+);
+if( !empty( $module_params['sort_mode'] ) && preg_match( $sort_pattern, $module_params['sort_mode'] ) ) {
+ $sort_mode = $module_params['sort_mode'];
+} else {
+ $sort_mode = 'last_modified_desc';
+}
+
$getHash['status_id'] = $status_id;
+$getHash['sort_mode'] = $sort_mode;
$getHash['max_records'] = !empty( $module_rows ) ? $module_rows : $gBitSystem->mPrefs['max_articles'];
-$getHash['sort_mode'] = !empty( $module_params['sort_mode'] ) ? $module_params['sort_mode'] : 'last_modified_desc';
+$getHash['topic'] = !empty( $module_params['topic'] ) ? $module_params['topic'] : NULL;
$articles = $articles->getList( $getHash );
$smarty->assign( 'modArticles', $articles['data'] );