Exemplo n.º 1
0
 function __construct()
 {
     $this->listClients = new SplDoublyLinkedList();
     //=========================load file===============================//
     $read = new ReadCsv();
     $lisClient = $read->get2DArrayFromCsv('files/clientes.csv', ',');
     foreach ($lisClient as $row => $data) {
         $listProductByClient = new SplDoublyLinkedList();
         $contLines = 0;
         $codeProduct = 0;
         foreach ($data as $rowL => $dataL) {
             if ($rowL > 1 && $dataL != "") {
                 if ($contLines == 0) {
                     $codeProduct = $dataL;
                     $contLines++;
                 } else {
                     $listProdCliente = new ListaProductosPorCliente();
                     $listProdCliente->setIdProducto($codeProduct);
                     $listProdCliente->setProducto($dataL);
                     $listProductByClient->push($listProdCliente);
                     $contLines--;
                 }
             }
         }
         $client1 = new Clientes();
         $client1->setName($data[0]);
         $client1->setId($data[1]);
         $client1->setListPruductByClient($listProductByClient);
         $this->listClients->push($client1);
     }
     //=========================//load file=============================//
     $this->listClients->serialize();
     //$this->loadFile();
 }
<?php

session_start();
if (isset($_GET['csvFile'])) {
    include './ReadCsv.php';
    $params = array('csvFile' => $_GET['csvFile']);
    $result = new ReadCsv($params);
    $return_json = $result->returnJson();
} else {
    $return_json = FALSE;
}
?>
  
<!DOCTYPE HTML>
<html>
  <head>
  	<meta charset="UTF-8">
  	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  	<script src="http://www.google.com/jsapi"></script>
  	<script src="./js/jquery.cookie.js"></script>
  	<script src="./js/iuse.js"></script>
	<script src="./js/countries.js"></script>
	<script src="./js/kml.js"></script>
	<script src="./js/colorcalc.js" type="text/javascript"></script>
  	<link rel="stylesheet" href="./css/visualisation.css" />
  	<script>
  	    var displayHeight = <?php 
echo $_GET['h'];
?>
 - 50;
  	    var displayWidth = <?php 
Exemplo n.º 3
0
 public function addPasillos()
 {
     /* $list = new SplDoublyLinkedList();
     
               //=====================producto==============================//
               $listProduct = new SplDoublyLinkedList();
               $listProduct2 = new SplDoublyLinkedList();
     
               $product=new Producto();
               $product->setProduct("P1");
               $product->setIdProduct(1);
               $listProduct->push($product);
               $listProduct2->push($product);
     
               $product2=new Producto();
               $product2->setProduct("P2");
               $product2->setIdProduct(2);
               $listProduct->push($product2);
     
               $product3=new Producto();
               $product3->setProduct("P3");
               $product3->setIdProduct(3);
               $listProduct->push($product3);
     
               $product4=new Producto();
               $product4->setProduct("P4");
               $product4->setIdProduct(4);
               $listProduct->push($product4);
               $listProduct2->push($product4);
               //=====================//producto==============================//
     
     
     
               //=====================productos==============================//
               $listProducts = new SplDoublyLinkedList();
               $listProducts2 = new SplDoublyLinkedList();
     
               $products=new Productos();
               $products->setMarca("Lechuga");
               $products->setListProducts($listProduct);
               $listProducts->push($products);
               $listProducts2->push($products);
     
               $products2=new Productos();
               $products2->setMarca("Repollo");
               $products2->setListProducts($listProduct2);
               $listProducts->push($products2);
     
               $products3=new Productos();
               $products3->setMarca("Aguacates");
               $products3->setListProducts($listProduct2);
               $listProducts2->push($products3);
     
               //=====================//productos==============================//
     
     
     
               //=====================tipo productos==============================//
               $listTipoProducts = new SplDoublyLinkedList();
               $listTipoProducts2 = new SplDoublyLinkedList();
     
               $tipoProductos=new TipoProducto();
               $tipoProductos->setNameType("Hortalizas");
               $tipoProductos->setListProduct($listProducts);
               $listTipoProducts->push($tipoProductos);
               $listTipoProducts2->push($tipoProductos);
     
               $tipoProductos2=new TipoProducto();
               $tipoProductos2->setNameType("Hortalizas y verduras");
               $tipoProductos2->setListProduct($listProducts2);
               $listTipoProducts2->push($tipoProductos2);
     
               //=====================//tipo productos==============================//
     
     
               //=====================Pasillo==============================//
               $pasillo=new Pasillo();
               $pasillo->setName("Pasillo 1");
               $pasillo->setNumber("1");
               $pasillo->setTypeProducts($listTipoProducts);
               $list->push($pasillo);
     
               $pasillo2=new Pasillo();
               $pasillo2->setName("Pasillo 2");
               $pasillo2->setNumber("2");
               $pasillo2->setTypeProducts($listTipoProducts2);
               $list->push($pasillo2);
               //=====================//Pasillo==============================//
     
               $list->serialize();
     
               /*
               echo "FIFO (First In First Out) :\n";
               echo "<pre>";
               $list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
               for ($list->rewind(); $list->valid(); $list->next()) {
               print_r($list->current());
               }
               echo "</pre>";
              * */
     //=========================load file===============================//
     $read = new ReadCsv();
     $lisClient = $read->get2DArrayFromCsv('files/pasillo.csv', ',');
     $list = new SplDoublyLinkedList();
     foreach ($lisClient as $row => $data) {
         $listProducts = new SplDoublyLinkedList();
         $listTypeProducts = new SplDoublyLinkedList();
         //=======listas=======//
         $listProduct = "";
         $namePasillo = "";
         $marca = "";
         //=======/listas======//
         //=======bandras======//
         $contProduc = 0;
         $productLoad = 1;
         $typeProductsLoad = 0;
         $pasilloLoad = 0;
         $setPasilloLoad = 0;
         //=======//bandras======//
         foreach ($data as $rowL => $dataL) {
             if ($dataL == "-") {
                 //sepador productos
                 $productLoad = 0;
                 $typeProductsLoad = 1;
             }
             if ($dataL == "/") {
                 //sepador tipos de productos
                 $productLoad = 0;
                 $typeProductsLoad = 0;
                 $pasilloLoad = 1;
             }
             //inserta los productos y sus listas de producto
             if ($productLoad == 1) {
                 if ($contProduc == 0) {
                     $listProduct = $this->getListProduct($dataL, $row, $rowL);
                     $contProduc++;
                 } else {
                     if ($marca == "") {
                         $marca = $dataL;
                     } else {
                         $this->getListProducts($listProducts, $listProduct, $dataL, $marca);
                         $contProduc = 0;
                         $marca = "";
                     }
                 }
             }
             if ($typeProductsLoad == 1 & $dataL != "-") {
                 $this->getListTypePruduct($dataL, $listTypeProducts, $listProducts);
                 $productLoad = 1;
                 $typeProductsLoad = 0;
                 $contProduc = 0;
             }
             if ($pasilloLoad == 1 && $dataL != "/") {
                 if ($setPasilloLoad == 0) {
                     $namePasillo = $dataL;
                     $setPasilloLoad++;
                 } else {
                     $this->getListPasillos($namePasillo, $dataL, $listTypeProducts, $list);
                     $pasilloLoad = 0;
                 }
             }
         }
     }
     //=========================//load file=============================//
     return $list;
 }