Used to gather a menu of lessons for a user, including markers for each lesson they have completed or not completed @param ApplicationRoot The current running context of the application @param userId Identifier of the user @return HTML lesson menu for Open Floor Plan.
(String ApplicationRoot, String userId, Locale lang)
| 978 | * @return HTML lesson menu for Open Floor Plan. |
| 979 | */ |
| 980 | public static String getLessons (String ApplicationRoot, String userId, Locale lang) |
| 981 | { |
| 982 | log.debug("*** Getter.getLesson ***"); |
| 983 | //Getting Translated Level Names |
| 984 | ResourceBundle bundle = ResourceBundle.getBundle("i18n.moduleGenerics.moduleNames", lang); |
| 985 | String output = new String(); |
| 986 | Connection conn = Database.getCoreConnection(ApplicationRoot); |
| 987 | try |
| 988 | { |
| 989 | //Get the lesson modules |
| 990 | CallableStatement callstmt = conn.prepareCall("call lessonInfo(?)"); |
| 991 | callstmt.setString(1, userId); |
| 992 | log.debug("Gathering lessonInfo ResultSet for user " + userId); |
| 993 | ResultSet lessons = callstmt.executeQuery(); |
| 994 | log.debug("Opening Result Set from moduleAllInfo"); |
| 995 | while(lessons.next()) |
| 996 | { |
| 997 | //log.debug("Adding " + lessons.getString(1)); |
| 998 | output += "<li>"; |
| 999 | //Markers for completion |
| 1000 | if(lessons.getString(4) != null) |
| 1001 | { |
| 1002 | output += "<img src='css/images/completed.png'/>"; |
| 1003 | } |
| 1004 | else |
| 1005 | { |
| 1006 | output+= "<img src='css/images/uncompleted.png'/>"; |
| 1007 | } |
| 1008 | //Prepare lesson output |
| 1009 | output += "<a class='lesson' id='" |
| 1010 | + Encode.forHtmlAttribute(lessons.getString(3)) |
| 1011 | + "' href='javascript:;'>" |
| 1012 | + Encode.forHtml(bundle.getString(lessons.getString(1))) |
| 1013 | + "</a>"; |
| 1014 | output += "</li>"; |
| 1015 | } |
| 1016 | //If no output has been found, return an error message |
| 1017 | if(output.isEmpty()) |
| 1018 | { |
| 1019 | output = "<li><a href='javascript:;'>No lessons found</a></li>"; |
| 1020 | } |
| 1021 | else |
| 1022 | { |
| 1023 | log.debug("Lesson List returned"); |
| 1024 | } |
| 1025 | } |
| 1026 | catch(Exception e) |
| 1027 | { |
| 1028 | log.error("lesson Retrieval: " + e.toString()); |
| 1029 | } |
| 1030 | Database.closeConnection(conn); |
| 1031 | log.debug("*** END getLesson() ***"); |
| 1032 | return output; |
| 1033 | } |
| 1034 | |
| 1035 | /** |
| 1036 | * This method returns the address of a module based on the module identifier submitted. |