From 7586135936b335d8c0ed48a7e84e869c7adb7fdb Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 22 Jun 2020 15:44:21 +0200 Subject: [PATCH] Minor - format code, remove unused code --- main/inc/lib/Compilatio.php | 33 +++++++++------------------ main/plagiarism/compilatio/upload.php | 9 ++++---- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/main/inc/lib/Compilatio.php b/main/inc/lib/Compilatio.php index 5d3904df27..4c1175891e 100644 --- a/main/inc/lib/Compilatio.php +++ b/main/inc/lib/Compilatio.php @@ -1,9 +1,10 @@ soapcli)) { return "Error in constructor compilatio() $this->soapcli"; } - $idDocument = $this->soapcli->__call( + + return $this->soapcli->__call( 'addDocumentBase64', [ $this->key, @@ -272,8 +274,6 @@ class Compilatio base64_encode($content), ] ); - - return $idDocument; } catch (SoapFault $fault) { return "Erreur sendDoc()".$fault->faultcode." ".$fault->faultstring; } @@ -293,9 +293,8 @@ class Compilatio return "Error in constructor compilatio() ".$this->soapcli; } $param = [$this->key, $compiHash]; - $idDocument = $this->soapcli->__call('getDocument', $param); - return $idDocument; + return $this->soapcli->__call('getDocument', $param); } catch (SoapFault $fault) { return "Erreur getDoc()".$fault->faultcode." ".$fault->faultstring; } @@ -315,9 +314,8 @@ class Compilatio return "Error in constructor compilatio() ".$this->soapcli; } $param = [$this->key, $compiHash]; - $idDocument = $this->soapcli->__call('getDocumentReportUrl', $param); - return $idDocument; + return $this->soapcli->__call('getDocumentReportUrl', $param); } catch (SoapFault $fault) { return "Erreur getReportUrl()".$fault->faultcode." ".$fault->faultstring; } @@ -375,9 +373,8 @@ class Compilatio return "Error in constructor compilatio() ".$this->soapcli; } $param = [$this->key]; - $resultat = $this->soapcli->__call('getAccountQuotas', $param); - return $resultat; + return $this->soapcli->__call('getAccountQuotas', $param); } catch (SoapFault $fault) { return "Erreur getQuotas()".$fault->faultcode." ".$fault->faultstring; } @@ -412,7 +409,6 @@ class Compilatio { $loading = Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin'); $loading .= ' '; - //$refreshReturn = Display::url('javascript:window.location.reload(false);', $loading); switch ($status) { case 'ANALYSE_IN_QUEUE': @@ -444,8 +440,6 @@ class Compilatio $highThreshold ) { $index = round($index); - $pour = round((50 * $index) / 100); - $return = ''; $class = 'error'; if ($index < $weakThreshold) { $class = 'success'; @@ -455,9 +449,7 @@ class Compilatio } } - $return .= Display::bar_progress($index, true, null, $class); - - return $return; + return Display::bar_progress($index, true, null, $class); } /** @@ -524,7 +516,7 @@ class Compilatio $courseId = (int) $courseId; $table = Database::get_course_table(TABLE_PLAGIARISM); - $sql = "SELECT compilatio_id FROM $table + $sql = "SELECT compilatio_id FROM $table WHERE document_id = $documentId AND c_id= $courseId"; $result = Database::query($sql); $result = Database::fetch_object($result); @@ -543,7 +535,6 @@ class Compilatio */ public function giveWorkIdState($workId) { - $compilatioImgFolder = api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/img/'; $courseId = api_get_course_int_id(); $compilatioId = $this->getCompilatioId($workId, $courseId); @@ -611,8 +602,6 @@ class Compilatio } } - $result = $workId.'|'.$actionCompilatio.'|'.$status.'|'; - - return $result; + return $workId.'|'.$actionCompilatio.'|'.$status.'|'; } } diff --git a/main/plagiarism/compilatio/upload.php b/main/plagiarism/compilatio/upload.php index 53c1b32d0f..04d8740590 100644 --- a/main/plagiarism/compilatio/upload.php +++ b/main/plagiarism/compilatio/upload.php @@ -1,4 +1,5 @@ 0) { @@ -221,13 +222,13 @@ function compilatioUpdateWorkDocument($docId, $courseId) $workTitle = getWorkTitle($docId, $courseId); if ($extensionFile != '' && $urlFile_ext == '') { - /* Rename the files in the FS whit the extension*/ + /* Rename the files in the FS with the extension */ $shortFilename = $filename; $cleanWorkTitle = api_replace_dangerous_char($workTitle); $newestFilename = $shortFilename.'_'.$cleanWorkTitle; rename($coursePath.$urlFile, $coursePath.$work_folder.$newestFilename); /*rename the db's input with the extension*/ - $sql = "UPDATE $workTable SET url='".$work_folder.$newestFilename."' + $sql = "UPDATE $workTable SET url='".$work_folder.$newestFilename."' WHERE c_id=$courseId AND id=$docId"; Database::query($sql); }