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 package fr.paris.lutece.plugins.extend.modules.comment.dashboard;
35
36 import java.util.HashMap;
37 import java.util.List;
38 import java.util.Locale;
39 import java.util.Map;
40
41 import fr.paris.lutece.plugins.extend.modules.comment.business.Comment;
42 import fr.paris.lutece.plugins.extend.modules.comment.service.CommentService;
43 import fr.paris.lutece.plugins.extend.modules.comment.service.ICommentService;
44 import fr.paris.lutece.portal.service.dashboard.IPublicDashboardComponent;
45 import fr.paris.lutece.portal.service.i18n.I18nService;
46 import fr.paris.lutece.portal.service.spring.SpringContextService;
47
48
49
50
51 public class PublicDashboardComment implements IPublicDashboardComponent
52 {
53
54 public static final String DASHBOARD_PROPERTIES_TITLE = "module.extend.comment.publicdashboard.bean.title";
55 private String strIdComponent = "extend-comment.PublicDashboardComment";
56 private static final String TEMPLATE_DASHBOARD_COMMENTS = "/skin/plugins/extend/modules/comment/publicdashboard_comments.html";
57 private static final String MARK_DASHBOARD_COMMENTS = "comments_publidashboard";
58
59 @Override
60 public String getComponentDescription( Locale locale ) {
61 return I18nService.getLocalizedString( DASHBOARD_PROPERTIES_TITLE, locale );
62 }
63
64 @Override
65 public String getComponentId( ) {
66 return strIdComponent;
67 }
68
69 @Override
70 public String getDashboardTemplate( )
71 {
72 return TEMPLATE_DASHBOARD_COMMENTS;
73 }
74
75 @Override
76 public Map<String, Object> getDashboardModel( String user_id, Map<String,String[]> additionalParameters )
77 {
78 Map<String, Object> model = new HashMap<String, Object>( );
79 model.put( MARK_DASHBOARD_COMMENTS, searchCommentUser( user_id ) );
80 return model;
81 }
82
83
84
85
86
87
88
89
90 private static List<Comment> searchCommentUser( String user_id )
91 {
92
93 ICommentService commService = SpringContextService.getBean( CommentService.BEAN_SERVICE );
94
95 List<Comment> lstComment = commService.findCommentsByLuteceUser( user_id );
96
97 return lstComment;
98 }
99
100
101
102 }