Commit d9bc79af authored by Elias Villiger's avatar Elias Villiger
Browse files

Remove unused DataImport.php and column 'AS import'

parent 2109e086
Pipeline #845 passed with stage
in 1 minute and 50 seconds
......@@ -1336,7 +1336,6 @@ const COLUMN_HTMLENTITIES = 'htmlentities';
const COLUMN_STRIPTAGS = 'striptags';
const COLUMN_MIME_TYPE = 'mimeType'; // Will also be used to identify equal named columns in upload record.
const COLUMN_FILE_SIZE = 'fileSize'; // Will also be used to identify equal named columns in upload record.
const COLUMN_IMPORT = "import";
const COLUMN_EXCEL_PLAIN = 'XLS';
const COLUMN_EXCEL_NUMERIC = 'XLSn';
const COLUMN_EXCEL_STRING = 'XLSs';
......
......@@ -37,7 +37,6 @@ require_once(__DIR__ . '/../helper/KeyValueStringParser.php');
require_once(__DIR__ . '/../helper/Token.php');
require_once(__DIR__ . '/Thumbnail.php');
//require_once(__DIR__ . '/Monitor.php');
require_once(__DIR__ . '/../utils/DataImport.php');
const DEFAULT_QUESTION = 'question';
const DEFAULT_ICON = 'icon';
......@@ -813,10 +812,6 @@ class Report {
$content .= strip_tags($columnValue);
break;
case COLUMN_IMPORT:
$dataImport = new DataImport($this->db);
$content = $dataImport->process($columnValue, 'test');
break;
case COLUMN_EXCEL_PLAIN:
$content .= $columnValue . PHP_EOL;
break;
......
<?php
/**
* Created by PhpStorm.
* User: cr
* Date: 12/23/15
* Time: 6:33 PM
*/
namespace qfq;
use qfq;
require_once(__DIR__ . '/../Constants.php');
//require_once(__DIR__ . '/../../../Resources/Private/Classes/PHPExcel/IOFactory.php');
require_once(__DIR__ . '/../database/Database.php');
/**
* Class DataImport
* @package qfq
*/
class DataImport {
/**
* @var Database
*/
private $db = null;
/**
* DataImport constructor.
* @param Database $db
*/
public function __construct(Database $db) {
$this->db = $db;
}
/**
* @param $filename
* @param $table
* @param string $region
* @param string $mode
* @return string
* @throws CodeException
* @throws DbException
*/
public function process($filename, $table, $region = IMPORT_REGION_DEFAULT, $mode = IMPORT_MODE_REPLACE) {
// echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
// $objPHPExcel = \PHPExcel_IOFactory::load($filename);
$table = IMPORT_PREFIX . $table;
// $columnDefinition = $this->prepareTable($objPHPExcel);
$this->db->createTable($table, $columnDefinition, $mode);
// var_dump($sheetData);
return '';
}
// /**
// * @param \PHPExcel_IOFactory $objPHPExcel
// * @return array
// */
// private function prepareTable(\PHPExcel $objPHPExcel) {
//
// $columnDefinition = array();
//
// for ($ii = 0; $ii < 10; $ii++) {
// $columnDefinition[] = [CHR(65 + $ii), 'varchar(255)'];
// }
//
// return $columnDefinition;
// }
//
// private function importRows(\PHPExcel $objPHPExcel) {
// $highestRow = 0;
// $highestColumnIndex = 0;
// $worksheet = null;
//
// foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
// $worksheetTitle = $worksheet->getTitle();
// $highestRow = $worksheet->getHighestRow(); // e.g. 10
// $highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
// $highestColumnIndex = \PHPExcel_Cell::columnIndexFromString($highestColumn);
// $nrColumns = ord($highestColumn) - 64;
//// echo "<br>The worksheet " . $worksheetTitle . " has ";
//// echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
//// echo ' and ' . $highestRow . ' row.';
//// echo '<br>Data: <table border="1"><tr>';
// for ($row = 1; $row <= $highestRow; ++$row) {
// echo '<tr>';
// for ($col = 0; $col < $highestColumnIndex; ++$col) {
// $cell = $worksheet->getCellByColumnAndRow($col, $row);
// $val = $cell->getValue();
// $dataType = \PHPExcel_Cell_DataType::dataTypeForValue($val);
// echo '<td>' . $val . '<br>(Typ ' . $dataType . ')</td>';
// }
// echo '</tr>';
// }
// echo '</table>';
// }
//
// for ($row = 2; $row <= $highestRow; ++$row) {
// $val = array();
// for ($col = 0; $col < $highestColumnIndex; ++$col) {
// $cell = $worksheet->getCellByColumnAndRow($col, $row);
// $val[] = $cell->getValue();
// }
//
// $Connection = "INSERT INTO `users` (name, family, type) VALUES ('" . $val[1] . "','" . $val[2] . "','" . $val[3] . "')";
// }
//
// }
//
//
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment