Minor - format code, remove unused code

webservicelpcreate
Julio Montoya 5 years ago
parent 88fa85c433
commit 7586135936
  1. 33
      main/inc/lib/Compilatio.php
  2. 9
      main/plagiarism/compilatio/upload.php

@ -1,9 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Build the comunication with the SOAP server Compilatio.net
* call severals methods for the file management in Compilatio.net.
* Build the communication with the SOAP server Compilatio.net
* call several methods for the file management in Compilatio.net.
*
* @version: 2.0
*/
@ -261,7 +262,8 @@ class Compilatio
if (!is_object($this->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 .= '&nbsp;';
//$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.'|';
}
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../inc/global.inc.php';
@ -91,7 +92,7 @@ function sendDocument($documentId, $courseInfo)
compilatioUpdateWorkDocument($documentId, $courseId);
$workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$query = "SELECT * FROM $workTable
$query = "SELECT * FROM $workTable
WHERE id = $documentId AND c_id= $courseId";
$sqlResult = Database::query($query);
$doc = Database::fetch_object($sqlResult);
@ -161,7 +162,7 @@ function getWorkTitle($docId, $courseId)
$courseId = (int) $courseId;
$workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$sql = "SELECT title FROM $workTable
$sql = "SELECT title FROM $workTable
WHERE c_id= $courseId AND id = $docId";
$res = Database::query($sql);
if (Database::num_rows($res) > 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);
}

Loading…
Cancel
Save