Ver Fonte

Fixing missing changes from latest merge

Julio Montoya há 12 anos atrás
pai
commit
9d6ec31187

+ 3 - 1
main/gradebook/lib/gradebook_functions.inc.php

@@ -583,7 +583,7 @@ function get_list_gradebook_certificates_by_user_id ($user_id,$cat_id=null) {
     return $list_certificate;
 }
 
-function get_user_certificate_content($user_id, $course_code, $is_preview = false) {
+function get_user_certificate_content($user_id, $course_code, $is_preview = false, $hide_print_button = false) {
     //generate document HTML
     $content_html       = DocumentManager::replace_user_info_into_html($user_id, $course_code, $is_preview);
 
@@ -597,8 +597,10 @@ function get_user_certificate_content($user_id, $course_code, $is_preview = fals
     $new_content_html   = str_replace('/main/img/', api_get_path(WEB_IMG_PATH), $new_content_html);
 
     //add print header
+    if ($hide_print_button == false) {
     $print  = '<style media="print" type="text/css">#print_div {visibility:hidden;}</style>';
     $print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="'.api_get_path(WEB_CODE_PATH).'img/printmgr.gif" alt="' . get_lang('Print') . '" /> ' . get_lang('Print') . '</a>';
+    }
 
     //add header
     $new_content_html = $new_content[0].$print.'</head>'.$new_content_html;

+ 42 - 0
main/survey/survey.lib.php

@@ -49,9 +49,49 @@ class survey_manager
         return $code.$num;
     }
 
+    /**
+     * Deletes all survey invitations of a user
+     * @param int $user_id
+     * @return boolean
+     * @assert ('') === false
+     */
+    public static function delete_all_survey_invitations_by_user($user_id) {
+        $user_id = intval($user_id);
+       
+        if (empty($user_id)) {
+            return false;
+        }
+        $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
+        $table_survey = Database :: get_course_table(TABLE_SURVEY);
+        
+        $sql = "SELECT survey_invitation_id, survey_code FROM $table_survey_invitation WHERE user = '$user_id' AND c_id <> 0 ";
+        $result = Database::query($sql);
+        $deleted = array();
+       	while ($row = Database::fetch_array($result ,'ASSOC')){
+            $survey_invitation_id = $row['survey_invitation_id'];
+            $survey_code = $row['survey_code'];
+            $sql2 = "DELETE FROM $table_survey_invitation WHERE survey_invitation_id = '$survey_invitation_id' AND c_id <> 0";
+            if (Database::query($sql2)) {
+                $sql3 = "UPDATE $table_survey SET invited = invited-1 ".
+                       " WHERE c_id  <> 0 AND code ='$survey_code'";
+                Database::query($sql3);
+            }
+        }
+    }
+
+     /**
+     *
+     * @param type $course_code
+     * @param type $session_id
+     * @return type
+     * @assert ('') === false
+     */
     public static function get_surveys($course_code, $session_id = 0)
     {
         $table_survey = Database :: get_course_table(TABLE_SURVEY);
+        if (empty($course_code)) {
+            return false;
+        }
         $course_info = api_get_course_info($course_code);
         $session_condition = api_get_session_condition($session_id, true, true);
 
@@ -1725,6 +1765,7 @@ class survey_question
                             $_GET['action']
                         ).'&type='.Security::remove_XSS($_GET['type']).''
                     );
+                    exit;
                 }
             }
         }
@@ -4602,6 +4643,7 @@ class SurveyUtil
         $sender_email = $_user['mail'];
         $sender_user_id = api_get_user_id();
 
+		$replyto = array();
         if (api_get_setting('survey_email_sender_noreply') == 'noreply') {
             $noReply = api_get_setting('noreply_email_address');
             if (!empty($noReply)) {