diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index c05e7bf036..9a63267549 100644 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -395,7 +395,7 @@ class survey_manager { if ($shared) { $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY); // Deleting the survey - $sql = "DELETE FROM $table_survey WHERE survey_id='".Database::escape_string($survey_id)."'"; + $sql = "DELETE FROM $table_survey WHERE c_id = $course_id AND survey_id='".Database::escape_string($survey_id)."'"; $res = Database::query($sql); } else { $sql = "DELETE FROM $table_survey WHERE c_id = $course_id AND survey_id='".Database::escape_string($survey_id)."'"; @@ -3835,14 +3835,14 @@ class SurveyUtil { // Send the email if checkboxed if (($new_user || $reminder == 1) && $sendmail != 0) { // Make a change for absolute url - if (isset($invitation_text)) { - $invitation_text = api_html_entity_decode($invitation_text, ENT_QUOTES); + if (isset($invitation_text)) { + $invitation_text = api_html_entity_decode($invitation_text, ENT_QUOTES); $invitation_text = str_replace('src="../../', 'src="'.api_get_path(WEB_PATH), $invitation_text); $invitation_text = trim(stripslashes($invitation_text)); - } + } SurveyUtil::send_invitation_mail($value, $invitation_code, $invitation_title, $invitation_text); $counter++; - } + } } return $counter; // Number of invitations sent } @@ -3857,7 +3857,7 @@ class SurveyUtil { function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text) { global $_user, $_course, $_configuration; - $portal_url = $_configuration['root_web']; + $portal_url = api_get_path(WEB_PATH); if ($_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { @@ -3866,7 +3866,7 @@ class SurveyUtil { } } // Replacing the **link** part with a valid link for the user - $survey_link = $portal_url.$_configuration['code_append'].'survey/'.'fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$invitation_code; + $survey_link = $portal_url.'main/survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$invitation_code; $text_link = ''.get_lang('ClickHereToAnswerTheSurvey')."
\r\n
\r\n".get_lang('OrCopyPasteTheFollowingUrl')."
\r\n ".$survey_link; $replace_count = 0; @@ -3900,7 +3900,7 @@ class SurveyUtil { $sender_name = $noreply; $sender_email = $noreply; } - } + } @api_mail_html($recipient_name, $recipient_email, $invitation_title, $full_invitation_text, $sender_name, $sender_email, $replyto); } diff --git a/main/survey/survey_invite.php b/main/survey/survey_invite.php index 76d3e30262..a8e0e20f2e 100644 --- a/main/survey/survey_invite.php +++ b/main/survey/survey_invite.php @@ -111,13 +111,13 @@ $users->setElementTemplate(' '); -$users->setButtonAttributes('add', array('class' => 'arrowr')); -$users->setButtonAttributes('remove', array('class' => 'arrowl')); +$users->setButtonAttributes('add', array('class' => 'btn arrowr')); +$users->setButtonAttributes('remove', array('class' => 'btn arrowl')); // Additional users -$form->addElement('textarea', 'additional_users', array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')), array('cols' => 50, 'rows' => 2)); +$form->addElement('textarea', 'additional_users', array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')), array('class' => 'span6', 'rows' => 2)); // The title of the mail -$form->addElement('text', 'mail_title', get_lang('MailTitle'), array('size' => '80')); +$form->addElement('text', 'mail_title', get_lang('MailTitle'), array('class' => 'span6')); // The text of the mail $form->addElement('html_editor', 'mail_text', array(get_lang('MailText'), get_lang('UseLinkSyntax')), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '150')); @@ -134,7 +134,7 @@ $form->addElement('style_submit_button', 'submit', get_lang('PublishSurvey'), 'c $form->addRule('mail_title', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('mail_text', get_lang('ThisFieldIsRequired'), 'required'); -$portal_url = $_configuration['root_web']; +$portal_url = api_get_path(WEB_PATH); if ($_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { @@ -144,11 +144,11 @@ if ($_configuration['multiple_access_urls']) { } // Show the URL that can be used by users to fill a survey without invitation -$auto_survey_link = $portal_url.$_configuration['code_append']. - 'survey/'.'fillsurvey.php?course='.$_course['sysCode']. - '&invitationcode=auto&scode='.$survey_data['survey_code']; -$form->addElement('static',null, null, '

' . get_lang('AutoInviteLink')); -$form->addElement('static',null, null, $auto_survey_link); +$auto_survey_link = $portal_url.'main/survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode=auto&scode='.$survey_data['survey_code']; + +$form->addElement('label', null, get_lang('AutoInviteLink')); +$form->addElement('label', null, $auto_survey_link); + if ($form->validate()) { $values = $form->exportValues(); // Save the invitation mail @@ -164,7 +164,7 @@ if ($form->validate()) { $additional_users[$i] = trim($additional_users[$i]); } $counter_additional_users = SurveyUtil::save_invitations($additional_users, $values['mail_title'], - $values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']); + $values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']); // Updating the invited field in the survey table SurveyUtil::update_count_invited($survey_data['code']); $total_count = $count_course_users + $counter_additional_users; @@ -185,4 +185,4 @@ if ($form->validate()) { } // Footer -Display :: display_footer(); +Display :: display_footer(); \ No newline at end of file