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 8function smarty_function_activity($params) 9{ 10 $smarty = TikiLib::lib('smarty'); 11 12 if (isset($params['info'])) { 13 $activity = $params['info']; 14 } else { 15 $lib = TikiLib::lib('unifiedsearch'); 16 $docs = $lib->getDocuments('activity', $params['id']); 17 18 $activity = reset($docs); 19 20 if (! $activity) { 21 return tr('Not found.'); 22 } 23 24 $activity = TikiLib::lib('unifiedsearch')->getRawArray($activity); 25 } 26 27 $smarty->assign('activity', $activity); 28 $smarty->assign('activity_format', ! empty($params['format']) ? $params['format'] : 'default'); 29 $templateName = 'activity/' . $activity['event_type'] . '.tpl'; 30 31 if (empty($smarty->get_filename($templateName))) { 32 $templateName = 'activity/default_event.tpl'; 33 } 34 return $smarty->fetch($templateName); 35} 36