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

pull/2487/head
Yannick Warnier 8 years ago
commit 7a6992414f
  1. 101
      main/cron/import_csv.php
  2. 27
      main/document/upload.php
  3. BIN
      main/img/icons/22/file_zip.png
  4. 4
      main/inc/lib/api.lib.php
  5. 5
      main/inc/lib/document.lib.php
  6. 1
      main/inc/lib/fileUpload.lib.php
  7. 4
      main/inc/lib/social.lib.php
  8. 9
      main/inc/lib/usermanager.lib.php
  9. 10
      main/inc/local.inc.php
  10. 2
      main/install/configuration.dist.php
  11. 11
      main/lp/learnpath.class.php
  12. 1
      main/lp/lp_controller.php
  13. 39
      plugin/bbb/lib/bbb.lib.php
  14. 4
      plugin/bbb/listing.php
  15. 4
      plugin/bbb/listing.tpl

@ -1150,11 +1150,12 @@ class ImportCsv
$emailBody = get_lang('Dear').' ((user_firstname)) <br />'.
sprintf(
get_lang('YouHaveBeenSubscribedToCourseXTheStartDateXAndCommentX'),
$courseTitle,
$date,
$event['comment']
);
get_lang('YouHaveBeenSubscribedToCourseXTheStartDateXAndCommentX'),
$courseTitle,
$date,
$event['comment']
)
;
$subject = sprintf(
get_lang('AgendaAvailableInCourseX'),
@ -1221,34 +1222,78 @@ class ImportCsv
$report['mail_not_sent_because_date']++;
}
}
$content = '';
if ($update && isset($item['item_id'])) {
//the event already exists, just update
$eventResult = $agenda->editEvent(
$item['item_id'],
$event['start'],
$event['end'],
false,
$event['title'],
$content,
array('everyone'), // $usersToSend
array(), //$attachmentArray = array(),
[], //$attachmentCommentList
$eventComment,
$color,
false,
false,
$this->defaultAdminId
);
if ($eventResult !== false) {
$this->logger->addInfo(
"Event updated #".$item['item_id']." External cal Id: (".$externalEventId.") $info"
$eventInfo = $agenda->get_event($item['item_id']);
if (empty($eventInfo)) {
// Means that agenda external id exists but the event doesn't exist
$this->logger->addInfo("external event id exists: $externalEventId");
$this->logger->addInfo("but Chamilo event don't exists: ".$item['item_id']);
$eventId = $agenda->addEvent(
$event['start'],
$event['end'],
false,
$event['title'],
$content,
array('everyone'), // $usersToSend
false, //$addAsAnnouncement = false
null, // $parentEventId
array(), //$attachmentArray = array(),
[], //$attachmentCommentList
$eventComment,
$color
);
if (!empty($eventId)) {
$this->logger->addInfo("Chamilo event created: ".$eventId);
$values = $extraFieldValue->get_values_by_handler_and_field_id(
$item['item_id'],
$extraFieldInfo['id']
);
foreach ($values as $extraFieldValueItem) {
$params = [
'id' => $extraFieldValueItem['id'],
'item_id' => $eventId
];
$extraFieldValue->update($params);
$this->logger->addInfo(
'Updating calendar extra field #'.$extraFieldValueItem['id'].' new item_id: '.$eventId.' old item_id: '.$item['item_id']
);
}
} else {
$this->logger->addInfo("Error while creating event external id: $externalEventId");
}
} else {
$this->logger->addInfo(
"Error while updating event with external id: $externalEventId"
// The event already exists, just update
$eventResult = $agenda->editEvent(
$item['item_id'],
$event['start'],
$event['end'],
false,
$event['title'],
$content,
array('everyone'), // $usersToSend
array(), //$attachmentArray = array(),
[], //$attachmentCommentList
$eventComment,
$color,
false,
false,
$this->defaultAdminId
);
if ($eventResult !== false) {
$this->logger->addInfo(
"Event updated #".$item['item_id']." External cal Id: (".$externalEventId.") $info"
);
} else {
$this->logger->addInfo(
"Error while updating event with external id: $externalEventId"
);
}
}
} else {
// New event. Create it.

@ -98,7 +98,7 @@ function check_unzip() {
}
}
function setFocus(){
function setFocus() {
$("#title_file").focus();
}
</script>';
@ -202,9 +202,11 @@ if (!empty($_FILES)) {
$redirectUrl = api_get_self().'?'.api_get_cidreq();
if ($document_data) {
$redirectUrl .= '&'.http_build_query([
'id' => $document_data['iid']
]);
$redirectUrl .= '&'.http_build_query(
[
'id' => $document_data['iid'],
]
);
}
header("Location: $redirectUrl");
@ -218,10 +220,12 @@ Display::display_header($nameTools, 'Doc');
// Link back to the documents overview
if ($is_certificate_mode) {
$actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).
'</a>';
} else {
$actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).
'</a>';
}
// Link to create a folder
@ -253,7 +257,9 @@ $form->addElement('hidden', 'id', $document_id);
$form->addElement('hidden', 'curdirpath', $path);
$course_quota = format_file_size(DocumentManager::get_course_quota() - DocumentManager::documents_total_space());
$label = get_lang('MaxFileSize').': '.ini_get('upload_max_filesize').'<br/>'.get_lang('DocumentQuota').': '.$course_quota;
$label =
get_lang('MaxFileSize').': '.ini_get('upload_max_filesize').'<br/>'.
get_lang('DocumentQuota').': '.$course_quota;
$form->addElement('file', 'file', array(get_lang('File'), $label), 'style="width: 250px" id="user_upload"');
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'title_file'));
@ -275,7 +281,12 @@ $form->addElement(
if (api_get_setting('search_enabled') === 'true') {
//TODO: include language file
$supported_formats = get_lang('SupportedFormatsForIndex').': HTML, PDF, TXT, PDF, Postscript, MS Word, RTF, MS Power Point';
$form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument').'<div style="font-size: 80%" >'.$supported_formats.'</div>');
$form->addElement(
'checkbox',
'index_document',
'',
get_lang('SearchFeatureDoIndexDocument').'<div style="font-size: 80%" >'.$supported_formats.'</div>'
);
$form->addElement('html', '<br /><div class="sub-form">');
$form->addElement('html', '<div class="label">'.get_lang('SearchFeatureDocumentLanguage').'</div>');
$form->addLabel(get_lang('Language'), api_get_languages_combo());

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

@ -1534,7 +1534,7 @@ function api_get_user_info(
// Re-use user information if not stale and already stored in APCu
if ($cacheAvailable === true) {
$apcVar = api_get_configuration_value('apc_prefix').'userinfo_'.$user_id;
if (apcu_exists($apcVar) && $updateCache == false) {
if (apcu_exists($apcVar) && $updateCache == false && $checkIfUserOnline == false) {
$user = apcu_fetch($apcVar);
return $user;
@ -7828,6 +7828,8 @@ function api_get_configuration_value($variable)
// Check the current url id, id = 1 by default
$urlId = isset($_configuration['access_url']) ? (int) $_configuration['access_url'] : 1;
$variable = trim($variable);
// Check if variable exists
if (isset($_configuration[$variable])) {
if (is_array($_configuration[$variable])) {

@ -2954,9 +2954,6 @@ class DocumentManager
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir;
$group_properties = GroupManager::get_group_properties(api_get_group_id());
$groupIid = isset($group_properties['iid']) ? $group_properties['iid'] : 0;
if (isset($files[$fileKey])) {
$upload_ok = process_uploaded_file($files[$fileKey], $show_output);
@ -2967,7 +2964,7 @@ class DocumentManager
$base_work_dir,
$path,
api_get_user_id(),
$groupIid,
api_get_group_id(),
null,
$unzip,
$if_exists,

@ -1125,6 +1125,7 @@ function clean_up_files_in_zip($p_event, &$p_header)
$skipFiles = [
'__MACOSX',
'.Thumbs.db',
'Thumbs.db',
];
if (in_array($baseName, $skipFiles)) {
return 0;

@ -1179,7 +1179,7 @@ class SocialManager extends UserManager
{
$html = null;
if (isset($_GET['id']) or count($user_list) < 1) {
if (isset($_GET['id']) || count($user_list) < 1) {
return false;
}
@ -1189,7 +1189,7 @@ class SocialManager extends UserManager
}
foreach ($user_list as $uid) {
$user_info = api_get_user_info($uid, $checkIfUserOnline = true);
$user_info = api_get_user_info($uid, true);
$lastname = $user_info['lastname'];
$firstname = $user_info['firstname'];
$completeName = $firstname.', '.$lastname;

@ -485,6 +485,7 @@ class UserManager
$layoutContent = $tplContent->get_template('mail/content_registration_platform.tpl');
$emailBody = $tplContent->fetch($layoutContent);
/* MANAGE EVENT WITH MAIL */
if (EventsMail::check_if_using_class('user_registration')) {
$values["about_user"] = $return;
@ -514,6 +515,14 @@ class UserManager
null,
$additionalParameters
);
$notification = api_get_configuration_value('send_notification_when_user_added');
if (!empty($notification) && isset($notification['admins']) && is_array($notification['admins'])) {
foreach ($notification['admins'] as $adminId) {
$emailSubjectToAdmin = get_lang('UserAdded').': '.api_get_person_name($firstName, $lastName);
MessageManager::send_message_simple($adminId, $emailSubjectToAdmin, $emailBody);
}
}
}
if ($sendEmailToAllAdmins) {

@ -660,22 +660,22 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
$forceSsoRedirect = api_get_setting('sso_force_redirect');
if ($forceSsoRedirect === 'true') {
// all users to be redirected unless they are connected (removed req on sso_cookie)
$redirectToMasterConditions = !isset($_GET['sso_referer']) && !isset($_GET['loginFailed']);
$redirectToMasterConditions = !isset($_REQUEST['sso_referer']) && !isset($_GET['loginFailed']);
} else {
// Users to still see the homepage without connecting
$redirectToMasterConditions = !isset($_GET['sso_referer']) && !isset($_GET['loginFailed']) && isset($_GET['sso_cookie']);
$redirectToMasterConditions = !isset($_REQUEST['sso_referer']) && !isset($_GET['loginFailed']) && isset($_GET['sso_cookie']);
}
if ($redirectToMasterConditions) {
// Redirect to master server
$osso->ask_master();
} elseif (isset($_GET['sso_cookie'])) {
} elseif (isset($_REQUEST['sso_cookie'])) {
// Here we are going to check the origin of
// what the call says should be used for
// authentication, and ensure we know it
$matches_domain = false;
if (isset($_GET['sso_referer'])) {
if (isset($_REQUEST['sso_referer'])) {
$protocol = api_get_setting('sso_authentication_protocol');
// sso_authentication_domain can list
// several, comma-separated, domains
@ -690,7 +690,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
// then skip other possibilities
// Do NOT compare the whole referer, as this might cause confusing errors with friendly urls,
// like in Drupal /?q=user& vs /user?
$referrer = substr($_GET['sso_referer'], 0, strrpos($_GET['sso_referer'], '/'));
$referrer = substr($_REQUEST['sso_referer'], 0, strrpos($_REQUEST['sso_referer'], '/'));
if ($protocol.trim($mu) === $referrer) {
$matches_domain = true;
break;

@ -646,3 +646,5 @@ $_configuration['gradebook_badge_sidebar'] = [
// Allow multiple anon users see BT#13324
//$_configuration['max_anonymous_users'] = 0;
// Send email notification to admin when a user is created
//$_configuration['send_notification_when_user_added'] = ['admins' => [1] ];

@ -11449,6 +11449,17 @@ EOD;
// Removing category.
$em->remove($item);
$em->flush();
$courseInfo = api_get_course_info_by_id($courseId);
$sessionId = api_get_session_id();
// Delete link tool
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$link = 'lp/lp_controller.php?cidReq='.$courseInfo['code'].'&id_session='.$sessionId.'&gidReq=0&gradebook=0&origin=&action=view_category&id='.$id;
// Delete tools
$sql = "DELETE FROM $tbl_tool
WHERE c_id = ".$courseId." AND (link LIKE '$link%' AND image='lp_category.gif')";
Database::query($sql);
}
}

@ -535,6 +535,7 @@ switch ($action) {
}
if (isset($_REQUEST['id'])) {
learnpath::deleteCategory($_REQUEST['id']);
Display::addFlash(Display::return_message(get_lang('Deleted')));
}
require 'lp_list.php';
break;

@ -1070,21 +1070,30 @@ class bbb
'first'
);
$recordingParams = array(
/*
* NOTE: Set the recordId below to a valid id after you have
* created a recorded meeting, and received a real recordID
* back from your BBB server using the
* getRecordingsWithXmlResponseArray method.
*/
// REQUIRED - We have to know which recording:
'recordId' => $meetingData['remote_id'],
);
$result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams);
$delete = false;
// Check if there are recordings for this meeting
$recordings = $this->api->getRecordingsWithXmlResponseArray(['meetingId' => $meetingData['remote_id']]);
if (!empty($recordings) && isset($recordings['messageKey']) && $recordings['messageKey'] == 'noRecordings') {
$delete = true;
} else {
$recordingParams = array(
/*
* NOTE: Set the recordId below to a valid id after you have
* created a recorded meeting, and received a real recordID
* back from your BBB server using the
* getRecordingsWithXmlResponseArray method.
*/
// REQUIRED - We have to know which recording:
'recordId' => $meetingData['remote_id'],
);
$result = $this->api->deleteRecordingsWithXmlResponseArray($recordingParams);
if (!empty($result) && isset($result['deleted']) && $result['deleted'] === 'true') {
$delete = true;
}
}
if (!empty($result) && isset($result['deleted']) && $result['deleted'] === 'true') {
if ($delete) {
Database::delete(
'plugin_bbb_room',
array('meeting_id = ?' => array($id))
@ -1096,7 +1105,7 @@ class bbb
);
}
return $result;
return $delete;
}
/**

@ -30,8 +30,7 @@ if ($bbb->isGlobalConference()) {
api_protect_course_script(true);
}
$message = null;
$message = '';
if ($conferenceManager) {
switch ($action) {
case 'add_to_calendar':
@ -76,6 +75,7 @@ if ($conferenceManager) {
Display::addFlash($message);
header('Location: '.$bbb->getListingUrl());
exit;
break;
case 'end':
$bbb->endMeeting($_GET['id']);

@ -76,7 +76,9 @@
{% if allow_to_edit %}
<td>
{% if meeting.status == 1 %}
<a class="btn btn-default" href="{{ meeting.end_url }} "> {{ 'CloseMeeting'|get_plugin_lang('BBBPlugin') }}</a>
<a class="btn btn-default" href="{{ meeting.end_url }} ">
{{ 'CloseMeeting'|get_plugin_lang('BBBPlugin') }}
</a>
{% else %}
{{ meeting.action_links }}
{% endif %}

Loading…
Cancel
Save