blob: 21123c416988c00312e6b00ce6df666bad0d3187 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
/**
* @version $Header$
* @package articles
* @subpackage modules
*/
/**
* Initialization
*/
include_once( ARTICLES_PKG_CLASS_PATH.'BitArticle.php' );
extract( $moduleParams );
$articles = new BitArticle();
$stati = array( 'pending', 'approved' );
if( !empty( $module_params['status'] ) && in_array( $module_params['status'], $stati ) ) {
$status_id = constant( 'ARTICLE_STATUS_'.strtoupper( $module_params['status'] ) );
} else {
$status_id = ARTICLE_STATUS_APPROVED;
}
$sortOptions = array(
"last_modified_asc",
"last_modified_desc",
"created_asc",
"created_desc",
"publish_date_desc",
"publish_date_asc",
"expire_date_desc",
"expire_date_asc",
);
if( !empty( $module_params['sort_mode'] ) && in_array( $module_params['sort_mode'], $sortOptions ) ) {
$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->getConfig( 'articles_max_list' );
$getHash['topic_name'] = !empty( $module_params['topic_name'] ) ? $module_params['topic_name'] : NULL;
$getHash['topic_id'] = !empty( $module_params['topic_id'] ) ? $module_params['topic_id'] : NULL;
$articlelist = $articles->getList( $getHash );
if( ( !empty( $module_params['topic_id'] ) || !empty( $module_params['topic_name'] ) ) && empty($moduleParams['title']) && !empty( $articles ) ) {
$_template->tpl_vars['moduleTitle'] = new Smarty_variable( $articles[0]['topic_name'] );
} elseif( !empty($moduleParams['title']) ) {
$_template->tpl_vars['moduleTitle'] = new Smarty_variable( $moduleParams['title'] );
} else {
$_template->tpl_vars['moduleTitle'] = new Smarty_variable( "Articles" );
}
$_template->tpl_vars['params'] = new Smarty_variable( !empty( $moduleParams['params'] ) );
$_template->tpl_vars['listtype'] = new Smarty_variable( ( isset($module_params['list_type']) && (strncasecmp($module_params['list_type'], 'u', 1) == 0) ) ? 'ul' : 'ol' );
$_template->tpl_vars['modArticles'] = new Smarty_variable( $articlelist );
|