1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8//this script may only be included - so its better to die if called directly.
9if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
10	header("location: index.php");
11	exit;
12}
13
14/**
15 * @return array
16 */
17function module_user_pages_info()
18{
19	return [
20		'name' => tra('User Pages'),
21		'description' => tra('Displays to registered users the specified number of wiki pages which they were the last to edit.'),
22		'prefs' => ['feature_wiki'],
23		'params' => [],
24		'common_params' => ["rows", "nonums"]
25	];
26}
27
28/**
29 * @param $mod_reference
30 * @param $module_params
31 */
32function module_user_pages($mod_reference, $module_params)
33{
34	global $user;
35	if ($user) {
36		$tikilib = TikiLib::lib('tiki');
37		$smarty = TikiLib::lib('smarty');
38
39		$ranking = $tikilib->get_user_pages($user, $mod_reference["rows"]);
40		$smarty->assign('modUserPages', $ranking);
41		$smarty->assign('tpl_module_title', tra("My Pages"));
42	}
43}
44