From 9b35d61430d0e1ba914dfe8dcb5da2493c3349df Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 8 Aug 2012 13:22:46 +0200 Subject: [PATCH] Adding welcome to course block see #3898 --- main/inc/lib/userportal.lib.php | 18 +++++++++++++++++- main/lang/english/index.inc.php | 3 +++ main/lang/english/trad4all.inc.php | 17 +++++++++-------- main/template/default/layout/layout_2_col.tpl | 7 +++++++ .../default/layout/welcome_to_course.tpl | 10 ++++++++++ user_portal.php | 5 +++++ 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 main/template/default/layout/welcome_to_course.tpl diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 5f2411d765..33b27e1060 100644 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -1055,9 +1055,25 @@ class IndexManager { } } } - return $sessions_with_category.$sessions_with_no_category.$courses_html.$special_courses; } + + /** + * Shows a welcome message when the user doesn't have any content in the course list + */ + function return_welcome_to_course_block() { + $tpl = $this->tpl->get_template('layout/welcome_to_course.tpl'); + + $course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; + $course_list_url = api_get_path(WEB_PATH).'user_portal.php'; + + $this->tpl->assign('course_catalog_url', $course_catalog_url); + $this->tpl->assign('course_list_url', $course_list_url); + $this->tpl->assign('course_catalog_link', Display::url(get_lang('here'), $course_catalog_url)); + $this->tpl->assign('course_list_link', Display::url(get_lang('here'), $course_list_url)); + + return $this->tpl->fetch($tpl); + } function return_hot_courses() { return CourseManager::return_hot_courses(); diff --git a/main/lang/english/index.inc.php b/main/lang/english/index.inc.php index 9ecfbac766..dd9ed3c570 100644 --- a/main/lang/english/index.inc.php +++ b/main/lang/english/index.inc.php @@ -75,4 +75,7 @@ $YouDoNotHaveAnySessionInItsHistory = "You have no session in your sessions hist $PortalHomepageDefaultIntroduction = "

Congratulations! You have successfully installed your e-learning portal!

You can now complete the installation by following three easy steps:

  1. Configure you portal by going to the administration section, and select the Portal -> Configuration settings entry.
  2. Add some life to your portal by creating users and/or training. You can do that by inviting new people to create their accounts or creating them yourself through the administration's Users and Training sections.
  3. Edit this page through the Edit portal homepage entry in the administration section.

You can always find more information about this software on our website: http://www.chamilo.org.

Have fun, and don't hesitate to join the community and give us feedback through our forum.

"; $Username = "User name"; $Profile = "Profile"; +$HelloXAsYouCanSeeYourCourseListIsEmpty = "

Hello %s and welcome,

+

As you can see, your courses list is still empty. That's because you are not registered to any course yet!

"; +$GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX = "

Go ahead and browse our course catalog %s to register to any course you like. Once registered, you will see the course appear right %s, instead of this message.

"; ?> \ No newline at end of file diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 89263c9891..dd970f7caf 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -958,13 +958,13 @@ $SendInformation = "Send information"; $YouMustAcceptLicence = "You must accept the licence"; $SelectOne = "Select one"; $ContactInformationHasBeenSent = "Contact information has been sent"; -$ContactInformationDescription = "Dear user,
-
You are about to start using one of the best open-source e-learning platform on the market. Like many other open-source project, this project is backed up by a large community of students, teachers, developers and content creators who would like to promote the project better.
-
-By knowing a little bit more about you, one of our most important users, who will manage this e-learning system, we will be able to let people know that our software is used and let you know when we organize events that might be relevant to you.
-
-By filling this form, you accept that the Chamilo association or its members might send you information by e-mail about important events or updates in the Chamilo software or community. This will help the community grow as an organized entity where information flow, with a permanent respect of your time and your privacy.
-
+$ContactInformationDescription = "Dear user,
+
You are about to start using one of the best open-source e-learning platform on the market. Like many other open-source project, this project is backed up by a large community of students, teachers, developers and content creators who would like to promote the project better.
+
+By knowing a little bit more about you, one of our most important users, who will manage this e-learning system, we will be able to let people know that our software is used and let you know when we organize events that might be relevant to you.
+
+By filling this form, you accept that the Chamilo association or its members might send you information by e-mail about important events or updates in the Chamilo software or community. This will help the community grow as an organized entity where information flow, with a permanent respect of your time and your privacy.
+
Please note that you are not required to fill this form. If you want to remain anonymous, we will loose the opportunity to offer you all the privileges of being a registered portal administrator, but we will respect your decision. Simply leave this form empty and click \"Next\".

"; $CompanyActivity = "Your company's activity"; $DateUnLock = "Unlock date"; @@ -1170,7 +1170,7 @@ $SaveForNow = "Save and continue later"; $NoQuicktime = "Your browser does not have the QuickTime plugin installed. You can still use the platform, but to run a larger number of media file types, we suggest you might want to install it."; $NoJavaSun = "Your browser doesn't seem to have the Sun Java plugin installed. You can still use the platform, but you will lose a few of its capabilities."; $NoJava = "Your browser does not support Java"; -$JavaSun24 = "Your browser has a Java version not supported by this tool. +$JavaSun24 = "Your browser has a Java version not supported by this tool. To use it you have to install a Java Sun version higher than 24"; $NoMessageAnywere = "If you do not want to see this message again during this session, click here"; $Attempts = "Attempts"; @@ -1334,4 +1334,5 @@ $DataTableSearch = "Search"; $HideColumn = "Hide column"; $DisplayColumn = "Show column"; $LegalAgreementAccepted = "Legal agreement accepted"; +$here = "here"; ?> \ No newline at end of file diff --git a/main/template/default/layout/layout_2_col.tpl b/main/template/default/layout/layout_2_col.tpl index a8dcb300dd..eb4b2bb4cb 100644 --- a/main/template/default/layout/layout_2_col.tpl +++ b/main/template/default/layout/layout_2_col.tpl @@ -28,6 +28,13 @@ {% include "default/layout/page_body.tpl" %} + {# Welcome to course block #} + {% if welcome_to_course_block %} +
+ {{ welcome_to_course_block }} +
+ {% endif %} + {% if content is not null %}
{{ content }} diff --git a/main/template/default/layout/welcome_to_course.tpl b/main/template/default/layout/welcome_to_course.tpl new file mode 100644 index 0000000000..fe9ee0f892 --- /dev/null +++ b/main/template/default/layout/welcome_to_course.tpl @@ -0,0 +1,10 @@ +{{ "HelloXAsYouCanSeeYourCourseListIsEmpty" | get_lang | format(_u.complete_name) }} + +{% if "allow_students_to_browse_courses" | get_setting == 'true' %} + + {{ "GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX" | get_lang | format(course_catalog_link, course_list_link) }} + + + {{ "CourseCatalog" | get_lang }} + +{% endif %} \ No newline at end of file diff --git a/user_portal.php b/user_portal.php index 98da6f2c26..d879c4f7c0 100644 --- a/user_portal.php +++ b/user_portal.php @@ -155,6 +155,11 @@ $user_id = api_get_user_id(); // Main courses and session list $courses_and_sessions = $controller->return_courses_and_sessions($user_id); +//Show the chamilo mascot +if (empty($courses_and_sessions)) { + $controller->tpl->assign('welcome_to_course_block', $controller->return_welcome_to_course_block()); +} + $controller->tpl->assign('content', $courses_and_sessions); if (api_get_setting('allow_browser_sniffer') == 'true') {