diff --git a/app/Resources/public/css/themes/chamilo/print.css b/app/Resources/public/css/themes/chamilo/print.css
index 1761db732d..d73ce73049 100644
--- a/app/Resources/public/css/themes/chamilo/print.css
+++ b/app/Resources/public/css/themes/chamilo/print.css
@@ -534,7 +534,7 @@ dl.upload_option {
height: 0;
}
p, blockquote, ol, ul {
- font-size: 12px;
+ /*font-size: 12px;*/
}
h1 {
font-size: 21px;
@@ -768,19 +768,19 @@ padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;}
text-align: left;
}
.data_table tr.row_odd {
- background-color: #fafafa;
+ background-color: #fafafa;
}
.data_table tr.row_odd:hover, .data_table tr.row_even:hover {
background-color: #f0f0f0;
}
.data_table tr.row_even {
- background-color: #fff;
+ background-color: #fff;
}
.data_table td .highlight {
font-weight: bold;
}
.data_table td {
- padding: 5px;
+ padding: 5px;
border-bottom: 1px solid #b0b0b0;
border-right: 1px dotted #e1e1e1;
border-left: 1px dotted #e1e1e1;
@@ -795,7 +795,7 @@ padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;}
margin-bottom: 15px;
margin-top: 8px;
text-align: left;
- width: 100%;
+ width: 100%;
}
.data_table_no_border td {
diff --git a/main/auth/external_login/newUser.ldap.php b/main/auth/external_login/newUser.ldap.php
index 7eb6979e27..583ee09665 100755
--- a/main/auth/external_login/newUser.ldap.php
+++ b/main/auth/external_login/newUser.ldap.php
@@ -63,7 +63,7 @@ if ($ldap_user !== false) {
}
Event::eventLogin($chamiloUser->getId());
- MessageManager::sendNotificationByRegisteredUser($chamiloUser);
+ MessageManager::sendNotificationOfNewRegisteredUser($chamiloUser);
}
} else {
$loginFailed = true;
diff --git a/main/auth/inscription.php b/main/auth/inscription.php
index 3e75330f89..e65f397663 100755
--- a/main/auth/inscription.php
+++ b/main/auth/inscription.php
@@ -834,50 +834,8 @@ if ($form->validate()) {
sent a mail to the platform admin and exit the page.*/
if (api_get_setting('allow_registration') === 'approval') {
// 1. Send mail to all platform admin
- $emailsubject = get_lang('ApprovalForNewAccount').': '.$values['username'];
- $emailbody = get_lang('ApprovalForNewAccount')."\n";
- $emailbody .= get_lang('UserName').': '.$values['username']."\n";
-
- if (api_is_western_name_order()) {
- $emailbody .= get_lang('FirstName').': '.$values['firstname']."\n";
- $emailbody .= get_lang('LastName').': '.$values['lastname']."\n";
- } else {
- $emailbody .= get_lang('LastName').': '.$values['lastname']."\n";
- $emailbody .= get_lang('FirstName').': '.$values['firstname']."\n";
- }
- $emailbody .= get_lang('Email').': '.$values['email']."\n";
- $emailbody .= get_lang('Status').': '.$values['status']."\n\n";
-
- $url_edit = Display::url(
- api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id,
- api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user_id
- );
-
- $emailbody .= get_lang('ManageUser').": $url_edit";
-
- if (api_get_configuration_value('send_inscription_notification_to_general_admin_only')) {
- $email = api_get_setting('emailAdministrator');
- $firtname = api_get_setting('administratorSurname');
- $lastname = api_get_setting('administratorName');
-
- api_mail_html("$firtname $lastname", $email, $emailsubject, $emailbody);
- } else {
- $admins = UserManager::get_all_administrators();
- foreach ($admins as $admin_info) {
- MessageManager::send_message(
- $admin_info['user_id'],
- $emailsubject,
- $emailbody,
- [],
- [],
- null,
- null,
- null,
- null,
- $user_id
- );
- }
- }
+ $chamiloUser = api_get_user_entity($user_id);
+ MessageManager::sendNotificationOfNewRegisteredUserApproval($chamiloUser);
// 2. set account inactive
UserManager::disable($user_id);
diff --git a/main/document/showinframes.php b/main/document/showinframes.php
index 30ef99ab67..c4d6299dbb 100755
--- a/main/document/showinframes.php
+++ b/main/document/showinframes.php
@@ -103,7 +103,7 @@ if (!$is_allowed_to_edit && !$is_visible) {
}
$pathinfo = pathinfo($header_file);
-$playerSupportedFiles = ['mp3', 'mp4', 'ogv', 'flv', 'm4v', 'webm'];
+$playerSupportedFiles = ['mp3', 'mp4', 'ogv', 'ogg', 'flv', 'm4v', 'webm'];
$playerSupported = false;
if (in_array(strtolower($pathinfo['extension']), $playerSupportedFiles)) {
$playerSupported = true;
diff --git a/main/exercise/fill_blanks.class.php b/main/exercise/fill_blanks.class.php
index 7658f27d1c..9e7e039dbf 100755
--- a/main/exercise/fill_blanks.class.php
+++ b/main/exercise/fill_blanks.class.php
@@ -1133,7 +1133,7 @@ class FillBlanks extends Question
$result = '';
$listStudentAnswerInfo = self::getAnswerInfo($answer, true);
- if (in_array($resultsDisabled, [
+ /*if (in_array($resultsDisabled, [
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
]
@@ -1143,7 +1143,7 @@ class FillBlanks extends Question
if ($showTotalScoreAndUserChoices) {
$resultsDisabled = false;
}
- }
+ }*/
// rebuild the answer with good HTML style
// this is the student answer, right or wrong
diff --git a/main/gradebook/gradebook_display_certificate.php b/main/gradebook/gradebook_display_certificate.php
index 08944f60f8..eec54aaecb 100755
--- a/main/gradebook/gradebook_display_certificate.php
+++ b/main/gradebook/gradebook_display_certificate.php
@@ -317,12 +317,21 @@ if (count($certificate_list) == 0) {
echo '
'.get_lang('Date').' : '.api_convert_and_format_date($valueCertificate['created_at']).' | ';
echo '';
$url = api_get_path(WEB_PATH).'certificates/index.php?id='.$valueCertificate['id'].'&user_id='.$value['user_id'];
- $certificates = Display::url(
+ $certificateUrl = Display::url(
get_lang('Certificate'),
$url,
['target' => '_blank', 'class' => 'btn btn-default']
);
- echo $certificates;
+ echo $certificateUrl;
+
+ $url .= '&action=export';
+ $pdf = Display::url(
+ Display::return_icon('pdf.png', get_lang('Download')),
+ $url,
+ ['target' => '_blank']
+ );
+ echo $pdf;
+
echo '
'.Display::return_icon('delete.png', get_lang('Delete')).'
';
diff --git a/main/gradebook/gradebook_display_summary.php b/main/gradebook/gradebook_display_summary.php
index 05413f579c..90143e463a 100644
--- a/main/gradebook/gradebook_display_summary.php
+++ b/main/gradebook/gradebook_display_summary.php
@@ -145,7 +145,7 @@ switch ($action) {
case 'download':
$userId = isset($_GET['user_id']) && $_GET['user_id'] ? $_GET['user_id'] : null;
$cats = Category::load($cat_id, null, null, null, null, null, false);
- GradebookUtils::generateTable($courseInfo, $userId, $cats);
+ GradebookUtils::generateTable($courseInfo, $userId, $cats, false, false, $userList);
break;
}
diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php
index 353ceb5359..43bd5bfac0 100755
--- a/main/gradebook/lib/be/category.class.php
+++ b/main/gradebook/lib/be/category.class.php
@@ -937,7 +937,6 @@ class Category implements GradebookItem
}
}
- $students = [];
if (!empty($evals)) {
/** @var Evaluation $eval */
foreach ($evals as $eval) {
@@ -1128,18 +1127,6 @@ class Category implements GradebookItem
$maxScore = current($totalScorePerStudent);
return [$maxScore, $this->get_weight()];
- if (empty($bestResult)) {
- if ($cacheAvailable) {
- $cacheDriver->save($key, null);
- }
-
- return null;
- }
- if ($cacheAvailable) {
- $cacheDriver->save($key, [$bestResult, $weightsum]);
- }
-
- return [$bestResult, $weightsum];
break;
case 'average':
if (empty($ressum)) {
diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php
index 2fc391eb9b..538e0ae527 100755
--- a/main/gradebook/lib/fe/gradebooktable.class.php
+++ b/main/gradebook/lib/fe/gradebooktable.class.php
@@ -268,7 +268,6 @@ class GradebookTable extends SortableTable
$defaultData[$item->get_id()]['ranking'] = $rankingStudentList;
$defaultData[$item->get_id()]['ranking_invalidate'] = $invalidateRanking;
}
- //exit;
}
break;
}
diff --git a/main/gradebook/lib/gradebook_data_generator.class.php b/main/gradebook/lib/gradebook_data_generator.class.php
index 7454d8a160..6ac4fd1df1 100755
--- a/main/gradebook/lib/gradebook_data_generator.class.php
+++ b/main/gradebook/lib/gradebook_data_generator.class.php
@@ -240,10 +240,71 @@ class GradebookDataGenerator
}
$score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList);
}
+ //$score = AbstractLink::getCurrentUserRanking($userId, $item->entity->getUserScoreList());
} else {
if (!empty($studentList)) {
+ $session_id = api_get_session_id();
+ //$cats = $item->get_subcategories(null);
+ $evals = $item->get_evaluations(null);
+ $links = $item->get_links(null);
foreach ($studentList as $user) {
- $score = $this->build_result_column(
+ $ressum = 0;
+ $weightsum = 0;
+ $bestResult = 0;
+
+ if (!empty($evals)) {
+ foreach ($evals as $eval) {
+ $evalres = $eval->calc_score($user['user_id'], null);
+ $eval->setStudentList($studentList);
+
+ if (isset($evalres) && $eval->get_weight() != 0) {
+ $evalweight = $eval->get_weight();
+ $weightsum += $evalweight;
+ if (!empty($evalres[1])) {
+ $ressum += $evalres[0] / $evalres[1] * $evalweight;
+ }
+
+ if ($ressum > $bestResult) {
+ $bestResult = $ressum;
+ }
+ } else {
+ if ($eval->get_weight() != 0) {
+ $evalweight = $eval->get_weight();
+ $weightsum += $evalweight;
+ }
+ }
+ }
+ }
+
+ if (!empty($links)) {
+ foreach ($links as $link) {
+ $link->setStudentList($studentList);
+
+ if ($session_id) {
+ $link->set_session_id($session_id);
+ }
+
+ $linkres = $link->calc_score($user['user_id'], null);
+ if (!empty($linkres) && $link->get_weight() != 0) {
+ $linkweight = $link->get_weight();
+ $link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
+
+ $weightsum += $linkweight;
+ $ressum += $linkres[0] / $link_res_denom * $linkweight;
+ if ($ressum > $bestResult) {
+ $bestResult = $ressum;
+ }
+ } else {
+ // Adding if result does not exists
+ if ($link->get_weight() != 0) {
+ $linkweight = $link->get_weight();
+ $weightsum += $linkweight;
+ }
+ }
+ }
+ }
+
+ /*$score = $this->build_result_column(
$user['user_id'],
$item,
$ignore_score_color,
@@ -251,11 +312,18 @@ class GradebookDataGenerator
);
if (!empty($score['score'][0])) {
$invalidateResults = false;
+ }*/
+
+ if (!empty($ressum)) {
+ $invalidateResults = false;
}
- $rankingStudentList[$user['user_id']] = $score['score'][0];
+
+ $rankingStudentList[$user['user_id']] = $ressum;
}
}
+ //error_log($item->get_id());
$score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList);
+ //error_log(print_r($score, 1));
}
$row['ranking'] = $scoreDisplay->display_score(
@@ -314,6 +382,7 @@ class GradebookDataGenerator
} else {
if (!empty($studentList)) {
foreach ($studentList as $user) {
+
$score = $this->build_result_column(
$user['user_id'],
$item,
diff --git a/main/inc/lib/MailTemplateManager.php b/main/inc/lib/MailTemplateManager.php
index 643e951537..809a88f2e4 100644
--- a/main/inc/lib/MailTemplateManager.php
+++ b/main/inc/lib/MailTemplateManager.php
@@ -209,4 +209,25 @@ class MailTemplateManager extends Model
return false;
}
+ /**
+ * Gets a custom mail template by the name of the template it replaces
+ * @param string $templateType Name of the template file it replaces
+ * @return string
+ */
+ public function getTemplateByType($templateType)
+ {
+ if (empty($templateType)) {
+ return '';
+ }
+ $result = Database::select(
+ 'template',
+ $this->table,
+ ['where' => ['type = ? ' => $templateType, ' AND url_id = ? ' => api_get_current_access_url_id()]],
+ 'first'
+ );
+ if (empty($result)) {
+ return '';
+ }
+ return $result['template'];
+ }
}
diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php
index 61686e25f9..30128fe6ea 100644
--- a/main/inc/lib/document.lib.php
+++ b/main/inc/lib/document.lib.php
@@ -3256,6 +3256,7 @@ class DocumentManager
{
$id = api_get_unique_id();
switch ($extension) {
+ case 'ogg':
case 'mp3':
$document_data['file_extension'] = $extension;
$html = '';
diff --git a/main/inc/lib/events.lib.php b/main/inc/lib/events.lib.php
index eba1e5b2fb..32d3488584 100644
--- a/main/inc/lib/events.lib.php
+++ b/main/inc/lib/events.lib.php
@@ -2260,6 +2260,17 @@ class Event
$courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
Database::insert($courseTrackingTable, $params);
+ // Time should also be added to the track_e_login table so as to
+ // affect total time on the platform
+ $params = [
+ 'login_user_id' => $userId,
+ 'login_date' => $loginDate,
+ 'user_ip' => api_get_real_ip(),
+ 'logout_date' => $logoutDate
+ ];
+ $platformTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
+ Database::insert($platformTrackingTable, $params);
+
return true;
}
@@ -2292,6 +2303,7 @@ class Event
return false;
}
$courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
+ $platformTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$courseId = (int) $courseId;
$userId = (int) $userId;
$sessionId = (int) $sessionId;
@@ -2326,8 +2338,22 @@ class Event
$courseAccessId = $row[0];
$sql = "DELETE FROM $courseTrackingTable
WHERE course_access_id = $courseAccessId";
+ Database::query($sql);
+ }
+ $sql = "SELECT login_id
+ FROM $platformTrackingTable
+ WHERE
+ login_user_id = $userId AND
+ (UNIX_TIMESTAMP(logout_date) - UNIX_TIMESTAMP(login_date)) = '$virtualTime'
+ ORDER BY login_date DESC LIMIT 0,1";
+ $result = Database::query($sql);
+ if (Database::num_rows($result) > 0) {
+ // Found the latest connection
+ $row = Database::fetch_row($result);
+ $loginAccessId = $row[0];
+ $sql = "DELETE FROM $platformTrackingTable
+ WHERE login_id = $loginAccessId";
$result = Database::query($sql);
-
return $result;
}
diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php
index da475289ad..6eea65d685 100755
--- a/main/inc/lib/message.lib.php
+++ b/main/inc/lib/message.lib.php
@@ -2655,7 +2655,7 @@ class MessageManager
*
* @param User $user
*/
- public static function sendNotificationByRegisteredUser(User $user)
+ public static function sendNotificationOfNewRegisteredUser(User $user)
{
$tplMailBody = new Template(
null,
@@ -2696,6 +2696,88 @@ class MessageManager
}
}
+ /**
+ * Send a notification to all admins when a new user is registered
+ * while the approval method is used for users registration
+ *
+ * @param User $user
+ */
+ public static function sendNotificationOfNewRegisteredUserApproval(User $user)
+ {
+ $tplMailBody = new Template(
+ null,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false
+ );
+ $tplMailBody->assign('user', $user);
+ $tplMailBody->assign('is_western_name_order', api_is_western_name_order());
+ $userId = $user->getId();
+ $url_edit = Display::url(
+ api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$userId,
+ api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$userId
+ );
+ $tplMailBody->assign(
+ 'manageUrl',
+ $url_edit
+ );
+ // Get extra field values for this user and reformat the array
+ $extraFieldValues = new ExtraFieldValue('user');
+ $userExtraFields = $extraFieldValues->getAllValuesByItem($userId);
+ $values = [];
+ foreach($userExtraFields as $field => $value) {
+ $values[$value['variable']] = $value['value'];
+ }
+ $tplMailBody->assign(
+ 'extra',
+ $values
+ );
+ $layoutContent = '';
+ $emailbody = '';
+ if (api_get_configuration_value('mail_template_system') == true) {
+ $mailTemplateManager = new MailTemplateManager();
+ $templateText = $mailTemplateManager->getTemplateByType('new_user_mail_to_admin_approval.tpl');
+ if (empty($templateText)) {
+ } else {
+ // custom procedure to load a template as a string (doesn't use cache so may slow down)
+ $template = $tplMailBody->twig->createTemplate($templateText);
+ $emailbody = $template->render($tplMailBody->params);
+ }
+ }
+ if (empty($emailbody)) {
+ $layoutContent = $tplMailBody->get_template('mail/new_user_mail_to_admin_approval.tpl');
+ $emailbody = $tplMailBody->fetch($layoutContent);
+ }
+
+ $emailsubject = '['.get_lang('ApprovalForNewAccount').'] '.$user->getUsername();
+
+ if (api_get_configuration_value('send_inscription_notification_to_general_admin_only')) {
+ $email = api_get_setting('emailAdministrator');
+ $firstname = api_get_setting('administratorSurname');
+ $lastname = api_get_setting('administratorName');
+ api_mail_html("$firstname $lastname", $email, $emailsubject, $emailbody);
+ } else {
+ $admins = UserManager::get_all_administrators();
+ foreach ($admins as $admin_info) {
+ self::send_message(
+ $admin_info['user_id'],
+ $emailsubject,
+ $emailbody,
+ [],
+ [],
+ null,
+ null,
+ null,
+ null,
+ $userId
+ );
+ }
+ }
+ }
+
/**
* Get the error log from failed mailing
* This assumes a complex setup where you have a cron script regularly copying the mail queue log
diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php
index c387372e82..b4efcb6834 100755
--- a/main/lp/learnpath.class.php
+++ b/main/lp/learnpath.class.php
@@ -12944,7 +12944,7 @@ EOD;
}
$documentPathInfo = pathinfo($document->getPath());
- $mediaSupportedFiles = ['mp3', 'mp4', 'ogv', 'flv', 'm4v'];
+ $mediaSupportedFiles = ['mp3', 'mp4', 'ogv', 'ogg', 'flv', 'm4v'];
$extension = isset($documentPathInfo['extension']) ? $documentPathInfo['extension'] : '';
$showDirectUrl = !in_array($extension, $mediaSupportedFiles);
diff --git a/main/lp/learnpathList.class.php b/main/lp/learnpathList.class.php
index b3d96a0746..1deb2f03c8 100755
--- a/main/lp/learnpathList.class.php
+++ b/main/lp/learnpathList.class.php
@@ -106,10 +106,7 @@ class LearnpathList
$isAllowToEdit = api_is_allowed_to_edit();
/** @var CLp $row */
foreach ($learningPaths as $row) {
- // Use domesticate here instead of Database::escape_string because
- // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
- // is done using domesticate()
- $name = domesticate($row->getName());
+ $name = Database::escape_string($row->getName());
$link = 'lp/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
$oldLink = 'newscorm/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php
index 9427bfd158..fb467d5cef 100755
--- a/main/mySpace/myStudents.php
+++ b/main/mySpace/myStudents.php
@@ -1855,7 +1855,7 @@ if (empty($details)) {
echo ' ('.$documentNumber.') | ';
$qualification = !empty($results['qualification']) ? $results['qualification'] : '-';
echo ' '.$qualification.' | ';
- echo ' '.$results['formatted_date'].' | ';
+ echo ' '.api_convert_and_format_date($results['sent_date_from_db']).' '.$results['expiry_note'].' | ';
$assignment = get_work_assignment_by_id($work->id, $courseInfo['real_id']);
echo ' ';
diff --git a/main/template/default/mail/new_user_mail_to_admin_approval.tpl b/main/template/default/mail/new_user_mail_to_admin_approval.tpl
new file mode 100644
index 0000000000..628d23d65a
--- /dev/null
+++ b/main/template/default/mail/new_user_mail_to_admin_approval.tpl
@@ -0,0 +1,14 @@
+{{ 'ApprovalForNewAccount'|get_lang }}
+
+ - {{ 'Username'|get_lang }}: {{ user.getUsername() }}
+ {% if is_western_name_order %}
+ - {{ 'FirstName'|get_lang }}: {{ user.getFirstName() }}
+ - {{ 'LastName' }}: {{ user.getLastName() }}
+ {% else %}
+ - {{ 'LastName' }}: {{ user.getLastName() }}
+ - {{ 'FirstName' }}: {{ user.getFirstName() }}
+ {% endif %}
+ - {{ 'Email'|get_lang }}: {{ user.getEmail() }}
+ - {{ 'Status'|get_lang }}: {{ user.getStatus() }}
+
+{{ 'ManageUser'|get_lang }}: {{ manageUrl }}
diff --git a/main/work/work.lib.php b/main/work/work.lib.php
index 75b9a7edbf..ae1a691d42 100755
--- a/main/work/work.lib.php
+++ b/main/work/work.lib.php
@@ -2069,6 +2069,7 @@ function get_work_user_list(
$work_date = api_get_local_time($work['sent_date']);
$date = date_to_str_ago($work['sent_date']).' '.$work_date;
$work['formatted_date'] = $work_date.' '.$add_string;
+ $work['expiry_note'] = $add_string;
$work['sent_date_from_db'] = $work['sent_date'];
$work['sent_date'] = ''.
$add_string.' '.Display::dateToStringAgoAndLongDate($work['sent_date']).' ';
| |