diff --git a/erpnext/www/lms/course.html b/erpnext/www/lms/course.html index 3acc76e5d0c..182efab7d6f 100644 --- a/erpnext/www/lms/course.html +++ b/erpnext/www/lms/course.html @@ -8,11 +8,12 @@ {% endblock %} - {% block content %} -{% with current_content = current_content %} +
+{% with current_content = current_content, next_content = next_content, course_name = current_course.name, program=current_program%} {% include "www/lms/templates/includes/" + current_content.content_type.lower() + ".html" %} {% endwith %} +
{% endblock %} \ No newline at end of file diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py index ff7073dc9cf..02761024623 100644 --- a/erpnext/www/lms/course.py +++ b/erpnext/www/lms/course.py @@ -3,6 +3,17 @@ import frappe def get_context(context): - context.current_course = frappe.get_doc("Course", frappe.form_dict["course"]) - context.current_content = frappe.get_doc("Content", frappe.form_dict["content"]) - next_content = get_next_content() \ No newline at end of file + if frappe.form_dict['course']: + context.current_course = frappe.get_doc("Course", frappe.form_dict["course"]) + context.current_content = frappe.get_doc("Content", frappe.form_dict["content"]) + context.current_program = frappe.form_dict["program"] + context.next_content = get_next_content(context) + + +def get_next_content(context): + if context.current_course: + course_data = [content_item.content for content_item in context.current_course.course_content] + try: + return course_data[course_data.index(context.current_content.name) + 1] + except IndexError: + return None \ No newline at end of file diff --git a/erpnext/www/lms/index.html b/erpnext/www/lms/index.html index 1974d4f569e..444bbde093f 100644 --- a/erpnext/www/lms/index.html +++ b/erpnext/www/lms/index.html @@ -13,7 +13,7 @@
- +
{{ program_name }}
{{ description }}
diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html index 449c040c425..23f2e5c528f 100644 --- a/erpnext/www/lms/program.html +++ b/erpnext/www/lms/program.html @@ -22,7 +22,7 @@
- Start Course + Start Course
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py index b6ebcf44d26..c61aee53f6b 100644 --- a/erpnext/www/lms/program.py +++ b/erpnext/www/lms/program.py @@ -1,9 +1,11 @@ from __future__ import unicode_literals +from erpnext.education.utils import get_student_name import frappe def get_context(context): - context.program = frappe.get_doc("Program", frappe.form_dict["code"]) + print(get_student_name(frappe.session.user)) + context.program = frappe.get_doc("Program", frappe.form_dict["program"]) context.course_list, context.course_data = get_courses(context) def get_courses(context): diff --git a/erpnext/www/lms/templates/includes/article.html b/erpnext/www/lms/templates/includes/article.html index f9fd6e0036c..2ca93fa43b9 100644 --- a/erpnext/www/lms/templates/includes/article.html +++ b/erpnext/www/lms/templates/includes/article.html @@ -10,7 +10,11 @@
Previous - Next + {% if next_content != None %} + Next + {% else %} + Finish Course + {% endif %}

@@ -23,7 +27,7 @@
Report a diff --git a/erpnext/www/lms/templates/includes/quiz.html b/erpnext/www/lms/templates/includes/quiz.html index 97a2e6828c4..280a17baae0 100644 --- a/erpnext/www/lms/templates/includes/quiz.html +++ b/erpnext/www/lms/templates/includes/quiz.html @@ -1,56 +1,62 @@ -{% macro quiz(question, opt1, opt2, opt3, opt4) %} -
-
{{ question }}
-
-
- - -
-
- - -
-
- - -
-
- - -
+{% macro quiz(loop_index, question_id, question, options) %} +
+
{{ loop_index }}{{ question }}
+
+ + {% for option in options %} +
+ + +
+ {% endfor %}
+
{% endmacro %} -
-
\ No newline at end of file diff --git a/erpnext/www/lms/templates/includes/video.html b/erpnext/www/lms/templates/includes/video.html index 77a4e6cc970..6727321dec9 100644 --- a/erpnext/www/lms/templates/includes/video.html +++ b/erpnext/www/lms/templates/includes/video.html @@ -13,7 +13,11 @@
Previous - Next + {% if next_content != None %} + Next + {% else %} + Finish Course + {% endif %}