Minor - flint fixes

pull/2970/head
Julio Montoya 6 years ago
parent 106100a53d
commit e13c12ed89
  1. 4
      main/inc/ajax/model.ajax.php
  2. 74
      main/inc/lib/Compilatio.php
  3. 11
      main/plagiarism/compilatio/compiladmin.php
  4. 6
      main/plagiarism/compilatio/upload.php
  5. 22
      main/work/work_list_all.php

@ -1266,7 +1266,7 @@ switch ($action) {
$columns = array_merge($columns, $plagiarismColumns); $columns = array_merge($columns, $plagiarismColumns);
$columns[] = 'actions'; $columns[] = 'actions';
} else { } else {
$columns = array('type', 'firstname', 'lastname', 'title', 'sent_date'); $columns = ['type', 'firstname', 'lastname', 'title', 'sent_date'];
$columns = array_merge($columns, $plagiarismColumns); $columns = array_merge($columns, $plagiarismColumns);
$columns[] = 'actions'; $columns[] = 'actions';
} }
@ -1292,7 +1292,7 @@ switch ($action) {
} }
if (isset($_GET['type']) && $_GET['type'] == 'simple') { if (isset($_GET['type']) && $_GET['type'] == 'simple') {
$columns = [ $columns = [
'type', 'title', 'qualification', 'sent_date', 'qualificator_id' 'type', 'title', 'qualification', 'sent_date', 'qualificator_id',
]; ];
$columns = array_merge($columns, $plagiarismColumns); $columns = array_merge($columns, $plagiarismColumns);
$columns[] = 'actions'; $columns[] = 'actions';

@ -3,12 +3,12 @@
/** /**
* Build the comunication with the SOAP server Compilatio.net * Build the comunication with the SOAP server Compilatio.net
* call severals methods for the file management in Compilatio.net * call severals methods for the file management in Compilatio.net.
* *
* Date: 26/05/16 * Date: 26/05/16
*
* @version:1.0 * @version:1.0
*/ */
class Compilatio class Compilatio
{ {
/** Identification key for the Compilatio account*/ /** Identification key for the Compilatio account*/
@ -25,7 +25,6 @@ class Compilatio
/** /**
* Compilatio constructor. * Compilatio constructor.
*
*/ */
public function __construct() public function __construct()
{ {
@ -59,19 +58,19 @@ class Compilatio
$this->key = $key; $this->key = $key;
if (!empty($urlsoap)) { if (!empty($urlsoap)) {
if (!empty($proxyHost)) { if (!empty($proxyHost)) {
$param = array( $param = [
'trace' => false, 'trace' => false,
'soap_version' => $soapVersion, 'soap_version' => $soapVersion,
'exceptions' => true, 'exceptions' => true,
'proxy_host' => '"'.$proxyHost.'"', 'proxy_host' => '"'.$proxyHost.'"',
'proxy_port' => $proxyPort, 'proxy_port' => $proxyPort,
); ];
} else { } else {
$param = array( $param = [
'trace' => false, 'trace' => false,
'soap_version' => $soapVersion, 'soap_version' => $soapVersion,
'exceptions' => true, 'exceptions' => true,
); ];
} }
$this->soapcli = new SoapClient($urlsoap, $param); $this->soapcli = new SoapClient($urlsoap, $param);
} else { } else {
@ -248,7 +247,7 @@ class Compilatio
} }
/** /**
* Method for the file load * Method for the file load.
* *
* @param $title * @param $title
* @param $description * @param $description
@ -266,24 +265,24 @@ class Compilatio
} }
$idDocument = $this->soapcli->__call( $idDocument = $this->soapcli->__call(
'addDocumentBase64', 'addDocumentBase64',
array( [
$this->key, $this->key,
utf8_encode(urlencode($title)), utf8_encode(urlencode($title)),
utf8_encode(urlencode($description)), utf8_encode(urlencode($description)),
utf8_encode(urlencode($filename)), utf8_encode(urlencode($filename)),
utf8_encode($mimeType), utf8_encode($mimeType),
base64_encode($content), base64_encode($content),
) ]
); );
return $idDocument; return $idDocument;
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
return ("Erreur sendDoc()".$fault->faultcode." ".$fault->faultstring); return "Erreur sendDoc()".$fault->faultcode." ".$fault->faultstring;
} }
} }
/** /**
* Method for recover a document's information * Method for recover a document's information.
* *
* @param $compiHash * @param $compiHash
* *
@ -293,19 +292,19 @@ class Compilatio
{ {
try { try {
if (!is_object($this->soapcli)) { if (!is_object($this->soapcli)) {
return ("Error in constructor compilatio() ".$this->soapcli); return "Error in constructor compilatio() ".$this->soapcli;
} }
$param = array($this->key, $compiHash); $param = [$this->key, $compiHash];
$idDocument = $this->soapcli->__call('getDocument', $param); $idDocument = $this->soapcli->__call('getDocument', $param);
return $idDocument; return $idDocument;
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
return ("Erreur getDoc()".$fault->faultcode." ".$fault->faultstring); return "Erreur getDoc()".$fault->faultcode." ".$fault->faultstring;
} }
} }
/** /**
* method for recover an url document's report * method for recover an url document's report.
* *
* @param $compiHash * @param $compiHash
* *
@ -315,19 +314,19 @@ class Compilatio
{ {
try { try {
if (!is_object($this->soapcli)) { if (!is_object($this->soapcli)) {
return ("Error in constructor compilatio() ".$this->soapcli); return "Error in constructor compilatio() ".$this->soapcli;
} }
$param = array($this->key, $compiHash); $param = [$this->key, $compiHash];
$idDocument = $this->soapcli->__call('getDocumentReportUrl', $param); $idDocument = $this->soapcli->__call('getDocumentReportUrl', $param);
return $idDocument; return $idDocument;
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
return ("Erreur getReportUrl()".$fault->faultcode." ".$fault->faultstring); return "Erreur getReportUrl()".$fault->faultcode." ".$fault->faultstring;
} }
} }
/** /**
* Method for deleting a Compialtio's account document * Method for deleting a Compialtio's account document.
* *
* @param $compiHash * @param $compiHash
* *
@ -337,17 +336,17 @@ class Compilatio
{ {
try { try {
if (!is_object($this->soapcli)) { if (!is_object($this->soapcli)) {
return ("Error in constructor compilatio() ".$this->soapcli); return "Error in constructor compilatio() ".$this->soapcli;
} }
$param = array($this->key, $compiHash); $param = [$this->key, $compiHash];
$this->soapcli->__call('deleteDocument', $param); $this->soapcli->__call('deleteDocument', $param);
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
return ("Erreur deldoc()".$fault->faultcode." ".$fault->faultstring); return "Erreur deldoc()".$fault->faultcode." ".$fault->faultstring;
} }
} }
/** /**
* Method for start the analysis for a document * Method for start the analysis for a document.
* *
* @param $compiHash * @param $compiHash
* *
@ -357,36 +356,37 @@ class Compilatio
{ {
try { try {
if (!is_object($this->soapcli)) { if (!is_object($this->soapcli)) {
return ("Error in constructor compilatio() ".$this->soapcli); return "Error in constructor compilatio() ".$this->soapcli;
} }
$param = array($this->key, $compiHash); $param = [$this->key, $compiHash];
$this->soapcli->__call('startDocumentAnalyse', $param); $this->soapcli->__call('startDocumentAnalyse', $param);
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
return ("Erreur startAnalyse()".$fault->faultcode." ".$fault->faultstring); return "Erreur startAnalyse()".$fault->faultcode." ".$fault->faultstring;
} }
} }
/** /**
* Method for recover the account's quota * Method for recover the account's quota.
*
* @return string * @return string
*/ */
public function getQuotas() public function getQuotas()
{ {
try { try {
if (!is_object($this->soapcli)) { if (!is_object($this->soapcli)) {
return ("Error in constructor compilatio() ".$this->soapcli); return "Error in constructor compilatio() ".$this->soapcli;
} }
$param = array($this->key); $param = [$this->key];
$resultat = $this->soapcli->__call('getAccountQuotas', $param); $resultat = $this->soapcli->__call('getAccountQuotas', $param);
return $resultat; return $resultat;
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
return ("Erreur getQuotas()".$fault->faultcode." ".$fault->faultstring); return "Erreur getQuotas()".$fault->faultcode." ".$fault->faultstring;
} }
} }
/** /**
* Method for identify a file extension and the possibility that the document can be managed by Compilatio * Method for identify a file extension and the possibility that the document can be managed by Compilatio.
* *
* @param $filename * @param $filename
* *
@ -402,7 +402,7 @@ class Compilatio
} }
/** /**
* Fonction affichage de la barre de progression d'analyse version 3.1 * Fonction affichage de la barre de progression d'analyse version 3.1.
* *
* @param string $status From the document * @param string $status From the document
* @param $pour * @param $pour
@ -461,7 +461,7 @@ class Compilatio
} }
/** /**
* Method for display the PomprseuilmankBar (% de plagiat) * Method for display the PomprseuilmankBar (% de plagiat).
* *
* @param $percentagePumping * @param $percentagePumping
* @param $weakThreshold * @param $weakThreshold
@ -512,11 +512,11 @@ class Compilatio
} }
/** /**
* Method for validation of hash * Method for validation of hash.
*
* @param string $hash * @param string $hash
* *
* @return bool * @return bool
*
*/ */
public static function isMd5($hash) public static function isMd5($hash)
{ {
@ -524,7 +524,7 @@ class Compilatio
} }
/** /**
* function for delete a document of the compilatio table if plagiarismTool is Compilatio * function for delete a document of the compilatio table if plagiarismTool is Compilatio.
* *
* @param int $courseId * @param int $courseId
* @param int $itemId * @param int $itemId

@ -26,15 +26,14 @@ echo "<b>"
?> ?>
<br><br> <br><br>
<? <?php
if (!isset($_GET['action'])) if (!isset($_GET['action'])) {
{ ?>
?>
<body style="margin:0px;padding:0px"> <body style="margin:0px;padding:0px">
<form style="margin:0px;" method="GET"> <form style="margin:0px;" method="GET">
<input type="submit" name="action" value="Test de Connexion SOAP"> <input type="submit" name="action" value="Test de Connexion SOAP">
</form> </form>
<? <?php
} else { } else {
echo get_lang('compilatioConnectionTestSoap')."<br>"; echo get_lang('compilatioConnectionTestSoap')."<br>";
echo "1) ".get_lang('compilatioServerConnection')."<br>"; echo "1) ".get_lang('compilatioServerConnection')."<br>";
@ -59,6 +58,6 @@ if (!isset($_GET['action']))
echo get_lang('compilatioNotConnection')."<br>"; echo get_lang('compilatioNotConnection')."<br>";
echo get_lang('compilatioParamVerification')."<br>"; echo get_lang('compilatioParamVerification')."<br>";
} }
} }
?> ?>
</body> </body>

@ -31,7 +31,7 @@ if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'multi') {
/** /**
* File problem in the url field that no longer have the file extension, * File problem in the url field that no longer have the file extension,
* Compilatio's server refuse the files * Compilatio's server refuse the files
* we renames in the FS and the database with the file extension that is found in the title field * we renames in the FS and the database with the file extension that is found in the title field.
*/ */
compilatioUpdateWorkDocument($documentId, $courseId); compilatioUpdateWorkDocument($documentId, $courseId);
@ -87,7 +87,7 @@ if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'multi') {
} }
} }
} else { } else {
$documentId = isset($_GET['doc']) ? $_GET['doc']: 0; $documentId = isset($_GET['doc']) ? $_GET['doc'] : 0;
sendDocument($documentId, $courseInfo); sendDocument($documentId, $courseInfo);
} }
@ -137,7 +137,7 @@ function sendDocument($documentId, $courseInfo)
} }
/** /**
* function for show and recovery the extension from a file * function for show and recovery the extension from a file.
* *
* @param $docId * @param $docId
* @param $courseId * @param $courseId

@ -216,13 +216,13 @@ if ($allowAntiPlagiarism) {
$plagiarismListJqgridColumn = ['Compilatio']; $plagiarismListJqgridColumn = ['Compilatio'];
$plagiarismListJqgridLine = [ $plagiarismListJqgridLine = [
[ [
'name'=>'compilatio', 'name' => 'compilatio',
'index'=>'compilatio', 'index' => 'compilatio',
'width'=>'40', 'width' => '40',
'align'=>'left', 'align' => 'left',
'search' => 'false', 'search' => 'false',
'sortable'=>'false' 'sortable' => 'false',
] ],
]; ];
} }
@ -539,9 +539,7 @@ if ($allowAntiPlagiarism) {
if (in_array($data['id'], $listCompilatioDocId)) { if (in_array($data['id'], $listCompilatioDocId)) {
$javascriptWorkId .= $data['id'].'a'; $javascriptWorkId .= $data['id'].'a';
} }
} } ?>
?>
<!-- <!--
Lets display the javascript AJAX tools for refreshing datas that needed to be refreshed Lets display the javascript AJAX tools for refreshing datas that needed to be refreshed
Only document with state ANALYSE_IN_QUEUE or ANALYSE_PROCESSING need to ask server Only document with state ANALYSE_IN_QUEUE or ANALYSE_PROCESSING need to ask server
@ -554,9 +552,9 @@ if ($allowAntiPlagiarism) {
var analyseProcessing = "ANALYSE_PROCESSING"; var analyseProcessing = "ANALYSE_PROCESSING";
var analyseInQueue = "ANALYSE_IN_QUEUE"; var analyseInQueue = "ANALYSE_IN_QUEUE";
var refreshDelaisAfter = 30000; var refreshDelaisAfter = 30000;
var allWorkId = "<?php echo $javascriptWorkId ?>"; var allWorkId = "<?php echo $javascriptWorkId; ?>";
var workFolderId = "<?php echo $workId; ?>"; var workFolderId = "<?php echo $workId; ?>";
var compilationWebUrl = "<?php echo api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/' ?>"; var compilationWebUrl = "<?php echo api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/'; ?>";
var divExisteTimer = null; var divExisteTimer = null;
var msgWaitJS = '<?php echo Display::return_message(get_lang('PleaseWaitThisCouldTakeAWhile')); ?>'; var msgWaitJS = '<?php echo Display::return_message(get_lang('PleaseWaitThisCouldTakeAWhile')); ?>';
var div = document.createElement('div'); var div = document.createElement('div');
@ -695,7 +693,7 @@ if ($allowAntiPlagiarism) {
type: "get", type: "get",
dataType: "html", dataType: "html",
error: function () { error: function () {
showData("<?php echo get_lang('CompilatioComunicationAjaxImpossible');?>"); showData("<?php echo get_lang('CompilatioComunicationAjaxImpossible'); ?>");
}, },
success: function (strData) { success: function (strData) {
showData(strData); showData(strData);

Loading…
Cancel
Save