From c4228df6e449b6680e395e7e295e51c50099f6ca Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 Jan 2017 10:17:17 +0100 Subject: [PATCH] Minor - format code --- main/course_info/infocours.php | 9 ++--- main/inc/ajax/install.ajax.php | 18 ++++----- main/inc/ajax/social.ajax.php | 2 +- main/inc/ajax/thematic.ajax.php | 65 +++++++++++++++++---------------- main/inc/lib/social.lib.php | 7 +++- main/social/home.php | 2 +- main/social/index.php | 2 +- 7 files changed, 55 insertions(+), 50 deletions(-) diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index f949ae71ae..10d5971148 100755 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -118,17 +118,16 @@ $form->addHtml('
'); -$image_html = ''; - +$image = ''; // Display course picture $course_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository; // course path - if (file_exists($course_path.'/course-pic85x85.png')) { $course_web_path = api_get_path(WEB_COURSE_PATH).$currentCourseRepository; // course web path $course_medium_image = $course_web_path.'/course-pic85x85.png?'.rand(1, 1000); // redimensioned image 85x85 - $image_html = '
'; + $image = '
+
'; } -$form->addElement('html', $image_html); +$form->addHtml($image); $form->addText('title', get_lang('Title'), true); $form->applyFilter('title', 'html_filter'); diff --git a/main/inc/ajax/install.ajax.php b/main/inc/ajax/install.ajax.php index e47d8177de..a89df233bd 100755 --- a/main/inc/ajax/install.ajax.php +++ b/main/inc/ajax/install.ajax.php @@ -1,5 +1,5 @@ $company_city ); - $result = $client->__soapCall('ws_add_contact_information', array('contact_params' => $contact_params)); - + $result = $client->__soapCall( + 'ws_add_contact_information', + array('contact_params' => $contact_params) + ); echo $result; } - - } + } break; - default: - echo ''; + default: + echo ''; } exit; diff --git a/main/inc/ajax/social.ajax.php b/main/inc/ajax/social.ajax.php index ad29125289..80f5973f1a 100755 --- a/main/inc/ajax/social.ajax.php +++ b/main/inc/ajax/social.ajax.php @@ -1,5 +1,5 @@ set_thematic_plan_attributes($_REQUEST['thematic_id'], $title_list[$i], $description_list[$i], $description_type[$i]); - $affected_rows = $thematic->thematic_plan_save(); - } - } - $thematic_plan_data = $thematic->get_thematic_plan_data(); - $return = $thematic->get_thematic_plan_div($thematic_plan_data); - echo $return[$_REQUEST['thematic_id']];*/ - break; - case 'save_thematic_advance': - if (!api_is_allowed_to_edit(null, true)) { - echo ''; - exit; - } - /* + case 'save_thematic_plan': + /*$title_list = $_REQUEST['title']; + $description_list = $_REQUEST['desc']; + //$description_list = $_REQUEST['description']; + $description_type = $_REQUEST['description_type']; + if (api_is_allowed_to_edit(null, true)) { + for($i=1;$iset_thematic_plan_attributes($_REQUEST['thematic_id'], $title_list[$i], $description_list[$i], $description_type[$i]); + $affected_rows = $thematic->thematic_plan_save(); + } + } + $thematic_plan_data = $thematic->get_thematic_plan_data(); + $return = $thematic->get_thematic_plan_div($thematic_plan_data); + echo $return[$_REQUEST['thematic_id']];*/ + break; + case 'save_thematic_advance': + if (!api_is_allowed_to_edit(null, true)) { + echo ''; + exit; + } + /* if (($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) || (!empty($_REQUEST['duration_in_hours']) && !is_numeric($_REQUEST['duration_in_hours'])) ) { if ($_REQUEST['start_date_type'] == 1 && empty($_REQUEST['start_date_by_attendance'])) { $start_date_error = true; @@ -79,7 +79,7 @@ switch ($action) { $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true); $return = $thematic->get_thematic_advance_div($thematic_advance_data); echo $return[$_REQUEST['thematic_id']][$_REQUEST['thematic_advance_id']];*/ - break; + break; case 'get_datetime_by_attendance': $attendance_id = intval($_REQUEST['attendance_id']); $thematic_advance_id = intval($_REQUEST['thematic_advance_id']); @@ -98,9 +98,12 @@ switch ($action) { } $new_thematic_list = array(); - foreach($thematic_list_temp as $item) { - if (!empty($item['attendance_id']) ) { - $new_thematic_list[$item['id']] = array('attendance_id' =>$item['attendance_id'], 'start_date'=>$item['start_date']); + foreach ($thematic_list_temp as $item) { + if (!empty($item['attendance_id'])) { + $new_thematic_list[$item['id']] = array( + 'attendance_id' => $item['attendance_id'], + 'start_date' => $item['start_date'], + ); } } @@ -114,8 +117,7 @@ switch ($action) { $insert = true; //checking if was already taken foreach ($new_thematic_list as $key => $thematic_item) { - //if ($calendar['db_date_time'] == $thematic_item['start_date'] && $calendar['attendance_id'] == $thematic_item['attendance_id'] ) { - if ($calendar['db_date_time'] == $thematic_item['start_date'] ) { + if ($calendar['db_date_time'] == $thematic_item['start_date']) { $insert = false; if ($thematic_advance_id == $key) { $insert = true; @@ -146,9 +148,10 @@ switch ($action) { if (!empty($thematic_advance_id)) { $thematic = new Thematic(); $affected_rows = $thematic->update_done_thematic_advances($thematic_advance_id); - //if ($affected_rows) { - $total_average = $thematic->get_total_average_of_thematic_advances(api_get_course_id(), api_get_session_id()); - //} + $total_average = $thematic->get_total_average_of_thematic_advances( + api_get_course_id(), + api_get_session_id() + ); } echo $total_average; break; diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 014735b4f8..7ea41117fb 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -496,7 +496,6 @@ class SocialManager extends UserManager $my_course['course_info']['real_id'] ); - //$valor = api_get_settings_params(); $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path if (api_get_setting('course_images_in_courses_list') === 'true') { if (file_exists($course_path.'/course-pic85x85.png')) { @@ -510,7 +509,11 @@ class SocialManager extends UserManager ); } } else { - $imageCourse = Display::return_icon('course.png', get_lang('Course'), array('class' => 'img-default')); + $imageCourse = Display::return_icon( + 'course.png', + get_lang('Course'), + array('class' => 'img-default') + ); } //display course entry diff --git a/main/social/home.php b/main/social/home.php index 03c4ade24a..2a4d6e7002 100755 --- a/main/social/home.php +++ b/main/social/home.php @@ -1,5 +1,5 @@