Minor - format code, update from v2

pull/2970/head
Julio Montoya 6 years ago
parent b51ff19298
commit fed9744183
  1. 26
      main/inc/lib/pdf.lib.php
  2. 4
      main/inc/lib/template.lib.php
  3. 17
      main/inc/lib/tracking.lib.php
  4. 2
      main/mySpace/myStudents.php
  5. 2
      main/mySpace/works_in_session_report.php
  6. 2
      main/session/about.php
  7. 2
      main/session/session_course_user.php
  8. 2
      main/session/session_list.php
  9. 3
      main/survey/surveyUtil.class.php

@ -665,17 +665,17 @@ class PDF
/** /**
* Sets the PDF header. * Sets the PDF header.
* *
* @param array $course_data * @param array $courseInfo
*/ */
public function set_header($course_data) public function set_header($courseInfo)
{ {
$this->pdf->defaultheaderfontsize = 10; // in pts $this->pdf->defaultheaderfontsize = 10; // in pts
$this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI
$this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer
$userId = api_get_user_id(); $userId = api_get_user_id();
if (!empty($course_data['code'])) { if (!empty($courseInfo['code'])) {
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']); $teacher_list = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
$teachers = ''; $teachers = '';
if (!empty($teacher_list)) { if (!empty($teacher_list)) {
@ -732,14 +732,14 @@ class PDF
* Pre-formats a PDF to the right size and, if not stated otherwise, with * Pre-formats a PDF to the right size and, if not stated otherwise, with
* header, footer and watermark (if any). * header, footer and watermark (if any).
* *
* @param array $course_data General course information (to fill headers) * @param array $courseInfo General course information (to fill headers)
* @param bool $complete Whether we want headers, footers and watermark or not * @param bool $complete Whether we want headers, footers and watermark or not
*/ */
public function format_pdf($course_data, $complete = true) public function format_pdf($courseInfo, $complete = true)
{ {
$course_code = null; $courseCode = null;
if (!empty($course_data)) { if (!empty($courseInfo)) {
$course_code = $course_data['code']; $courseCode = $courseInfo['code'];
} }
/*$pdf->SetAuthor('Documents Chamilo'); /*$pdf->SetAuthor('Documents Chamilo');
@ -757,7 +757,7 @@ class PDF
if ($complete) { if ($complete) {
// Adding watermark // Adding watermark
if (api_get_setting('pdf_export_watermark_enable') == 'true') { if (api_get_setting('pdf_export_watermark_enable') == 'true') {
$watermark_file = self::get_watermark($course_code); $watermark_file = self::get_watermark($courseCode);
if ($watermark_file) { if ($watermark_file) {
//http://mpdf1.com/manual/index.php?tid=269&searchstring=watermark //http://mpdf1.com/manual/index.php?tid=269&searchstring=watermark
$this->pdf->SetWatermarkImage($watermark_file); $this->pdf->SetWatermarkImage($watermark_file);
@ -769,7 +769,7 @@ class PDF
$this->pdf->showWatermarkImage = true; $this->pdf->showWatermarkImage = true;
} }
} }
if ($course_code) { if ($courseCode) {
$watermark_text = api_get_course_setting('pdf_export_watermark_text'); $watermark_text = api_get_course_setting('pdf_export_watermark_text');
if (empty($watermark_text)) { if (empty($watermark_text)) {
$watermark_text = api_get_setting('pdf_export_watermark_text'); $watermark_text = api_get_setting('pdf_export_watermark_text');
@ -787,7 +787,7 @@ class PDF
} }
if (empty($this->custom_header)) { if (empty($this->custom_header)) {
self::set_header($course_data); self::set_header($courseInfo);
} else { } else {
$this->pdf->SetHTMLHeader($this->custom_header, 'E'); $this->pdf->SetHTMLHeader($this->custom_header, 'E');
$this->pdf->SetHTMLHeader($this->custom_header, 'O'); $this->pdf->SetHTMLHeader($this->custom_header, 'O');

@ -1219,7 +1219,7 @@ class Template
/** @var User $tutor */ /** @var User $tutor */
foreach ($tutors as $tutor) { foreach ($tutors as $tutor) {
$names[] = $tutor->getCompleteName(); $names[] = UserManager::formatUserFullName($tutor);
} }
return implode(CourseManager::USER_SEPARATOR, $names); return implode(CourseManager::USER_SEPARATOR, $names);
@ -1249,7 +1249,7 @@ class Template
/** @var User $teacher */ /** @var User $teacher */
foreach ($teachers as $teacher) { foreach ($teachers as $teacher) {
$names[] = $teacher->getCompleteName(); $names[] = UserManager::formatUserFullName($teacher);
} }
return implode(CourseManager::USER_SEPARATOR, $names); return implode(CourseManager::USER_SEPARATOR, $names);

@ -2003,23 +2003,6 @@ class Tracking
//see #5736 //see #5736
$last_login_date_timestamp = api_strtotime($last_login_date); $last_login_date_timestamp = api_strtotime($last_login_date);
$now = time(); $now = time();
//If the last connection is > than 7 days, the text is red
//345600 = 7 days in seconds
/*
if ($now - $last_login_date_timestamp > 604800) {
if ($convert_date) {
$last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
$icon = api_is_allowed_to_edit() ?
'<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'">
'.Display::return_icon('messagebox_warning.gif').'
</a>'
: null;
return $icon.Display::label($last_login_date, 'warning');
} else {
return $last_login_date;
}
} else {
*/
if ($convert_date) { if ($convert_date) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
} else { } else {

@ -124,7 +124,7 @@ if (!empty($details)) {
} else { } else {
if ($origin === 'resume_session') { if ($origin === 'resume_session') {
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => '../session/session_list.php', 'url' => "../session/session_list.php",
'name' => get_lang('SessionList'), 'name' => get_lang('SessionList'),
]; ];
$interbreadcrumb[] = [ $interbreadcrumb[] = [

@ -64,7 +64,7 @@ if ($session) {
if (!array_key_exists($user->getId(), $usersInfo)) { if (!array_key_exists($user->getId(), $usersInfo)) {
$usersInfo[$user->getId()] = [ $usersInfo[$user->getId()] = [
'code' => $user->getOfficialCode(), 'code' => $user->getOfficialCode(),
'complete_name' => $user->getCompleteName(), 'complete_name' => UserManager::formatUserFullName($user),
'time_in_platform' => api_time_to_hms( 'time_in_platform' => api_time_to_hms(
Tracking::get_time_spent_on_the_platform($user->getId(), 'ever') Tracking::get_time_spent_on_the_platform($user->getId(), 'ever')
), ),

@ -61,7 +61,7 @@ foreach ($sessionCourses as $sessionCourse) {
/** @var User $courseCoach */ /** @var User $courseCoach */
foreach ($courseCoaches as $courseCoach) { foreach ($courseCoaches as $courseCoach) {
$coachData = [ $coachData = [
'complete_name' => $courseCoach->getCompleteName(), 'complete_name' => UserManager::formatUserFullName($courseCoach),
'image' => UserManager::getUserPicture( 'image' => UserManager::getUserPicture(
$courseCoach->getId(), $courseCoach->getId(),
USER_IMAGE_SIZE_ORIGINAL USER_IMAGE_SIZE_ORIGINAL

@ -102,7 +102,7 @@ $interbreadcrumb[] = [
]; ];
Display::display_header($tool_name); Display::display_header($tool_name);
echo Display::page_header($session->getName().' - '.$user->getCompleteName()); echo Display::page_header($session->getName().' - '.UserManager::formatUserFullName($user));
?> ?>
<div class="row"> <div class="row">
<div class="col-sm-8 col-sm-offset-2"> <div class="col-sm-8 col-sm-offset-2">

@ -13,7 +13,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
SessionManager::protectSession(null, false); SessionManager::protectSession(null, false);
//Add the JS needed to use the jqgrid // Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js(); $htmlHeadXtra[] = api_get_jqgrid_js();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;

@ -1613,6 +1613,7 @@ class SurveyUtil
public static function export_complete_report_xls($survey_data, $filename, $user_id = 0) public static function export_complete_report_xls($survey_data, $filename, $user_id = 0)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$user_id = (int) $user_id;
$surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0; $surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
if (empty($course_id) || empty($surveyId)) { if (empty($course_id) || empty($surveyId)) {
@ -1773,7 +1774,7 @@ class SurveyUtil
$sql = "SELECT * FROM $table_survey_answer $sql = "SELECT * FROM $table_survey_answer
WHERE c_id = $course_id AND survey_id = $surveyId"; WHERE c_id = $course_id AND survey_id = $surveyId";
if ($user_id != 0) { if ($user_id != 0) {
$sql .= " AND user='".intval($user_id)."' "; $sql .= " AND user='".$user_id."' ";
} }
$sql .= ' ORDER BY user ASC'; $sql .= ' ORDER BY user ASC';

Loading…
Cancel
Save