Updating from 1.11.x

pull/2881/head
Julio Montoya 6 years ago
parent e1cb48c5ee
commit ca2cd707a6
  1. 5
      main/admin/user_edit.php
  2. 81
      main/messages/inbox.php
  3. 94
      main/messages/new_message.php
  4. 74
      main/messages/outbox.php
  5. 51
      main/messages/view_message.php
  6. 303
      main/mySpace/myStudents.php
  7. 6
      main/social/groups.php
  8. 2
      main/social/message_for_group_form.inc.php
  9. 6
      main/social/profile.php
  10. 2
      main/social/search.php
  11. 2
      main/timeline/index.php
  12. 2
      main/work/add_user.php
  13. 2
      main/work/upload.php
  14. 3
      main/work/upload_from_template.php
  15. 48
      main/work/work.lib.php
  16. 38
      tests/behat/features/bootstrap/FeatureContext.php
  17. 18
      tests/behat/features/toolLp.feature

@ -512,11 +512,11 @@ $actions = [
),
];
$actionBar = Display::toolbarAction('toolbar-user-information', [implode(PHP_EOL, $actions)]);
$content = Display::toolbarAction('toolbar-user-information', [implode(PHP_EOL, $actions)]);
$bigImage = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_BIG);
$normalImage = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_ORIGINAL);
$content = '<div class="row">';
$content .= '<div class="row">';
$content .= '<div class="col-md-10">';
// Display form
$content .= $form->returnForm();
@ -526,6 +526,5 @@ $content .= '<a class="thumbnail expand-image" href="'.$bigImage.'" /><img src="
$content .= '</div>';
$tpl = new Template($tool_name);
$tpl->assign('actions', $actionBar);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -72,12 +72,12 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
if (isset($user_reply) && !is_null($user_id_by_email) && strlen($info_reply[0]) > 0) {
MessageManager::send_message($user_id_by_email, $title, $content);
$show_message .= MessageManager::return_message($user_id_by_email, 'confirmation');
$message_content .= MessageManager::inbox_display();
$social_right_content .= MessageManager::inbox_display();
exit;
} elseif (is_null($user_id_by_email)) {
$message_box = get_lang('ErrorSendingMessage');
$show_message .= Display::return_message(api_xml_http_response_encode($message_box), 'error');
$message_content .= MessageManager::inbox_display();
$social_right_content .= MessageManager::inbox_display();
exit;
}
} elseif (trim($info_delete[0]) == 'delete') {
@ -89,7 +89,7 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
}
$message_box = get_lang('SelectedMessagesDeleted');
$show_message .= Display::return_message(api_xml_http_response_encode($message_box));
$message_content .= MessageManager::inbox_display();
$social_right_content .= MessageManager::inbox_display();
exit;
}
}
@ -115,45 +115,44 @@ $interbreadcrumb[] = [
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Inbox')];
$actions = '';
$keyword = '';
// Comes from normal profile
if ($allowMessage) {
if ($allowSocial === false && $allowMessage) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
// LEFT CONTENT
$social_menu_block = '';
if ($allowSocial) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
}
// Right content
$social_right_content = '';
$keyword = '';
if ($allowSocial) {
$actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('new-message.png', get_lang('ComposeMessage'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new-message.png', get_lang('ComposeMessage'), [], 32).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('outbox.png', get_lang('Outbox'), [], 32).'</a>';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/inbox.php');
try {
if ($form->validate()) {
$values = $form->getSubmitValues();
$keyword = $values['keyword'];
}
} catch (HTML_QuickForm_Error $e) {
echo $e->getMessage();
}
$actionsRight = $form->returnForm();
$actions = Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
$social_right_content .= Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
}
// SOCIAL MENU
/*$social_menu_block = '';
if ($allowSocial) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
}*/
// Right content
$message_content = '';
//MAIN CONTENT
if (!isset($_GET['del_msg'])) {
$message_content .= MessageManager::inbox_display($keyword);
$social_right_content .= MessageManager::inbox_display($keyword);
} else {
$num_msg = (int) $_POST['total'];
for ($i = 0; $i < $num_msg; $i++) {
@ -165,20 +164,24 @@ if (!isset($_GET['del_msg'])) {
);
}
}
$message_content .= MessageManager::inbox_display();
$social_right_content .= MessageManager::inbox_display();
}
$tpl = new Template($nameTools);
$tpl = new Template(null);
if ($actions) {
$tpl->assign('actions', $actions);
$tpl->assign('actions', Display::toolbarAction('toolbar', [$actions]));
}
// Block Social Avatar
// SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
$tpl->assign('content_inbox', $message_content);
$social_layout = $tpl->get_template('message/inbox.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
$content = $social_right_content;
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}

@ -60,7 +60,7 @@ function add_image_form() {
</script>';
$nameTools = get_lang('ComposeMessage');
$tpl = new Template($nameTools);
$tpl = new Template(get_lang('ComposeMessage'));
/**
* Shows the compose area + a list of users to select from.
@ -347,36 +347,57 @@ $interbreadcrumb[] = [
];
$group_id = isset($_REQUEST['group_id']) ? (int) $_REQUEST['group_id'] : 0;
$message_content = null;
$actions = null;
$social_right_content = null;
if ($group_id != 0) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'.
Display::return_icon('back.png', api_xml_http_response_encode(get_lang('ComposeMessage')), null, ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.
Display::return_icon('message_new.png', api_xml_http_response_encode(get_lang('ComposeMessage')), null, ICON_SIZE_MEDIUM).'</a>';
$social_right_content .= '<div class=actions>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'.
Display::return_icon('back.png', api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.
Display::return_icon('message_new.png', api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
$social_right_content .= '</div>';
} else {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('back.png', get_lang('Back'), null, ICON_SIZE_MEDIUM).'</a>';
if (api_get_setting('allow_message_tool') === 'true') {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'</a>';
}
if ($allowSocial) {
} else {
$social_right_content .= '<div class=actions>';
if (api_get_setting('allow_message_tool') === 'true') {
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
$social_right_content .= '</div>';
}
}
$show_message = null;
// LEFT COLUMN
$social_left_content = '';
if ($allowSocial) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$social_right_content .= '<div class="row">';
$social_right_content .= '<div class="col-md-12">';
$social_right_content .= '<div class="actions">';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('back.png', get_lang('Back'), [], 32).'</a>';
$social_right_content .= '</div>';
$social_right_content .= '</div>';
$social_right_content .= '<div class="col-md-12">';
}
// MAIN CONTENT
if (!isset($_POST['compose'])) {
if (isset($_GET['re_id'])) {
$message_content .= show_compose_reply_to_message(
$social_right_content .= show_compose_reply_to_message(
$_GET['re_id'],
api_get_user_id(),
$tpl
);
} elseif (isset($_GET['send_to_user'])) {
$message_content .= show_compose_to_user($_GET['send_to_user'], $tpl);
$social_right_content .= show_compose_to_user($_GET['send_to_user'], $tpl);
} else {
$message_content .= show_compose_to_any($tpl);
$social_right_content .= show_compose_to_any($tpl);
}
} else {
$restrict = false;
@ -393,7 +414,7 @@ if (!isset($_POST['compose'])) {
// comes from a reply button
if (isset($_GET['re_id']) || isset($_GET['forward_id'])) {
$message_content .= manageForm($default, null, null, $tpl);
$social_right_content .= manageForm($default, null, null, $tpl);
} else {
// post
if ($restrict) {
@ -405,24 +426,29 @@ if (!isset($_POST['compose'])) {
if (isset($_POST['hidden_user'])) {
$default['users'] = [$_POST['hidden_user']];
}
$message_content .= manageForm($default, null, null, $tpl);
$social_right_content .= manageForm($default, null, null, $tpl);
} else {
$show_message = Display::return_message(get_lang('ErrorSendingMessage'), 'error');
$social_right_content .= Display::return_message(get_lang('ErrorSendingMessage'), 'error');
}
}
}
MessageManager::cleanAudioMessage();
if ($allowSocial) {
$social_right_content .= '</div>';
$social_right_content .= '</div>';
}
if ($actions) {
$tpl->assign(
'actions',
Display::toolbarAction('toolbar', [$actions])
);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
MessageManager::cleanAudioMessage();
if ($allowSocial) {
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
$content = $social_right_content;
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}
$tpl->assign('message', $show_message);
$tpl->assign('content_inbox', $message_content);
$social_layout = $tpl->get_template('message/inbox.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -48,39 +48,40 @@ $interbreadcrumb[] = [
'name' => get_lang('Messages'),
];
$actions = null;
$actions = '';
if ($allowMessage) {
$actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('back.png', get_lang('Back'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('new-message.png', get_lang('ComposeMessage'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'</a>';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php');
if ($form->validate()) {
$values = $form->getSubmitValues();
$keyword = $values['keyword'];
}
$actionsRight = $form->returnForm();
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
$action = null;
if (isset($_REQUEST['action'])) {
$action = $_REQUEST['action'];
}
$keyword = '';
$message_content = null;
$social_right_content = '';
if ($allowSocial) {
$actions .= Display::toolbarAction(
$social_menu_block = SocialManager::show_social_menu('messages');
$actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('back.png', get_lang('Back'), [], 32).'</a>';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php');
if ($form->validate()) {
$values = $form->getSubmitValues();
$keyword = $values['keyword'];
}
$actionsRight = $form->returnForm();
$social_right_content .= Display::toolbarAction(
'toolbar',
[$actionsLeft, $actionsRight]
);
}
//MAIN CONTENT
if ($action == 'delete') {
$delete_list_id = [];
@ -91,33 +92,40 @@ if ($action == 'delete') {
$delete_list_id = $_POST['id'];
}
for ($i = 0; $i < count($delete_list_id); $i++) {
$show_message .= MessageManager::delete_message_by_user_sender(
MessageManager::delete_message_by_user_sender(
api_get_user_id(),
$delete_list_id[$i]
);
}
$delete_list_id = [];
$message_content .= MessageManager::outbox_display($keyword);
$social_right_content .= MessageManager::outbox_display($keyword);
} elseif ($action == 'deleteone') {
$delete_list_id = [];
$id = Security::remove_XSS($_GET['id']);
MessageManager::delete_message_by_user_sender(api_get_user_id(), $id);
$delete_list_id = [];
$message_content .= MessageManager::outbox_display($keyword);
$social_right_content .= MessageManager::outbox_display($keyword);
} else {
$message_content .= MessageManager::outbox_display($keyword);
$social_right_content .= MessageManager::outbox_display($keyword);
}
$tpl = new Template(get_lang('Outbox'));
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if ($actions) {
$tpl->assign('actions', $actions);
if ($allowSocial) {
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
$content = $social_right_content;
if ($actions) {
$tpl->assign(
'actions',
Display::toolbarAction('toolbar', [$actions])
);
}
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}
$tpl->assign('content_inbox', $message_content);
$social_layout = $tpl->get_template('message/inbox.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -24,33 +24,16 @@ if ($allowSocial) {
}
$interbreadcrumb[] = ['url' => 'inbox.php', 'name' => get_lang('Messages')];
$social_right_content = '<div class="actions">';
if (api_get_setting('allow_message_tool') === 'true') {
$actionLeft = Display::url(
Display::return_icon(
'new-message.png',
get_lang('ComposeMessage')
),
api_get_path(WEB_PATH).'main/messages/new_message.php'
);
$actionLeft .= Display::url(
Display::return_icon(
'inbox.png',
get_lang('Inbox')
),
api_get_path(WEB_PATH).'main/messages/inbox.php'
);
$actionLeft .= Display::url(
Display::return_icon(
'outbox.png',
get_lang('Outbox')
),
api_get_path(WEB_PATH).'main/messages/outbox.php'
);
$toolbar = Display::toolbarAction('inbox', [0 => $actionLeft]);
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('new-message.png', get_lang('ComposeMessage')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
$social_right_content .= '</div>';
if (empty($_GET['id'])) {
$messageId = $_GET['id_send'];
@ -74,26 +57,30 @@ $logInfo = [
Event::registerLog($logInfo);
// MAIN CONTENT
$message = MessageManager::showMessageBox($messageId, $source);
$messageContent = '';
if (api_get_setting('allow_social_tool') === 'true') {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu($show_menu);
}
// MAIN CONTENT
$message .= MessageManager::showMessageBox($messageId, $source);
if (!empty($message)) {
$messageContent = $message;
$social_right_content .= $message;
} else {
api_not_allowed(true);
}
$tpl = new Template(get_lang('View'));
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), $show_menu);
if (api_get_setting('allow_social_tool') === 'true') {
$tpl->assign('actions', $toolbar);
$tpl->assign('message', $messageContent);
$social_layout = $tpl->get_template('message/view_message.html.twig');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
$content = $social_right_content;
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}

@ -13,6 +13,7 @@ use ChamiloSession as Session;
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery.easy-pie-chart/dist/jquery.easypiechart.js"></script>';
$export = isset($_GET['export']) ? $_GET['export'] : false;
$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
@ -267,6 +268,7 @@ switch ($action) {
$table->setCellContents(1, 4, $last);
$courseTable = '';
if (!empty($courses)) {
$courseTable .= '<table class="data_table">';
$courseTable .= '<thead>';
@ -851,9 +853,7 @@ $csv_content[] = [
$coachs_name = '';
$session_name = '';
$table_title = Display::return_icon('user.png', get_lang('User')).$user_info['complete_name'];
echo Display::page_subheader($table_title);
$userPicture = UserManager::getUserPicture($user_info['user_id'], USER_IMAGE_SIZE_BIG);
$userGroupManager = new UserGroup();
@ -879,56 +879,8 @@ $userInfo = [
'online' => $online,
];
?>
<div class="row">
<div class="col-sm-2">
<img src="<?php echo $userPicture; ?>" class="thumbnail img-responsive">
</div>
<div class="col-sm-5">
<table class="table table-striped table-hover">
<thead>
<tr>
<th colspan="2"><?php echo get_lang('Information'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo get_lang('Name'); ?></td>
<td><?php echo $user_info['complete_name_with_message_link']; ?></td>
</tr>
<tr>
<td><?php echo get_lang('Email'); ?></td>
<td>
<?php
echo !empty($user_info['email'])
? '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>'
: get_lang('NoEmail');
?>
</td>
</tr>
<tr>
<td><?php echo get_lang('Tel'); ?></td>
<td><?php echo !empty($user_info['phone']) ? $user_info['phone'] : get_lang('NoTel'); ?></td>
</tr>
<tr>
<td><?php echo get_lang('OfficialCode'); ?></td>
<td><?php
echo !empty($user_info['official_code'])
? $user_info['official_code']
: get_lang('NoOfficialCode');
?></td>
</tr>
<tr>
<td><?php echo get_lang('OnLine'); ?></td>
<td><?php echo $online; ?></td>
</tr>
<?php
if (!empty($course_code)) {
?>
<tr>
<td colspan="2">
<?php
echo Display::url(
if (!empty($course_code)) {
$userInfo['url_access'] = Display::url(
get_lang('SeeAccesses'),
'access_details.php?'
.http_build_query(
@ -941,11 +893,9 @@ $userInfo = [
]
),
['class' => 'btn btn-default']
); ?>
</td>
</tr>
<?php
);
}
// Display timezone if the user selected one and if the admin allows the use of user's timezone
$timezone = null;
$timezone_user = UserManager::get_extra_user_data_by_field(
@ -959,71 +909,21 @@ $userInfo = [
$timezone = $timezone_user['timezone'];
}
if ($timezone !== null) {
?>
<tr>
<td> <?php echo get_lang('Timezone').' : '.$timezone; ?> </td>
</tr>
<?php
$userInfo['timezone'] = $timezone;
}
?>
</tbody>
</table>
</div>
<div class="col-sm-5">
<table class="table table-striped table-hover">
<thead>
<tr>
<th colspan="2" class="text-center"><?php echo get_lang('Tracking'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td align="right"><?php echo get_lang('FirstLoginInPlatform'); ?></td>
<td align="left"><?php echo $first_connection_date; ?></td>
</tr>
<tr>
<td align="right"><?php echo get_lang('LatestLoginInPlatform'); ?></td>
<td align="left"><?php echo $last_connection_date; ?></td>
</tr>
<?php
if ($details == 'true') {
?>
<tr>
<td align="right"><?php echo get_lang('TimeSpentInTheCourse'); ?></td>
<td align="left"><?php echo $time_spent_on_the_course; ?></td>
</tr>
<tr>
<td align="right">
<?php
echo get_lang('Progress').' ';
Display::display_icon(
'info3.gif',
get_lang('ScormAndLPProgressTotalAverage'),
['align' => 'absmiddle', 'hspace' => '3px']
); ?>
</td>
<td align="left"><?php echo $avg_student_progress.'%'; ?></td>
</tr>
<tr>
<td align="right">
<?php
echo get_lang('Score').' ';
Display::display_icon(
'info3.gif',
get_lang('ScormAndLPTestTotalAverage'),
['align' => 'absmiddle', 'hspace' => '3px']
); ?>
</td>
<td align="left">
<?php
if (is_numeric($avg_student_score)) {
echo $avg_student_score.'%';
$score = $avg_student_score.'%';
} else {
echo $avg_student_score;
} ?>
</td>
</tr>
<?php
$score = $avg_student_score;
}
$userInfo['student_score'] = $score;
$userInfo['student_progress'] = $avg_student_progress;
$userInfo['first_connection'] = $first_connection_date;
$userInfo['last_connection'] = $last_connection_date;
if ($details == 'true') {
$userInfo['time_spent_course'] = $time_spent_on_the_course;
}
if (api_get_setting('allow_terms_conditions') === 'true') {
@ -1035,30 +935,95 @@ $userInfo = [
'legal_accept'
);
$icon = Display::return_icon('accept_na.png');
$legalTime = null;
if (isset($value['value']) && !empty($value['value'])) {
list($legalId, $legalLanguageId, $legalTime) = explode(':', $value['value']);
$icon = Display::return_icon('accept.png').' '.api_get_local_time($legalTime);
$icon .= ' '.Display::url(
$icon = Display::return_icon('accept.png');
$btn = Display::url(
get_lang('DeleteLegal'),
api_get_self().'?action=delete_legal&student='.$student_id.'&course='.$course_code,
['class' => 'btn btn-danger btn-xs']
['class' => 'btn btn-danger']
);
$timeLegalAccept = api_get_local_time($legalTime);
} else {
$icon .= ' '.Display::url(
$btn = Display::url(
get_lang('SendLegal'),
api_get_self().'?action=send_legal&student='.$student_id.'&course='.$course_code,
['class' => 'btn btn-primary btn-xs']
['class' => 'btn btn-primary']
);
$timeLegalAccept = get_lang('NotRegistered');
}
echo '<tr>
<td align="right">';
echo get_lang('LegalAccepted').' </td> <td align="left">'.$icon;
echo '</td></tr>';
}
$userInfo['legal'] = [
'icon' => $icon,
'datetime' => $timeLegalAccept,
'url_send' => $btn,
];
}
$details = false;
if (!empty($courseInfo)) {
$nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
$messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
$links = Tracking::count_student_visited_links($student_id, $courseInfo['real_id'], $sessionId);
$chat_last_connection = Tracking::chat_last_connection($student_id, $courseInfo['real_id'], $sessionId);
$documents = Tracking::count_student_downloaded_documents($student_id, $courseInfo['real_id'], $sessionId);
$uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
$userInfo['tools'] = [
'tasks' => $nb_assignments,
'messages' => $messages,
'links' => $links,
'chat_connection' => $chat_last_connection,
'documents' => $documents,
'upload_documents' => $uploaded_documents,
];
} else {
$details = true;
}
$tpl = new Template('',
false,
false,
false,
false,
false,
false);
$tpl->assign('user', $userInfo);
$tpl->assign('details', $details);
$templateName = $tpl->get_template('my_space/user_details.tpl');
$content = $tpl->fetch($templateName);
echo $content;
$allowAll = api_get_configuration_value('allow_teacher_access_student_skills');
if ($allowAll) {
// Show all skills
echo Tracking::displayUserSkills(
$user_info['user_id'],
0,
0,
true
);
} else {
// Default behaviour - Show all skills depending the course and session id
echo Tracking::displayUserSkills(
$user_info['user_id'],
$courseInfo ? $courseInfo['real_id'] : 0,
$sessionId
);
}
echo '<br><br>';
?>
</tbody>
</table>
<div class="row">
<div class="col-sm-5">
<?php if (!empty($userGroups)) {
?>
<table class="table table-striped table-hover">
@ -1083,19 +1048,6 @@ $userInfo = [
</div>
<?php
$tpl = new Template(
'',
false,
false,
false,
false,
false,
false
);
$tpl->assign('user', $userInfo);
$templateName = $tpl->get_template('my_space/user_details.tpl');
$content = $tpl->fetch($templateName);
$exportCourseList = [];
$lpIdList = [];
if (empty($details)) {
@ -1423,7 +1375,7 @@ if (empty($details)) {
if ($user_info['status'] != INVITEE) {
$csv_content[] = [];
$csv_content[] = [str_replace('&nbsp;', '', strip_tags($table_title))];
$csv_content[] = [str_replace('&nbsp;', '', strip_tags($userInfo['complete_name']))];
$trackingColumns = api_get_configuration_value('tracking_columns');
if (isset($trackingColumns['my_students_lp'])) {
foreach ($columnHeaders as $key => $value) {
@ -1969,22 +1921,7 @@ if (empty($details)) {
</div>
';
echo '<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th colspan="2">'.get_lang('OtherTools').'</th>
</tr>
</thead>
<tbody>
';
$csv_content[] = [];
$nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
$messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
$links = Tracking::count_student_visited_links($student_id, $courseInfo['real_id'], $sessionId);
$chat_last_connection = Tracking::chat_last_connection($student_id, $courseInfo['real_id'], $sessionId);
$documents = Tracking::count_student_downloaded_documents($student_id, $courseInfo['real_id'], $sessionId);
$uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
$csv_content[] = [
get_lang('OtherTools'),
@ -2013,53 +1950,7 @@ if (empty($details)) {
$csv_content[] = [
get_lang('ChatLastConnection'),
$chat_last_connection,
]; ?>
<tr><!-- assignments -->
<td width="40%"><?php echo get_lang('Student_publication'); ?></td>
<td><?php echo $nb_assignments; ?></td>
</tr>
<tr><!-- messages -->
<td><?php echo get_lang('Forum').' - '.get_lang('NumberOfPostsForThisUser'); ?></td>
<td><?php echo $messages; ?></td>
</tr>
<tr><!-- links -->
<td><?php echo get_lang('LinksDetails'); ?></td>
<td><?php echo $links; ?></td>
</tr>
<tr><!-- downloaded documents -->
<td><?php echo get_lang('DocumentsDetails'); ?></td>
<td><?php echo $documents; ?></td>
</tr>
<tr><!-- uploaded documents -->
<td><?php echo get_lang('UploadedDocuments'); ?></td>
<td><?php echo $uploaded_documents; ?></td>
</tr>
<tr><!-- Chats -->
<td><?php echo get_lang('ChatLastConnection'); ?></td>
<td><?php echo $chat_last_connection; ?></td>
</tr>
</tbody>
</table>
</div>
<?php
} //end details
$allowAll = api_get_configuration_value('allow_teacher_access_student_skills');
if ($allowAll) {
// Show all skills
echo Tracking::displayUserSkills(
$user_info['user_id'],
0,
0,
true
);
} else {
// Default behaviour - Show all skills depending the course and session id
echo Tracking::displayUserSkills(
$user_info['user_id'],
$courseInfo ? $courseInfo['real_id'] : 0,
$sessionId
);
];
}
if ($allowMessages === true) {
@ -2136,6 +2027,4 @@ if ($export) {
exit;
}
echo $content;
Display::display_footer();

@ -386,7 +386,5 @@ $templateName = 'social/groups.tpl';
$tpl->setHelp('Groups');
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/groups.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$social_layout = $tpl->get_template($templateName);
$tpl->display($social_layout);

@ -114,4 +114,4 @@ if (api_get_setting('allow_message_tool') === 'true') {
$tpl->assign('content', $form->returnForm());
}
$tpl->display_one_col_template();
$tpl->displayBlankTemplateNoHeader();

@ -394,12 +394,10 @@ $tpl->assign('social_right_information', $socialRightInformation);
$tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
$formModalTpl = new Template();
$formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
$formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form());
$template = $formModalTpl->get_template('social/form_modals.tpl');
$formModals = $formModalTpl->fetch($template);
$tpl->assign('form_modals', $formModals);
$social_layout = $tpl->get_template('social/profile.tpl');
$content = $tpl->fetch($social_layout);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$tpl->display($social_layout);

@ -247,7 +247,7 @@ $tpl->assign('social_search', $block_search);
$tpl->assign('search_form', $searchForm);
$formModalTpl = new Template();
$formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
$formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form());
$template = $formModalTpl->get_template('social/form_modals.tpl');
$formModals = $formModalTpl->fetch($template);

@ -20,6 +20,8 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
$check = Security::check_token('request');
$token = Security::get_token();
$actions = '';
$message = '';
switch ($action) {
case 'add':

@ -115,7 +115,7 @@ if (!empty($userToAddList)) {
$url,
['class' => 'btn btn-primary btn-sm']
);
echo '<li class="list-group-item">'.$userName.'<div class="float-right"> '.$link.'</div></li>';
echo '<li class="list-group-item">'.$userName.'<div class="pull-right"> '.$link.'</div></li>';
}
echo '</ul>';
} else {

@ -11,7 +11,7 @@ require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$work_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$work_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
$is_allowed_to_edit = api_is_allowed_to_edit();
$course_id = api_get_course_int_id();

@ -22,6 +22,7 @@ $session_id = api_get_session_id();
$course_info = api_get_course_info();
$course_code = $course_info['code'];
$group_id = api_get_group_id();
$sessionId = api_get_session_id();
if (empty($work_id)) {
api_not_allowed(true);
@ -92,7 +93,7 @@ if ($form->validate()) {
$workInfo,
$values,
$course_info,
$id_session,
$sessionId,
$group_id,
$user_id,
[],

@ -3743,21 +3743,23 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo
*
* @param int $workId
* @param array $courseInfo
* @param int $session_id
* @param int $sessionId
*/
function sendAlertToUsers($workId, $courseInfo, $session_id)
function sendAlertToUsers($workId, $courseInfo, $sessionId)
{
$user_list = [];
$workData = get_work_data_by_id($workId, $courseInfo['real_id'], $session_id);
$sessionId = (int) $sessionId;
$workData = get_work_data_by_id($workId, $courseInfo['real_id'], $sessionId);
// last value is to check this is not "just" an edit
// YW Tis part serve to send a e-mail to the tutors when a new file is sent
$send = api_get_course_setting('email_alert_manager_on_new_doc');
$userList = [];
if ($send == SEND_EMAIL_EVERYONE || $send == SEND_EMAIL_TEACHERS) {
// Lets predefine some variables. Be sure to change the from address!
if (empty($session_id)) {
if (empty($sessionId)) {
//Teachers
$user_list = CourseManager::get_user_list_from_course_code(
$userList = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
null,
null,
@ -3766,9 +3768,9 @@ function sendAlertToUsers($workId, $courseInfo, $session_id)
);
} else {
// Coaches
$user_list = CourseManager::get_user_list_from_course_code(
$userList = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
$session_id,
$sessionId,
null,
null,
2
@ -3777,34 +3779,22 @@ function sendAlertToUsers($workId, $courseInfo, $session_id)
}
if ($send == SEND_EMAIL_EVERYONE || $send == SEND_EMAIL_STUDENTS) {
if (!$session_id) {
$session_id = null;
}
$student = CourseManager::get_user_list_from_course_code(
api_get_course_id(),
$session_id,
null,
null,
STUDENT,
null,
null,
null,
null,
null,
[api_get_user_id()]
);
$user_list = array_merge($user_list, $student);
// Send mail only to sender
$studentList = [[
'user_id' => api_get_user_id(),
]];
$userList = array_merge($userList, $studentList);
}
if ($send) {
$subject = "[".api_get_setting('siteName')."] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']." ";
foreach ($user_list as $user_data) {
foreach ($userList as $user_data) {
$to_user_id = $user_data['user_id'];
$user_info = api_get_user_info($to_user_id);
$message = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$courseInfo['name']."\n";
$message .= get_lang('UserName')." : ".$user_info['complete_name']."\n";
$message .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$url = api_get_path(WEB_CODE_PATH)."work/work.php?cidReq=".$courseInfo['code']."&id_session=".$session_id."&id=".$workData['id'];
$url = api_get_path(WEB_CODE_PATH)."work/work.php?cidReq=".$courseInfo['code']."&id_session=".$sessionId."&id=".$workData['id'];
$message .= get_lang('WorkName')." : ".$workData['title']."\n\n".'<a href="'.$url.'">'.get_lang('DownloadLink')."</a>\n";
MessageManager::send_message_simple(
$to_user_id,
@ -3978,12 +3968,13 @@ function processWorkForm(
}
if (array_key_exists('document_id', $workInfo)) {
$documentId = isset($values['document_id']) ? intval($values['document_id']) : 0;
$documentId = isset($values['document_id']) ? (int) $values['document_id'] : 0;
$sql = "UPDATE $work_table SET
document_id = '$documentId'
WHERE iid = $workId";
Database::query($sql);
}
api_item_property_update(
$courseInfo,
'work',
@ -4037,6 +4028,7 @@ function processWorkForm(
$courseId,
$sessionId
);
if (count($userWorks) == 1) {
// The student only uploaded one doc so far, so add the
// considered work time to his course connection time

@ -132,16 +132,22 @@ class FeatureContext extends MinkContext
$friendId = $friendId;
$friendUsername = $friendUsername;
$sendInvitationURL = '/main/inc/ajax/message.ajax.php?' . http_build_query([
$sendInvitationURL = '/main/inc/ajax/message.ajax.php?'.
http_build_query(
[
'a' => 'send_invitation',
'user_id' => $friendId,
'content' => 'Add me'
]);
$acceptInvitationURL = '/main/inc/ajax/social.ajax.php?' . http_build_query([
'content' => 'Add me',
]
);
$acceptInvitationURL = '/main/inc/ajax/social.ajax.php?'.
http_build_query(
[
'a' => 'add_friend',
'friend_id' => $adminId,
'is_my_friend' => 'friend'
]);
'is_my_friend' => 'friend',
]
);
$this->iAmAPlatformAdministrator();
$this->visit($sendInvitationURL);
@ -156,11 +162,15 @@ class FeatureContext extends MinkContext
public function iHaveAPublicPasswordProtectedCourse($code, $password)
{
$this->visit('/main/admin/course_add.php');
$this->fillFields(new TableNode([
$this->fillFields(
new TableNode(
[
['title', 'Password Protected'],
['visual_code', $code],
['visibility', 3]
]));
['visibility', 3],
]
)
);
$this->pressButton('submit');
$this->visit('/main/course_info/infocours.php?cidReq=' . $code);
$this->assertPageContainsText('Course registration password');
@ -230,11 +240,15 @@ class FeatureContext extends MinkContext
*/
public function iTryDeleteAFriendFromSocialGroup($friendId, $groupId)
{
$this->visit('/main/social/group_members.php?' . http_build_query([
$this->visit(
'/main/social/group_members.php?'.http_build_query(
[
'id' => $groupId,
'u' => $friendId,
'action' => 'delete'
]));
'action' => 'delete',
]
)
);
}
/**

@ -48,11 +48,9 @@ Feature: LP tool
Then I should see "LP 1"
And I should see "Document 1"
And I should see "Exercise 1"
And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
Then I should see "LP 1"
Scenario: Delete a LP category
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
And I follow "Delete"
Then I should not see "LP category 1"
# Scenario: Check the PDF export in LP list if hide SCORM PDF link is false
# Given I am on "/main/admin/settings.php?category=Course"
@ -67,9 +65,19 @@ Feature: LP tool
# And I press "Save settings"
# And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list&isStudentView=true"
# Then I should not see an icon with title "Export to PDF"
Scenario: LP exists and LP category exists
And I am on "/main/lp/lp_controller.php?cidReq=TEMP&id_session=0&gidReq=0&gradebook=0&origin="
Then I should see "LP 1"
And I should see "LP category 1"
Scenario: Delete a LP
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list"
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP"
And I follow "Delete"
And I confirm the popup
Then I should not see "LP 1"
Scenario: Delete a LP category
Given I am on "/main/lp/lp_controller.php?cidReq=TEMP"
Then I should see "LP category 1"
And I follow "Delete"
Then I should see "Deleted"

Loading…
Cancel
Save