summaryrefslogtreecommitdiff
path: root/modules/mod_user_pages.php
blob: 90afe2832901e6785ab8464fcfdc14002c07d7e0 (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
<?php
// $Header$
/**
 * Params:
 * - content_type_guid : if set, show only those content_type_guid's
 * - show_date : if set, show date of last modification
 * @package liberty
 * @subpackage modules
 */

use Bitweaver\KernelTools;

global $gQueryUser, $gBitUser, $module_rows, $module_params, $gLibertySystem, $module_title;

$userId = $gBitUser->mUserId;
if( !empty( $gQueryUser->mUserId ) ) {
	$userId = $gQueryUser->mUserId;
}

if( empty( $module_title ) ) {
	if( !empty( $module_params['content_type_guid'] ) && !empty( $gLibertySystem->mContentTypes[$module_params['content_type_guid']] ) ) {
		$title = KernelTools::tra( "Last Changes" ).': '.$gLibertySystem->getContentTypeName( $module_params['content_type_guid'], true );
		$gBitSmarty->assign( 'contentType', $module_params['content_type_guid'] );
	} else {
		$gBitSmarty->assign( 'contentType', false );
		$title = KernelTools::tra( "Last Changes" );
	}
	$gBitSmarty->assign( 'moduleTitle', $title );
}

if( !empty( $module_params['show_date'] ) ) {
	$gBitSmarty->assign( 'userShowDate',  true  );
}

$listHash = [
	'content_type_guid' => !empty( $module_params['content_type_guid'] ) ? $module_params['content_type_guid'] : null,
	'offset' => 0,
	'max_records' => $module_rows,
	'sort_mode' => 'last_modified_desc',
	'user_id' => $userId,
];
$modLastPages = $gBitUser->getContentList( $listHash );
$gBitSmarty->assign( 'modLastPages', $modLastPages );
?>