From ba7f9ba2ce00c9d26ef56a4ad431ec050b3e15e1 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 9 Aug 2012 21:51:57 -0500 Subject: [PATCH 01/45] Creating 1.9.x branch to open the way for 1.10 in head --- README.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/README.txt b/README.txt index 3663d41f4e..a77851bc87 100644 --- a/README.txt +++ b/README.txt @@ -1 +1,2 @@ For more information on Chamilo, open documentation/index.html in this directory with a web browser. + From 7f5316f15c184af14a5ea211aae59871689d3515 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 11:58:47 +0200 Subject: [PATCH 02/45] Moving fields in question see #3370 --- .../exercice/global_multiple_answer.class.php | 2 +- ...le_answer_combination_true_false.class.php | 4 +- .../multiple_answer_true_false.class.php | 63 ++++++++++--------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/main/exercice/global_multiple_answer.class.php b/main/exercice/global_multiple_answer.class.php index 49414419a0..8bb47d731f 100644 --- a/main/exercice/global_multiple_answer.class.php +++ b/main/exercice/global_multiple_answer.class.php @@ -110,7 +110,7 @@ if (!class_exists('GlobalMultipleAnswer')): $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); $answer_number->freeze(); - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox" style="margin-left: 2em;"'); + $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"'); $boxes_names[] = 'correct[' . $i . ']'; $form->addElement('html_editor', 'answer[' . $i . ']', null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); diff --git a/main/exercice/multiple_answer_combination_true_false.class.php b/main/exercice/multiple_answer_combination_true_false.class.php index 560e18bb8d..c62f151929 100644 --- a/main/exercice/multiple_answer_combination_true_false.class.php +++ b/main/exercice/multiple_answer_combination_true_false.class.php @@ -1,5 +1,5 @@ - addElement ('html', ''); $renderer = & $form->defaultRenderer(); + $defaults = array(); - //Extra values True, false, Dont known - if (!empty($this->extra)) { - $scores = explode(':',$this->extra); - - if (!empty($scores)) { - for ($i = 1; $i <=3; $i++) { - $defaults['option['.$i.']'] = $scores[$i-1]; - } - } - } - - // 3 scores - $form->addElement('text', 'option[1]',get_lang('Correct'), array('size'=>'5','value'=>'1')); - $form->addElement('text', 'option[2]',get_lang('Wrong'), array('size'=>'5','value'=>'-0.5')); - $form->addElement('text', 'option[3]',get_lang('DoubtScore'),array('size'=>'5','value'=>'0')); - - $form -> addElement('hidden', 'options_count', 3); - - $form -> addElement ('html', '
'); - $html.=' + $html = '
'; - // show column comment when feedback is enable - if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) { - $html .=''; - } - $html .= ''; + // show column comment when feedback is enable + if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) { + $html .=''; + } + $html .= ''; $form -> addElement ('label', get_lang('Answers').'
', $html); $correct = 0; - if (!empty($this -> id)) { + if (!empty($this -> id)) { $answer = new Answer($this -> id); $answer->read(); if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { @@ -161,12 +142,33 @@ class MultipleAnswerTrueFalse extends Question { } $form->addElement ('html', ''); } - $form -> addElement ('html', '
'.get_lang('Number').' @@ -80,15 +61,15 @@ class MultipleAnswerTrueFalse extends Question { '.get_lang('Answer').' '.get_lang('Comment').'
'.get_lang('Comment').'
'); - $form -> addElement ('html', '
'); + + $form->addElement('html', ''); + $form->addElement('html', '
'); + + $form->addElement('html', ''); + + //Extra values True, false, Dont known + if (!empty($this->extra)) { + $scores = explode(':',$this->extra); + if (!empty($scores)) { + for ($i = 1; $i <=3; $i++) { + $defaults['option['.$i.']'] = $scores[$i-1]; + } + } + } + + // 3 scores + $form->addElement('text', 'option[1]', get_lang('Correct'), array('size'=>'5','value'=>'1')); + $form->addElement('text', 'option[2]', get_lang('Wrong'), array('size'=>'5','value'=>'-0.5')); + $form->addElement('text', 'option[3]', get_lang('DoubtScore'),array('size'=>'5','value'=>'0')); + + $form -> addElement('hidden', 'options_count', 3); + + $form -> addElement ('html', '
'); //$form -> add_multiple_required_rule ($boxes_names , get_lang('ChooseAtLeastOneCheckbox') , 'multiple_required'); - $navigator_info = api_get_navigator(); global $text, $class, $show_quiz_edition; @@ -198,7 +200,6 @@ class MultipleAnswerTrueFalse extends Question { $form -> setDefaults($defaults); //} } - $form->setConstants(array('nb_answers' => $nb_answers)); } From dc611e7dd06e1404845550e6938f1116c3f7f215 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 12:36:49 +0200 Subject: [PATCH 03/45] Fixing gradebook actions showed to students --- .../gradebook/lib/fe/gradebooktable.class.php | 9 +++++---- .../gradebook/lib/gradebook_functions.inc.php | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index c241ed1061..563c384c8d 100644 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -176,7 +176,8 @@ class GradebookTable extends SortableTable { if (api_is_allowed_to_edit(null, true)) { //id $row[] = $this->build_id_column($item); - } + } + //Type $row[] = $this->build_type_column($item); @@ -230,7 +231,7 @@ class GradebookTable extends SortableTable { } else { //students get the results and certificates columns if (count($this->evals_links) > 0 && $status_user != 1) { - $value_data = isset($data[4]) ? $data[4] : null; + $value_data = isset($data[4]) ? $data[4] : null; if (!is_null($value_data)) { $row[] = Display::tag('h4', $value_data); } else { @@ -315,7 +316,7 @@ class GradebookTable extends SortableTable { $row[] = $invisibility_span_open.$weight.$extra.$invisibility_span_close; - if (api_is_allowed_to_edit(null, true)) { + if (api_is_allowed_to_edit(null, true)) { //$weight_total_links += intval($data[3]); } else { $cattotal = Category :: load($_GET['selectcat']); @@ -577,7 +578,7 @@ class GradebookTable extends SortableTable { } } - private function build_edit_column($item) { + private function build_edit_column($item) { switch ($item->get_item_type()) { // category case 'C' : diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index c39ba676d7..37a7ff0751 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -292,15 +292,22 @@ function build_edit_icons_link($link, $selectcat) { $cat = new Category(); $message_link = $cat->show_message_resource_delete($link->get_course_code()); $is_locked = $link->is_locked(); - - if ($message_link===false) { - $visibility_icon= ($link->is_visible() == 0) ? 'invisible' : 'visible'; - $visibility_command= ($link->is_visible() == 0) ? 'set_visible' : 'set_invisible'; + + $modify_icons = null; + + if (!api_is_allowed_to_edit(null, true)) { + return null; + } + + if ($message_link === false) { + $visibility_icon = ($link->is_visible() == 0) ? 'invisible' : 'visible'; + $visibility_command = ($link->is_visible() == 0) ? 'set_visible' : 'set_invisible'; if ($is_locked && !api_is_platform_admin()) { $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'),'',ICON_SIZE_SMALL); - } else { - $modify_icons = ''.Display::return_icon('edit.png', get_lang('Modify'),'',ICON_SIZE_SMALL).''; + } else { + $modify_icons = ''. + Display::return_icon('edit.png', get_lang('Modify'),'',ICON_SIZE_SMALL).''; } //$modify_icons .= ' '; From a1aee062d72d7794fb5e1ce76785ed996c8ef5c2 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 13:12:13 +0200 Subject: [PATCH 04/45] Fixing message when sending email see #4032 --- main/inc/lib/login.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/login.lib.php b/main/inc/lib/login.lib.php index e1ce73b32c..ef9447c601 100644 --- a/main/inc/lib/login.lib.php +++ b/main/inc/lib/login.lib.php @@ -109,7 +109,7 @@ class Login $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); $email_admin = api_get_setting('emailAdministrator'); - if (@api_mail('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) { + if (api_mail_html('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) { return get_lang('your_password_has_been_reset'); } else { $admin_email = Display :: encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))); From 5e63a43af8bdbea4a090645a379dc6293c29f8d8 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 15:14:10 +0200 Subject: [PATCH 05/45] Fixing email notifications for work and exercises --- .../announcement_email.class.php | 11 +- main/exercice/exercise.class.php | 234 +++++++----------- main/exercice/exercise.lib.php | 20 +- main/exercice/exercise_result.php | 28 ++- main/inc/lib/course.lib.php | 16 +- main/inc/lib/message.lib.php | 7 + main/work/work.php | 93 ++----- 7 files changed, 153 insertions(+), 256 deletions(-) diff --git a/main/announcements/announcement_email.class.php b/main/announcements/announcement_email.class.php index 16299f08cd..e68d856358 100644 --- a/main/announcements/announcement_email.class.php +++ b/main/announcements/announcement_email.class.php @@ -255,20 +255,15 @@ class AnnouncementEmail */ public function send() { - $sender = $this->sender(); - $sender_name = api_get_person_name($sender['firstName'], $sender['lastName'], null, PERSON_NAME_EMAIL_ADDRESS); - $sender_email = $sender['mail']; - + $sender = $this->sender(); $subject = $this->subject(); $message = $this->message(); // Send email one by one to avoid antispam $users = $this->sent_to(); + foreach ($users as $user) { - MessageManager::send_message($user['user_id'], $subject, $message, null, null, null, null, null, null, $sender['user_id']); - //$recipient_name = api_get_person_name($user['firstname'], $user['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); - //$recipient_email = $user['email']; - //@api_mail_html($recipient_name, $recipient_email, $subject, $message, $sender_name, $sender_email, null, $attachement, true); + MessageManager::send_message_simple($user['user_id'], $subject, $message, $sender['user_id']); } $this->log_mail_sent(); } diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 9eb0f4a57c..2867ea6ff3 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -1858,7 +1858,9 @@ class Exercise { if ($debug) error_log('manage_answer $learnpath_id: '.$learnpath_id); if ($debug) error_log('manage_answer $learnpath_item_id: '.$learnpath_item_id); - $extra_data = array(); + $extra_data = array(); + $arrques = null; + $arrans = null; $questionId = intval($questionId); $exeId = intval($exeId); @@ -2300,8 +2302,8 @@ class Exercise { } else { $totalScore+=$questionScore; } - $arrques[] = $questionName; - $arrans[] = $choice; + $arrques = $questionName; + $arrans = $choice; } else { $studentChoice = $choice; if ($studentChoice) { @@ -2324,8 +2326,8 @@ class Exercise { } else { $totalScore+=$questionScore; } - $arrques[] = $questionName; - $arrans[] = $choice; + $arrques = $questionName; + $arrans = $choice; } else { $studentChoice = $choice; if ($studentChoice) { @@ -2495,18 +2497,13 @@ class Exercise { if ($origin!='learnpath') { ExerciseShowFunctions::display_fill_in_blanks_answer($answer,0,0); } - } elseif($answerType == FREE_ANSWER) { - // to store the details of open questions in an array to be used in mail - $arrques[] = $questionName; - $arrans[] = $choice; + } elseif($answerType == FREE_ANSWER) { if($origin != 'learnpath') { ExerciseShowFunctions::display_free_answer($choice,0,0); } } elseif($answerType == ORAL_EXPRESSION) { - // to store the details of open questions in an array to be used in mail - $arrques[] = $questionName; - $arrans[] = $choice; - if($origin != 'learnpath') { + // to store the details of open questions in an array to be used in mail + if ($origin != 'learnpath') { ExerciseShowFunctions::display_oral_expression_answer($choice, 0, 0, $nano); } } elseif($answerType == HOT_SPOT) { @@ -2744,8 +2741,7 @@ class Exercise { $max_coord = poly_get_max($poly_user,$poly_answer); $poly_user_compiled = poly_compile($poly_user,$max_coord); $poly_answer_compiled = poly_compile($poly_answer,$max_coord); - $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord); - + $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord); $overlap = $poly_results['both']; $poly_answer_area = $poly_results['s1']; @@ -3187,7 +3183,13 @@ class Exercise { if ($debug) error_log($sql_update); Database::query($sql_update); } - $return_array = array('score'=>$questionScore, 'weight'=>$questionWeighting,'extra'=>$extra_data); + + $return_array = array( 'score' => $questionScore, + 'weight' => $questionWeighting, + 'extra' => $extra_data, + 'open_question' => $arrques, + 'open_answer' => $arrans + ); return $return_array; } //End function @@ -3195,148 +3197,88 @@ class Exercise { * Sends a notification when a user ends an examn * */ - function send_notification($arrques, $arrans, $origin) { + function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) { if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { - return ''; - } - + return null; + } // Email configuration settings $coursecode = api_get_course_id(); $course_info = api_get_course_info(api_get_course_id()); - $to = ''; - $teachers = array(); - if (api_get_session_id()) { - $teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id()); - } else { - $teachers = CourseManager::get_teacher_list_from_course_code($coursecode); - } - $num = count($teachers); - if ($num > 1) { - $to = array(); - foreach($teachers as $teacher) { - $to[] = $teacher['email']; - } - } elseif ($num>0){ - foreach($teachers as $teacher) { - $to = $teacher['email']; - } - } else { - //this is a problem (it means that there is no admin for this course) - } - - $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$this->id; + + $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify'; $user_info = UserManager::get_user_info_by_id(api_get_user_id()); - $mycharset = api_get_system_encoding(); - $msg = ' - - '; - - if (count($arrques) > 0) { - $msg .= ' -

'.get_lang('OpenQuestionsAttempted').' : -

-

'.get_lang('AttemptDetails').' :
-

- - - - - - - - - - - - - - - - -

  '.get_lang('CourseName').'

#course#

  '.get_lang('TestAttempted').'#exercise#
  '.get_lang('StudentName').'#firstName# #lastName#
  '.get_lang('StudentEmail').' #mail#
-


'.get_lang('OpenQuestionsAttemptedAre').' :

- '; - - for($i=0;$i'.get_lang('OpenQuestionsAttempted').' :

+

'.get_lang('AttemptDetails').' :

+
- - + + - - - '; - - $msg1 = str_replace("#exercise#", $this->exercise, $msg); - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); - $msg = str_replace("#mail#", $user_info['email'],$msg1); - $msg1 = str_replace("#questionName#",$arrques[$i],$msg); - $msg = str_replace("#answer#", $arrans[$i],$msg1); - $msg1 = str_replace("#i#", $i,$msg); - $msg = str_replace("#course#", $course_info['name'],$msg1); - } - - $msg.='
  '.get_lang('Question').' #questionName#

'.get_lang('CourseName').'

#course#

  '.get_lang('Answer').' #answer#

'; - if ($origin != 'learnpath') { - $msg.= ''.get_lang('ClickToCommentAndGiveFeedback').',
- #url#
'; + '.get_lang('TestAttempted').' + #exercise# + + + '.get_lang('StudentName').' + #firstName# #lastName# + + + '.get_lang('StudentEmail').' + #mail# + + '; + $open_question_list = null; + foreach ($question_list_answers as $item) { + $question = $item['question']; + $answer = $item['answer']; + + if (!empty($question) && !empty($answer)) { + $open_question_list.=' +   '.get_lang('Question').' + '.$question.' + + +   '.get_lang('Answer').' + '.$answer.' + '; + } } - $msg.= ''; - - $msg1 = str_replace("#url#", $url_email, $msg); - $mail_content = $msg1; - - $subject = get_lang('OpenQuestionsAttempted'); + + + if (!empty($open_question_list)) { + $msg .= '


'.get_lang('OpenQuestionsAttemptedAre').' :

+ '; + $msg .= $open_question_list; + $msg.='

'; + + + $msg1 = str_replace("#exercise#", $this->exercise, $msg); + $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); + $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); + $msg = str_replace("#mail#", $user_info['email'],$msg1); + $msg = str_replace("#course#", $course_info['name'],$msg1); + + if ($origin != 'learnpath') { + $msg.= get_lang('ClickToCommentAndGiveFeedback').',
+ #url#'; + } + $msg1 = str_replace("#url#", $url_email, $msg); + $mail_content = $msg1; + $subject = get_lang('OpenQuestionsAttempted'); + + $teachers = array(); + if (api_get_session_id()) { + $teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id()); + } else { + $teachers = CourseManager::get_teacher_list_from_course_code($coursecode); + } - $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); - $email_admin = api_get_setting('emailAdministrator'); - $result = @api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset)); - } else { - $msg .= ' -

'.get_lang('ExerciseAttempted').'

- - - - - - - - - - - - '.(api_is_western_name_order() ? '' : '').' - - - - -

'.get_lang('CourseName').'

#course#

  '.get_lang('TestAttempted').'#exercise#
  '.get_lang('StudentName').'#firstName# #lastName##lastName# #firstName#
  '.get_lang('StudentEmail').' #mail#
'; - - $msg= str_replace("#exercise#", $this->exercise,$msg); - $msg= str_replace("#firstName#", $user_info['firstname'], $msg); - $msg= str_replace("#lastName#", $user_info['lastname'], $msg); - $msg= str_replace("#mail#", $user_info['email'], $msg); - $msg= str_replace("#course#", $course_info['name'], $msg); - - if ($origin != 'learnpath') { - - $msg.='
- '.get_lang('ClickToCommentAndGiveFeedback').',
- #url#
'; - } - $msg .= ''; - - $msg = str_replace("#url#", $url_email, $msg); - $mail_content = $msg; - $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); - $email_admin = api_get_setting('emailAdministrator'); - $subject = get_lang('ExerciseAttempted'); - $result = @api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset)); - } + foreach ($teachers as $user_id => $teacher_data) { + MessageManager::send_message_simple($user_id, $subject, $mail_content); + } + } } function show_exercise_result_header($user_data, $date = null) { diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index 01fbc3afd3..3853b81f26 100644 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -1934,8 +1934,6 @@ function delete_chat_exercise_session($exe_id) { } } - - function display_question_list_by_attempt($objExercise, $exe_id, $save_user_result = false) { global $origin; @@ -1948,8 +1946,7 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu $counter = 1; $total_score = $total_weight = 0; - $exercise_content = null; - + $exercise_content = null; //Hide results $show_results = false; @@ -1981,7 +1978,8 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu echo "
 
"; } } - + + $question_list_answers = array(); // Loop over all question to show results for each of them, one by one if (!empty($question_list)) { @@ -2002,6 +2000,7 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu $total_score += $result['score']; $total_weight += $result['weight']; + $question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer']); $my_total_score = $result['score']; $my_total_weight = $result['weight']; @@ -2068,19 +2067,20 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu echo $total_score_text; - - if ($save_user_result) { // Tracking of results $learnpath_id = $exercise_stat_info['orig_lp_id']; $learnpath_item_id = $exercise_stat_info['orig_lp_item_id']; $learnpath_item_view_id = $exercise_stat_info['orig_lp_item_view_id']; + if (api_is_allowed_to_session_edit()) { update_event_exercice($exercise_stat_info['exe_id'], $objExercise->selectId(), $total_score, $total_weight, api_get_session_id(), $learnpath_id, $learnpath_item_id, $learnpath_item_view_id, $exercise_stat_info['exe_duration'], $question_list, '', array(), $end_date); } + + // Send notification .. + if (!api_is_allowed_to_edit(null,true)) { + $objExercise->send_notification_for_open_questions($question_list_answers, $origin, $exe_id); + } } - - - } \ No newline at end of file diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php index 20cab15c1d..3f47af7cd5 100644 --- a/main/exercice/exercise_result.php +++ b/main/exercice/exercise_result.php @@ -135,7 +135,6 @@ Display :: display_normal_message(get_lang('Saved').'
',false); display_question_list_by_attempt($objExercise, $exe_id, true); - //If is not valid $session_control_key = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) { @@ -152,23 +151,26 @@ delete_chat_exercise_session($exe_id); if ($origin != 'learnpath') { echo '
'; echo Display::url(get_lang('ReturnToCourseHomepage'), api_get_course_url(), array('class' => 'btn btn-large')); + + if (api_is_allowed_to_session_edit()) { + Session::erase('objExercise'); + Session::erase('exe_id'); + } + Display::display_footer(); } else { $lp_mode = $_SESSION['lp_mode']; $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; //echo $total_score.','.$total_weight; exit; - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; - echo ''."\n"; + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; + + if (api_is_allowed_to_session_edit()) { + Session::erase('objExercise'); + Session::erase('exe_id'); + } + + echo ''; //record the results in the learning path, using the SCORM interface (API) - echo ''."\n"; + echo ''; echo ''; -} - -// Send notification.. -if (!api_is_allowed_to_edit(null,true)) { - $objExercise->send_notification($arrques, $arrans, $origin); -} -if (api_is_allowed_to_session_edit()) { - Session::erase('objExercise'); - Session::erase('exe_id'); } \ No newline at end of file diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index ca3ec71b0d..5c30e16857 100644 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -1112,19 +1112,19 @@ class CourseManager { * Return user info array of all users registered in the specified real or virtual course * This only returns the users that are registered in this actual course, not linked courses. * - * @param string $course_code the code of the course - * @param boolean $with_session determines if the course is used in a session or not - * @param integer $session_id the id of the session - * @param string $limit the LIMIT statement of the sql statement - * @param string $order_by the field to order the users by. Valid values are 'lastname', 'firstname', 'username', 'email', 'official_code' OR a part of a SQL statement that starts with ORDER BY ... - * @param int 0 or 2 (student, coach) if using the session id, STUDENT or COURSEMANAGER if using session_id = 0 + * @param string $course_code the code of the course + * @param boolean $with_session determines if the course is used in a session or not + * @param integer $session_id the id of the session + * @param string $limit the LIMIT statement of the sql statement + * @param string $order_by the field to order the users by. Valid values are 'lastname', 'firstname', 'username', 'email', 'official_code' OR a part of a SQL statement that starts with ORDER BY ... + * @param int if using the session_id: 0 or 2 (student, coach), if using session_id = 0 STUDENT or COURSEMANAGER * @return array */ public static function get_user_list_from_course_code($course_code, $session_id = 0, $limit = '', $order_by = '', $filter_by_status = null) { // variable initialisation $session_id = intval($session_id); - $course_code = Database::escape_string($course_code); - $where = array(); + $course_code = Database::escape_string($course_code); + $where = array(); // if the $order_by does not contain 'ORDER BY' we have to check if it is a valid field that can be sorted on if (!strstr($order_by,'ORDER BY')) { diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index 2f9af80764..185d762e1a 100644 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -318,6 +318,13 @@ class MessageManager return false; } + /** + * A handy way to send message + */ + public static function send_message_simple($receiver_user_id, $subject, $message, $sender_id = null) { + return MessageManager::send_message($receiver_user_id, $subject, $message, null, null, null, null, null, null, $sender_id); + } + /** * Update parent ids for other receiver user from current message in groups * @author Christian Fasanando Flores diff --git a/main/work/work.php b/main/work/work.php index 2f786a0913..bb0152b75b 100644 --- a/main/work/work.php +++ b/main/work/work.php @@ -680,88 +680,39 @@ switch ($action) { //Bad token or can't add works $error_message = get_lang('IsNotPosibleSaveTheDocument'); } - + if (!empty($succeed) && !empty($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'); - + if ($send > 0) { - // Lets predefine some variables. Be sure to change the from address! - - $emailto = array (); + // Lets predefine some variables. Be sure to change the from address! if (empty($id_session)) { - $sql_resp = 'SELECT u.email as myemail FROM ' . $table_course_user . ' cu, ' . $table_user . ' u - WHERE cu.course_code = ' . "'" . api_get_course_id() . "'" . ' AND cu.status = 1 AND u.user_id = cu.user_id'; - $res_resp = Database::query($sql_resp); - while ($row_email = Database :: fetch_array($res_resp)) { - if (!empty ($row_email['myemail'])) { - $emailto[$row_email['myemail']] = $row_email['myemail']; - } - } + //Teachers + $user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), null, null, null, COURSEMANAGER); } else { - // coachs of the session - $sql_resp = 'SELECT user.email as myemail - FROM ' . $table_session . ' session INNER JOIN ' . $table_user . ' user - ON user.user_id = session.id_coach - WHERE session.id = ' . intval($id_session); - $res_resp = Database::query($sql_resp); - while ($row_email = Database :: fetch_array($res_resp)) { - if (!empty ($row_email['myemail'])) { - $emailto[$row_email['myemail']] = $row_email['myemail']; - } - } - - //coach of the course - $sql_resp = 'SELECT user.email as myemail - FROM ' . $table_session_course_user . ' scu - INNER JOIN ' . $table_user . ' user - ON user.user_id = scu.id_user AND scu.status=2 - WHERE scu.id_session = ' . intval($id_session); - $res_resp = Database::query($sql_resp); - while ($row_email = Database :: fetch_array($res_resp)) { - if (!empty ($row_email['myemail'])) { - $emailto[$row_email['myemail']] = $row_email['myemail']; - } - } + //Coaches + $user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id, null, null, 2); } - - if (count($emailto) > 0) { - $emailto = implode(',', $emailto); - $emailsubject = "[" . api_get_setting('siteName') . "] "; - $sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname'); - $email_admin = api_get_setting('emailAdministrator'); - // The body can be as long as you wish, and any combination of text and variables - - $emailbody = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']."\n"; - $emailbody .= get_lang('WorkName')." : ".substr($my_cur_dir_path, 0, -1)."\n"; - $emailbody .= get_lang('UserName')." : ".$currentUserFirstName .' '.$currentUserLastName ."\n"; + + $emailsubject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']." "; + + foreach ($user_list as $user_data) { + $user_id = $user_data; + $emailbody = get_lang('SendMailBody')."\n".get_lang('CourseName')." : ".$_course['name']."\n"; + //$emailbody .= get_lang('WorkName')." : ".substr($my_cur_dir_path, 0, -1)."\n"; + $emailbody .= get_lang('UserName')." : ".api_get_person_name($user_data['firstname'], $user_data['lastname'])."\n"; $emailbody .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n"; - $emailbody .= get_lang('FileName')." : ".$title."\n\n".get_lang('DownloadLink')."\n"; - $emailbody .= api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&curdirpath=".$my_cur_dir_path."\n\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator'); + $emailbody .= get_lang('WorkName')." : ".$title."\n\n".get_lang('DownloadLink')."\n"; + $url = api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&id=".$work_id; + $emailbody .= Display::url($url, $url)." \n\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator'); - // Here we are forming one large header line - // Every header must be followed by a \n except the last - @api_mail('', $emailto, $emailsubject, $emailbody, $sender_name,$email_admin); - - $emailbody_user = get_lang('Dear')." ".$currentUserFirstName .' '.$currentUserLastName .", \n\n"; - $emailbody_user .= get_lang('MessageConfirmSendingOfTask')."\n".get_lang('CourseName')." : ".$_course['name']."\n"; - $emailbody_user .= get_lang('WorkName')." : ".substr($my_cur_dir_path, 0, -1)."\n"; - $emailbody_user .= get_lang('DateSent')." : ".api_format_date(api_get_local_time())."\n"; - $emailbody_user .= get_lang('FileName')." : ".$title."\n\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator');; - - //Mail to user - //var_dump($currentUserEmail, $emailsubject, $emailbody_user, $sender_name, $email_admin); - - @api_mail('', $currentUserEmail, $emailsubject, $emailbody_user, $sender_name, $email_admin); - } - } - $message = get_lang('DocAdd'); - //stats - if (!$Id) { - $Id = $insertId; + MessageManager::send_message_simple($user_id, $emailsubject, $emailbody); + } } - event_upload($Id); + $message = get_lang('DocAdd'); + event_upload($id); Display :: display_confirmation_message(get_lang('DocAdd'), false); } else { if (!empty($error_message)) { From 6f2229e4e9eb33b8c0919abd15a3ee41b6b43c57 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 16:43:12 +0200 Subject: [PATCH 06/45] Fixing document quota see #4483 --- main/document/document_quota.php | 55 +++++++++++++++++++++++-------- main/inc/lib/document.lib.php | 6 ++-- main/inc/lib/groupmanager.lib.php | 18 +++++++--- 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/main/document/document_quota.php b/main/document/document_quota.php index 57358ad5cc..5ac80892cc 100644 --- a/main/document/document_quota.php +++ b/main/document/document_quota.php @@ -3,6 +3,9 @@ $language_file = array('document'); require_once '../inc/global.inc.php'; + +require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; + $current_course_tool = TOOL_DOCUMENT; $this_section = SECTION_COURSES; @@ -15,34 +18,58 @@ $htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.pieRenderer.min.js'); $htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.donutRenderer.min.js'); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/jqplot/jquery.jqplot.min.css'); -$course_id = api_get_course_id(); -$session_id = api_get_session_id(); +$course_code = api_get_course_id(); +$course_id = api_get_course_int_id(); +$session_id = api_get_session_id(); +$group_id = api_get_group_id(); $session = array(); -$session_list = SessionManager::get_session_by_course($course_id); -$total_quota = DocumentManager::get_course_quota(); +$session_list = SessionManager::get_session_by_course($course_code); + +$total_quota_bytes = DocumentManager::get_course_quota(); -$only_base_quota = DocumentManager::documents_total_space(api_get_course_int_id(), 0, 0); +$quota_bytes = DocumentManager::documents_total_space($course_id, 0 , 0); -$course_quota = round($only_base_quota/$total_quota, 2)*100; -$session[] = array(get_lang('Course'), $course_quota); +$quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; -$used_quota = $course_quota; +$session[] = array(get_lang('Course').' ('.format_file_size($quota_bytes).')', $quota_percentage); + +$used_quota_bytes = $quota_bytes; if (!empty($session_list)) { foreach ($session_list as $session_data) { - $quota = intval(DocumentManager::documents_total_space(api_get_course_int_id(), null, $session_data['id'])); - if (!empty($quota)) { - $quota = round($quota/$total_quota, 2)*100; + $quota_percentage = 0; + $quota_bytes = intval(DocumentManager::documents_total_space($course_id, null, $session_data['id'])); + if (!empty($quota_bytes)) { + $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; } if ($session_id == $session_data['id']) { $session_data['name'] = $session_data['name'] . ' * '; } - $used_quota += $quota; - $session[] = array(addslashes($session_data['name']), $quota); + $used_quota_bytes += $quota_bytes; + $session[] = array(addslashes(get_lang('Session').': '.$session_data['name']).' ('.format_file_size($quota_bytes).')', $quota_percentage); + } +} + +$group_list = GroupManager::get_groups(); + +if (!empty($group_list)) { + foreach ($group_list as $group_data) { + $quota_percentage = 0; + $my_group_id = $group_data['id']; + $quota_bytes = intval(DocumentManager::documents_total_space($course_id, $my_group_id, 0)); + if (!empty($quota_bytes)) { + $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; + } + if ($group_id == $my_group_id) { + $group_data['name'] = $group_data['name'] . ' * '; + } + $used_quota_bytes += $quota_bytes; + $session[] = array(addslashes(get_lang('Group').': '.$group_data['name']).' ('.format_file_size($quota_bytes).')', $quota_percentage); } } +$quota_percentage = round(($total_quota_bytes - $used_quota_bytes)/$total_quota_bytes, 2)*100; -$session[] = array(addslashes(get_lang('ShowCourseQuotaUse')), 100 - $used_quota); +$session[] = array(addslashes(get_lang('ShowCourseQuotaUse')).' ('.format_file_size($total_quota_bytes - $used_quota_bytes).') ', $quota_percentage); $quota_data = json_encode($session); diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index f7baea4cb6..f8cec3fd9b 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -18,8 +18,7 @@ class DocumentManager { } /** - * @return the document folder quota for the current course, in bytes, or the default quota - * @todo eliminate globals + * @return the document folder quota for the current course, in bytes, or the default quota */ public static function get_course_quota() { $course_info = api_get_course_info(); @@ -2432,8 +2431,7 @@ class DocumentManager { $course_quota_m = round($course_quota / 1000000); $already_consumed_space_m = round($already_consumed_space / 1000000, 2); $percentage = $already_consumed_space / $course_quota * 100; - $percentage = round($percentage, 1); - //$message = "You are currently using %s (%s) of your %s."; + $percentage = round($percentage, 1); $message = get_lang('YouAreCurrentlyUsingXOfYourX'); $message = sprintf($message, $already_consumed_space_m, $percentage.'%',$course_quota_m.' '); echo Display::div($message, array('id'=>'document_quota')); diff --git a/main/inc/lib/groupmanager.lib.php b/main/inc/lib/groupmanager.lib.php index 130ece1c63..1fec8ea884 100644 --- a/main/inc/lib/groupmanager.lib.php +++ b/main/inc/lib/groupmanager.lib.php @@ -64,6 +64,17 @@ class GroupManager { //GROUP FUNCTIONS private function __construct() { } + + public static function get_groups() { + $table_group = Database :: get_course_table(TABLE_GROUP); + $course_id = api_get_course_int_id(); + + $sql = "SELECT * FROM $table_group WHERE c_id = $course_id "; + $result = Database::query($sql); + return Database::store_result($result, 'ASSOC'); + + } + /** * Get list of groups for current course. * @param int $category The id of the category from which the groups are @@ -72,8 +83,7 @@ class GroupManager { * @return array An array with all information about the groups. */ public static function get_group_list ($category = null, $course_code = null) { - $my_user_id = api_get_user_id(); - $my_status_of_user_in_course = ''; + $my_user_id = api_get_user_id(); /* if ($course_code != null) { @@ -1374,10 +1384,10 @@ class GroupManager { } if (!empty($groups)) { array_filter($groups); - } - + } return $groups; } + /* Group functions - these take virtual/linked courses into account when necessary */ From b6fe0c5b8fdc7242d7a29f81e7ec7d29a2120301 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 19:21:15 +0200 Subject: [PATCH 07/45] Fixing bug when sending notifications see BT#4776 --- main/inc/lib/notification.lib.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/main/inc/lib/notification.lib.php b/main/inc/lib/notification.lib.php index ad9dad2095..d0339c08d1 100644 --- a/main/inc/lib/notification.lib.php +++ b/main/inc/lib/notification.lib.php @@ -52,8 +52,15 @@ class Notification extends Model { public function __construct() { $this->table = Database::get_main_table(TABLE_NOTIFICATION); - $this->admin_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); //api_get_setting('siteName') - $this->admin_email = api_get_setting('emailAdministrator'); + + $this->admin_email = api_get_setting('noreply_email_address'); + $this->admin_name = api_get_setting('siteName'); + + // If no-reply email doesn't exist use the admin email + if (empty($this->admin_email)) { + $this->admin_email = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); + $this->admin_name = api_get_setting('emailAdministrator'); + } } /** @@ -62,11 +69,19 @@ class Notification extends Model { */ public function send($frec = NOTIFY_MESSAGE_DAILY) { $notifications = $this->find('all',array('where'=>array('sent_at IS NULL AND send_freq = ?'=>$frec))); + + if (!empty($notifications)) { foreach ($notifications as $item_to_send) { //Sending email - api_mail_html($item_to_send['dest_mail'], $item_to_send['dest_mail'], Security::filter_terms($item_to_send['title']), Security::filter_terms($item_to_send['content']), $this->admin_name, $this->admin_email); + api_mail_html($item_to_send['dest_mail'], + $item_to_send['dest_mail'], + Security::filter_terms($item_to_send['title']), + Security::filter_terms($item_to_send['content']), + $this->admin_name, + $this->admin_email + ); if ($this->debug) { error_log('Sending message to: '.$item_to_send['dest_mail']); } //Updating From 6ce8a632205071950bff6f645f28facf1143efe4 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 10 Aug 2012 19:22:22 +0200 Subject: [PATCH 08/45] Fixing variable order --- main/inc/lib/notification.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/notification.lib.php b/main/inc/lib/notification.lib.php index d0339c08d1..79e86507a7 100644 --- a/main/inc/lib/notification.lib.php +++ b/main/inc/lib/notification.lib.php @@ -58,8 +58,8 @@ class Notification extends Model { // If no-reply email doesn't exist use the admin email if (empty($this->admin_email)) { - $this->admin_email = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); - $this->admin_name = api_get_setting('emailAdministrator'); + $this->admin_email = api_get_setting('emailAdministrator'); + $this->admin_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); } } From 31ef83827c215b2162eaad12bfcb97254ef55cbc Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 13 Aug 2012 08:40:03 +0200 Subject: [PATCH 09/45] Minor - fixing CSS style --- main/css/base.css | 53 ++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/main/css/base.css b/main/css/base.css index 60c28925bf..55e4d58676 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -2550,14 +2550,12 @@ div.admin_section h4 { box-shadow: 0 1px 3px rgba(0,0,0,0.1); position: relative; - background-image: -ms-linear-gradient(top, #992800, #C83F25); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#992800), to(#C83F25)); - background-image: -webkit-linear-gradient(top, #992800, #C83F25); - background-image: -o-linear-gradient(top, #992800, #C83F25); + background-image: -ms-linear-gradient(top, #FDFDFD, #F3F5F7); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#FDFDFD), to(#F3F5F7)); + background-image: -webkit-linear-gradient(top, #FDFDFD, #F3F5F7); + background-image: -o-linear-gradient(top, #FDFDFD, #F3F5F7); background-image: -moz-linear-gradient(top, #FDFDFD, #F3F5F7); - background-image: linear-gradient(top, #992800, #C83F25); - - + background-image: linear-gradient(top, #FDFDFD, #F3F5F7); } .ribbon .rib { @@ -2604,8 +2602,7 @@ div.admin_section h4 { background-image: -webkit-linear-gradient(top, #992800, #C83F25); background-image: -o-linear-gradient(top, #992800, #C83F25); background-image: -moz-linear-gradient(top, #992800, #C83F25); - background-image: linear-gradient(top, #992800, #C83F25); - + background-image: linear-gradient(top, #992800, #C83F25); border-top: 1px solid #C56E5B; border-bottom: 1px solid #7A290F; @@ -4593,27 +4590,27 @@ data table /* Only for Firefox */ @-moz-document url-prefix() { select#question_type_hidden option { - padding: 10px 0px 10px 40px; - background-repeat:no-repeat; + padding: 10px 0px 10px 40px; + background-repeat:no-repeat; + } + select#question_type_hidden option[value="1"] {background-image: url(../img/icons/32/mcua.gif);} + select#question_type_hidden option[value="2"] {background-image: url(../img/icons/32/mcma.gif);} + select#question_type_hidden option[value="3"] {background-image: url(../img/icons/32/fill_in_blanks.gif);} + select#question_type_hidden option[value="4"] {background-image: url(../img/icons/32/matching.gif);} + select#question_type_hidden option[value="5"] {background-image: url(../img/icons/32/open_answer.gif);} + select#question_type_hidden option[value="6"] {background-image: url(../img/icons/32/hotspot.gif);} + + select#question_type_hidden option[value="7"] {background-image: url(../img/icons/32/mcma.gif);} + select#question_type_hidden option[value="8"] {background-image: url(../img/icons/32/mcma.gif);} + + select#question_type_hidden option[value="9"] {background-image: url(../img/icons/32/mcmac.gif);} + select#question_type_hidden option[value="10"] {background-image: url(../img/icons/32/mcuao.gif);} + select#question_type_hidden option[value="11"] {background-image: url(../img/icons/32/mcmao.gif);} + select#question_type_hidden option[value="12"] {background-image: url(../img/icons/32/mcmaco.gif);} + select#question_type_hidden option[value="13"] {background-image: url(../img/icons/32/audio_question.png);} + select#question_type_hidden option[value="14"] {background-image: url(../img/icons/32/mcmagl.gif);} } -select#question_type_hidden option[value="1"] {background-image: url(../img/icons/32/mcua.gif);} -select#question_type_hidden option[value="2"] {background-image: url(../img/icons/32/mcma.gif);} -select#question_type_hidden option[value="3"] {background-image: url(../img/icons/32/fill_in_blanks.gif);} -select#question_type_hidden option[value="4"] {background-image: url(../img/icons/32/matching.gif);} -select#question_type_hidden option[value="5"] {background-image: url(../img/icons/32/open_answer.gif);} -select#question_type_hidden option[value="6"] {background-image: url(../img/icons/32/hotspot.gif);} - -select#question_type_hidden option[value="7"] {background-image: url(../img/icons/32/mcma.gif);} -select#question_type_hidden option[value="8"] {background-image: url(../img/icons/32/mcma.gif);} - -select#question_type_hidden option[value="9"] {background-image: url(../img/icons/32/mcmac.gif);} -select#question_type_hidden option[value="10"] {background-image: url(../img/icons/32/mcuao.gif);} -select#question_type_hidden option[value="11"] {background-image: url(../img/icons/32/mcmao.gif);} -select#question_type_hidden option[value="12"] {background-image: url(../img/icons/32/mcmaco.gif);} -select#question_type_hidden option[value="13"] {background-image: url(../img/icons/32/audio_question.png);} -select#question_type_hidden option[value="14"] {background-image: url(../img/icons/32/mcmagl.gif);} -} .btn-success.btn-install{ float: right; From e85be7bc491fd56143bf98ef43180b345c20b281 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 13 Aug 2012 09:09:15 +0200 Subject: [PATCH 10/45] Fixing bug when entering the exercise_reminder.php and there's no alert if the time limit is on could fix bug #5304 --- main/exercice/exercise.class.php | 14 ++++++++++---- main/exercice/exercise_reminder.php | 9 +++------ main/exercice/exercise_submit.php | 4 +--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 2867ea6ff3..aed3e4dad4 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -1662,8 +1662,7 @@ class Exercise { send_form(); } }); - $('#clock_warning').dialog('open'); - + $('#clock_warning').dialog('open'); $('#counter_to_redirect').epiclock({ mode: $.epiclock.modes.countdown, @@ -1677,7 +1676,12 @@ class Exercise { function send_form() { //console.log('send_form'); - $('#exercise_form').submit(); + if ($('#exercise_form').length) { + $('#exercise_form').submit(); + } else { + //In reminder + final_submit(); + } } function onExpiredTimeExercise() { @@ -3601,7 +3605,9 @@ class Exercise { } function return_time_left_div() { - return '
'; + $html = ''; + $html .= '
'; + return $html; } } endif; \ No newline at end of file diff --git a/main/exercice/exercise_reminder.php b/main/exercice/exercise_reminder.php index 00165ce93a..c9f460eb53 100644 --- a/main/exercice/exercise_reminder.php +++ b/main/exercice/exercise_reminder.php @@ -112,14 +112,14 @@ if ($time_control) { echo Display::div('', array('id'=>'message')); -echo ''; - - echo ''; - + echo '
From a8d7a1366477820dec002148895962eca0889559 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 13 Aug 2012 09:22:05 +0200 Subject: [PATCH 11/45] Minor - cosmetic changes --- main/exercice/exercise.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index aed3e4dad4..1571b4daea 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -646,7 +646,7 @@ class Exercise { $sound = $this->sound; $type = $this->type; $attempts = $this->attempts; - $feedback_type = $this->feedback_type; + $feedback_type = $this->feedback_type; $random = $this->random; $random_answers = $this->random_answers; $active = $this->active; @@ -854,7 +854,7 @@ class Exercise { $form_title = get_lang('NewEx'); } - $form->addElement('header', '', $form_title); + $form->addElement('header', $form_title); // title $form->addElement('text', 'exerciseTitle', get_lang('ExerciseName'), array('class' => 'span6','id'=>'exercise_title')); @@ -1008,7 +1008,7 @@ class Exercise { $var = Exercise::selectTimeLimit(); - if (($this->start_time!='0000-00-00 00:00:00')) + if (($this->start_time != '0000-00-00 00:00:00')) $form->addElement('html','
'); else $form->addElement('html','