From 8b10f6d1c931cbcc832eb3010e69b52a3d97c059 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 25 Jul 2014 22:44:32 -0500 Subject: [PATCH] Minor - Code indentation - refs #7218 --- main/inc/introductionSection.inc.php | 369 +++++++++++++++------------ 1 file changed, 201 insertions(+), 168 deletions(-) diff --git a/main/inc/introductionSection.inc.php b/main/inc/introductionSection.inc.php index 43e891532e..2be445dc5c 100755 --- a/main/inc/introductionSection.inc.php +++ b/main/inc/introductionSection.inc.php @@ -22,7 +22,7 @@ * @package chamilo.include */ -/* Constants and variables */ +/* Constants and variables */ $TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO); $intro_editAllowed = $is_allowed_to_edit; @@ -52,6 +52,7 @@ $height = '300'; // The global variable $fck_attribute has been deprecated. It stays here for supporting old external code. global $fck_attribute; + if (is_array($fck_attribute)) { if (isset($fck_attribute['ToolbarSet'])) { $toolbar_set = $fck_attribute['ToolbarSet']; @@ -145,167 +146,182 @@ if (!empty($session_id)) { /* Determines the correct display */ if ($intro_cmdEdit || $intro_cmdAdd) { - $intro_dispDefault = false; - $intro_dispForm = true; - $intro_dispCommand = false; + $intro_dispDefault = false; + $intro_dispForm = true; + $intro_dispCommand = false; } else { - $intro_dispDefault = true; - $intro_dispForm = false; - - if ($intro_editAllowed) { - $intro_dispCommand = true; - } else { - $intro_dispCommand = false; - } + $intro_dispDefault = true; + $intro_dispForm = false; + + if ($intro_editAllowed) { + $intro_dispCommand = true; + } else { + $intro_dispCommand = false; + } } /* Executes the display */ // display thematic advance inside a postit if ($intro_dispForm) { - $default['intro_content'] = $intro_content; - $form->setDefaults($default); - $introduction_section .= '
'; - $introduction_section .= $form->return_form(); - $introduction_section .= '
'; + $default['intro_content'] = $intro_content; + $form->setDefaults($default); + $introduction_section .= '
'; + $introduction_section .= $form->return_form(); + $introduction_section .= '
'; } $thematic_description_html = ''; if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { - $thematic = new Thematic(); + $thematic = new Thematic(); $displayMode = api_get_course_setting('display_info_advance_inside_homecourse'); - if ($displayMode == '1') { - //$information_title = get_lang('InfoAboutLastDoneAdvance'); - $last_done_advance = $thematic->get_last_done_thematic_advance(); - $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); + if ($displayMode == '1') { + //$information_title = get_lang('InfoAboutLastDoneAdvance'); + $last_done_advance = $thematic->get_last_done_thematic_advance(); + $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); $subTitle1 = get_lang('CurrentTopic'); - } else if($displayMode == '2') { + } else if($displayMode == '2') { //$information_title = get_lang('InfoAboutNextAdvanceNotDone'); $last_done_advance = $thematic->get_next_thematic_advance_not_done(); - $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(2); - $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); + $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(2); + $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done); $subTitle1 = $subTitle2 = get_lang('NextTopic'); - } else if($displayMode == '3') { - //$information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone'); - $last_done_advance = $thematic->get_last_done_thematic_advance(); - $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); - $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); - $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done); + } else if($displayMode == '3') { + //$information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone'); + $last_done_advance = $thematic->get_last_done_thematic_advance(); + $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); + $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); + $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done); $subTitle1 = get_lang('CurrentTopic'); $subTitle2 = get_lang('NextTopic'); } - if (!empty($thematic_advance_info)) { - - /*$thematic_advance = get_lang('CourseThematicAdvance').' '.$thematic->get_total_average_of_thematic_advances().'%';*/ - $thematic_advance = get_lang('CourseThematicAdvance'); - $thematicScore = $thematic->get_total_average_of_thematic_advances().'%'; - $thematicUrl = api_get_path(WEB_CODE_PATH).'course_progress/index.php?action=thematic_details&'.api_get_cidreq(); - if (api_is_allowed_to_edit(null, true)) { - //$thematic_advance = ''.get_lang('CourseThematicAdvance').' '.$thematic->get_total_average_of_thematic_advances().'%'; - } - $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']); - - $thematic_advance_info['start_date'] = api_get_local_time($thematic_advance_info['start_date']); - $thematic_advance_info['start_date'] = api_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG); - $userInfo = $_SESSION['_user']; - $courseInfo = api_get_course_info(); - //die('
'.print_r($courseInfo,1).'
'); - - $thematic_description_html = '
-
-
-
-
-
-
-
'; - $thematic_description_html.='

'.$userInfo['firstName'].'

'.$userInfo['lastName'].'

-

'.$thematicScore.'

-

'.$thematic_advance.'

'.$courseInfo['name'].'

'; - $thematic_description_html.=' -
-
-
'; - $thematic_description_html.='
-
-
-
-
-
-
- -
-
-
-
-
'.$thematic_advance.' '.$thematicScore.'
-
-
-
- '.get_lang('ShowFullCourseAdvance').' -
-
-
-
'; - $thematic_description_html.='
-
'; - $thematic_description_html.='
-
'.$subTitle1.'
-

'.$thematic_info['title'].'

-

'.$thematic_advance_info['start_date'].'

-

'.$thematic_advance_info['content'].'

-

'.get_lang('DurationInHours').' : '.$thematic_advance_info['duration'].' - '.get_lang('SeeDetail').'

-
'; - - - - - /*$thematic_description_html = '
- -
'; - /*$thematic_description_html .= '
-
-
';*/ - } + if (!empty($thematic_advance_info)) { + + /*$thematic_advance = get_lang('CourseThematicAdvance').' '.$thematic->get_total_average_of_thematic_advances().'%';*/ + $thematic_advance = get_lang('CourseThematicAdvance'); + $thematicScore = $thematic->get_total_average_of_thematic_advances( + ) . '%'; + $thematicUrl = api_get_path( + WEB_CODE_PATH + ) . 'course_progress/index.php?action=thematic_details&' . api_get_cidreq( + ); + if (api_is_allowed_to_edit(null, true)) { + //$thematic_advance = ''.get_lang('CourseThematicAdvance').' '.$thematic->get_total_average_of_thematic_advances().'%'; + } + $thematic_info = $thematic->get_thematic_list( + $thematic_advance_info['thematic_id'] + ); + + $thematic_advance_info['start_date'] = api_get_local_time( + $thematic_advance_info['start_date'] + ); + $thematic_advance_info['start_date'] = api_format_date( + $thematic_advance_info['start_date'], + DATE_TIME_FORMAT_LONG + ); + $userInfo = $_SESSION['_user']; + $courseInfo = api_get_course_info(); + //die('
'.print_r($courseInfo,1).'
'); + + $thematic_description_html = + '
+
+
+
+
+
+
+
'; + $thematic_description_html .= + '
+

' . $userInfo['firstName'] . '

+

' . $userInfo['lastName'] . '

+
+
+

' . $thematicScore . '

+
+
+

' . $thematic_advance . '

+

' . $courseInfo['name'] . '

+
+
'; + $thematic_description_html .= + ' +
+
+
'; + $thematic_description_html .= + '
+
+
+
+
+
+
+ +
+
+
+
+
' . $thematic_advance . ' ' . $thematicScore .' +
+
+
+
+ ' . get_lang('ShowFullCourseAdvance') . ' +
+
+
+
'; + $thematic_description_html .= + '
+
'; + $thematic_description_html .= + '
+
' . $subTitle1 . '
+

' . $thematic_info['title'] . '

+

' . $thematic_advance_info['start_date'] . '

+

' . $thematic_advance_info['content'] . '

+

' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . ' - ' . get_lang('SeeDetail') . '

+
'; + + if (!empty($thematic_advance_info2)) { + $thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']); + $thematic_advance_info2['start_date'] = api_get_local_time($thematic_advance_info2['start_date']); + $thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG); + + $thematic_description_html .= + '
+
'.$subTitle2.'
+

'.$thematic_info['title'].'

+

'.$thematic_advance_info2['start_date'].'

+

'.$thematic_advance_info2['content'].'

+

'.get_lang('DurationInHours').' : '.$thematic_advance_info2['duration'].' - '.get_lang('SeeDetail').'

+
'; + } + $thematic_description_html.= + '
+
+
+
+
+
+
+
+
+
'; + } } $introduction_section .= '
'; @@ -313,48 +329,65 @@ $introduction_section .= $thematic_description_html; $introduction_section .= '
'; $introduction_section .= '
'; + if ($intro_dispDefault) { - $intro_content = $intro_content; + $intro_content = $intro_content; - if (!empty($intro_content)) { - $introduction_section.='
'; - $introduction_section .= $intro_content; - $introduction_section.='
'; - } + if (!empty($intro_content)) { + $introduction_section.='
'; + $introduction_section .= $intro_content; + $introduction_section.='
'; + } } $introduction_section .= '
'; if ($intro_dispCommand) { - if (empty($intro_content)) { - // Displays "Add intro" commands - $introduction_section .= '
'; - if (!empty ($GLOBALS['_cid'])) { - $introduction_section .= ""; + if (empty($intro_content)) { + // Displays "Add intro" commands + $introduction_section .= '"; - - } else { - // Displays "edit intro && delete intro" commands - $introduction_section .= '
'; - if (!empty ($GLOBALS['_cid'])) { - $introduction_section .= "".Display::return_icon('edit.png',get_lang('Modify'),'',ICON_SIZE_SMALL).""; - $introduction_section .= "".Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).""; - } else { - $introduction_section .= "".Display::return_icon('edit.png',get_lang('Modify'),'',ICON_SIZE_SMALL).""; - $introduction_section .= "".Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).""; - } - $introduction_section .= "
"; + $introduction_section .= ""; + } else { + $introduction_section .= "\n".get_lang('AddIntro').""; + } + $introduction_section .= "
"; + + } else { + // Displays "edit intro && delete intro" commands + $introduction_section .= '"; // Fix for chrome XSS filter for videos in iframes - BT#7930 $browser = api_get_navigator(); if (strpos($introduction_section, '