module training add dirs output, upload

This commit is contained in:
PLESK5 2017-03-23 17:29:25 +01:00
parent a7e32b448f
commit b252f6ba5c
3 changed files with 70 additions and 68 deletions

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -1,68 +0,0 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once(__DIR__.'/models/CSVReader.php');
function debug($var)
{
echo "<pre>";
print_r($var);
echo "</pre>";
}
$original = new ArrayExtended();
$original_score = new ArrayExtended();
$reader = new CSVReader(__DIR__.'/upload/Bilan_original.csv');
$reader ->skipHeader()
->onEachLine(function(ArrayExtended $cols) use($original, $original_score) {
$original[] = $cols[0];
$original_score[] = $cols[1];
return true;
})
->onError(function($failed_num_line) {
debug($failed_num_line);
})
->read();
$new_version = new ArrayExtended();
$new_version_score = new ArrayExtended();
$reader = new CSVReader(__DIR__.'/upload/BILAN.csv');
$reader ->skipHeader()
->setDelimiter("\"")
->onEachLine(function(ArrayExtended $cols) use($new_version, $new_version_score) {
$new_version[] = $cols[0];
$new_version_score[] = $cols[1];
return true;
})
->onError(function($failed_num_line) {
debug($failed_num_line);
})
->read();
$original = $original->toArray();
$original_score = $original_score->toArray();
$new_version = $new_version->toArray();
$new_version_score = $new_version_score->toArray();
//debug($new_version);
//debug(array_diff_assoc($new_version, $original));
//debug(array_diff_assoc($original, $new_version));
$diff = array();
foreach(array_diff($original, $new_version) as $i => $code_client) {
$diff[$code_client] = $original_score[$i];
}
debug($diff);
/*
$diff = array();
foreach(array_diff($new_version, $original) as $i => $code_client) {
$diff[$code_client] = $new_version_score[$i];
}
debug($diff);
*/

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;