Minor - format code, update from v2

pull/2970/head
Julio Montoya 6 years ago
parent b51ff19298
commit fed9744183
  1. 24
      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.
*
* @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->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI
$this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer
$userId = api_get_user_id();
if (!empty($course_data['code'])) {
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']);
if (!empty($courseInfo['code'])) {
$teacher_list = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
$teachers = '';
if (!empty($teacher_list)) {
@ -732,14 +732,14 @@ class PDF
* Pre-formats a PDF to the right size and, if not stated otherwise, with
* 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
*/
public function format_pdf($course_data, $complete = true)
public function format_pdf($courseInfo, $complete = true)
{
$course_code = null;
if (!empty($course_data)) {
$course_code = $course_data['code'];
$courseCode = null;
if (!empty($courseInfo)) {
$courseCode = $courseInfo['code'];
}
/*$pdf->SetAuthor('Documents Chamilo');
@ -757,7 +757,7 @@ class PDF
if ($complete) {
// Adding watermark
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) {
//http://mpdf1.com/manual/index.php?tid=269&searchstring=watermark
$this->pdf->SetWatermarkImage($watermark_file);
@ -769,7 +769,7 @@ class PDF
$this->pdf->showWatermarkImage = true;
}
}
if ($course_code) {
if ($courseCode) {
$watermark_text = api_get_course_setting('pdf_export_watermark_text');
if (empty($watermark_text)) {
$watermark_text = api_get_setting('pdf_export_watermark_text');
@ -787,7 +787,7 @@ class PDF
}
if (empty($this->custom_header)) {
self::set_header($course_data);
self::set_header($courseInfo);
} else {
$this->pdf->SetHTMLHeader($this->custom_header, 'E');
$this->pdf->SetHTMLHeader($this->custom_header, 'O');

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

@ -2003,23 +2003,6 @@ class Tracking
//see #5736
$last_login_date_timestamp = api_strtotime($last_login_date);
$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) {
return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
} else {

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

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

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

@ -102,7 +102,7 @@ $interbreadcrumb[] = [
];
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="col-sm-8 col-sm-offset-2">

@ -13,7 +13,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
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();
$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)
{
$course_id = api_get_course_int_id();
$user_id = (int) $user_id;
$surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
if (empty($course_id) || empty($surveyId)) {
@ -1773,7 +1774,7 @@ class SurveyUtil
$sql = "SELECT * FROM $table_survey_answer
WHERE c_id = $course_id AND survey_id = $surveyId";
if ($user_id != 0) {
$sql .= " AND user='".intval($user_id)."' ";
$sql .= " AND user='".$user_id."' ";
}
$sql .= ' ORDER BY user ASC';

Loading…
Cancel
Save