From 1e5cacd7226bbc2cd0265eb57adce271b3c1a74c Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 6 Aug 2018 14:28:24 -0500 Subject: [PATCH] Minor - Format code - refs #2412 --- main/session/about.php | 25 +- main/template/default/session/about.tpl | 435 ++++++++++++------------ 2 files changed, 243 insertions(+), 217 deletions(-) diff --git a/main/session/about.php b/main/session/about.php index ad73d499da..90ce7afbff 100644 --- a/main/session/about.php +++ b/main/session/about.php @@ -1,11 +1,13 @@ find('ChamiloCoreBundle:Session', $sessionId); if (!$session) { @@ -35,6 +38,7 @@ $sessionCourses = $em->getRepository('ChamiloCoreBundle:Session')->getCoursesOrd $fieldsRepo = $em->getRepository('ChamiloCoreBundle:ExtraField'); $fieldTagsRepo = $em->getRepository('ChamiloCoreBundle:ExtraFieldRelTag'); $userRepo = UserManager::getRepository(); +/** @var SequenceRepository $sequenceResourceRepo */ $sequenceResourceRepo = $em->getRepository('ChamiloCoreBundle:SequenceResource'); $tagField = $fieldsRepo->findOneBy([ @@ -46,6 +50,7 @@ $courseValues = new ExtraFieldValue('course'); $userValues = new ExtraFieldValue('user'); $sessionValues = new ExtraFieldValue('session'); +/** @var Course $sessionCourse */ foreach ($sessionCourses as $sessionCourse) { $courseTags = []; @@ -87,8 +92,16 @@ foreach ($sessionCourses as $sessionCourse) { ] ); - $courseDescription = $courseObjectives = $courseTopics = $courseMethodology = $courseMaterial = $courseResources = $courseAssessment = ''; + $courseDescription = ''; + $courseObjectives = ''; + $courseTopics = ''; + $courseMethodology = ''; + $courseMaterial = ''; + $courseResources = ''; + $courseAssessment = ''; $courseCustom = []; + + /** @var CCourseDescription $descriptionTool */ foreach ($courseDescriptionTools as $descriptionTool) { switch ($descriptionTool->getDescriptionType()) { case CCourseDescription::TYPE_DESCRIPTION: @@ -206,8 +219,8 @@ if ($checker) { BuyCoursesPlugin::PRODUCT_TYPE_SESSION ); if ($sessionIsPremium) { - Session::write('SessionIsPremium', true); - Session::write('sessionId', $sessionId); + ChamiloSession::write('SessionIsPremium', true); + ChamiloSession::write('sessionId', $sessionId); } } @@ -216,7 +229,9 @@ $redirectToSession = $redirectToSession ? '?s='.$sessionId : false; $coursesInThisSession = SessionManager::get_course_list_by_session_id($sessionId); $coursesCount = count($coursesInThisSession); -$redirectToSession = $coursesCount == 1 && $redirectToSession ? $redirectToSession.'&cr='.array_values($coursesInThisSession)[0]['directory'] : $redirectToSession; +$redirectToSession = $coursesCount == 1 && $redirectToSession + ? ($redirectToSession.'&cr='.array_values($coursesInThisSession)[0]['directory']) + : $redirectToSession; $template->assign('redirect_to_session', $redirectToSession); $template->assign('courses', $courses); diff --git a/main/template/default/session/about.tpl b/main/template/default/session/about.tpl index 4e56c2999c..68b24f3a26 100644 --- a/main/template/default/session/about.tpl +++ b/main/template/default/session/about.tpl @@ -1,121 +1,124 @@
{% if is_subscribed and user_session_time != -0 and user_session_time >= 1 %} -
- {{ 'AlreadyRegisteredToSession'|get_lang }} -
+
+ {{ 'AlreadyRegisteredToSession'|get_lang }} +
{% elseif is_subscribed and user_session_time < 1 %} -
- {{ 'YourSessionTimeIsExpired'|get_lang }} -
+
+ {{ 'YourSessionTimeIsExpired'|get_lang }} +
{% endif %}
-
-
-
-
-

{{ session.name }}

- {% if show_tutor %} -
- {{ 'SessionGeneralCoach'|get_lang }}: {{ session.generalCoach.getCompleteName() }} -
- {% endif %} - {% if session.getShowDescription() %} -
- {{ session.getDescription() }} -
- {% endif %} - -
-
-
-
-

- {% if session.duration %} - {{ 'SessionDurationXDaysTotal'|get_lang|format(session.duration) }} - {% else %} - {{ session_date.display }} - {% endif %} -

-
- {% if is_premium == false %} -
{{ 'CourseSubscription'|get_lang }}
-
- {% if _u.logged and not is_subscribed %} - {{ subscribe_button }} - {% elseif not _u.logged %} - {% if 'allow_registration'|api_get_setting != 'false' %} - - {{ 'SignUp'|get_lang }} - - {% endif %} - {% endif %} -
- {% else %} -
-
- {{ 'SalePrice'|get_lang }} -
-
- {{ is_premium.iso_code }} {{ is_premium.price }} +
+
+
+
+

{{ session.name }}

+ {% if show_tutor %} +
+ {{ 'SessionGeneralCoach'|get_lang }}: + {{ session.generalCoach.getCompleteName() }}
-
- {{ 'BuyNow'|get_lang }} + {% endif %} + {% if session.getShowDescription() %} +
+ {{ session.getDescription() }}
-
{% endif %} - {% if has_requirements %} -
-
{{ 'RequiredSessions'|get_lang }}
- {% for sequence in sequences %} - {% if sequence.requirements %} -

- {{ sequence.name }} : - {% for requirement in sequence.requirements %} - - {{ requirement.getName }} - - {% endfor %} -

+ +
+
+
+
+

+ {% if session.duration %} + {{ 'SessionDurationXDaysTotal'|get_lang|format(session.duration) }} + {% else %} + {{ session_date.display }} {% endif %} - {% endfor %} +

- {% endif %} + {% if is_premium == false %} +
{{ 'CourseSubscription'|get_lang }}
+
+ {% if _u.logged and not is_subscribed %} + {{ subscribe_button }} + {% elseif not _u.logged %} + {% if 'allow_registration'|api_get_setting != 'false' %} + + {{ 'SignUp'|get_lang }} + + {% endif %} + {% endif %} +
+ {% else %} +
+
+ {{ 'SalePrice'|get_lang }} +
+
+ {{ is_premium.iso_code }} {{ is_premium.price }} +
+ +
+ {% endif %} + {% if has_requirements %} +
+
{{ 'RequiredSessions'|get_lang }}
+ {% for sequence in sequences %} + {% if sequence.requirements %} +

+ {{ sequence.name }} : + {% for requirement in sequence.requirements %} + + {{ requirement.getName }} + + {% endfor %} +

+ {% endif %} + {% endfor %} +
+ {% endif %} +
-
{% for course_data in courses %} {% set course_video = '' %} {% for extra_field in course_data.extra_fields %} {% if extra_field.value.getField().getVariable() == 'video_url' %} {% set course_video = extra_field.value.getValue() %} - {% endif %} + {% endif %} {% endfor %}
@@ -134,9 +137,9 @@
{% if courses|length > 1 %} -
-

{{ course_data.course.getTitle }}

-
+
+

{{ course_data.course.getTitle }}

+
{% endif %}
{{ course_data.description.getContent }} @@ -144,143 +147,151 @@
{% if course_data.tags %} -
+
-
    -
  • {{ 'Tags'|get_lang }} :
  • - {% for tag in course_data.tags %} -
  • - {{ tag.getTag }} -
  • - {% endfor %} -
-
+
    +
  • {{ 'Tags'|get_lang }} :
  • + {% for tag in course_data.tags %} +
  • + {{ tag.getTag }} +
  • + {% endfor %} +
+
{% endif %}
-
-
-
-
-

{{ "CourseInformation"|get_lang }}

-
- {% if course_data.objectives %} -
-

{{ course_data.objectives.getTitle }}

- -
- {% endif %} +
+
+
+
+

{{ "CourseInformation"|get_lang }}

+
+ {% if course_data.objectives %} +
+

{{ course_data.objectives.getTitle }}

+ +
+ {% endif %} - {% if course_data.topics %} -
-

{{ course_data.topics.getTitle }}

- -
- {% endif %} + {% if course_data.topics %} +
+

{{ course_data.topics.getTitle }}

+ +
+ {% endif %} - {% if course_data.methodology %} -
-

{{ course_data.methodology.getTitle }}

- -
- {% endif %} + {% if course_data.methodology %} +
+

{{ course_data.methodology.getTitle }}

+ +
+ {% endif %} - {% if course_data.material %} -
-

{{ course_data.material.getTitle }}

- -
- {% endif %} + {% if course_data.material %} +
+

{{ course_data.material.getTitle }}

+ +
+ {% endif %} - {% if course_data.resources %} -
-

{{ course_data.resources.getTitle }}

- -
- {% endif %} + {% if course_data.resources %} +
+

{{ course_data.resources.getTitle }}

+ +
+ {% endif %} - {% if course_data.assessment %} -
-

{{ course_data.assessment.getTitle }}

- -
- {% endif %} + {% if course_data.assessment %} +
+

{{ course_data.assessment.getTitle }}

+ +
+ {% endif %} - {% if course_data.custom %} - {% for custom in course_data.custom %} -
-

{{ custom.getTitle }}

- + {% if course_data.custom %} + {% for custom in course_data.custom %} +
+

{{ custom.getTitle }} +

+ +
+ {% endfor %} + {% endif %}
- {% endfor %} - {% endif %}
-
-
-
-
-
+
+
+
+
- {% if course_data.coaches %} -
-

{{ "Coaches"|get_lang }}

- {% for coach in course_data.coaches %} -
-
-
- {{ coach.complete_name }} -
-
-

{{ coach.complete_name }}

- {% if coach.diploma %} -

{{ coach.diploma }}

- {% endif %} -
-
- {% if coach.openarea %} -
-

{{ coach.openarea }}

+ {% if course_data.coaches %} +
+

{{ "Coaches"|get_lang }}

+ {% for coach in course_data.coaches %} +
+
+
+ {{ coach.complete_name }} +
+
+

{{ coach.complete_name }}

+ {% if coach.diploma %} +

{{ coach.diploma }}

+ {% endif %} +
+
+ {% if coach.openarea %} +
+

{{ coach.openarea }}

+
+ {% endif %} + {% for coach_extra_field in coach.extra_fields %} +
+
{{ coach_extra_field.value.getField().getDisplayText() }}
+
{{ coach_extra_field.value.getValue() }}
+
+ {% endfor %} +
+ {% endfor %}
- {% endif %} - {% for coach_extra_field in coach.extra_fields %} -
-
{{ coach_extra_field.value.getField().getDisplayText() }}
-
{{ coach_extra_field.value.getValue() }}
-
- {% endfor %} -
- {% endfor %} -
- {% endif %} + {% endif %} +
-
{% endfor %} - +