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

1.10.x
Angel Fernando Quiroz Campos 10 years ago
commit 9bb4ea0eae
  1. 4
      main/dropbox/dropbox_functions.inc.php
  2. 169
      main/exercice/exercise.class.php
  3. 35
      main/work/work.lib.php

@ -1010,8 +1010,8 @@ function store_add_dropbox()
),
$recipent_temp['email'],
get_lang('NewDropboxFileUploaded'),
get_lang('NewDropboxFileUploadedContent').' '.api_get_path(WEB_CODE_PATH).
'dropbox/index.php?cidReq='.$_course['sysCode']."\n\n".
get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?' . api_get_cidreq() . '">'.get_lang('SeeFile').'</a>'.
"\n\n".
api_get_person_name(
$_user['firstName'],
$_user['lastName'],

@ -4035,26 +4035,26 @@ class Exercise
. '&action=qualify';
$user_info = api_get_user_info(api_get_user_id());
$msg = '<p>'.get_lang('ExerciseAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#email#</td>
</tr>
</table>';
$msg = get_lang('ExerciseAttempted').'<br /><br />'
.get_lang('AttemptDetails').' : <br /><br />'.
'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td><b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>#email#</td>'
.'</tr>'
.'</table>';
$open_question_list = null;
$msg = str_replace("#email#", $user_info['email'], $msg);
@ -4064,8 +4064,7 @@ class Exercise
$msg = str_replace("#course#", $courseInfo['name'], $msg1);
if ($origin != 'learnpath') {
$msg.= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
$msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
@ -4111,26 +4110,26 @@ class Exercise
. '&action=qualify';
$user_info = api_get_user_info(api_get_user_id());
$msg = '<p>'.get_lang('OpenQuestionsAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#mail#</td>
</tr>
</table>';
$msg = get_lang('OpenQuestionsAttempted').'<br /><br />'
.get_lang('AttemptDetails').' : <br /><br />'
.'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td><b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>#mail#</td>'
.'</tr>'
.'</table>';
$open_question_list = null;
foreach ($question_list_answers as $item) {
$question = $item['question'];
@ -4138,21 +4137,21 @@ class Exercise
$answer_type = $item['answer_type'];
if (!empty($question) && !empty($answer) && $answer_type == FREE_ANSWER) {
$open_question_list.='
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>
<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>
</tr>
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>
<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>
</tr>';
$open_question_list .=
'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
.'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
.'</tr>'
.'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>'
.'<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>'
.'</tr>';
}
}
if (!empty($open_question_list)) {
$msg .= '<p><br />'.get_lang('OpenQuestionsAttemptedAre').' :</p>
<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= '<p><br />'.get_lang('OpenQuestionsAttemptedAre').' :</p>'.
'<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= $open_question_list;
$msg .= '</table><br />';
@ -4164,8 +4163,7 @@ class Exercise
$msg = str_replace("#course#", $course_info['name'],$msg1);
if ($origin != 'learnpath') {
$msg .= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
$msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;
@ -4215,39 +4213,39 @@ class Exercise
$answer_type = $item['answer_type'];
if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
$oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>
<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>
</tr>
<tr>
<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>
<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>
</tr></table>';
$oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
.'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
.'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
.'</tr>'
.'<tr>'
.'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Answer').'</td>'
.'<td valign="top" bgcolor="#F3F3F3">'.$answer.'</td>'
.'</tr></table>';
}
}
if (!empty($oral_question_list)) {
$msg = '<p>'.get_lang('OralQuestionsAttempted').' :</p>
<p>'.get_lang('AttemptDetails').' : </p>
<table class="data_table">
<tr>
<td><h3>'.get_lang('CourseName').'</h3></td>
<td><h3>#course#</h3></td>
</tr>
<tr>
<td>'.get_lang('TestAttempted').'</span></td>
<td>#exercise#</td>
</tr>
<tr>
<td>'.get_lang('StudentName').'</td>
<td>#firstName# #lastName#</td>
</tr>
<tr>
<td>'.get_lang('StudentEmail').'</td>
<td>#mail#</td>
</tr>
</table>';
$msg = get_lang('OralQuestionsAttempted').'<br /><br />
'.get_lang('AttemptDetails').' : <br /><br />'
.'<table>'
.'<tr>'
.'<td><em>'.get_lang('CourseName').'</em></td>'
.'<td><b>#course#</b></td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('TestAttempted').'</td>'
.'<td>#exercise#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentName').'</td>'
.'<td>#firstName# #lastName#</td>'
.'</tr>'
.'<tr>'
.'<td>'.get_lang('StudentEmail').'</td>'
.'<td>#mail#</td>'
.'</tr>'
.'</table>';
$msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />';
$msg1 = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
@ -4256,8 +4254,7 @@ class Exercise
$msg = str_replace("#course#", $course_info['name'], $msg1);
if ($origin != 'learnpath') {
$msg.= get_lang('ClickToCommentAndGiveFeedback').', <br />
<a href="#url#">#url#</a>';
$msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
}
$msg1 = str_replace("#url#", $url_email, $msg);
$mail_content = $msg1;

@ -773,7 +773,7 @@ function create_unexisting_work_directory($base_work_dir, $desired_dir_name)
/**
* Delete a work-tool directory
* @param int $id work id to delete
* @param int $id work directory id to delete
* @return integer -1 on error
*/
function deleteDirWork($id)
@ -2227,19 +2227,23 @@ function send_reminder_users_without_publication($task_data)
/**
* Sends an email to the students of a course when a homework is created
*
* @param string course_id
* @param int $courseId course_id
* @param int $sessionId session_id
* @param int $workId work_id
*
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
* @author Julio Montoya <gugli100@gmail.com> Adding session support - 2011
*/
function send_email_on_homework_creation($course_id)
function send_email_on_homework_creation($courseId, $sessionId = 0, $workId)
{
$courseInfo = api_get_course_info_by_id($courseId);
$courseCode = $courseInfo['code'];
// Get the students of the course
$session_id = api_get_session_id();
if (empty($session_id)) {
$students = CourseManager::get_student_list_from_course_code($course_id);
$students = CourseManager::get_student_list_from_course_code($courseCode);
} else {
$students = CourseManager::get_student_list_from_course_code($course_id, true, $session_id);
$students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
}
$emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
$currentUser = api_get_user_info(api_get_user_id());
@ -2253,14 +2257,16 @@ function send_email_on_homework_creation($course_id)
null,
PERSON_NAME_EMAIL_ADDRESS
);
$link = api_get_path(WEB_CODE_PATH) . 'work/work_list_all.php?' . api_get_cidreq() . '&id=' . $workId;
$emailbody = get_lang('Dear')." ".$name_user.",\n\n";
$emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$course_id.". "."\n\n".get_lang('PleaseCheckHomeworkPage');
$emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$courseCode.". "."\n\n".
'<a href="'. $link . '">' . get_lang('PleaseCheckHomeworkPage') . '</a>';
$emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
$additionalParameters = array(
'smsType' => SmsPlugin::ASSIGNMENT_BEEN_CREATED_COURSE,
'userId' => $student["user_id"],
'courseTitle' => $course_id
'courseTitle' => $courseCode
);
api_mail_html(
@ -3529,6 +3535,8 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo
}
/**
* Send an e-mail to users related to this work (course teachers, usually, but
* might include other group members)
* @param int $workId
* @param array $courseInfo
* @param int $session_id
@ -3536,7 +3544,8 @@ function uploadWork($my_folder_data, $_course, $isCorrection = false, $workInfo
function sendAlertToUsers($workId, $courseInfo, $session_id)
{
$user_list = array();
$workData = get_work_assignment_by_id($workId, $courseInfo['real_id']);
//$workData = get_work_assignment_by_id($workId, $courseInfo['real_id']);
$workData = get_work_data_by_id($workId, $courseInfo['real_id'], $session_id);
//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');
@ -3592,16 +3601,16 @@ function sendAlertToUsers($workId, $courseInfo, $session_id)
null,
PERSON_NAME_EMAIL_ADDRESS
);
$subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$courseInfo['name']." ";
$subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']." ";
foreach ($user_list 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')." : ".api_get_person_name($user_info['firstname'], $user_info['lastname'])."\n";
$message .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n";
$message .= get_lang('WorkName')." : ".$workData['title']."\n\n".get_lang('DownloadLink')."\n";
$url = api_get_path(WEB_CODE_PATH)."work/work.php?cidReq=".$courseInfo['code']."&id_session=".$session_id."&id=".$workData['id'];
$message .= $url;
$message .= get_lang('WorkName')." : ".$workData['title']."\n\n".'<a href="'.$url.'">'.get_lang('DownloadLink')."</a>\n";
//$message .= $url;
MessageManager::send_message_simple($to_user_id, $subject, $message);
api_mail_html(
api_get_person_name(
@ -3798,7 +3807,7 @@ function addDir($formValues, $user_id, $courseInfo, $group_id, $session_id)
updatePublicationAssignment($id, $formValues, $courseInfo, $group_id);
if (api_get_course_setting('email_alert_students_on_new_homework') == 1) {
send_email_on_homework_creation(api_get_course_id());
send_email_on_homework_creation($course_id, $session_id, $id);
}
return $id;

Loading…
Cancel
Save