Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/2487/head
jmontoyaa 9 years ago
commit b0985ab0cd
  1. 2
      certificates/index.php
  2. 4
      main/admin/legal_add.php
  3. 8
      main/admin/special_exports.php
  4. 28
      main/admin/subscribe_user2course.php
  5. 10
      main/admin/user_add.php
  6. 2
      main/admin/user_update_import.php
  7. 70
      main/document/document.php
  8. 26
      main/exercise/answer.class.php
  9. 30
      main/exercise/oral_expression.class.php
  10. 16
      main/exercise/stats.php
  11. 10
      main/gradebook/exercise_jump.php
  12. 4
      main/gradebook/gradebook_edit_cat.php
  13. 6
      main/gradebook/gradebook_edit_eval.php
  14. 16
      main/gradebook/lib/be/exerciselink.class.php
  15. 6
      main/gradebook/lib/fe/linkaddeditform.class.php
  16. 4
      main/inc/ajax/chat.ajax.php
  17. 20
      main/inc/ajax/exercise.ajax.php
  18. 2
      main/inc/lib/usergroup.lib.php
  19. 2
      main/lp/download.php
  20. 4
      main/lp/learnpathList.class.php
  21. 26
      main/mySpace/lp_tracking.php
  22. 8
      main/session/about.php
  23. 12
      main/session/resume_session.php
  24. 50
      main/social/profile.php
  25. 24
      main/social/search.php
  26. 2
      main/survey/survey_invitation.php
  27. 4
      main/ticket/priorities.php
  28. 2
      main/ticket/settings.php
  29. 52
      main/ticket/ticket_details.php
  30. 10
      main/upload/upload_ppt.php
  31. 32
      main/user/user.php
  32. 24
      main/user/user_export.php
  33. 46
      plugin/buycourses/src/buycourses.ajax.php
  34. 10
      plugin/buycourses/src/configure_course.php
  35. 62
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseArchiver.php

@ -39,7 +39,7 @@ switch ($action) {
$pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4'; $pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4';
$userInfo = api_get_user_info($certificate->user_id); $userInfo = api_get_user_info($certificate->user_id);
$pdfName = api_replace_dangerous_char(get_lang('Certificate') . ' ' . $userInfo['username']); $pdfName = api_replace_dangerous_char(get_lang('Certificate').' '.$userInfo['username']);
$pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams); $pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams);
$pdf->html_to_pdf( $pdf->html_to_pdf(

@ -66,7 +66,7 @@ if ($form->validate()) {
Display::addFlash(Display::return_message($message)); Display::addFlash(Display::return_message($message));
header('Location: legal_list.php?sec_token='.$tok); header('Location: legal_list.php?sec_token='.$tok);
exit(); exit();
} elseif ($submit=='preview') { } elseif ($submit == 'preview') {
$defaults['type'] = $type; $defaults['type'] = $type;
$defaults['content'] = $content; $defaults['content'] = $content;
$defaults['changes'] = $changes; $defaults['changes'] = $changes;
@ -143,7 +143,7 @@ if (isset($_POST['language'])) {
} }
$tool_name = get_lang('AddTermsAndConditions'); $tool_name = get_lang('AddTermsAndConditions');
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
Display :: display_header($tool_name); Display :: display_header($tool_name);
echo '<script> echo '<script>

@ -17,7 +17,7 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
// Access restrictions // Access restrictions
api_protect_admin_script(true); api_protect_admin_script(true);
$nameTools = get_lang('SpecialExports'); $nameTools = get_lang('SpecialExports');
@ -39,7 +39,7 @@ echo Display::page_header($nameTools);
if (count($_POST) == 0) { if (count($_POST) == 0) {
Display::display_normal_message(get_lang('SpecialExportsIntroduction')); Display::display_normal_message(get_lang('SpecialExportsIntroduction'));
} }
$error =0; $error = 0;
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@ -159,7 +159,7 @@ function form_special_export()
$renderer->setCustomElementTemplate('<div>{element}</div> '); $renderer->setCustomElementTemplate('<div>{element}</div> ');
$form->addElement('radio', 'backup_option', '', get_lang('SpecialCreateFullBackup'), 'full_backup'); $form->addElement('radio', 'backup_option', '', get_lang('SpecialCreateFullBackup'), 'full_backup');
$form->addElement('radio', 'backup_option', '', get_lang('SpecialLetMeSelectItems'), 'select_items'); $form->addElement('radio', 'backup_option', '', get_lang('SpecialLetMeSelectItems'), 'select_items');
$form->addElement('html','<br />'); $form->addElement('html', '<br />');
$form->addButtonExport(get_lang('CreateBackup')); $form->addButtonExport(get_lang('CreateBackup'));
$form->addProgress(); $form->addProgress();
$values['backup_option'] = 'full_backup'; $values['backup_option'] = 'full_backup';
@ -240,7 +240,7 @@ function fullexportspecial()
if (count($list_course) > 0) { if (count($list_course) > 0) {
foreach ($list_course as $_course) { foreach ($list_course as $_course) {
if ($FileZip['PATH'] == '/') { if ($FileZip['PATH'] == '/') {
$querypath=''; // to prevent ...path LIKE '//%'... in query $querypath = ''; // to prevent ...path LIKE '//%'... in query
} else { } else {
$querypath = $FileZip['PATH']; $querypath = $FileZip['PATH'];
} }

@ -30,7 +30,7 @@ $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
/* Header */ /* Header */
$tool_name = get_lang('AddUsersToACourse'); $tool_name = get_lang('AddUsersToACourse');
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
function validate_filter() { function validate_filter() {
@ -142,12 +142,12 @@ if (is_array($extra_field_list)) {
if (isset($_POST[$varname]) && $_POST[$varname] != '0') { if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
$use_extra_fields = true; $use_extra_fields = true;
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
$extra_field_result[]= UserManager::get_extra_user_data_by_tags( $extra_field_result[] = UserManager::get_extra_user_data_by_tags(
intval($_POST['field_id']), intval($_POST['field_id']),
$_POST[$varname] $_POST[$varname]
); );
} else { } else {
$extra_field_result[]= UserManager::get_extra_user_data_by_value( $extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'], $new_field['variable'],
$_POST[$varname] $_POST[$varname]
); );
@ -163,8 +163,8 @@ if ($use_extra_fields) {
$final_result = array(); $final_result = array();
if (count($extra_field_result) > 1) { if (count($extra_field_result) > 1) {
for ($i = 0; $i < count($extra_field_result) - 1; $i++) { for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
if (is_array($extra_field_result[$i+1])) { if (is_array($extra_field_result[$i + 1])) {
$final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]); $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
} }
} }
} else { } else {
@ -172,14 +172,14 @@ if ($use_extra_fields) {
} }
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
if (is_array($final_result) && count($final_result)>0) { if (is_array($final_result) && count($final_result) > 0) {
$where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') "; $where_filter = " AND u.user_id IN ('".implode("','", $final_result)."') ";
} else { } else {
//no results //no results
$where_filter = " AND u.user_id = -1"; $where_filter = " AND u.user_id = -1";
} }
} else { } else {
if (is_array($final_result) && count($final_result)>0) { if (is_array($final_result) && count($final_result) > 0) {
$where_filter = " AND user_id IN ('".implode("','", $final_result)."') "; $where_filter = " AND user_id IN ('".implode("','", $final_result)."') ";
} else { } else {
//no results //no results
@ -200,10 +200,10 @@ if ($orderListByOfficialCode === 'true') {
$sql = "SELECT user_id, lastname, firstname, username, official_code $sql = "SELECT user_id, lastname, firstname, username, official_code
FROM $tbl_user FROM $tbl_user
WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter
ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; ORDER BY ".(count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$sql = "SELECT u.user_id,lastname,firstname,username, official_code $sql = "SELECT u.user_id,lastname,firstname,username, official_code
@ -215,7 +215,7 @@ if (api_is_multiple_url_enabled()) {
access_url_id = $access_url_id AND access_url_id = $access_url_id AND
(".$target_name." LIKE '".$first_letter_user."%' ) (".$target_name." LIKE '".$first_letter_user."%' )
$where_filter $where_filter
ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; ORDER BY ".(count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
} }
} }
@ -259,7 +259,7 @@ if (is_array($extra_field_list)) {
echo '&nbsp;<select name="'.$varname.'">'; echo '&nbsp;<select name="'.$varname.'">';
echo '<option value="0">--'.get_lang('Select').'--</option>'; echo '<option value="0">--'.get_lang('Select').'--</option>';
foreach ($new_field['data'] as $option) { foreach ($new_field['data'] as $option) {
$checked=''; $checked = '';
if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
if (isset($_POST[$varname])) { if (isset($_POST[$varname])) {
if ($_POST[$varname] == $option['tag']) { if ($_POST[$varname] == $option['tag']) {
@ -317,7 +317,7 @@ if (is_array($extra_field_list)) {
<td width="40%" align="center"> <td width="40%" align="center">
<select name="UserList[]" multiple="multiple" size="20" style="width:300px;"> <select name="UserList[]" multiple="multiple" size="20" style="width:300px;">
<?php foreach ($db_users as $user) { ?> <?php foreach ($db_users as $user) { ?>
<option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>> <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
<?php <?php
$userName = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')'; $userName = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')';
if ($showOfficialCode) { if ($showOfficialCode) {
@ -338,7 +338,7 @@ if (is_array($extra_field_list)) {
<td width="40%" align="center"> <td width="40%" align="center">
<select name="CourseList[]" multiple="multiple" size="20" style="width:300px;"> <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;">
<?php foreach ($db_courses as $course) { ?> <?php foreach ($db_courses as $course) { ?>
<option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>> <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>>
<?php echo '('.$course['visual_code'].') '.$course['title']; ?> <?php echo '('.$course['visual_code'].') '.$course['title']; ?>
</option> </option>
<?php } ?> <?php } ?>

@ -135,7 +135,7 @@ if (api_get_setting('registration', 'email') == 'true') {
} }
if (api_get_setting('login_is_email') == 'true') { if (api_get_setting('login_is_email') == 'true') {
$form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('email', get_lang('UserTaken'), 'username_available'); $form->addRule('email', get_lang('UserTaken'), 'username_available');
} }
@ -155,7 +155,7 @@ $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allow
if (api_get_setting('login_is_email') != 'true') { if (api_get_setting('login_is_email') != 'true') {
$form->addElement('text', 'username', get_lang('LoginName'), array('id'=> 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off')); $form->addElement('text', 'username', get_lang('LoginName'), array('id'=> 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off'));
$form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
$form->addRule('username', get_lang('UserTaken'), 'username_available'); $form->addRule('username', get_lang('UserTaken'), 'username_available');
} }
@ -277,7 +277,7 @@ $group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
$form->addGroup($group, 'mail', get_lang('SendMailToNewUser')); $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'));
// Expiration Date // Expiration Date
$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
$group = array (); $group = array();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
$group[] = $form->createElement( $group[] = $form->createElement(
'DateTimePicker', 'DateTimePicker',
@ -306,7 +306,7 @@ $returnParams = $extraField->addElements(
$jquery_ready_content = $returnParams['jquery_ready_content']; $jquery_ready_content = $returnParams['jquery_ready_content'];
// the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
$htmlHeadXtra[] ='<script> $htmlHeadXtra[] = '<script>
$(document).ready(function(){ $(document).ready(function(){
'.$jquery_ready_content.' '.$jquery_ready_content.'
}); });
@ -464,7 +464,7 @@ if ($form->validate()) {
$form->setConstants(array('sec_token' => $token)); $form->setConstants(array('sec_token' => $token));
} }
if (!empty($message)){ if (!empty($message)) {
$message = Display::return_message(stripslashes($message)); $message = Display::return_message(stripslashes($message));
} }
$content = $form->returnForm(); $content = $form->returnForm();

@ -261,7 +261,7 @@ function element_start($parser, $data)
global $current_tag; global $current_tag;
switch ($data) { switch ($data) {
case 'Contact': case 'Contact':
$user = array (); $user = array();
break; break;
default: default:
$current_tag = $data; $current_tag = $data;

@ -76,10 +76,10 @@ if (
$_user = api_get_user_info(); $_user = api_get_user_info();
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
$courseId = $courseInfo['real_id']; $courseId = $courseInfo['real_id'];
$course_dir = $courseInfo['directory'] . '/document'; $course_dir = $courseInfo['directory'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path . $course_dir; $base_work_dir = $sys_course_path.$course_dir;
$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'] . '/document'; $http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document';
$document_path = $base_work_dir; $document_path = $base_work_dir;
$usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true'; $usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true';
$course_dir = $courseInfo['directory'].'/document'; $course_dir = $courseInfo['directory'].'/document';
@ -279,7 +279,7 @@ switch ($action) {
$certificateId $certificateId
); );
Display::addFlash(Display::return_message( Display::addFlash(Display::return_message(
get_lang('DocDeleted') . ': ' . $documentInfo['title'], get_lang('DocDeleted').': '.$documentInfo['title'],
'success' 'success'
)); ));
} else { } else {
@ -482,11 +482,9 @@ switch ($action) {
case 'convertToPdf': case 'convertToPdf':
// PDF format as target by default // PDF format as target by default
$formatTarget = $_REQUEST['formatTarget'] ? $formatTarget = $_REQUEST['formatTarget'] ?
strtolower(Security::remove_XSS($_REQUEST['formatTarget'])) : strtolower(Security::remove_XSS($_REQUEST['formatTarget'])) : 'pdf';
'pdf';
$formatType = $_REQUEST['formatType'] ? $formatType = $_REQUEST['formatType'] ?
strtolower(Security::remove_XSS($_REQUEST['formatType'])) : strtolower(Security::remove_XSS($_REQUEST['formatType'])) : 'text';
'text';
// Get the document data from the ID // Get the document data from the ID
$document_info = DocumentManager::get_document_data_by_id( $document_info = DocumentManager::get_document_data_by_id(
$document_id, $document_id,
@ -494,8 +492,8 @@ switch ($action) {
true, true,
$session_id $session_id
); );
$file = $sys_course_path . $courseInfo['directory'] . $file = $sys_course_path.$courseInfo['directory'].
'/document' . $document_info['path']; '/document'.$document_info['path'];
$fileInfo = pathinfo($file); $fileInfo = pathinfo($file);
if ($fileInfo['extension'] == $formatTarget) { if ($fileInfo['extension'] == $formatTarget) {
Display::addFlash(Display::return_message( Display::addFlash(Display::return_message(
@ -526,9 +524,9 @@ switch ($action) {
'warning' 'warning'
)); ));
} else { } else {
$convertedFile = $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $convertedFile = $fileInfo['dirname'].DIRECTORY_SEPARATOR.
$fileInfo['filename'] . '_from_' . $fileInfo['extension'] . $fileInfo['filename'].'_from_'.$fileInfo['extension'].
'.' . $formatTarget; '.'.$formatTarget;
$convertedTitle = $document_info['title']; $convertedTitle = $document_info['title'];
$obj = new OpenofficePresentation(true); $obj = new OpenofficePresentation(true);
if (file_exists($convertedFile)) { if (file_exists($convertedFile)) {
@ -553,11 +551,11 @@ switch ($action) {
$gidReq = Security::remove_XSS($_GET['gidReq']); $gidReq = Security::remove_XSS($_GET['gidReq']);
$file_link = Display::url( $file_link = Display::url(
get_lang('SeeFile'), get_lang('SeeFile'),
api_get_path(WEB_CODE_PATH) . api_get_path(WEB_CODE_PATH).
'document/showinframes.php?'.api_get_cidreq_params($cidReq, $id_session, $gidReq).'&id=' . current($result) 'document/showinframes.php?'.api_get_cidreq_params($cidReq, $id_session, $gidReq).'&id='.current($result)
); );
Display::addFlash(Display::return_message( Display::addFlash(Display::return_message(
get_lang('CopyMade') . ' ' . $file_link, get_lang('CopyMade').' '.$file_link,
'confirmation', 'confirmation',
false false
)); ));
@ -719,7 +717,7 @@ if (isset($_GET['curdirpath']) &&
$new_content_html $new_content_html
); );
$new_content_html = str_replace( $new_content_html = str_replace(
SYS_CODE_PATH . 'img/', SYS_CODE_PATH.'img/',
api_get_path(WEB_IMG_PATH), api_get_path(WEB_IMG_PATH),
$new_content_html $new_content_html
); );
@ -776,11 +774,11 @@ function convertModal (id, format) {
$("#convertSelect").change(function() { $("#convertSelect").change(function() {
var formatTarget = $(this).val(); var formatTarget = $(this).val();
window.location.href = "'. window.location.href = "'.
api_get_self() . '?' . api_get_cidreq() . api_get_self().'?'.api_get_cidreq().
'&curdirpath=' . $curdirpath . '&curdirpath='.$curdirpath.
'&action=convertToPdf&formatTarget=' . '&action=convertToPdf&formatTarget='.
'" + formatTarget + "&id=" + id + "&' . '" + formatTarget + "&id=" + id + "&'.
api_get_cidreq() . '&formatType=" + format; api_get_cidreq().'&formatType=" + format;
}); });
$("#convertModal").on("hidden", function(){ $("#convertModal").on("hidden", function(){
$("." + format + "FormatType").hide(); $("." + format + "FormatType").hide();
@ -1120,7 +1118,7 @@ if ($isAllowedToEdit ||
DocumentManager::updateDbInfo( DocumentManager::updateDbInfo(
'update', 'update',
$document_to_move['path'], $document_to_move['path'],
$moveTo . '/' . basename($document_to_move['path']) $moveTo.'/'.basename($document_to_move['path'])
); );
//update database item property //update database item property
@ -1350,7 +1348,7 @@ if ($isAllowedToEdit ||
if (!empty($newFolderData)) { if (!empty($newFolderData)) {
$message = Display::return_message( $message = Display::return_message(
get_lang('DirCr') . ' ' . $newFolderData['title'], get_lang('DirCr').' '.$newFolderData['title'],
'confirmation' 'confirmation'
); );
} else { } else {
@ -1433,27 +1431,27 @@ if ($isAllowedToEdit ||
$document_id_for_template = intval($_GET['add_as_template']); $document_id_for_template = intval($_GET['add_as_template']);
// Create the form that asks for the directory name // Create the form that asks for the directory name
$templateForm .= ' $templateForm .= '
<form name="set_document_as_new_template" class="form-horizontal" enctype="multipart/form-data" action="' . api_get_self() . '?add_as_template=' . $document_id_for_template . '" method="post"> <form name="set_document_as_new_template" class="form-horizontal" enctype="multipart/form-data" action="' . api_get_self().'?add_as_template='.$document_id_for_template.'" method="post">
<fieldset> <fieldset>
<legend>' . get_lang('AddAsTemplate') . '</legend> <legend>' . get_lang('AddAsTemplate').'</legend>
<div class="form-group"> <div class="form-group">
<label for="template_title" class="col-sm-2 control-label">' . get_lang('TemplateName') . '</label> <label for="template_title" class="col-sm-2 control-label">' . get_lang('TemplateName').'</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" class="form-control" id="template_title" name="template_title"> <input type="text" class="form-control" id="template_title" name="template_title">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="template_image" class="col-sm-2 control-label">' . get_lang('TemplateImage') . '</label> <label for="template_image" class="col-sm-2 control-label">' . get_lang('TemplateImage').'</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="file" name="template_image" id="template_image"> <input type="file" name="template_image" id="template_image">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<button type="submit" name="create_template" class="btn btn-primary">' . get_lang('CreateTemplate') . '</button> <button type="submit" name="create_template" class="btn btn-primary">' . get_lang('CreateTemplate').'</button>
</div> </div>
</div> </div>
<input type="hidden" name="curdirpath" value="' . $curdirpath . '" /> <input type="hidden" name="curdirpath" value="' . $curdirpath.'" />
</fieldset> </fieldset>
</form> </form>
<hr> <hr>
@ -1658,7 +1656,7 @@ if ($isAllowedToEdit ||
if (api_get_setting('enable_record_audio') === 'true') { if (api_get_setting('enable_record_audio') === 'true') {
$actionsLeft .= Display::url( $actionsLeft .= Display::url(
Display::return_icon('new_recording.png', get_lang('RecordMyVoice'), '', ICON_SIZE_MEDIUM), Display::return_icon('new_recording.png', get_lang('RecordMyVoice'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . 'document/record_audio.php?' . api_get_cidreq() . '&id=' . $document_id api_get_path(WEB_CODE_PATH).'document/record_audio.php?'.api_get_cidreq().'&id='.$document_id
); );
} }
@ -2129,18 +2127,18 @@ echo '
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header" style="text-align: center;"> <div class="modal-header" style="text-align: center;">
<button type="button" class="close" data-dismiss="modal" aria-label="' . get_lang('Close') . '"> <button type="button" class="close" data-dismiss="modal" aria-label="' . get_lang('Close').'">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title">' . get_lang('Convert') . '</h4> <h4 class="modal-title">' . get_lang('Convert').'</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form action="#" class="form-horizontal"> <form action="#" class="form-horizontal">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4 control-label" for="convertSelect">' . get_lang('ConvertFormats') . '</label> <label class="col-sm-4 control-label" for="convertSelect">' . get_lang('ConvertFormats').'</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select id="convertSelect"> <select id="convertSelect">
<option value="">' . get_lang('Select') . '</option> <option value="">' . get_lang('Select').'</option>
<option value="pdf"> <option value="pdf">
PDF - Portable Document File PDF - Portable Document File
</option> </option>
@ -2159,7 +2157,7 @@ echo '
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">' . get_lang('Close') . '</button> <button type="button" class="btn btn-default" data-dismiss="modal">' . get_lang('Close').'</button>
</div> </div>
</div> </div>
</div>'; </div>';

@ -78,7 +78,7 @@ class Answer
$objExercise->read($exerciseId); $objExercise->read($exerciseId);
if ($objExercise->random_answers == '1' && $this->getQuestionType() != CALCULATED_ANSWER) { if ($objExercise->random_answers == '1' && $this->getQuestionType() != CALCULATED_ANSWER) {
$this->readOrderedBy('rand()', '');// randomize answers $this->readOrderedBy('rand()', ''); // randomize answers
} else { } else {
$this->read(); // natural order $this->read(); // natural order
} }
@ -119,7 +119,7 @@ class Answer
ORDER BY position"; ORDER BY position";
$result = Database::query($sql); $result = Database::query($sql);
$i=1; $i = 1;
// while a record is found // while a record is found
while ($object = Database::fetch_object($result)) { while ($object = Database::fetch_object($result)) {
@ -136,7 +136,7 @@ class Answer
$this->iid[$i] = $object->iid; $this->iid[$i] = $object->iid;
$i++; $i++;
} }
$this->nbrAnswers = $i-1; $this->nbrAnswers = $i - 1;
} }
/** /**
@ -172,7 +172,7 @@ class Answer
$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
$questionId = $this->questionId; $questionId = $this->questionId;
$sql="SELECT id FROM $sql = "SELECT id FROM
$TBL_ANSWER $TBL_ANSWER
WHERE c_id = {$this->course_id} AND question_id ='".$questionId."'"; WHERE c_id = {$this->course_id} AND question_id ='".$questionId."'";
@ -195,14 +195,14 @@ class Answer
* @param string $field * @param string $field
* @author Frederic Vauthier * @author Frederic Vauthier
*/ */
public function readOrderedBy($field, $order='ASC') public function readOrderedBy($field, $order = 'ASC')
{ {
$field = Database::escape_string($field); $field = Database::escape_string($field);
if (empty($field)) { if (empty($field)) {
$field = 'position'; $field = 'position';
} }
if ($order != 'ASC' && $order!='DESC') { if ($order != 'ASC' && $order != 'DESC') {
$order = 'ASC'; $order = 'ASC';
} }
@ -238,7 +238,7 @@ class Answer
c_id = {$this->course_id} AND c_id = {$this->course_id} AND
question_id='".$questionId."' question_id='".$questionId."'
ORDER BY $field $order"; ORDER BY $field $order";
$result=Database::query($sql); $result = Database::query($sql);
$i = 1; $i = 1;
// while a record is found // while a record is found
@ -274,7 +274,7 @@ class Answer
$this->iid[$i] = $doubt_data->iid; $this->iid[$i] = $doubt_data->iid;
$i++; $i++;
} }
$this->nbrAnswers = $i-1; $this->nbrAnswers = $i - 1;
} }
/** /**
@ -418,8 +418,8 @@ class Answer
public function getGradesList() public function getGradesList()
{ {
$list = array(); $list = array();
for ($i = 0; $i<$this->nbrAnswers;$i++){ for ($i = 0; $i < $this->nbrAnswers; $i++) {
if(!empty($this->answer[$i])){ if (!empty($this->answer[$i])) {
$list[$i] = $this->weighting[$i]; $list[$i] = $this->weighting[$i];
} }
} }
@ -437,7 +437,7 @@ class Answer
$sql = "SELECT type FROM $TBL_QUESTIONS $sql = "SELECT type FROM $TBL_QUESTIONS
WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'"; WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'";
$res = Database::query($sql); $res = Database::query($sql);
if (Database::num_rows($res)<=0){ if (Database::num_rows($res) <= 0) {
return null; return null;
} }
$row = Database::fetch_array($res); $row = Database::fetch_array($res);
@ -614,7 +614,7 @@ class Answer
$correctList = []; $correctList = [];
$answerList = []; $answerList = [];
for ($i=1; $i <= $this->new_nbrAnswers; $i++) { for ($i = 1; $i <= $this->new_nbrAnswers; $i++) {
$answer = $this->new_answer[$i]; $answer = $this->new_answer[$i];
$correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : ''; $correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : '';
$comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : ''; $comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : '';
@ -787,7 +787,7 @@ class Answer
); );
$i = 0; $i = 0;
if (!empty($destination_options)) { if (!empty($destination_options)) {
foreach($destination_options as $item) { foreach ($destination_options as $item) {
$fixed_list[$new_option_list[$i]] = $item['id']; $fixed_list[$new_option_list[$i]] = $item['id'];
$i++; $i++;
} }

@ -105,7 +105,7 @@ class OralExpression extends Question
} }
$this->storePath = $this->generateDirectory(); $this->storePath = $this->generateDirectory();
$this->fileName = $this->generateFileName(); $this->fileName = $this->generateFileName();
$this->filePath = $this->storePath . $this->fileName; $this->filePath = $this->storePath.$this->fileName;
} }
/** /**
@ -114,26 +114,26 @@ class OralExpression extends Question
*/ */
private function generateDirectory() private function generateDirectory()
{ {
$this->storePath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/exercises/'; $this->storePath = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/exercises/';
if (!is_dir($this->storePath)) { if (!is_dir($this->storePath)) {
mkdir($this->storePath); mkdir($this->storePath);
} }
if (!is_dir($this->storePath . $this->sessionId)) { if (!is_dir($this->storePath.$this->sessionId)) {
mkdir($this->storePath . $this->sessionId); mkdir($this->storePath.$this->sessionId);
} }
if (!empty($this->exerciseId) && !is_dir($this->storePath . $this->sessionId . '/' . $this->exerciseId)) { if (!empty($this->exerciseId) && !is_dir($this->storePath.$this->sessionId.'/'.$this->exerciseId)) {
mkdir($this->storePath . $this->sessionId . '/' . $this->exerciseId); mkdir($this->storePath.$this->sessionId.'/'.$this->exerciseId);
} }
if (!empty($this->id) && !is_dir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id)) { if (!empty($this->id) && !is_dir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id)) {
mkdir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id); mkdir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id);
} }
if (!empty($this->userId) && !is_dir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id . '/' . $this->userId)) { if (!empty($this->userId) && !is_dir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id.'/'.$this->userId)) {
mkdir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id . '/' . $this->userId); mkdir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id.'/'.$this->userId);
} }
$params = [ $params = [
@ -192,7 +192,7 @@ class OralExpression extends Question
*/ */
public function returnRecorder() public function returnRecorder()
{ {
$directory = '/..' . $this->generateRelativeDirectory(); $directory = '/..'.$this->generateRelativeDirectory();
$recordAudioView = new Template( $recordAudioView = new Template(
'', '',
false, false,
@ -246,7 +246,7 @@ class OralExpression extends Question
return ''; return '';
} }
return $this->storePath . $result->getFilename(); return $this->storePath.$result->getFilename();
} }
} }
@ -305,12 +305,12 @@ class OralExpression extends Question
$items[5] = 'temp_exe'; $items[5] = 'temp_exe';
$filename = implode('-', $items); $filename = implode('-', $items);
if (is_file($this->storePath . $filename . '.' . $extension)) { if (is_file($this->storePath.$filename.'.'.$extension)) {
$old_name = $this->storePath . $filename . '.' . $extension; $old_name = $this->storePath.$filename.'.'.$extension;
$items = explode('-', $this->fileName); $items = explode('-', $this->fileName);
$items[5] = $exe_id; $items[5] = $exe_id;
$filename = $filename = implode('-', $items); $filename = $filename = implode('-', $items);
$new_name = $this->storePath . $filename . '.' . $extension; $new_name = $this->storePath.$filename.'.'.$extension;
rename($old_name, $new_name); rename($old_name, $new_name);
break; break;
} }

@ -68,13 +68,13 @@ if (!empty($question_list)) {
$data[$question_id]['type'] = $question_obj->get_question_type_name(); $data[$question_id]['type'] = $question_obj->get_question_type_name();
$percentange = 0; $percentange = 0;
if ($count_students) { if ($count_students) {
$percentange = $count_users / $count_students*100; $percentange = $count_users / $count_students * 100;
} }
$data[$question_id]['students_who_try_exercise'] = Display::bar_progress( $data[$question_id]['students_who_try_exercise'] = Display::bar_progress(
$percentange, $percentange,
false, false,
$count_users .' / '.$count_students $count_users.' / '.$count_students
); );
$data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2); $data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2);
$data[$question_id]['average_score'] = round($exercise_stats['average'], 2); $data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
@ -152,7 +152,7 @@ if (!empty($question_list)) {
$data[$id]['answer'] = $answer_item; $data[$id]['answer'] = $answer_item;
$answer_item = api_substr($answer_item, 1); $answer_item = api_substr($answer_item, 1);
$answer_item = api_substr($answer_item, 0, api_strlen($answer_item) -1); $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) - 1);
$data[$id]['answer'] = $answer_item; $data[$id]['answer'] = $answer_item;
$data[$id]['correct'] = '-'; $data[$id]['correct'] = '-';
@ -162,7 +162,7 @@ if (!empty($question_list)) {
$percentage = 0; $percentage = 0;
if (!empty($count_students)) { if (!empty($count_students)) {
$percentage = $count/$count_students*100; $percentage = $count / $count_students * 100;
} }
$data[$id]['attempts'] = Display::bar_progress( $data[$id]['attempts'] = Display::bar_progress(
$percentage, $percentage,
@ -203,7 +203,7 @@ if (!empty($question_list)) {
); );
$percentage = 0; $percentage = 0;
if (!empty($count_students)) { if (!empty($count_students)) {
$percentage = $count/$count_students*100; $percentage = $count / $count_students * 100;
} }
$data[$id]['attempts'] = Display::bar_progress( $data[$id]['attempts'] = Display::bar_progress(
$percentage, $percentage,
@ -230,7 +230,7 @@ if (!empty($question_list)) {
); );
$percentage = 0; $percentage = 0;
if (!empty($count_students)) { if (!empty($count_students)) {
$percentage = $count/$count_students*100; $percentage = $count / $count_students * 100;
} }
$data[$id]['attempts'] = Display::bar_progress( $data[$id]['attempts'] = Display::bar_progress(
$percentage, $percentage,
@ -256,7 +256,7 @@ if (!empty($question_list)) {
); );
$percentage = 0; $percentage = 0;
if (!empty($count_students)) { if (!empty($count_students)) {
$percentage = $count/$count_students*100; $percentage = $count / $count_students * 100;
} }
$data[$id]['attempts'] = Display::bar_progress( $data[$id]['attempts'] = Display::bar_progress(
$percentage, $percentage,
@ -300,7 +300,7 @@ $interbreadcrumb[] = array(
); );
$tpl = new Template(get_lang('ReportByQuestion')); $tpl = new Template(get_lang('ReportByQuestion'));
$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' . $actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">'.
Display:: return_icon( Display:: return_icon(
'back.png', 'back.png',
get_lang('GoBackToQuestionList'), get_lang('GoBackToQuestionList'),

@ -23,7 +23,7 @@ $type = Security::remove_XSS($_GET['type']);
$doExerciseUrl = ''; $doExerciseUrl = '';
if (isset($_GET['doexercise'])) { if (isset($_GET['doexercise'])) {
$doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([ $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.http_build_query([
'session_id' => $session_id, 'session_id' => $session_id,
'cidReq' => $cidReq, 'cidReq' => $cidReq,
'gradebook' => $gradebook, 'gradebook' => $gradebook,
@ -38,7 +38,7 @@ if (isset($_GET['doexercise'])) {
if ($type == LINK_HOTPOTATOES) { if ($type == LINK_HOTPOTATOES) {
$exerciseId = $_GET['exerciseId']; $exerciseId = $_GET['exerciseId'];
$path = Security::remove_XSS($_GET['path']); $path = Security::remove_XSS($_GET['path']);
$doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/showinframes.php?'.http_build_query([ $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/showinframes.php?'.http_build_query([
'session_id' => $session_id, 'session_id' => $session_id,
'cidReq' => Security::remove_XSS($cidReq), 'cidReq' => Security::remove_XSS($cidReq),
'file' => $path, 'file' => $path,
@ -53,7 +53,7 @@ if (isset($_GET['doexercise'])) {
header('Location: '.$doExerciseUrl); header('Location: '.$doExerciseUrl);
exit; exit;
} else { } else {
$url = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq); $url = api_get_path(WEB_CODE_PATH).'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
if (isset($_GET['gradebook'])) { if (isset($_GET['gradebook'])) {
$url .= '&gradebook=view&exerciseId='.intval($_GET['exerciseId']); $url .= '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
@ -69,11 +69,11 @@ if (isset($_GET['doexercise'])) {
// If the exercise was added once redirect to the LP // If the exercise was added once redirect to the LP
$firstLp = current($exercise->lpList); $firstLp = current($exercise->lpList);
if (isset($firstLp['lp_id'])) { if (isset($firstLp['lp_id'])) {
$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&lp_id=' . $firstLp['lp_id'] . '&action=view&isStudentView=true'; $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&lp_id='.$firstLp['lp_id'].'&action=view&isStudentView=true';
} }
} else { } else {
// If the exercise was added multiple times show the LP list // If the exercise was added multiple times show the LP list
$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq().'&action=list'; $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=list';
} }
} }
} }

@ -80,12 +80,12 @@ if ($form->validate()) {
$cat->setIsRequirement(false); $cat->setIsRequirement(false);
} }
$cat->save(); $cat->save();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id().'&'.api_get_cidreq()); header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat='.$cat->get_parent_id().'&'.api_get_cidreq());
exit; exit;
} }
$selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : ''; $selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : '';
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '&' . api_get_cidreq(), 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'&'.api_get_cidreq(),
'name' => get_lang('Gradebook') 'name' => get_lang('Gradebook')
); );
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;

@ -20,7 +20,7 @@ $form = new EvalForm(
null, null,
'edit_eval_form', 'edit_eval_form',
null, null,
api_get_self() . '?editeval=' . intval($_GET['editeval']).'&'.api_get_cidreq() api_get_self().'?editeval='.intval($_GET['editeval']).'&'.api_get_cidreq()
); );
if ($form->validate()) { if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
@ -44,10 +44,10 @@ if ($form->validate()) {
} }
$eval->set_visible($visible); $eval->set_visible($visible);
$eval->save(); $eval->save();
header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id().'&'.api_get_cidreq()); header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
exit; exit;
} }
$selectcat_inter=isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; $selectcat_inter = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter, 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter,
'name' => get_lang('Gradebook' 'name' => get_lang('Gradebook'

@ -51,8 +51,8 @@ class ExerciseLink extends AbstractLink
$result = Database::query($sql); $result = Database::query($sql);
$cats = array(); $cats = array();
while ($data=Database::fetch_array($result)) { while ($data = Database::fetch_array($result)) {
$cats[] = array ($data['id'], $data['title']); $cats[] = array($data['id'], $data['title']);
} }
return $cats; return $cats;
@ -124,8 +124,8 @@ class ExerciseLink extends AbstractLink
$cats = array(); $cats = array();
if (isset($result)) { if (isset($result)) {
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
while ($data=Database::fetch_array($result)) { while ($data = Database::fetch_array($result)) {
$cats[] = array ($data['id'], $data['title']); $cats[] = array($data['id'], $data['title']);
} }
} }
} }
@ -182,9 +182,9 @@ class ExerciseLink extends AbstractLink
WHERE WHERE
session_id = $session_id AND session_id = $session_id AND
c_id = $course_id AND c_id = $course_id AND
exe_exo_id = ".(int)$this->get_ref_id(); exe_exo_id = ".(int) $this->get_ref_id();
$result = Database::query($sql); $result = Database::query($sql);
$number=Database::fetch_row($result); $number = Database::fetch_row($result);
return ($number[0] != 0); return ($number[0] != 0);
} }
@ -305,7 +305,7 @@ class ExerciseLink extends AbstractLink
if (empty($count)) { if (empty($count)) {
return array(0, $weight); return array(0, $weight);
} }
return array($sumResult/$count , $weight); return array($sumResult / $count, $weight);
break; break;
case 'ranking': case 'ranking':
return AbstractLink::getCurrentUserRanking($stud_id, $students); return AbstractLink::getCurrentUserRanking($stud_id, $students);
@ -385,7 +385,7 @@ class ExerciseLink extends AbstractLink
FROM '.$this->get_exercise_table().' FROM '.$this->get_exercise_table().'
WHERE WHERE
c_id = '.$this->course_id.' AND c_id = '.$this->course_id.' AND
id = '.(int)$this->get_ref_id().' '; id = '.(int) $this->get_ref_id().' ';
$result = Database::query($sql); $result = Database::query($sql);
$number = Database::fetch_row($result); $number = Database::fetch_row($result);

@ -130,9 +130,9 @@ class LinkAddEditForm extends FormValidator
//var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight()); //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
//$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight; //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
//$values['weight'] = $weight; //$values['weight'] = $weight;
$values['weight'] = $link->get_weight() ; $values['weight'] = $link->get_weight();
} }
$defaults['weight_mask'] = $values['weight'] ; $defaults['weight_mask'] = $values['weight'];
$defaults['select_gradebook'] = $link->get_category_id(); $defaults['select_gradebook'] = $link->get_category_id();
} }
@ -150,7 +150,7 @@ class LinkAddEditForm extends FormValidator
) )
); );
} else { } else {
$this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5')); $this->addText('max', get_lang('QualificationNumeric'), true, array('size' => '4', 'maxlength' => '5'));
$this->addRule('max', get_lang('OnlyNumbers'), 'numeric'); $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
$this->addRule('max', get_lang('NegativeValue'), 'compare', '>='); $this->addRule('max', get_lang('NegativeValue'), 'compare', '>=');
} }

@ -77,9 +77,9 @@ switch ($action) {
$room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
} }
$videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}"; $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}";
$videoChatLink = Display::url( $videoChatLink = Display::url(
Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'), Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'),
$videoChatUrl $videoChatUrl
); );

@ -35,7 +35,7 @@ switch ($action) {
$sidx = $_REQUEST['sidx']; //index to filter $sidx = $_REQUEST['sidx']; //index to filter
$sord = $_REQUEST['sord']; //asc or desc $sord = $_REQUEST['sord']; //asc or desc
if (!in_array($sord, array('asc','desc'))) { if (!in_array($sord, array('asc', 'desc'))) {
$sord = 'desc'; $sord = 'desc';
} }
// get index row - i.e. user click to sort $sord = $_GET['sord']; // get index row - i.e. user click to sort $sord = $_GET['sord'];
@ -64,7 +64,7 @@ switch ($action) {
$total_pages = 0; $total_pages = 0;
if ($count > 0) { if ($count > 0) {
if (!empty($limit)) { if (!empty($limit)) {
$total_pages = ceil($count/$limit); $total_pages = ceil($count / $limit);
} }
} }
@ -126,7 +126,7 @@ switch ($action) {
$response->page = $page; $response->page = $page;
$response->total = $total_pages; $response->total = $total_pages;
$response->records = $count; $response->records = $count;
$i=0; $i = 0;
if (!empty($results)) { if (!empty($results)) {
foreach ($results as $row) { foreach ($results as $row) {
@ -149,16 +149,16 @@ switch ($action) {
$row['count_questions'] = $count_questions; $row['count_questions'] = $count_questions;
$response->rows[$i]['id'] = $row['exe_id']; $response->rows[$i]['id'] = $row['exe_id'];
$remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time())); $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
$h = floor($remaining/3600); $h = floor($remaining / 3600);
$m = floor(($remaining - ($h*3600))/60); $m = floor(($remaining - ($h * 3600)) / 60);
$s = ($remaining - ($h*3600) - ($m*60)); $s = ($remaining - ($h * 3600) - ($m * 60));
$array = array( $array = array(
$row['firstname'], $row['firstname'],
$row['lastname'], $row['lastname'],
api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']', api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
$row['count_questions'], $row['count_questions'],
round($row['score']*100).'%' round($row['score'] * 100).'%'
); );
$response->rows[$i]['cell'] = $array; $response->rows[$i]['cell'] = $array;
$i++; $i++;
@ -531,7 +531,7 @@ switch ($action) {
$objQuestion = Question::read($questionId); $objQuestion = Question::read($questionId);
$objQuestion->get_question_type_name(); $objQuestion->get_question_type_name();
echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>'; echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel(); //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
ExerciseLib::showQuestion( ExerciseLib::showQuestion(
$questionId, $questionId,

@ -2029,8 +2029,6 @@ class UserGroup extends Model
$relation_group_title = get_lang('IAmAReader'); $relation_group_title = get_lang('IAmAReader');
$links .= '<li class="'.($show == 'invite_friends' ? 'active' : '').'"><a href="group_invitation.php?id='.$group_id.'">'. $links .= '<li class="'.($show == 'invite_friends' ? 'active' : '').'"><a href="group_invitation.php?id='.$group_id.'">'.
Display::return_icon('invitation_friend.png', get_lang('InviteFriends')).get_lang('InviteFriends').'</a></li>'; Display::return_icon('invitation_friend.png', get_lang('InviteFriends')).get_lang('InviteFriends').'</a></li>';
$links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';
if (self::canLeave($group_info)) { if (self::canLeave($group_info)) {
$links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.
Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>'; Display::return_icon('group_leave.png', get_lang('LeaveGroup')).get_lang('LeaveGroup').'</a></li>';

@ -24,7 +24,7 @@ $doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url; $doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url;
if (strpos($doc_url,'../') || strpos($doc_url,'/..')) { if (strpos($doc_url, '../') || strpos($doc_url, '/..')) {
$doc_url = ''; $doc_url = '';
} }
$sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm'; $sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm';

@ -117,8 +117,8 @@ class LearnpathList
// it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility()) // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
// is done using domesticate() // is done using domesticate()
$name = domesticate($row->getName()); $name = domesticate($row->getName());
$link = 'lp/lp_controller.php?action=view&lp_id=' . $row->getId() . '&id_session='.$session_id; $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; $oldLink = 'newscorm/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
$sql2 = "SELECT * FROM $tbl_tool $sql2 = "SELECT * FROM $tbl_tool
WHERE WHERE

@ -40,15 +40,15 @@ if (!api_is_platform_admin(true) &&
} }
if ($origin == 'user_course') { if ($origin == 'user_course') {
$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']); $interbreadcrumb[] = array("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']);
$interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users")); $interbreadcrumb[] = array("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users"));
} else if($origin == 'tracking_course') { } else if ($origin == 'tracking_course') {
$interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking")); $interbreadcrumb[] = array("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking"));
} else { } else {
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); $interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); $interbreadcrumb[] = array("url" => "student.php", "name" => get_lang("MyStudents"));
$interbreadcrumb[] = array ("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails")); $interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails"));
$nameTools=get_lang("DetailsStudentInCourse"); $nameTools = get_lang("DetailsStudentInCourse");
} }
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
@ -63,19 +63,19 @@ $lp_title = Database::result($rs, 0, 0);
$origin = 'tracking'; $origin = 'tracking';
$output = require_once api_get_path(SYS_CODE_PATH) . 'lp/lp_stats.php'; $output = require_once api_get_path(SYS_CODE_PATH).'lp/lp_stats.php';
Display :: display_header($nameTools); Display :: display_header($nameTools);
echo '<div class ="actions">'; echo '<div class ="actions">';
echo '<a href="javascript:history.back();">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="javascript:history.back();">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="javascript: void(0);" onclick="javascript: window.print();"> echo '<a href="javascript: void(0);" onclick="javascript: window.print();">
'.Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>'; '.Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'"> echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'">
'.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>'; '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo '</div>';
echo '<div class="clear"></div>'; echo '<div class="clear"></div>';
$session_name = api_get_session_name($session_id); $session_name = api_get_session_name($session_id);
$table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':' '). $table_title = ($session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ' : ' ').
Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '. Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '.
Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name; Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name;
echo Display::page_header($table_title); echo Display::page_header($table_title);

@ -167,8 +167,8 @@ $courseController = new CoursesController();
/* View */ /* View */
$template = new Template($session->getName(), true, true, false, true, false); $template = new Template($session->getName(), true, true, false, true, false);
$template->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); $template->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
$template->assign('page_url', api_get_path(WEB_PATH) . "session/{$session->getId()}/about/"); $template->assign('page_url', api_get_path(WEB_PATH)."session/{$session->getId()}/about/");
$template->assign('session', $session); $template->assign('session', $session);
$template->assign('session_date', $sessionDates); $template->assign('session_date', $sessionDates);
$template->assign( $template->assign(
@ -213,11 +213,11 @@ if ($checker) {
} }
$redirectToSession = api_get_configuration_value('allow_redirect_to_session_after_inscription_about'); $redirectToSession = api_get_configuration_value('allow_redirect_to_session_after_inscription_about');
$redirectToSession = $redirectToSession ? '?s=' . $sessionId : false; $redirectToSession = $redirectToSession ? '?s='.$sessionId : false;
$coursesInThisSession = SessionManager::get_course_list_by_session_id($sessionId); $coursesInThisSession = SessionManager::get_course_list_by_session_id($sessionId);
$coursesCount = count($coursesInThisSession); $coursesCount = count($coursesInThisSession);
$redirectToSession = $coursesCount == 1 && $redirectToSession ? $redirectToSession . '&cr=' . array_values($coursesInThisSession)[0]['directory'] : $redirectToSession; $redirectToSession = $coursesCount == 1 && $redirectToSession ? $redirectToSession.'&cr='.array_values($coursesInThisSession)[0]['directory'] : $redirectToSession;
$template->assign('redirect_to_session', $redirectToSession); $template->assign('redirect_to_session', $redirectToSession);
$template->assign('courses', $courses); $template->assign('courses', $courses);

@ -30,7 +30,7 @@ SessionManager::protectSession($sessionId);
$tool_name = get_lang('SessionOverview'); $tool_name = get_lang('SessionOverview');
//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); //$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); $interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
$orig_param = '&origin=resume_session'; $orig_param = '&origin=resume_session';
@ -184,7 +184,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
$coachs = array(); $coachs = array();
if (Database::num_rows($rs) > 0) { if (Database::num_rows($rs) > 0) {
while($info_coach = Database::fetch_array($rs)) { while ($info_coach = Database::fetch_array($rs)) {
$coachs[] = api_get_person_name( $coachs[] = api_get_person_name(
$info_coach['firstname'], $info_coach['firstname'],
$info_coach['lastname'] $info_coach['lastname']
@ -195,7 +195,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
} }
if (count($coachs) > 0) { if (count($coachs) > 0) {
$coach = implode('<br />',$coachs); $coach = implode('<br />', $coachs);
} else { } else {
$coach = get_lang('None'); $coach = get_lang('None');
} }
@ -218,7 +218,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
$downIcon = 'down.png'; $downIcon = 'down.png';
$downUrl = api_get_self().'?id_session='.$sessionId.'&course_id='.$course->getId().'&action=move_down'; $downUrl = api_get_self().'?id_session='.$sessionId.'&course_id='.$course->getId().'&action=move_down';
if ($count +1 == count($courses)) { if ($count + 1 == count($courses)) {
$downIcon = 'down_na.png'; $downIcon = 'down_na.png';
$downUrl = '#'; $downUrl = '#';
} }
@ -245,7 +245,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
<td>'.$coach.'</td> <td>'.$coach.'</td>
<td>'.$numberOfUsers.'</td> <td>'.$numberOfUsers.'</td>
<td> <td>
<a href="'. $courseUrl . '">'. <a href="'. $courseUrl.'">'.
Display::return_icon('course_home.gif', get_lang('Course')).'</a> Display::return_icon('course_home.gif', get_lang('Course')).'</a>
'.$orderButtons.' '.$orderButtons.'
<a href="session_course_user_list.php?id_session='.$sessionId.'&course_code='.$course->getCode().'">'. <a href="session_course_user_list.php?id_session='.$sessionId.'&course_code='.$course->getCode().'">'.
@ -317,7 +317,7 @@ if (!empty($userList)) {
array('onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;") array('onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;")
); );
$addUserToUrlLink= ''; $addUserToUrlLink = '';
if ($multiple_url_is_on) { if ($multiple_url_is_on) {
if ($user['access_url_id'] != $url_id) { if ($user['access_url_id'] != $url_id) {
$userLink .= ' '.Display::return_icon( $userLink .= ' '.Display::return_icon(

@ -58,9 +58,9 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
Display::addFlash(Display::return_message(get_lang('MessageSent'))); Display::addFlash(Display::return_message(get_lang('MessageSent')));
$url = api_get_path(WEB_CODE_PATH) . 'social/profile.php'; $url = api_get_path(WEB_CODE_PATH).'social/profile.php';
$url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']); $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
header('Location: ' . $url); header('Location: '.$url);
exit; exit;
} else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) { } else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) {
@ -75,9 +75,9 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
MESSAGE_STATUS_WALL MESSAGE_STATUS_WALL
); );
Display::addFlash(Display::return_message(get_lang('MessageSent'))); Display::addFlash(Display::return_message(get_lang('MessageSent')));
$url = api_get_path(WEB_CODE_PATH) . 'social/profile.php'; $url = api_get_path(WEB_CODE_PATH).'social/profile.php';
$url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']); $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
header('Location: ' . $url); header('Location: '.$url);
exit; exit;
} else if (isset($_GET['messageId'])) { } else if (isset($_GET['messageId'])) {
@ -89,7 +89,7 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
$status = SocialManager::deleteMessage($messageId); $status = SocialManager::deleteMessage($messageId);
Display::addFlash(Display::return_message(get_lang('MessageDeleted'))); Display::addFlash(Display::return_message(get_lang('MessageDeleted')));
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php'); header('Location: '.api_get_path(WEB_CODE_PATH).'social/profile.php');
exit; exit;
} }
} }
@ -153,16 +153,16 @@ $libpath = api_get_path(LIBRARY_PATH);
$ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php'; $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
$socialAjaxUrl = api_get_path(WEB_AJAX_PATH).'social.ajax.php'; $socialAjaxUrl = api_get_path(WEB_AJAX_PATH).'social.ajax.php';
$javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/'; $javascriptDir = api_get_path(LIBRARY_PATH).'javascript/';
api_block_anonymous_users(); api_block_anonymous_users();
$locale = api_get_language_isocode(); $locale = api_get_language_isocode();
// Add Jquery scroll pagination plugin // Add Jquery scroll pagination plugin
$htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js'); $htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js');
// Add Jquery Time ago plugin // Add Jquery Time ago plugin
$htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js'); $htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js');
$timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js'; $timeAgoLocaleDir = $javascriptDir.'jquery-timeago/locales/jquery.timeago.'.$locale.'.js';
if (file_exists($timeAgoLocaleDir)) { if (file_exists($timeAgoLocaleDir)) {
$htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js'); $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.'.$locale.'.js');
} }
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
@ -170,7 +170,7 @@ $htmlHeadXtra[] = '<script>
$(document).ready(function (){ $(document).ready(function (){
var container = $("#wallMessages"); var container = $("#wallMessages");
container.jscroll({ container.jscroll({
loadingHtml: "<div class=\"well_border\">' . get_lang('Loading') . ' </div>", loadingHtml: "<div class=\"well_border\">' . get_lang('Loading').' </div>",
nextSelector: "a.nextPage:last", nextSelector: "a.nextPage:last",
contentSelector: "", contentSelector: "",
callback: timeAgo callback: timeAgo
@ -201,7 +201,7 @@ $interbreadcrumb[] = array(
if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) { if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
$info_user = api_get_user_info($_GET['u']); $info_user = api_get_user_info($_GET['u']);
$interbreadcrumb[]= array( $interbreadcrumb[] = array(
'url' => '#', 'url' => '#',
'name' => $info_user['complete_name'] 'name' => $info_user['complete_name']
); );
@ -224,7 +224,7 @@ $i = 1;
$list = []; $list = [];
if (is_array($personal_course_list)) { if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) { foreach ($personal_course_list as $my_course) {
if ($i<=10) { if ($i <= 10) {
$list[] = SocialManager::get_logged_user_course_html($my_course, $i); $list[] = SocialManager::get_logged_user_course_html($my_course, $i);
$course_list_code[] = array('code' => $my_course['code']); $course_list_code[] = array('code' => $my_course['code']);
} else { } else {
@ -262,13 +262,13 @@ $wallSocialAddPost = SocialManager::getWallForm($show_full_profile);
$social_wall_block = $wallSocialAddPost; $social_wall_block = $wallSocialAddPost;
// Social Post Wall // Social Post Wall
$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId) ; $posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId);
$social_post_wall_block = empty($posts) ? '<p>'.get_lang("NoPosts").'</p>' : $posts; $social_post_wall_block = empty($posts) ? '<p>'.get_lang("NoPosts").'</p>' : $posts;
$socialAutoExtendLink = Display::url( $socialAutoExtendLink = Display::url(
get_lang('SeeMore'), get_lang('SeeMore'),
$socialAjaxUrl . '?u='. $my_user_id . '&a=list_wall_message&start=10&length=5', $socialAjaxUrl.'?u='.$my_user_id.'&a=list_wall_message&start=10&length=5',
array( array(
'class' => 'nextPage next', 'class' => 'nextPage next',
) )
@ -290,12 +290,12 @@ $(document).ready(function() {
$(".spinner").html("'. $(".spinner").html("'.
'<div class=\'text-center\'>'. '<div class=\'text-center\'>'.
'<em class=\'fa fa-spinner fa-pulse fa-1x\'></em>'. '<em class=\'fa fa-spinner fa-pulse fa-1x\'></em>'.
'<p>'. get_lang('Loading') . ' ' . get_lang('Preview') .'</p>'. '<p>'.get_lang('Loading').' '.get_lang('Preview').'</p>'.
'</div>'. '</div>'.
'"); '");
}, },
type: "POST", type: "POST",
url: "'. api_get_path(WEB_AJAX_PATH) .'social.ajax.php?a=read_url_with_open_graph", url: "'. api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=read_url_with_open_graph",
data: "social_wall_new_msg_main=" + e.originalEvent.clipboardData.getData("text"), data: "social_wall_new_msg_main=" + e.originalEvent.clipboardData.getData("text"),
success: function(response) { success: function(response) {
$("[name=\'wall_post_button\']").prop( "disabled", false ); $("[name=\'wall_post_button\']").prop( "disabled", false );
@ -390,7 +390,7 @@ if ($show_full_profile) {
.$tags['tag'] .$tags['tag']
.'</a>'; .'</a>';
} }
if (is_array($user_tags) && count($user_tags)>0) { if (is_array($user_tags) && count($user_tags) > 0) {
$extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': ' $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '
.' '.implode('', $tag_tmp).'</li>'; .' '.implode('', $tag_tmp).'</li>';
} }
@ -414,7 +414,7 @@ if ($show_full_profile) {
$extra_information_value .= '<li class="list-group-item">'.$data.'</li>'; $extra_information_value .= '<li class="list-group-item">'.$data.'</li>';
break; break;
default: default:
$extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']) . ': ' . $data . '</li>'; $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '.$data.'</li>';
break; break;
} }
} }
@ -423,7 +423,7 @@ if ($show_full_profile) {
// if there are information to show // if there are information to show
if (!empty($extra_information_value)) { if (!empty($extra_information_value)) {
$extra_information_value = '<ul class="list-group">' . $extra_information_value . '</ul>'; $extra_information_value = '<ul class="list-group">'.$extra_information_value.'</ul>';
$extra_information .= Display::panelCollapse( $extra_information .= Display::panelCollapse(
get_lang('ExtraInformation'), get_lang('ExtraInformation'),
@ -563,7 +563,7 @@ if ($show_full_profile) {
// Images uploaded by course // Images uploaded by course
$file_list = ''; $file_list = '';
if (is_array($course_list_code) && count($course_list_code)>0) { if (is_array($course_list_code) && count($course_list_code) > 0) {
foreach ($course_list_code as $course) { foreach ($course_list_code as $course) {
$file_list .= UserManager::get_user_upload_files_by_course( $file_list .= UserManager::get_user_upload_files_by_course(
$user_id, $user_id,
@ -575,7 +575,7 @@ if ($show_full_profile) {
$count_pending_invitations = 0; $count_pending_invitations = 0;
if (!isset($_GET['u']) || if (!isset($_GET['u']) ||
(isset($_GET['u']) && $_GET['u']==api_get_user_id()) (isset($_GET['u']) && $_GET['u'] == api_get_user_id())
) { ) {
$pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id()); $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
$list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id()); $list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
@ -584,7 +584,7 @@ if ($show_full_profile) {
if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) { if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
// Pending invitations // Pending invitations
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) { if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u'] == api_get_user_id())) {
if ($count_pending_invitations > 0) { if ($count_pending_invitations > 0) {
$invitations = '<ul class="list-group">'; $invitations = '<ul class="list-group">';
for ($i = 0; $i < $count_pending_invitations; $i++) { for ($i = 0; $i < $count_pending_invitations; $i++) {
@ -595,12 +595,12 @@ if ($show_full_profile) {
.' width="40px">'; .' width="40px">';
$userInfo = api_get_user_info($user_invitation_id); $userInfo = api_get_user_info($user_invitation_id);
$invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">' $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'
.api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>'; .api_get_person_name($userInfo['firstname'], $userInfo['lastname']).'</a>';
$invitations .='<div class="pull-right">'; $invitations .= '<div class="pull-right">';
$invitations .= Display::toolbarButton( $invitations .= Display::toolbarButton(
get_lang('SocialAddToFriends'), get_lang('SocialAddToFriends'),
api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([ api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
'a' => 'add_friend', 'a' => 'add_friend',
'friend_id' => $user_invitation_id, 'friend_id' => $user_invitation_id,
'is_my_friend' => 'friend' 'is_my_friend' => 'friend'
@ -647,7 +647,7 @@ if ($show_full_profile) {
} }
if (!empty($user_info['competences']) || !empty($user_info['diplomas']) if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
|| !empty($user_info['openarea']) || !empty($user_info['teach']) ) { || !empty($user_info['openarea']) || !empty($user_info['teach'])) {
$more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>'; $more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
if (!empty($user_info['competences'])) { if (!empty($user_info['competences'])) {

@ -22,13 +22,13 @@ $interbreadcrumb[] = array(
'name' => get_lang('SocialNetwork'), 'name' => get_lang('SocialNetwork'),
); );
$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null; $query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null;
$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null; $query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null;
$extra_fields = UserManager::get_extra_filtrable_fields(); $extra_fields = UserManager::get_extra_filtrable_fields();
$query_vars = array('q' => $query, 'search_type' => $query_search_type); $query_vars = array('q' => $query, 'search_type' => $query_search_type);
if (!empty($extra_fields)) { if (!empty($extra_fields)) {
foreach ($extra_fields as $extra_field) { foreach ($extra_fields as $extra_field) {
$field_name = 'field_' . $extra_field['variable']; $field_name = 'field_'.$extra_field['variable'];
if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') { if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') {
$query_vars[$field_name] = $_GET[$field_name]; $query_vars[$field_name] = $_GET[$field_name];
} }
@ -47,10 +47,10 @@ $totalUsers = array();
$usergroup = new UserGroup(); $usergroup = new UserGroup();
// I'm searching something // I'm searching something
if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) { if ($query != '' || ($query_vars['search_type'] == '1' && count($query_vars) > 2)) {
$itemPerPage = 6; $itemPerPage = 6;
if ($_GET['search_type']=='0' || $_GET['search_type']=='1') { if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') {
$page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1; $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1;
$totalUsers = UserManager::get_all_user_tags( $totalUsers = UserManager::get_all_user_tags(
$_GET['q'], $_GET['q'],
@ -65,7 +65,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
$users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage); $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage);
} }
if ($_GET['search_type']=='0' || $_GET['search_type']=='2') { if ($_GET['search_type'] == '0' || $_GET['search_type'] == '2') {
$pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1; $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1;
// Groups // Groups
$fromGroups = intval(($pageGroup - 1) * $itemPerPage); $fromGroups = intval(($pageGroup - 1) * $itemPerPage);
@ -90,7 +90,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
// Show send invitation icon if they are not friends yet // Show send invitation icon if they are not friends yet
if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) { if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) {
$sendInvitation = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user_info['user_id'] . '"> $sendInvitation = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="'.$user_info['user_id'].'">
<em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>'; <em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>';
} }
@ -186,7 +186,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
$tags = null; $tags = null;
$group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />'; $group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />';
$members = Display::returnFontAwesomeIcon('user') . '( ' .$count_users_group . ' )'; $members = Display::returnFontAwesomeIcon('user').'( '.$count_users_group.' )';
$item_1 = Display::tag('p', $url_open.$name.$url_close); $item_1 = Display::tag('p', $url_open.$name.$url_close);
$block_groups .= ' $block_groups .= '
@ -197,10 +197,10 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
</div> </div>
<div class="user-info"> <div class="user-info">
'.$item_1.' '.$item_1.'
<p>' . $members . '</p> <p>' . $members.'</p>
<p>' . $group['description'] . '</p> <p>' . $group['description'].'</p>
<p>' . $tags . '</p> <p>' . $tags.'</p>
<p>' . $url_open.get_lang('SeeMore') . $url_close . '</p> <p>' . $url_open.get_lang('SeeMore').$url_close.'</p>
</div> </div>
</div> </div>
</div>'; </div>';

@ -52,7 +52,7 @@ if ($survey_data['anonymous'] == 1) {
} }
if (!isset($_GET['view']) || $_GET['view'] == 'invited') { if (!isset($_GET['view']) || $_GET['view'] == 'invited') {
echo get_lang('ViewInvited'). ' | '; echo get_lang('ViewInvited').' | ';
} else { } else {
echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=invited">'.get_lang('ViewInvited').'</a> |'; echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=invited">'.get_lang('ViewInvited').'</a> |';
} }

@ -65,7 +65,7 @@ switch ($action) {
$form = TicketManager::getPriorityForm($url); $form = TicketManager::getPriorityForm($url);
$formToString = $form->returnForm(); $formToString = $form->returnForm();
if ($form->validate()) { if ($form->validate()) {
$values =$form->getSubmitValues(); $values = $form->getSubmitValues();
$params = [ $params = [
'name' => $values['name'], 'name' => $values['name'],
@ -95,7 +95,7 @@ switch ($action) {
); );
$formToString = $form->returnForm(); $formToString = $form->returnForm();
if ($form->validate()) { if ($form->validate()) {
$values =$form->getSubmitValues(); $values = $form->getSubmitValues();
$params = [ $params = [
'name' => $values['name'], 'name' => $values['name'],
'description' => $values['description'] 'description' => $values['description']

@ -17,7 +17,7 @@ Display::display_header(get_lang('Settings'));
echo '<div class="actions">'; echo '<div class="actions">';
echo Display::url( echo Display::url(
Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM), Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php' api_get_path(WEB_CODE_PATH).'ticket/tickets.php'
); );
echo '</div>'; echo '</div>';

@ -26,10 +26,10 @@ $(document).ready(function() {
width: 600, width: 600,
modal: true, modal: true,
buttons: { buttons: {
' . get_lang('Accept') . ': function(){ ' . get_lang('Accept').': function(){
$("#frmResponsable").submit() $("#frmResponsable").submit()
}, },
' . ucfirst(get_lang('Close')) . ': function() { ' . ucfirst(get_lang('Close')).': function() {
$(this).dialog("close"); $(this).dialog("close");
} }
} }
@ -40,13 +40,13 @@ $(document).ready(function() {
}); });
$(".responseyes").click(function () { $(".responseyes").click(function () {
if(!confirm("' . get_lang('AreYouSure') . ' : ' . strtoupper(get_lang('Yes')) . '. ' . get_lang('IfYouAreSureTheTicketWillBeClosed') . '")){ if(!confirm("' . get_lang('AreYouSure').' : '.strtoupper(get_lang('Yes')).'. '.get_lang('IfYouAreSureTheTicketWillBeClosed').'")){
return false; return false;
} }
}); });
$("input#responseno").click(function () { $("input#responseno").click(function () {
if(!confirm("' . get_lang('AreYouSure') . ' : ' . strtoupper(get_lang('No')) . '")){ if(!confirm("' . get_lang('AreYouSure').' : '.strtoupper(get_lang('No')).'")){
return false; return false;
} }
}); });
@ -179,13 +179,13 @@ if (isset($_POST['response'])) {
$user_id $user_id
); );
Display::addFlash(Display::return_message(get_lang('Updated'))); Display::addFlash(Display::return_message(get_lang('Updated')));
header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id); header("Location:".api_get_self()."?ticket_id=".$ticket_id);
exit; exit;
} }
} }
$title = 'Ticket #' . $ticket['ticket']['code']; $title = 'Ticket #'.$ticket['ticket']['code'];
if (!isset($_POST['compose'])) { if (!isset($_POST['compose'])) {
if (isset($_REQUEST['close'])) { if (isset($_REQUEST['close'])) {
@ -199,7 +199,7 @@ if (!isset($_POST['compose'])) {
echo '<div class="actions">'; echo '<div class="actions">';
echo Display::url( echo Display::url(
Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM), Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php?project_id='.$projectId api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$projectId
); );
echo '</div>'; echo '</div>';
$bold = ''; $bold = '';
@ -212,9 +212,9 @@ if (!isset($_POST['compose'])) {
</style>"; </style>";
} }
if ($isAdmin) { if ($isAdmin) {
$senderData = get_lang('AddedBy'). ' '.$ticket['ticket']['user_url'].' (' . $ticket['usuario']['username'] . ').'; $senderData = get_lang('AddedBy').' '.$ticket['ticket']['user_url'].' ('.$ticket['usuario']['username'].').';
} else { } else {
$senderData = get_lang('AddedBy'). ' '.$ticket['usuario']['complete_name'].' (' . $ticket['usuario']['username']. ').'; $senderData = get_lang('AddedBy').' '.$ticket['usuario']['complete_name'].' ('.$ticket['usuario']['username'].').';
} }
echo '<table width="100%" > echo '<table width="100%" >
@ -223,8 +223,8 @@ if (!isset($_POST['compose'])) {
<h1>'.$title.'</h1> <h1>'.$title.'</h1>
<h2>'.$ticket['ticket']['subject'].'</h2> <h2>'.$ticket['ticket']['subject'].'</h2>
<p> <p>
'.$senderData.' ' . '.$senderData.' '.
get_lang('Created') . ' '. get_lang('Created').' '.
Display::url( Display::url(
date_to_str_ago($ticket['ticket']['start_date_from_db']), date_to_str_ago($ticket['ticket']['start_date_from_db']),
'#', '#',
@ -240,37 +240,37 @@ if (!isset($_POST['compose'])) {
</td> </td>
</tr> </tr>
<tr> <tr>
<td><p><b>' . get_lang('Category') . ': </b>' . $ticket['ticket']['name'] . '</p></td> <td><p><b>' . get_lang('Category').': </b>'.$ticket['ticket']['name'].'</p></td>
</tr> </tr>
<tr> <tr>
<td><p ' . $bold . '><b>' . get_lang('Status') . ':</b> ' . $ticket['ticket']['status'] . '</p></td> <td><p ' . $bold.'><b>'.get_lang('Status').':</b> '.$ticket['ticket']['status'].'</p></td>
</tr> </tr>
<tr> <tr>
<td><p><b>' . get_lang('Priority') . ': </b>' . $ticket['ticket']['priority'] . '<p></td> <td><p><b>' . get_lang('Priority').': </b>'.$ticket['ticket']['priority'].'<p></td>
</tr>'; </tr>';
if (!empty($ticket['ticket']['assigned_last_user'])) { if (!empty($ticket['ticket']['assigned_last_user'])) {
$assignedUser = api_get_user_info($ticket['ticket']['assigned_last_user']); $assignedUser = api_get_user_info($ticket['ticket']['assigned_last_user']);
echo '<tr> echo '<tr>
<td><p><b>' . get_lang('AssignedTo') . ': </b>' . $assignedUser['complete_name'] . '<p></td> <td><p><b>' . get_lang('AssignedTo').': </b>'.$assignedUser['complete_name'].'<p></td>
</tr>'; </tr>';
} else { } else {
echo '<tr> echo '<tr>
<td><p><b>' . get_lang('AssignedTo') . ': </b>-<p></td> <td><p><b>' . get_lang('AssignedTo').': </b>-<p></td>
</tr>'; </tr>';
} }
if ($ticket['ticket']['course_url'] != null) { if ($ticket['ticket']['course_url'] != null) {
if (!empty($ticket['ticket']['session_id'])) { if (!empty($ticket['ticket']['session_id'])) {
$sessionInfo = api_get_session_info($ticket['ticket']['session_id']); $sessionInfo = api_get_session_info($ticket['ticket']['session_id']);
echo '<tr> echo '<tr>
<td><b>' . get_lang('Session') . ':</b> ' . $sessionInfo['name'] . ' </td> <td><b>' . get_lang('Session').':</b> '.$sessionInfo['name'].' </td>
<td></td> <td></td>
<td colspan="2"></td> <td colspan="2"></td>
</tr>'; </tr>';
} }
echo '<tr> echo '<tr>
<td><b>' . get_lang('Course') . ':</b> ' . $ticket['ticket']['course_url'] . ' </td> <td><b>' . get_lang('Course').':</b> '.$ticket['ticket']['course_url'].' </td>
<td></td> <td></td>
<td colspan="2"></td> <td colspan="2"></td>
</tr>'; </tr>';
@ -278,7 +278,7 @@ if (!isset($_POST['compose'])) {
echo '<tr> echo '<tr>
<td> <td>
<hr /> <hr />
<b>' . get_lang('Description') . ':</b> <br /> <b>' . get_lang('Description').':</b> <br />
'.$ticket['ticket']['message'].' '.$ticket['ticket']['message'].'
<hr /> <hr />
</td> </td>
@ -296,7 +296,7 @@ if (!isset($_POST['compose'])) {
$receivedMessage = ''; $receivedMessage = '';
if (!empty($message['subject'])) { if (!empty($message['subject'])) {
$receivedMessage = '<b>'.get_lang('Subject') . ': </b> '.$message['subject'].'<br/>'; $receivedMessage = '<b>'.get_lang('Subject').': </b> '.$message['subject'].'<br/>';
} }
if (!empty($message['message'])) { if (!empty($message['message'])) {
@ -313,9 +313,9 @@ if (!isset($_POST['compose'])) {
} }
} }
$entireMessage = $receivedMessage . $attachmentLinks; $entireMessage = $receivedMessage.$attachmentLinks;
$counterLink = Display::url('#'.$counter, api_get_self().'?ticket_id='.$ticket_id.'#note-'.$counter); $counterLink = Display::url('#'.$counter, api_get_self().'?ticket_id='.$ticket_id.'#note-'.$counter);
echo '<a id="note-'.$counter.'"> </a><h4>' . sprintf(get_lang('UpdatedByX'), $message['user_created']).' '.$date. echo '<a id="note-'.$counter.'"> </a><h4>'.sprintf(get_lang('UpdatedByX'), $message['user_created']).' '.$date.
' <span class="pull-right">'.$counterLink.'</span></h4>'; ' <span class="pull-right">'.$counterLink.'</span></h4>';
echo '<hr />'; echo '<hr />';
@ -329,7 +329,7 @@ if (!isset($_POST['compose'])) {
$counter++; $counter++;
} }
$subject = get_lang('ReplyShort') .': '.$ticket['ticket']['subject']; $subject = get_lang('ReplyShort').': '.$ticket['ticket']['subject'];
if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED && if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
$ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE $ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE
@ -451,7 +451,7 @@ if (!isset($_POST['compose'])) {
); );
Display::addFlash(Display::return_message(get_lang('Saved'))); Display::addFlash(Display::return_message(get_lang('Saved')));
header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id); header("Location:".api_get_self()."?ticket_id=".$ticket_id);
exit; exit;
} }
@ -466,7 +466,7 @@ function show_form_send_message($ticket)
$form = new FormValidator( $form = new FormValidator(
'send_ticket', 'send_ticket',
'POST', 'POST',
api_get_self() . '?ticket_id=' . $ticket['id'], api_get_self().'?ticket_id='.$ticket['id'],
'', '',
array( array(
'enctype' => 'multipart/form-data', 'enctype' => 'multipart/form-data',
@ -553,7 +553,7 @@ function show_form_send_message($ticket)
$form->addLabel( $form->addLabel(
'', '',
'<span id="link-more-attach"> '<span id="link-more-attach">
<span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span> <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile').'</span>
</span> </span>
('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).') ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')
'); ');

@ -21,9 +21,9 @@ if (isset($_POST['convert'])) {
if (isset($_FILES['user_file'])) { if (isset($_FILES['user_file'])) {
$allowed_extensions = array('odp', 'sxi', 'ppt', 'pps', 'sxd', 'pptx'); $allowed_extensions = array('odp', 'sxi', 'ppt', 'pps', 'sxd', 'pptx');
if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) { if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
require_once api_get_path(SYS_CODE_PATH) . 'lp/lp_upload.php'; require_once api_get_path(SYS_CODE_PATH).'lp/lp_upload.php';
if (isset($o_ppt) && $first_item_id != 0) { if (isset($o_ppt) && $first_item_id != 0) {
if (api_get_setting('search_enabled')=='true') { if (api_get_setting('search_enabled') == 'true') {
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
$specific_fields = get_specific_field_list(); $specific_fields = get_specific_field_list();
foreach ($specific_fields as $specific_field) { foreach ($specific_fields as $specific_field) {
@ -62,7 +62,7 @@ if (!$is_allowed_to_edit) {
api_not_allowed(true); api_not_allowed(true);
} }
$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang("Doc")); $interbreadcrumb[] = array("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang("Doc"));
$nameTools = get_lang("OogieConversionPowerPoint"); $nameTools = get_lang("OogieConversionPowerPoint");
Display :: display_header($nameTools); Display :: display_header($nameTools);
@ -74,7 +74,7 @@ if (!empty($errorMessage)) {
$div_upload_limit = get_lang('UploadMaxSize').' : '.ini_get('post_max_size'); $div_upload_limit = get_lang('UploadMaxSize').' : '.ini_get('post_max_size');
$form = new FormValidator('upload_ppt', 'POST', '?' . api_get_cidreq(), ''); $form = new FormValidator('upload_ppt', 'POST', '?'.api_get_cidreq(), '');
$form->addElement('header', get_lang("WelcomeOogieSubtitle")); $form->addElement('header', get_lang("WelcomeOogieSubtitle"));
$form->addElement('html', Display::return_message($message, 'info', false)); $form->addElement('html', Display::return_message($message, 'info', false));
$form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit)); $form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit));
@ -82,7 +82,7 @@ $form->addElement('checkbox', 'take_slide_name', '', get_lang('TakeSlideName'));
$options = ChamiloApi::getDocumentConversionSizes(); $options = ChamiloApi::getDocumentConversionSizes();
$form->addElement('select', 'slide_size', get_lang('SlideSize'), $options); $form->addElement('select', 'slide_size', get_lang('SlideSize'), $options);
if (api_get_setting('search_enabled') === 'true') { if (api_get_setting('search_enabled') === 'true') {
require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
$specific_fields = get_specific_field_list(); $specific_fields = get_specific_field_list();
$form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
$form->addSelectLanguage('language', get_lang('SearchFeatureDocumentLanguage')); $form->addSelectLanguage('language', get_lang('SearchFeatureDocumentLanguage'));

@ -180,7 +180,7 @@ if (api_is_allowed_to_edit(null, true)) {
'#', '#',
get_lang('UserPicture'), get_lang('UserPicture'),
get_lang('OfficialCode'), get_lang('OfficialCode'),
get_lang('FirstName') . ', ' . get_lang('LastName'), get_lang('FirstName').', '.get_lang('LastName'),
get_lang('Email'), get_lang('Email'),
get_lang('Phone') get_lang('Phone')
); );
@ -189,7 +189,7 @@ if (api_is_allowed_to_edit(null, true)) {
'#', '#',
get_lang('UserPicture'), get_lang('UserPicture'),
get_lang('OfficialCode'), get_lang('OfficialCode'),
get_lang('LastName') . ', ' . get_lang('FirstName'), get_lang('LastName').', '.get_lang('FirstName'),
get_lang('Email'), get_lang('Email'),
get_lang('Phone') get_lang('Phone')
); );
@ -214,7 +214,7 @@ if (api_is_allowed_to_edit(null, true)) {
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au '; $sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
} }
$sql .=" WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id "; $sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id ";
$sql .= ' AND session_id = '.$sessionId; $sql .= ' AND session_id = '.$sessionId;
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
@ -262,7 +262,7 @@ if (api_is_allowed_to_edit(null, true)) {
$counter, $counter,
$user_image, $user_image,
$user['official_code'], $user['official_code'],
$user['firstname'] . ', ' . $user['lastname'], $user['firstname'].', '.$user['lastname'],
$user['email'], $user['email'],
$user['phone'] $user['phone']
); );
@ -271,7 +271,7 @@ if (api_is_allowed_to_edit(null, true)) {
$counter, $counter,
$user_image, $user_image,
$user['official_code'], $user['official_code'],
$user['lastname'] . ', ' . $user['firstname'], $user['lastname'].', '.$user['firstname'],
$user['email'], $user['email'],
$user['phone'] $user['phone']
); );
@ -350,7 +350,7 @@ if (api_is_allowed_to_edit(null, true)) {
$counter, $counter,
$user_image, $user_image,
$user['official_code'], $user['official_code'],
$user['firstname'] . ', ' . $user['lastname'], $user['firstname'].', '.$user['lastname'],
$user['email'], $user['email'],
$user['phone'] $user['phone']
); );
@ -359,7 +359,7 @@ if (api_is_allowed_to_edit(null, true)) {
$counter, $counter,
$user_image, $user_image,
$user['official_code'], $user['official_code'],
$user['lastname'] . ', ' . $user['firstname'], $user['lastname'].', '.$user['firstname'],
$user['email'], $user['email'],
$user['phone'] $user['phone']
); );
@ -530,7 +530,7 @@ if (api_is_allowed_to_edit(null, true)) {
// Actions column // Actions column
$table->set_header($header_nr++, get_lang('Action'), false); $table->set_header($header_nr++, get_lang('Action'), false);
$table->set_column_filter($header_nr-1, 'modify_filter'); $table->set_column_filter($header_nr - 1, 'modify_filter');
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') { if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
$table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user'); $table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user');
@ -538,7 +538,7 @@ if (api_is_allowed_to_edit(null, true)) {
} else { } else {
if ($course_info['unsubscribe'] == 1) { if ($course_info['unsubscribe'] == 1) {
$table->set_header($header_nr++, get_lang('Action'), false); $table->set_header($header_nr++, get_lang('Action'), false);
$table->set_column_filter($header_nr-1, 'modify_filter'); $table->set_column_filter($header_nr - 1, 'modify_filter');
} }
} }
@ -590,19 +590,19 @@ if (api_is_allowed_to_edit(null, true)) {
echo '<div class="col-md-6">'; echo '<div class="col-md-6">';
echo $icon; echo $icon;
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=csv&type='.$type.'">'. $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=csv&type='.$type.'">'.
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> '; Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=xls&type='.$type.'">'. $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=xls&type='.$type.'">'.
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> '; Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' || if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' ||
api_is_platform_admin() api_is_platform_admin()
) { ) {
$actions .= '<a href="user_import.php?'.api_get_cidreq().'&action=import">'. $actions .= '<a href="user_import.php?'.api_get_cidreq().'&action=import">'.
Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).'</a> '; Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), '', ICON_SIZE_MEDIUM).'</a> ';
} }
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=pdf&type='.$type.'">'. $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=pdf&type='.$type.'">'.
Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> '; Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a> ';
echo $actions; echo $actions;
echo '</div>'; echo '</div>';
@ -897,7 +897,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$userInfo = api_get_user_info($user_id); $userInfo = api_get_user_info($user_id);
$userPicture = $userInfo['avatar']; $userPicture = $userInfo['avatar'];
$photo= '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />'; $photo = '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />';
$temp[] = $user_id; $temp[] = $user_id;
$temp[] = $photo; $temp[] = $photo;
@ -1022,7 +1022,7 @@ function modify_filter($user_id, $row, $data)
if (api_get_setting('allow_user_course_subscription_by_course_admin') === 'true' or api_is_platform_admin()) { if (api_get_setting('allow_user_course_subscription_by_course_admin') === 'true' or api_is_platform_admin()) {
// unregister // unregister
if ($user_id != $current_user_id || api_is_platform_admin()) { if ($user_id != $current_user_id || api_is_platform_admin()) {
$result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'. $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'.
get_lang('Unreg').'</a>&nbsp;'; get_lang('Unreg').'</a>&nbsp;';
} }
} }
@ -1030,7 +1030,7 @@ function modify_filter($user_id, $row, $data)
// Show buttons for unsubscribe // Show buttons for unsubscribe
if ($course_info['unsubscribe'] == 1) { if ($course_info['unsubscribe'] == 1) {
if ($user_id == $current_user_id) { if ($user_id == $current_user_id) {
$result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'. $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'.
get_lang('Unreg').'</a>&nbsp;'; get_lang('Unreg').'</a>&nbsp;';
} }
} }

@ -40,7 +40,7 @@ if (!empty($export['session'])) {
if (is_array($courseSessionValue) && isset($courseSessionValue[1])) { if (is_array($courseSessionValue) && isset($courseSessionValue[1])) {
$courseSessionCode = $courseSessionValue[0]; $courseSessionCode = $courseSessionValue[0];
$sessionId = $courseSessionValue[1]; $sessionId = $courseSessionValue[1];
$courseSessionInfo= api_get_course_info($courseSessionCode); $courseSessionInfo = api_get_course_info($courseSessionCode);
$courseSessionId = $courseSessionInfo['real_id']; $courseSessionId = $courseSessionInfo['real_id'];
$sessionInfo = api_get_session_info($sessionId); $sessionInfo = api_get_session_info($sessionId);
} }
@ -51,7 +51,7 @@ $sql = "SELECT
u.firstname AS FirstName, u.firstname AS FirstName,
u.email AS Email, u.email AS Email,
u.username AS UserName, u.username AS UserName,
".(($_configuration['password_encryption']!='none')?" ":"u.password AS Password, ")." ".(($_configuration['password_encryption'] != 'none') ? " " : "u.password AS Password, ")."
u.auth_source AS AuthSource, u.auth_source AS AuthSource,
u.status AS Status, u.status AS Status,
u.official_code AS OfficialCode, u.official_code AS OfficialCode,
@ -82,10 +82,10 @@ if (strlen($course_code) > 0) {
$filename = 'export_users_'.$sessionInfo['name'].'_'.api_get_local_time(); $filename = 'export_users_'.$sessionInfo['name'].'_'.api_get_local_time();
} else { } else {
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$sql.= " FROM $user_table u $sql .= " FROM $user_table u
INNER JOIN $tbl_user_rel_access_url as user_rel_url INNER JOIN $tbl_user_rel_access_url as user_rel_url
ON (u.user_id= user_rel_url.user_id) ON (u.user_id= user_rel_url.user_id)
WHERE access_url_id = $access_url_id WHERE access_url_id = $access_url_id
@ -97,8 +97,8 @@ if (strlen($course_code) > 0) {
$filename = 'export_users_'.api_get_local_time(); $filename = 'export_users_'.api_get_local_time();
} }
$data = array(); $data = array();
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false); $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') { if ($export['addcsvheader'] == '1' AND $export['file_type'] == 'csv') {
if ($_configuration['password_encryption'] != 'none') { if ($_configuration['password_encryption'] != 'none') {
$data[] = array( $data[] = array(
'UserId', 'UserId',
@ -128,27 +128,27 @@ if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') {
); );
} }
foreach($extra_fields as $extra) { foreach ($extra_fields as $extra) {
$data[0][]=$extra[1]; $data[0][] = $extra[1];
} }
} }
$res = Database::query($sql); $res = Database::query($sql);
while($user = Database::fetch_array($res,'ASSOC')) { while ($user = Database::fetch_array($res, 'ASSOC')) {
$student_data = UserManager:: get_extra_user_data( $student_data = UserManager:: get_extra_user_data(
$user['UserId'], $user['UserId'],
true, true,
false false
); );
foreach($student_data as $key=>$value) { foreach ($student_data as $key=>$value) {
$key = substr($key, 6); $key = substr($key, 6);
if (is_array($value)) { if (is_array($value)) {
$user[$key] = $value['extra_' . $key]; $user[$key] = $value['extra_'.$key];
} else { } else {
$user[$key] = $value; $user[$key] = $value;
} }
} }
$data[] = $user ; $data[] = $user;
} }
switch ($file_type) { switch ($file_type) {

@ -56,20 +56,20 @@ switch ($action) {
$userInfo = api_get_user_info($sale['user_id']); $userInfo = api_get_user_info($sale['user_id']);
$html = '<h2>' . $sale['product_name'] .'</h2>'; $html = '<h2>'.$sale['product_name'].'</h2>';
$html .= '<div class="row">'; $html .= '<div class="row">';
$html .= '<div class="col-sm-6 col-md-6">'; $html .= '<div class="col-sm-6 col-md-6">';
$html .= '<ul>'; $html .= '<ul>';
$html .= '<li><b>'. $plugin->get_lang('OrderPrice') . ':</b> '. $sale['price'] . '</li>'; $html .= '<li><b>'.$plugin->get_lang('OrderPrice').':</b> '.$sale['price'].'</li>';
$html .= '<li><b>'. $plugin->get_lang('CurrencyType') . ':</b> '. $currency['iso_code'] . '</li>'; $html .= '<li><b>'.$plugin->get_lang('CurrencyType').':</b> '.$currency['iso_code'].'</li>';
$html .= '<li><b>'. $plugin->get_lang('ProductType') . ':</b> '. $productType . '</li>'; $html .= '<li><b>'.$plugin->get_lang('ProductType').':</b> '.$productType.'</li>';
$html .= '<li><b>'. $plugin->get_lang('OrderDate') . ':</b> '. api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H) . '</li>'; $html .= '<li><b>'.$plugin->get_lang('OrderDate').':</b> '.api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H).'</li>';
$html .= '<li><b>'. $plugin->get_lang('Buyer') . ':</b> '. $userInfo['complete_name'] . '</li>'; $html .= '<li><b>'.$plugin->get_lang('Buyer').':</b> '.$userInfo['complete_name'].'</li>';
$html .= '<li><b>'. $plugin->get_lang('PaymentMethods') . ':</b> '. $paymentType . '</li>'; $html .= '<li><b>'.$plugin->get_lang('PaymentMethods').':</b> '.$paymentType.'</li>';
$html .= '</ul>'; $html .= '</ul>';
$html .= '</div>'; $html .= '</div>';
$html .= '<div class="col-sm-6 col-md-6">'; $html .= '<div class="col-sm-6 col-md-6">';
$html .= '<img class="thumbnail" src="'. $productImage .'" >'; $html .= '<img class="thumbnail" src="'.$productImage.'" >';
$html .= '</div>'; $html .= '</div>';
$html .= '</div>'; $html .= '</div>';
@ -114,9 +114,9 @@ switch ($action) {
$html = '<div class="row">' $html = '<div class="row">'
. '<p>' . '<p>'
. '<ul>' . '<ul>'
. '<li>'. get_plugin_lang("PayoutsTotalCompleted", "BuyCoursesPlugin") .' <b>'. $stats['completed_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['completed_total_amount'] .' '. $currency['iso_code'] . '</b></li>' . '<li>'.get_plugin_lang("PayoutsTotalCompleted", "BuyCoursesPlugin").' <b>'.$stats['completed_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['completed_total_amount'].' '.$currency['iso_code'].'</b></li>'
. '<li>'. get_plugin_lang("PayoutsTotalPending", "BuyCoursesPlugin") .' <b>'. $stats['pending_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['pending_total_amount'] .' '. $currency['iso_code'] . '</b></li>' . '<li>'.get_plugin_lang("PayoutsTotalPending", "BuyCoursesPlugin").' <b>'.$stats['pending_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['pending_total_amount'].' '.$currency['iso_code'].'</b></li>'
. '<li>'. get_plugin_lang("PayoutsTotalCanceled", "BuyCoursesPlugin") .' <b>'. $stats['canceled_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['canceled_total_amount'] .' '. $currency['iso_code'] . '</b></li>' . '<li>'.get_plugin_lang("PayoutsTotalCanceled", "BuyCoursesPlugin").' <b>'.$stats['canceled_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['canceled_total_amount'].' '.$currency['iso_code'].'</b></li>'
. '</ul>' . '</ul>'
. '</p>'; . '</p>';
$html .= '</div>'; $html .= '</div>';
@ -154,15 +154,15 @@ switch ($action) {
$currentCurrency = $plugin->getSelectedCurrency(); $currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code']; $isoCode = $currentCurrency['iso_code'];
$html .= '<p>'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'</p>'; $html .= '<p>'.get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin").'</p>';
$html .= '' $html .= ''
. '<p>' . '<p>'
. '<ul>' . '<ul>'
. '<li>'. get_plugin_lang("TotalAcounts", "BuyCoursesPlugin") .' <b>'. $totalAccounts .'</b></li>' . '<li>'.get_plugin_lang("TotalAcounts", "BuyCoursesPlugin").' <b>'.$totalAccounts.'</b></li>'
. '<li>'. get_plugin_lang("TotalPayout", "BuyCoursesPlugin") .' <b>'. $isoCode .' '. $totalPayout .'</b></li>' . '<li>'.get_plugin_lang("TotalPayout", "BuyCoursesPlugin").' <b>'.$isoCode.' '.$totalPayout.'</b></li>'
. '</ul>' . '</ul>'
. '</p>'; . '</p>';
$html .= '<p>'. get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin") .'</p>'; $html .= '<p>'.get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin").'</p>';
$html .= '<br /><br />'; $html .= '<br /><br />';
$html .= '<div id="spinner" class="text-center"></div>'; $html .= '<div id="spinner" class="text-center"></div>';
@ -207,7 +207,7 @@ switch ($action) {
echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false); echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false);
} else { } else {
echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false); echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'.$result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
} }
break; break;
@ -411,8 +411,8 @@ switch ($action) {
break; break;
} }
$ajaxCallFile = $plugin->getPath('SRC') . 'buycourses.ajax.php'; $ajaxCallFile = $plugin->getPath('SRC').'buycourses.ajax.php';
$serviceImg = $plugin->getPath('SERVICE_IMAGES') . $serviceSale['service']['image']; $serviceImg = $plugin->getPath('SERVICE_IMAGES').$serviceSale['service']['image'];
$html = "<img class='img-responsive text-center' src='$serviceImg'>"; $html = "<img class='img-responsive text-center' src='$serviceImg'>";
$html .= "<br />"; $html .= "<br />";
$html .= "<legend>{$plugin->get_lang('ServiceInformation')}</legend>"; $html .= "<legend>{$plugin->get_lang('ServiceInformation')}</legend>";
@ -434,7 +434,7 @@ switch ($action) {
} }
$html .= "<li><b>{$plugin->get_lang('AppliesTo')}:</b> $nodeType</li> "; $html .= "<li><b>{$plugin->get_lang('AppliesTo')}:</b> $nodeType</li> ";
$html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['service']['price']} {$serviceSale['currency']}</li> "; $html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['service']['price']} {$serviceSale['currency']}</li> ";
$duration = $serviceSale['service']['duration_days'] . ' ' . $plugin->get_lang('Days'); $duration = $serviceSale['service']['duration_days'].' '.$plugin->get_lang('Days');
$html .= "</ul>"; $html .= "</ul>";
$html .= "<legend>{$plugin->get_lang('SaleInfo')}</legend>"; $html .= "<legend>{$plugin->get_lang('SaleInfo')}</legend>";
$html .= "<ul>"; $html .= "<ul>";
@ -513,10 +513,10 @@ switch ($action) {
'success' 'success'
); );
} else { } else {
$html .= Display::return_message('Error - ' . $plugin->get_lang('ErrorContactPlatformAdmin'), 'error'); $html .= Display::return_message('Error - '.$plugin->get_lang('ErrorContactPlatformAdmin'), 'error');
} }
$html .= "<a id='finish-button' class='btn btn-primary'>" . $plugin->get_lang('ClickHereToFinish') . "</a>"; $html .= "<a id='finish-button' class='btn btn-primary'>".$plugin->get_lang('ClickHereToFinish')."</a>";
$html .= "</div>"; $html .= "</div>";
$html .= "<script>"; $html .= "<script>";
$html .= "$('#finish-button').click(function() {"; $html .= "$('#finish-button').click(function() {";
@ -539,10 +539,10 @@ switch ($action) {
'warning' 'warning'
); );
} else { } else {
$html .= Display::return_message('Error - ' . $plugin->get_lang('ErrorContactPlatformAdmin'), 'error'); $html .= Display::return_message('Error - '.$plugin->get_lang('ErrorContactPlatformAdmin'), 'error');
} }
$html .= "<a id='finish-button' class='btn btn-primary'>" . $plugin->get_lang('ClickHereToFinish') . "</a>"; $html .= "<a id='finish-button' class='btn btn-primary'>".$plugin->get_lang('ClickHereToFinish')."</a>";
$html .= "</div>"; $html .= "</div>";
$html .= "<script>"; $html .= "<script>";
$html .= "$('#finish-button').click(function() {"; $html .= "$('#finish-button').click(function() {";

@ -21,7 +21,7 @@ $plugin = BuyCoursesPlugin::create();
$commissionsEnable = $plugin->get('commissions_enable'); $commissionsEnable = $plugin->get('commissions_enable');
if ($commissionsEnable == 'true') { if ($commissionsEnable == 'true') {
$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/js/commissions.js"></script>'; $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'buycourses/resources/js/commissions.js"></script>';
$defaultCommissions = []; $defaultCommissions = [];
$commissions = ''; $commissions = '';
} }
@ -165,9 +165,9 @@ if ($commissionsEnable === 'true') {
. '<script>' . '<script>'
. '$(function(){' . '$(function(){'
. 'if ($("[name=\'commissions\']").val() === "") {' . 'if ($("[name=\'commissions\']").val() === "") {'
. '$("#panelSliders").html("<button id=\"setCommissionsButton\" class=\"btn btn-warning\">' . get_plugin_lang("SetCommissions", "BuyCoursesPlugin") . '</button>");' . '$("#panelSliders").html("<button id=\"setCommissionsButton\" class=\"btn btn-warning\">'.get_plugin_lang("SetCommissions", "BuyCoursesPlugin").'</button>");'
. '} else {' . '} else {'
. 'showSliders(100, "default", "' . $commissions . '");' . 'showSliders(100, "default", "'.$commissions.'");'
. '}' . '}'
. '});' . '});'
@ -225,7 +225,7 @@ if ($commissionsEnable === 'true') {
. '</label>' . '</label>'
. '<div class="col-sm-8">' . '<div class="col-sm-8">'
. Display::return_message( . Display::return_message(
sprintf($plugin->get_lang('TheActualPlatformCommissionIsX'), $platformCommission['commission']. '%'), sprintf($plugin->get_lang('TheActualPlatformCommissionIsX'), $platformCommission['commission'].'%'),
'info', 'info',
false false
) )
@ -283,7 +283,7 @@ if ($form->validate()) {
$plugin->deleteItem($productItem['id']); $plugin->deleteItem($productItem['id']);
} }
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/configuration.php'); header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/configuration.php');
exit; exit;
} }

@ -71,49 +71,49 @@ class CourseArchiver
$backupDirectory = self::getBackupDir(); $backupDirectory = self::getBackupDir();
// Create a temp directory // Create a temp directory
$backup_dir = $backupDirectory . 'CourseArchiver_' . api_get_unique_id() . '/'; $backup_dir = $backupDirectory.'CourseArchiver_'.api_get_unique_id().'/';
// All course-information will be stored in course_info.dat // All course-information will be stored in course_info.dat
$course_info_file = $backup_dir . 'course_info.dat'; $course_info_file = $backup_dir.'course_info.dat';
$user = api_get_user_info(); $user = api_get_user_info();
$date = new \DateTime(api_get_local_time()); $date = new \DateTime(api_get_local_time());
$zipFileName = $user['user_id'] . '_' . $course->code . '_' . $date->format('Ymd-His') . '.zip'; $zipFileName = $user['user_id'].'_'.$course->code.'_'.$date->format('Ymd-His').'.zip';
$zipFilePath = $backupDirectory. $zipFileName; $zipFilePath = $backupDirectory.$zipFileName;
$php_errormsg = ''; $php_errormsg = '';
$res = @mkdir($backup_dir, $perm_dirs); $res = @mkdir($backup_dir, $perm_dirs);
if ($res === false) { if ($res === false) {
//TODO set and handle an error message telling the user to review the permissions on the archive directory //TODO set and handle an error message telling the user to review the permissions on the archive directory
error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini') . ' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0); error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini').' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0);
} }
// Write the course-object to the file // Write the course-object to the file
$fp = @fopen($course_info_file, 'w'); $fp = @fopen($course_info_file, 'w');
if ($fp === false) { if ($fp === false) {
error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
} }
$res = @fwrite($fp, base64_encode(serialize($course))); $res = @fwrite($fp, base64_encode(serialize($course)));
if ($res === false) { if ($res === false) {
error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
} }
$res = @fclose($fp); $res = @fclose($fp);
if ($res === false) { if ($res === false) {
error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
} }
// Copy all documents to the temp-dir // Copy all documents to the temp-dir
if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) { if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) {
foreach ($course->resources[RESOURCE_DOCUMENT] as $document) { foreach ($course->resources[RESOURCE_DOCUMENT] as $document) {
if ($document->file_type == DOCUMENT) { if ($document->file_type == DOCUMENT) {
$doc_dir = $backup_dir . $document->path; $doc_dir = $backup_dir.$document->path;
@mkdir(dirname($doc_dir), $perm_dirs, true); @mkdir(dirname($doc_dir), $perm_dirs, true);
if (file_exists($course->path . $document->path)) { if (file_exists($course->path.$document->path)) {
copy($course->path . $document->path, $doc_dir); copy($course->path.$document->path, $doc_dir);
} }
} else { } else {
@mkdir($backup_dir . $document->path, $perm_dirs, true); @mkdir($backup_dir.$document->path, $perm_dirs, true);
} }
} }
} }
@ -121,59 +121,59 @@ class CourseArchiver
// Copy all scorm documents to the temp-dir // Copy all scorm documents to the temp-dir
if (isset($course->resources[RESOURCE_SCORM]) && is_array($course->resources[RESOURCE_SCORM])) { if (isset($course->resources[RESOURCE_SCORM]) && is_array($course->resources[RESOURCE_SCORM])) {
foreach ($course->resources[RESOURCE_SCORM] as $document) { foreach ($course->resources[RESOURCE_SCORM] as $document) {
$doc_dir = dirname($backup_dir . $document->path); $doc_dir = dirname($backup_dir.$document->path);
@mkdir($doc_dir, $perm_dirs, true); @mkdir($doc_dir, $perm_dirs, true);
copyDirTo($course->path . $document->path, $doc_dir, false); copyDirTo($course->path.$document->path, $doc_dir, false);
} }
} }
// Copy calendar attachments. // Copy calendar attachments.
if (isset($course->resources[RESOURCE_EVENT]) && is_array($course->resources[RESOURCE_EVENT])) { if (isset($course->resources[RESOURCE_EVENT]) && is_array($course->resources[RESOURCE_EVENT])) {
$doc_dir = dirname($backup_dir . '/upload/calendar/'); $doc_dir = dirname($backup_dir.'/upload/calendar/');
@mkdir($doc_dir, $perm_dirs, true); @mkdir($doc_dir, $perm_dirs, true);
copyDirTo($course->path . 'upload/calendar/', $doc_dir, false); copyDirTo($course->path.'upload/calendar/', $doc_dir, false);
} }
// Copy Learning path author image. // Copy Learning path author image.
if (isset($course->resources[RESOURCE_LEARNPATH]) && is_array($course->resources[RESOURCE_LEARNPATH])) { if (isset($course->resources[RESOURCE_LEARNPATH]) && is_array($course->resources[RESOURCE_LEARNPATH])) {
$doc_dir = dirname($backup_dir . '/upload/learning_path/'); $doc_dir = dirname($backup_dir.'/upload/learning_path/');
@mkdir($doc_dir, $perm_dirs, true); @mkdir($doc_dir, $perm_dirs, true);
copyDirTo($course->path . 'upload/learning_path/', $doc_dir, false); copyDirTo($course->path.'upload/learning_path/', $doc_dir, false);
} }
// Copy announcements attachments. // Copy announcements attachments.
if (isset($course->resources[RESOURCE_ANNOUNCEMENT]) && is_array($course->resources[RESOURCE_ANNOUNCEMENT])) { if (isset($course->resources[RESOURCE_ANNOUNCEMENT]) && is_array($course->resources[RESOURCE_ANNOUNCEMENT])) {
$doc_dir = dirname($backup_dir . '/upload/announcements/'); $doc_dir = dirname($backup_dir.'/upload/announcements/');
@mkdir($doc_dir, $perm_dirs, true); @mkdir($doc_dir, $perm_dirs, true);
copyDirTo($course->path . 'upload/announcements/', $doc_dir, false); copyDirTo($course->path.'upload/announcements/', $doc_dir, false);
} }
// Copy work folders (only folders) // Copy work folders (only folders)
if (isset($course->resources[RESOURCE_WORK]) && is_array($course->resources[RESOURCE_WORK])) { if (isset($course->resources[RESOURCE_WORK]) && is_array($course->resources[RESOURCE_WORK])) {
$doc_dir = dirname($backup_dir . '/upload/work/'); $doc_dir = dirname($backup_dir.'/upload/work/');
@mkdir($doc_dir, $perm_dirs, true); @mkdir($doc_dir, $perm_dirs, true);
// @todo: adjust to only create subdirs, but not copy files // @todo: adjust to only create subdirs, but not copy files
copyDirTo($course->path . 'upload/work/', $doc_dir, false); copyDirTo($course->path.'upload/work/', $doc_dir, false);
} }
if (isset($course->resources[RESOURCE_ASSET]) && is_array($course->resources[RESOURCE_ASSET])) { if (isset($course->resources[RESOURCE_ASSET]) && is_array($course->resources[RESOURCE_ASSET])) {
/** @var Asset $asset */ /** @var Asset $asset */
foreach ($course->resources[RESOURCE_ASSET] as $asset) { foreach ($course->resources[RESOURCE_ASSET] as $asset) {
$doc_dir = $backup_dir . $asset->path; $doc_dir = $backup_dir.$asset->path;
@mkdir(dirname($doc_dir), $perm_dirs, true); @mkdir(dirname($doc_dir), $perm_dirs, true);
$assetPath = $course->path . $asset->path; $assetPath = $course->path.$asset->path;
if (!file_exists($assetPath)) { if (!file_exists($assetPath)) {
continue; continue;
} }
if (is_dir($course->path . $asset->path)) { if (is_dir($course->path.$asset->path)) {
copyDirTo($course->path . $asset->path, $doc_dir); copyDirTo($course->path.$asset->path, $doc_dir);
continue; continue;
} }
copy($course->path . $asset->path, $doc_dir); copy($course->path.$asset->path, $doc_dir);
} }
} }
@ -209,7 +209,7 @@ class CourseArchiver
$date = $file_parts[0]; $date = $file_parts[0];
$ext = isset($file_parts[1]) ? $file_parts[1] : null; $ext = isset($file_parts[1]) ? $file_parts[1] : null;
if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) { if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) {
$date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2) . ' ' . substr($date, 9, 2) . ':' . substr($date, 11, 2) . ':' . substr($date, 13, 2); $date = substr($date, 0, 4).'-'.substr($date, 4, 2).'-'.substr($date, 6, 2).' '.substr($date, 9, 2).':'.substr($date, 11, 2).':'.substr($date, 13, 2);
$backup_files[] = array( $backup_files[] = array(
'file' => $file, 'file' => $file,
'date' => $date, 'date' => $date,
@ -230,7 +230,7 @@ class CourseArchiver
*/ */
public static function importUploadedFile($file) public static function importUploadedFile($file)
{ {
$new_filename = uniqid('') . '.zip'; $new_filename = uniqid('').'.zip';
$new_dir = self::getBackupDir(); $new_dir = self::getBackupDir();
if (!is_dir($new_dir)) { if (!is_dir($new_dir)) {
$fs = new Filesystem(); $fs = new Filesystem();
@ -264,11 +264,11 @@ class CourseArchiver
@mkdir($unzip_dir, api_get_permissions_for_new_directories(), true); @mkdir($unzip_dir, api_get_permissions_for_new_directories(), true);
@copy( @copy(
$filePath, $filePath,
$unzip_dir . '/backup.zip' $unzip_dir.'/backup.zip'
); );
// unzip the archive // unzip the archive
$zip = new \PclZip($unzip_dir . '/backup.zip'); $zip = new \PclZip($unzip_dir.'/backup.zip');
@chdir($unzip_dir); @chdir($unzip_dir);
$zip->extract(PCLZIP_OPT_TEMP_FILE_ON); $zip->extract(PCLZIP_OPT_TEMP_FILE_ON);
// remove the archive-file // remove the archive-file

Loading…
Cancel
Save