$update_photo_file = false;
 // Error Checking
 switch ($STEP) {
     case 2:
         /**
          * Not-Required (for edit) field "photo_file" / Select Local Photo.
          */
         if (isset($_FILES["photo_file"])) {
             switch ($_FILES["photo_file"]["error"]) {
                 case 0:
                     if (@in_array($photo_mimetype = strtolower(trim($_FILES["photo_file"]["type"])), array_keys($VALID_MIME_TYPES))) {
                         if (($photo_filesize = (int) trim($_FILES["photo_file"]["size"])) <= $VALID_MAX_FILESIZE) {
                             $update_photo_file = true;
                             $PROCESSED["photo_mimetype"] = $photo_mimetype;
                             $PROCESSED["photo_filesize"] = $photo_filesize;
                             $PROCESSED["photo_filename"] = useable_filename(trim($_FILES["photo_file"]["name"]));
                             $photo_file_extension = strtoupper($VALID_MIME_TYPES[strtolower(trim($_FILES["photo_file"]["type"]))]);
                             if (!defined("COMMUNITY_STORAGE_GALLERIES") || !@is_dir(COMMUNITY_STORAGE_GALLERIES) || !@is_writable(COMMUNITY_STORAGE_GALLERIES)) {
                                 $ERROR++;
                                 $ERRORSTR[] = "There is a problem with the gallery storage directory on the server; the MEdTech Unit has been informed of this error, please try again later.";
                                 application_log("error", "The community gallery storage path [" . COMMUNITY_STORAGE_GALLERIES . "] does not exist or is not writable.");
                             }
                         }
                     } else {
                         $ERROR++;
                         $ERRORSTR[] = "The file that you have uploaded does not appear to be a valid image. Please ensure that you upload a JPEG, GIF or PNG file.";
                     }
                     break;
                 case 1:
                 case 2:
                     $ERROR++;
 switch ($STEP) {
     case 2:
         if (isset($_FILES["uploaded_file"])) {
             switch ($_FILES["uploaded_file"]["error"]) {
                 case 0:
                     if (($file_filesize = (int) trim($_FILES["uploaded_file"]["size"])) <= $VALID_MAX_FILESIZE) {
                         $query = "\n\t\t\t\t\t\t\t\t\t\t\t\tSELECT `file_version`\n\t\t\t\t\t\t\t\t\t\t\t\tFROM `community_share_file_versions`\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `csfile_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\tAND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . "\n\t\t\t\t\t\t\t\t\t\t\t\tAND `community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\tAND `file_active` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `file_version` DESC\n\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 0, 1";
                         $result = $db->GetRow($query);
                         if ($result) {
                             $PROCESSED["file_version"] = $result["file_version"] + 1;
                         } else {
                             $PROCESSED["file_version"] = 1;
                         }
                         $PROCESSED["file_mimetype"] = strtolower(trim($_FILES["uploaded_file"]["type"]));
                         $PROCESSED["file_filesize"] = $file_filesize;
                         $PROCESSED["file_filename"] = useable_filename(trim($_FILES["uploaded_file"]["name"]));
                         if (!defined("COMMUNITY_STORAGE_DOCUMENTS") || !@is_dir(COMMUNITY_STORAGE_DOCUMENTS) || !@is_writable(COMMUNITY_STORAGE_DOCUMENTS)) {
                             $ERROR++;
                             $ERRORSTR[] = "There is a problem with the document storage directory on the server; the MEdTech Unit has been informed of this error, please try again later.";
                             application_log("error", "The community document storage path [" . COMMUNITY_STORAGE_DOCUMENTS . "] does not exist or is not writable.");
                         }
                     }
                     break;
                 case 1:
                 case 2:
                     $ERROR++;
                     $ERRORSTR[] = "The file that was uploaded is larger than " . readable_size($VALID_MAX_FILESIZE) . ". Please make the file smaller and try again.";
                     break;
                 case 3:
                     $ERROR++;
                     $ERRORSTR[] = "The file that was uploaded did not complete the upload process or was interrupted; please try again.";
                                    $cols[] = "Not Attempted";
                                    $cols[] = "0";
                                    $cols[] = $quiz_value;
                                    $cols[] = "0%";
                                }
                                echo '"' . implode('","', $cols) . '"', "\n";
                            }
                            $contents = ob_get_contents();
                            ob_clear_open_buffers();
                            header("Pragma: public");
                            header("Expires: 0");
                            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                            header("Content-Type: application/force-download");
                            header("Content-Type: application/octet-stream");
                            header("Content-Type: text/csv");
                            header("Content-Disposition: attachment; filename=\"" . date("Y-m-d") . "_" . useable_filename($quiz_record["content_title"] . "_NOT_ATTEMPTED_" . $quiz_record["quiz_title"]) . ".csv\"");
                            header("Content-Length: " . strlen($contents));
                            header("Content-Transfer-Encoding: binary\n");
                            echo $contents;
                            exit;
                        }
                        ?>
						<script type="text/javascript">
							jQuery(function(){
								
								jQuery(".respondents").click(function(){
									jQuery.ajax({
										type: 'POST',
										url: '<?php 
                        echo ENTRADA_URL . "/admin/" . $MODULE . '?section=results';
                        ?>
 // Error Checking
 switch ($STEP) {
     case 2:
         if (isset($_FILES["photo_files"]) && is_array($_FILES["photo_files"])) {
             if (!defined("COMMUNITY_STORAGE_GALLERIES") || !@is_dir(COMMUNITY_STORAGE_GALLERIES) || !@is_writable(COMMUNITY_STORAGE_GALLERIES)) {
                 $error_current++;
                 $ERROR++;
                 $ERRORSTR[] = "There is a problem with the storage directory on the server; the system administrator has been informed of this error, please try again later.";
                 application_log("error", "The community gallery storage path [" . COMMUNITY_STORAGE_GALLERIES . "] does not exist or is not writable.");
             } else {
                 foreach ($_FILES["photo_files"]["name"] as $tmp_photo_id => $photo_name) {
                     $PROCESSED = array();
                     $photo_id = 0;
                     $error_current = 0;
                     $photo_number = $tmp_photo_id + 1;
                     $photo_name = useable_filename(clean_input($photo_name, "trim"));
                     if ($photo_name != "") {
                         if (isset($_FILES["photo_files"]["error"][$tmp_photo_id])) {
                             switch ($_FILES["photo_files"]["error"][$tmp_photo_id]) {
                                 case 0:
                                     if (@in_array($photo_mimetype = strtolower(trim($_FILES["photo_files"]["type"][$tmp_photo_id])), array_keys($VALID_MIME_TYPES))) {
                                         $photo_filesize = (int) trim($_FILES["photo_files"]["size"][$tmp_photo_id]);
                                         if ($photo_filesize && $photo_filesize <= $VALID_MAX_FILESIZE) {
                                             $PROCESSED["photo_mimetype"] = $photo_mimetype;
                                             $PROCESSED["photo_filesize"] = $photo_filesize;
                                             $PROCESSED["photo_filename"] = $photo_name;
                                             $photo_file_extension = strtoupper($VALID_MIME_TYPES[strtolower(trim($_FILES["photo_files"]["type"][$tmp_photo_id]))]);
                                         }
                                     } else {
                                         $error_current++;
                                         $ERROR++;
Beispiel #5
0
                     $cols[] = "[WARNING]: Your weighting totals do not equal 100% or this student is missing a weighted assessment. Current weighted total worth " . $weight["total"] . "% of total course mark.";
                 }
             }
             echo "\"" . implode("\",\"", $cols) . "\"", "\n";
         }
         if ($export_weighted_grades) {
             echo "\n\n\n";
             echo "\"[NOTE]: Weighted Total grades account for student specific weighting exceptions\"\n";
         }
     }
     $contents = ob_get_contents();
     ob_clear_open_buffers();
     if (isset($COHORT)) {
         $filename = date("Y-m-d") . "_" . useable_filename($course_details["course_code"] . "_" . clean_input(groups_get_name($COHORT), array("trim", "file")) . "_gradebook") . ".csv\"";
     } else {
         $filename = date("Y-m-d") . "_" . useable_filename($course_details["course_code"] . "_gradebook") . ".csv\"";
     }
     header("Pragma: public");
     header("Expires: 0");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-Type: application/force-download");
     header("Content-Type: application/octet-stream");
     header("Content-Type: text/csv");
     header("Content-Disposition: attachment; filename=\"" . $filename);
     header("Content-Length: " . strlen($contents));
     header("Content-Transfer-Encoding: binary\n");
     echo $contents;
     exit;
 } else {
     $ERROR++;
     $ERRORSTR[] = "In order to view an assessment's grades you must provide some valid assessment identifiers.";
 } else {
     $COPYRIGHT = false;
 }
 // Error Checking
 switch ($STEP) {
     case 2:
         //var_dump($_FILES["uploaded_file"]);
         if (isset($_FILES["uploaded_file"]) && is_array($_FILES["uploaded_file"])) {
             foreach ($_FILES["uploaded_file"]["name"] as $tmp_file_id => $file_name) {
                 switch ($_FILES["uploaded_file"]["error"][$tmp_file_id]) {
                     case 0:
                         if (($file_filesize = (int) trim($_FILES["uploaded_file"]["size"][$tmp_file_id])) <= $VALID_MAX_FILESIZE) {
                             $PROCESSED["file_version"] = 1;
                             $PROCESSED["file_mimetype"] = strtolower(trim($_FILES["uploaded_file"]["type"][$tmp_file_id]));
                             $PROCESSED["file_filesize"] = $file_filesize;
                             $PROCESSED["file_filename"] = useable_filename(trim($file_name));
                             if (!defined("COMMUNITY_STORAGE_DOCUMENTS") || !@is_dir(COMMUNITY_STORAGE_DOCUMENTS) || !@is_writable(COMMUNITY_STORAGE_DOCUMENTS)) {
                                 $ERROR++;
                                 $ERRORSTR[] = "There is a problem with the document storage directory on the server; the MEdTech Unit has been informed of this error, please try again later.";
                                 application_log("error", "The community document storage path [" . COMMUNITY_STORAGE_DOCUMENTS . "] does not exist or is not writable.");
                             }
                         }
                         break;
                     case 1:
                     case 2:
                         $ERROR++;
                         $ERRORSTR[] = "The file that was uploaded is larger than " . readable_size($VALID_MAX_FILESIZE) . ". Please make the file smaller and try again.";
                         break;
                     case 3:
                         $ERROR++;
                         $ERRORSTR[] = "The file that was uploaded did not complete the upload process or was interrupted; please try again.";