src/AppBundle/Controller/ProvaController.php line 27

Open in your IDE?
  1. <?php
  2. namespace AppBundle\Controller;
  3. use \Pimcore\Controller\FrontendController;
  4. use \Symfony\Component\HttpFoundation\Request;
  5. use \Pimcore\Model\DataObject;
  6. use \Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  7. /*
  8.     use \AppBundle\Form\LoginFormType;
  9.     use \AppBundle\Model\DataObject\User;
  10.     use \Pimcore\Controller\Configuration\TemplatePhp;
  11.     use \Symfony\Component\Routing\Annotation\Route;
  12.     use \Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
  13.     use \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  14.     use \Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  15.  */   
  16.     
  17. //use Symfony\Component\HttpFoundation\Response;
  18. //use Symfony\Component\Routing\Annotation\Route;
  19. //use \Pimcore\Bundle\AdminBundle\Controller\Rest\AbstractRestController;
  20. //use Pimcore\Model\Asset;
  21. class ProvaController extends FrontendController
  22. {
  23.     public function defaultAction(Request $request)
  24.     {
  25.     }
  26.     public function defaultpdfAction(Request $request)
  27.     {
  28.     }
  29.     public function devtestAction(Request $request)
  30.     {
  31.     }
  32.     public function imptestAction(Request $request)
  33.     {
  34.     }
  35.     public function sitocusAction(Request $request)
  36.     {
  37.     }
  38.     public function prodcuspdfAction(Request $request)
  39.     {
  40.     }
  41.     public function palportalAction(Request $request)
  42.     {
  43.     }    
  44.     public function prodcusAction(Request $request)
  45.     {
  46.         $this->view->req=$request->getLocale();
  47.         $this->denyAccessUnlessGranted('ROLE_USER');
  48.         //$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'User tried to access a page without having ROLE_ADMIN');
  49.     }
  50.     public function prodcleanAction(Request $request)
  51.     {
  52.     }
  53.     public function listcleanAction(Request $request)
  54.     {
  55.     }
  56.     public function listcleanpdfAction(Request $request)
  57.     {
  58.     }
  59.     public function listpagepdfAction(Request $request)
  60.     {
  61.     }
  62.     public function listpagenewpdfAction(Request $request)
  63.     {
  64.         //proprietà PROP se è pari a UL=unlimited tira fuori tutti i design che esistono!!
  65.         //usare con cautela
  66.         $PROP=$this->view->document->getProperty('PROP');
  67.         $mySelection=$this->view->document->getProperty('selezione') ?: "list_2020_it";
  68.         $elencoDesign = new \Pimcore\Model\DataObject\Design\Listing();
  69.         if ($PROP=='UL') {
  70.             $elencoDesign=$this->getAllDesignUL();
  71.         } else{
  72.             $id=$this->view->document->getProperty('cartella')->getId();
  73.             $elencoDesign=$this->getAllDesign($id);    
  74.         }
  75.         
  76.         if ($elencoDesign->count()<1) return;
  77.         $pagesToRender=array();
  78.         foreach ($elencoDesign as $design) {
  79.             $prodbaselist = new DataObject\Variante\Listing();
  80.             $prodbaselist->setObjectTypes([DataObject\AbstractObject::OBJECT_TYPE_OBJECT]);
  81.             $prodbaselist->setLimit(30);
  82.             $prodbaselist->setOrderKey("o_key");
  83.             $prodbaselist->setOrder("asc");
  84.             $prodbaselist->setCondition("o_parentId = '".$design->getId()."' and ".$mySelection."=1");
  85.             $prodbaselist->load();
  86.             if ($prodbaselist->count()>0) {
  87.                 
  88.                 //preparo array dei plus e degli optional
  89.                 $myPlusAll=array();
  90.                 $myAccAll=array();
  91.                 $currId=0;
  92.                 $tiretype='';
  93.                 foreach ($prodbaselist as $entry) {
  94.                     $currId $entry->getId();
  95.                     $tiretype $entry->getDatitec();
  96.                     $myPlusAll=array_merge($myPlusAll,$entry->getPlus());
  97.                     $myAccAll=array_merge($myAccAll,$entry->getAccessori());
  98.                 }
  99.                 $myPlusAll=array_unique($myPlusAll);
  100.                 $myAccAll=array_unique($myAccAll);
  101.                 //************************************* INIZIO COSTRUISCO LISTA FOCOLARI E KIT *************************************
  102.                 $compFocolari=array();
  103.                 $compFocolari2D=array();
  104.                 $compKit=array();
  105.                 foreach ($prodbaselist as $prodbase) {
  106.                     $composizioneP=$prodbase->getComposizione();
  107.                     
  108.                     //il prodotto base è virtuale (ci sono varianti)
  109.                     if ($prodbase->getVirtual()) {
  110.                         $idPB=$prodbase->getId();
  111.                         //listo le vrianti sotto il prodotto base corrente
  112.                         $prodbaseVarList = new DataObject\Variante\Listing();
  113.                         $prodbaseVarList->setObjectTypes([DataObject\AbstractObject::OBJECT_TYPE_VARIANT]);
  114.                         $prodbaseVarList->setLimit(10);
  115.                         $prodbaseVarList->setCondition("o_parentId = ".$idPB);
  116.                         $prodbaseVarList->load();
  117.                         if ($prodbaseVarList->count()>0) {
  118.                             foreach($prodbaseVarList as $final) {
  119.                                 $composizioneP $final->getComposizione();
  120.                                 //ho la composizione della Variante "n"
  121.                                 foreach ($composizioneP as $key) {
  122.                                     $miocod $key->getCodice();
  123.                                     $miodes $key->getDescrizione();
  124.                                     //destino a lista Focolari o Kit in base al codice
  125.                                     if (substr($miocod,0,2)=='80') {
  126.                                         $compFocolari[]=$miocod;
  127.                                         $loc_matcol=$key->getDesc_bella();
  128.                                         if (!is_null($final->getMat_col())) $loc_matcol=$final->getMat_col()->getMat_Col();
  129.                                         $addendo=array("cod"=>$miocod,"pbase"=>$prodbase->getKey(),"matcol"=>$loc_matcol);
  130.                                         $compFocolari2D[]=$addendo;
  131.                                         //echo "aggiunto 1";
  132.                                     } else {
  133.                                         $compKit[]=$miocod;
  134.                                     }
  135.                                 }
  136.                             }
  137.                         }
  138.                     // il prodotto base non è virtuale
  139.                     } else {
  140.                         foreach ($composizioneP as $key) {
  141.                             $miocod $key->getCodice();
  142.                             $miodes $key->getDescrizione();
  143.                             //destino a lista Focolari o Kitin base al codice
  144.                             if (substr($miocod,0,2)=='80') {
  145.                                 $compFocolari[]=$miocod;
  146.                                 $loc_matcol=$key->getDesc_bella();
  147.                                 if (!is_null($final) and !is_null($final->getMat_col())) $loc_matcol=$final->getMat_col()->getMat_Col();
  148.                                 $addendo=array("cod"=>$miocod,"pbase"=>$prodbase->getKey(),"matcol"=>$loc_matcol);
  149.                                 $compFocolari2D[]=$addendo;
  150.                                 //echo "aggiunto 1";
  151.                             } else {
  152.                                 $compKit[]=$miocod;
  153.                             }
  154.                         }
  155.                     } //fine di if..else su is Virtual                              
  156.                 }
  157.                 $compFocolari=array_unique($compFocolari);
  158.                 
  159.                 // ----------------------------------------------
  160.                 $numfoccount($compFocolari);
  161.                 $numpbasecount($prodbaselist);
  162.                 $raggruppa=1;
  163.                 if ($numfoc!=$numpbase) {
  164.                     //echo "raggruppa";
  165.                     //print_r($compFocolari2D);
  166.                 } else {
  167.                     //echo "non raggruppa";
  168.                     $raggruppa=0;
  169.                 }
  170.                 // ----------------------------------------------                        
  171.                 //sort($compFocolari);
  172.                 $compKit=array_unique($compKit);
  173.                 sort($compKit);
  174.                 //************************************* FINE COSTRUISCO LISTA FOCOLARI E KIT *************************************
  175.                 //************************ INIZIO TABELLA INFERIORE *************************
  176.                 $class_name get_class($tiretype);
  177.                 $methods get_class_methods($class_name);
  178.                 
  179.                 $focAperto=0;
  180.                 $focChiusoAria=0;
  181.                 $focChiusoIdro=0;
  182.                 $focPellAria=0;
  183.                 $focPellIdro=0;
  184.                 $stufAria=0;
  185.                 $stufIdro=0;
  186.                 $pellAria=0;
  187.                 $pellIdro=0;
  188.                 
  189.                 $data_tabella=0;
  190.                 $arrayTest=array();
  191.                 $arrayTestNew=array();
  192.                 $nomefunzione='';
  193.                 $pbase_idprod_prec=1;
  194.                 $campi=array();
  195.                 foreach($methods as $method)
  196.                 {
  197.                     $rigaDatiNewh=array();
  198.                     $rigaDatiNew=array();
  199.                     switch ($method) {
  200.                         case "getFocolarepelletaria":
  201.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  202.                                 $nomefunzione=$method;
  203.                                 $focPellAria=1
  204.                                 $campi=array("nome","incentivi","misure","pot_nom","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  205.                                 //aggiungo un dato come filler
  206.                                 $arrayTestNew[]=$campi;                                        
  207.                             }
  208.                             break;
  209.                         case "getFocolarepelletidro":
  210.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  211.                                 $nomefunzione=$method;
  212.                                 $focPellIdro=1
  213.                                 $campi=array("nome","incentivi","misure","pot_nom","pot_acq","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  214.                                 //aggiungo un dato come filler
  215.                                 $arrayTestNew[]=$campi;                                        
  216.                             }
  217.                             break;
  218.                         case "getStufapelletaria":
  219.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  220.                                 $nomefunzione=$method;
  221.                                 $pellAria=1
  222.                                 $campi=array("nome","incentivi","misure","pot_nom","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  223.                                 //aggiungo un dato come filler
  224.                                 $arrayTestNew[]=$campi;   
  225.                                 //echo "Pellet aria<br />";                                     
  226.                             }
  227.                             break;
  228.                         case "getStufapelletidro":
  229.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  230.                                 $pellIdro=1;
  231.                                 $nomefunzione=$method;
  232.                                 $campi=array("nome","incentivi","misure","pot_nom","pot_acq","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  233.                                 //aggiungo un dato come filler
  234.                                 $arrayTestNew[]=$campi;                                        
  235.                             }
  236.                             break;
  237.                         case "getFocolarelegnaaria":
  238.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  239.                                 $focChiusoAria=1;
  240.                                 $nomefunzione=$method;
  241.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  242.                                 //aggiungo un dato come filler
  243.                                 $arrayTestNew[]=$campi;                                        
  244.                             }
  245.                             break;
  246.                         case "getFocolarelegnaidro":
  247.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  248.                                 $focChiusoIdro=1;
  249.                                 $nomefunzione=$method;
  250.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","pot_acq","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  251.                                 //aggiungo un dato come filler
  252.                                 $arrayTestNew[]=$campi;                                        
  253.                             }
  254.                             break;
  255.                         case "getFocolareaperto":
  256.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  257.                                 $focAperto=1;
  258.                                 $nomefunzione=$method;
  259.                                 $campi=array("nome","incentivi","misure","pot_nom","u_fumi","c_nrg","certificazioni");                                       
  260.                                 //aggiungo un dato come filler
  261.                                 $arrayTestNew[]=$campi;                                        
  262.                             }
  263.                             break;
  264.                         case "getStufalegnaaria":
  265.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  266.                                 $stufAria=1;
  267.                                 $nomefunzione=$method;
  268.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  269.                                 //aggiungo un dato come filler
  270.                                 $arrayTestNew[]=$campi;                                        
  271.                             }
  272.                             break;
  273.                         case "getStufalegnaidro":
  274.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  275.                                 $stufIdro=1;
  276.                                 $nomefunzione=$method;
  277.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","pot_acq","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  278.                                 //aggiungo un dato come filler
  279.                                 $arrayTestNew[]=$campi;                                        
  280.                             }
  281.                             break;
  282.                         default :
  283.                             //echo "Prodotti senza dati tecnici";
  284.                             //return;
  285.                             break;
  286.                     }
  287.                 }
  288.                 if (strlen($nomefunzione)<5) {
  289.                     //echo "Prodotto senza dati tecnici";
  290.                     //return;
  291.                 } else {
  292.                     //echo $nomefunzione."<br/>";
  293.                     //print_r($arrayTestNew);
  294.                     foreach ($prodbaselist as $prodbase) {
  295.                         $campoTest$prodbase->getId_prod() ?: $prodbase->getId();
  296.                         // echo $campoTest;
  297.                         if ($campoTest == $pbase_idprod_prec or is_null($prodbase->getDatitec()) or is_null(call_user_func(array($prodbase->getDatitec(),$nomefunzione)))) {
  298.                             //id_prodotto uguale a quello di prima, non faccio nulla
  299.                             //non c'è il brick, non faccio nulla
  300.                             //echo "Non c'è".$nomefunzione."<br/>";
  301.                         } else {
  302.                             //recupero il dato del brick
  303.                             $datoRiga=call_user_func(array($prodbase->getDatitec(),$nomefunzione)); 
  304.                             foreach ($campi as $campo) {
  305.                                 $dato='';
  306.                                 $datoh='';
  307.                                 //echo "CAMPO:".$campo."<br/>";
  308.                                 switch ($campo) {
  309.                                     case 'nome':
  310.                                         $datoh=$this->get("translator")->trans("list_dati_nome");
  311.                                         $dato=$prodbase->getKey();
  312.                                         break;
  313.                                     case 'misure':
  314.                                         $datoh=$this->get("translator")->trans("list_dati_misure");
  315.                                         if (!is_null($prodbase->getDatitec()->getMisure())) {
  316.                                             $dato=explode(" ",$prodbase->getDatitec()->getMisure()->getLar())[0]."x".explode(" ",$prodbase->getDatitec()->getMisure()->getProf())[0]."x".$prodbase->getDatitec()->getMisure()->getAlt();
  317.                                             if (!is_null($prodbase->getDatitec()->getMisure()->getPeso())) $dato=$dato."<br/>".$prodbase->getDatitec()->getMisure()->getPeso();
  318.                                             if (substr($dato,0,1)=='0'$dato="";
  319.                                         }
  320.                                         break;
  321.                                     case 'combustibile':
  322.                                         $datoh=$this->get("translator")->trans("list_dati_combustibile");
  323.                                         $dato=(string)$datoRiga->getCombustibile();
  324.                                         break;
  325.                                     case 'pot_nom':
  326.                                         $datoh=$this->get("translator")->trans("list_dati_pot_nom");
  327.                                         $dato=(string)$datoRiga->getPot_nom();
  328.                                         break;
  329.                                     case 'pot_acq':
  330.                                         $datoh=$this->get("translator")->trans("list_dati_pot_acq");
  331.                                         $dato=(string)$datoRiga->getPot_acq();
  332.                                         break;
  333.                                     case 'pot_bruc':
  334.                                         $datoh=$this->get("translator")->trans("list_dati_pot_bruc");
  335.                                         $dato=(string)$datoRiga->getPot_bruc();
  336.                                         break;
  337.                                     case 'rend_nom':
  338.                                         $datoh=$this->get("translator")->trans("list_dati_rend_nom");
  339.                                         $dato=(string)$datoRiga->getRend_nom();
  340.                                         break;
  341.                                     case 'auton':
  342.                                         $datoh=$this->get("translator")->trans("list_dati_auton");
  343.                                         $dato=(string)$datoRiga->getAuton();
  344.                                         break;
  345.                                     case 'capacita_serb':
  346.                                         $datoh=$this->get("translator")->trans("list_dati_capacita_serb");
  347.                                         $dato=(string)$datoRiga->getCapacita_serb();
  348.                                         break;
  349.                                     case 'consumi':
  350.                                         $datoh=$this->get("translator")->trans("list_dati_consumi");
  351.                                         $dato=explode(" ",$datoRiga->getConsumo_min())[0]." - ".$datoRiga->getConsumo_max();
  352.                                         break;
  353.                                     case 'carico_cons':
  354.                                         $datoh=$this->get("translator")->trans("list_dati_carico_cons");
  355.                                         $dato=(string)$datoRiga->getCarico_cons();
  356.                                         break;
  357.                                     case 'u_fumi':
  358.                                         $datoh=$this->get("translator")->trans("list_dati_u_fumi");
  359.                                         $dato=(string)$datoRiga->getU_fumi();
  360.                                         break;
  361.                                     case 'c_nrg':
  362.                                         $datoh=$this->get("translator")->trans("list_dati_c_nrg");
  363.                                         $dato=$datoRiga->getClasse_nrg();
  364.                                         break;
  365.                                     case 'certificazioni':
  366.                                         $datoh=$this->get("translator")->trans("list_dati_certificazioni");
  367.                                         $allinc=$prodbase->getCertificazioni();
  368.                                         if (!is_null($allinc)) {
  369.                                             $content="";
  370.                                             foreach ($allinc as $key3) {
  371.                                                 $miopic $key3->getImg_cert();
  372.                                                 if (!is_null($miopic) && $miopic instanceof \Pimcore\Model\Asset\Image) {
  373.                                                     $dato=$dato.$miopic->getThumbnail("listmini")->getHtml(); 
  374.                                                 }
  375.                                             }
  376.                                         }
  377.                                         break;
  378.                                     case 'incentivi':
  379.                                         $datoh=$this->get("translator")->trans("list_dati_incentivi");
  380.                                         $allinc=$prodbase->getIncentivi();
  381.                                         if (!is_null($allinc)) {
  382.                                             foreach ($allinc as $key2) {
  383.                                                 $miopic $key2->getImg_inc();
  384.                                                 if (!is_null($miopic) && $miopic instanceof \Pimcore\Model\Asset\Image) {
  385.                                                     $dato=$dato.$miopic->getThumbnail("listmini")->getHtml();
  386.                                                 }
  387.                                             }
  388.                                         }
  389.                                         break;
  390.                                     default:
  391.                                         # code...
  392.                                         break;
  393.                                 }
  394.                                 $rigaDatiNewh[$campo]=$datoh;
  395.                                 $rigaDatiNew[$campo]=$dato;
  396.                             }                           
  397.                             $arrayTestNew[]=$rigaDatiNew;
  398.                             $pbase_idprod_prec=$prodbase->getId_prod() ?: $prodbase->getId();
  399.                         } //if uguale al precedente o mancano dati
  400.                     //foreach sui prodotti base
  401.                 //if di nomefunzione
  402.                 
  403.                 $myArrayNew=$arrayTestNew;
  404.                 $myArrayh=$rigaDatiNewh;
  405.                 //************************ FINE TABELLA INFERIORE ***************************
  406.                 //aggiunge il design e i prodotti all'array da renderizzare
  407.                 $pagesToRender[]=array("design"=>$design,"prodottibase"=>$prodbaselist,"focolari"=>$compFocolari,"focolari2D"=>$compFocolari2D,"kit"=>$compKit,"raggruppa"=>$raggruppa,"optional"=>$myAccAll,"plus"=>$myPlusAll,"datih"=>$rigaDatiNewh,"dati"=>$arrayTestNew);
  408.             } else {
  409.             }
  410.         } //foreach design
  411.         $this->view->pages $pagesToRender;
  412.     }
  413.     public function listinonewAction(Request $request)
  414.     {
  415.         //proprietà PROP se è pari a UL=unlimited tira fuori tutti i design che esistono!!
  416.         //usare con cautela
  417.         $PROP=$this->view->document->getProperty('PROP');
  418.         $mySelection=$this->view->document->getProperty('selezione') ?: "list_2020_it";
  419.         $elencoDesign = new \Pimcore\Model\DataObject\Design\Listing();
  420.         if ($PROP=='UL') {
  421.             $elencoDesign=$this->getAllDesignUL();
  422.         } else{
  423.             $id=$this->view->document->getProperty('cartella')->getId();
  424.             $elencoDesign=$this->getAllDesign($id);    
  425.         }
  426.         
  427.         if ($elencoDesign->count()<1) return;
  428.         $pagesToRender=array();
  429.         foreach ($elencoDesign as $design) {
  430.             $prodbaselist = new DataObject\Variante\Listing();
  431.             $prodbaselist->setObjectTypes([DataObject\AbstractObject::OBJECT_TYPE_OBJECT]);
  432.             $prodbaselist->setLimit(30);
  433.             $prodbaselist->setOrderKey("o_key");
  434.             $prodbaselist->setOrder("asc");
  435.             $prodbaselist->setCondition("o_parentId = '".$design->getId()."' and ".$mySelection."=1");
  436.             $prodbaselist->load();
  437.             if ($prodbaselist->count()>0) {
  438.                 
  439.                 //preparo array dei plus e degli optional
  440.                 $myPlusAll=array();
  441.                 $myAccAll=array();
  442.                 $currId=0;
  443.                 $tiretype='';
  444.                 foreach ($prodbaselist as $entry) {
  445.                     $currId $entry->getId();
  446.                     $tiretype $entry->getDatitec();
  447.                     $myPlusAll=array_merge($myPlusAll,$entry->getPlus());
  448.                     $myAccAll=array_merge($myAccAll,$entry->getAccessori());
  449.                 }
  450.                 $myPlusAll=array_unique($myPlusAll);
  451.                 $myAccAll=array_unique($myAccAll);
  452.                 //************************************* INIZIO COSTRUISCO LISTA FOCOLARI E KIT *************************************
  453.                 $compFocolari=array();
  454.                 $compFocolari2D=array();
  455.                 $compKit=array();
  456.                 foreach ($prodbaselist as $prodbase) {
  457.                     $composizioneP=$prodbase->getComposizione();
  458.                     
  459.                     //il prodotto base è virtuale (ci sono varianti)
  460.                     if ($prodbase->getVirtual()) {
  461.                         $idPB=$prodbase->getId();
  462.                         //listo le vrianti sotto il prodotto base corrente
  463.                         $prodbaseVarList = new DataObject\Variante\Listing();
  464.                         $prodbaseVarList->setObjectTypes([DataObject\AbstractObject::OBJECT_TYPE_VARIANT]);
  465.                         $prodbaseVarList->setLimit(10);
  466.                         $prodbaseVarList->setCondition("o_parentId = ".$idPB);
  467.                         $prodbaseVarList->load();
  468.                         if ($prodbaseVarList->count()>0) {
  469.                             foreach($prodbaseVarList as $final) {
  470.                                 $composizioneP $final->getComposizione();
  471.                                 //ho la composizione della Variante "n"
  472.                                 foreach ($composizioneP as $key) {
  473.                                     $miocod $key->getCodice();
  474.                                     $miodes $key->getDescrizione();
  475.                                     //destino a lista Focolari o Kit in base al codice
  476.                                     if (substr($miocod,0,2)=='80') {
  477.                                         $compFocolari[]=$miocod;
  478.                                         $loc_matcol=$key->getDesc_bella();
  479.                                         if (!is_null($final->getMat_col())) $loc_matcol=$final->getMat_col()->getMat_Col();
  480.                                         $addendo=array("cod"=>$miocod,"pbase"=>$prodbase->getKey(),"matcol"=>$loc_matcol);
  481.                                         $compFocolari2D[]=$addendo;
  482.                                         //echo "aggiunto 1";
  483.                                     } else {
  484.                                         $compKit[]=$miocod;
  485.                                     }
  486.                                 }
  487.                             }
  488.                         }
  489.                     // il prodotto base non è virtuale
  490.                     } else {
  491.                         foreach ($composizioneP as $key) {
  492.                             $miocod $key->getCodice();
  493.                             $miodes $key->getDescrizione();
  494.                             //destino a lista Focolari o Kitin base al codice
  495.                             if (substr($miocod,0,2)=='80') {
  496.                                 $compFocolari[]=$miocod;
  497.                                 $loc_matcol=$key->getDesc_bella();
  498.                                 if (!is_null($final) and !is_null($final->getMat_col())) $loc_matcol=$final->getMat_col()->getMat_Col();
  499.                                 $addendo=array("cod"=>$miocod,"pbase"=>$prodbase->getKey(),"matcol"=>$loc_matcol);
  500.                                 $compFocolari2D[]=$addendo;
  501.                                 //echo "aggiunto 1";
  502.                             } else {
  503.                                 $compKit[]=$miocod;
  504.                             }
  505.                         }
  506.                     } //fine di if..else su is Virtual                              
  507.                 }
  508.                 $compFocolari=array_unique($compFocolari);
  509.                 
  510.                 // ----------------------------------------------
  511.                 $numfoccount($compFocolari);
  512.                 $numpbasecount($prodbaselist);
  513.                 $raggruppa=1;
  514.                 if ($numfoc!=$numpbase) {
  515.                     //echo "raggruppa";
  516.                     //print_r($compFocolari2D);
  517.                 } else {
  518.                     //echo "non raggruppa";
  519.                     $raggruppa=0;
  520.                 }
  521.                 // ----------------------------------------------                        
  522.                 //sort($compFocolari);
  523.                 $compKit=array_unique($compKit);
  524.                 sort($compKit);
  525.                 //************************************* FINE COSTRUISCO LISTA FOCOLARI E KIT *************************************
  526.                 //************************ INIZIO TABELLA INFERIORE *************************
  527.                 $class_name get_class($tiretype);
  528.                 $methods get_class_methods($class_name);
  529.                 
  530.                 $focAperto=0;
  531.                 $focChiusoAria=0;
  532.                 $focChiusoIdro=0;
  533.                 $focPellAria=0;
  534.                 $focPellIdro=0;
  535.                 $stufAria=0;
  536.                 $stufIdro=0;
  537.                 $pellAria=0;
  538.                 $pellIdro=0;
  539.                 
  540.                 $data_tabella=0;
  541.                 $arrayTest=array();
  542.                 $arrayTestNew=array();
  543.                 $nomefunzione='';
  544.                 $pbase_idprod_prec=1;
  545.                 $campi=array();
  546.                 foreach($methods as $method)
  547.                 {
  548.                     $rigaDatiNewh=array();
  549.                     $rigaDatiNew=array();
  550.                     switch ($method) {
  551.                         case "getFocolarepelletaria":
  552.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  553.                                 $nomefunzione=$method;
  554.                                 $focPellAria=1
  555.                                 $campi=array("nome","incentivi","misure","pot_nom","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  556.                                 //aggiungo un dato come filler
  557.                                 $arrayTestNew[]=$campi;                                        
  558.                             }
  559.                             break;
  560.                         case "getFocolarepelletidro":
  561.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  562.                                 $nomefunzione=$method;
  563.                                 $focPellIdro=1
  564.                                 $campi=array("nome","incentivi","misure","pot_nom","pot_acq","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  565.                                 //aggiungo un dato come filler
  566.                                 $arrayTestNew[]=$campi;                                        
  567.                             }
  568.                             break;
  569.                         case "getStufapelletaria":
  570.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  571.                                 $nomefunzione=$method;
  572.                                 $pellAria=1
  573.                                 $campi=array("nome","incentivi","misure","pot_nom","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  574.                                 //aggiungo un dato come filler
  575.                                 $arrayTestNew[]=$campi;   
  576.                                 //echo "Pellet aria<br />";                                     
  577.                             }
  578.                             break;
  579.                         case "getStufapelletidro":
  580.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  581.                                 $pellIdro=1;
  582.                                 $nomefunzione=$method;
  583.                                 $campi=array("nome","incentivi","misure","pot_nom","pot_acq","rend_nom","auton","capacita_serb","consumi","u_fumi","c_nrg","certificazioni");                                       
  584.                                 //aggiungo un dato come filler
  585.                                 $arrayTestNew[]=$campi;                                        
  586.                             }
  587.                             break;
  588.                         case "getFocolarelegnaaria":
  589.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  590.                                 $focChiusoAria=1;
  591.                                 $nomefunzione=$method;
  592.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  593.                                 //aggiungo un dato come filler
  594.                                 $arrayTestNew[]=$campi;                                        
  595.                             }
  596.                             break;
  597.                         case "getFocolarelegnaidro":
  598.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  599.                                 $focChiusoIdro=1;
  600.                                 $nomefunzione=$method;
  601.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","pot_acq","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  602.                                 //aggiungo un dato come filler
  603.                                 $arrayTestNew[]=$campi;                                        
  604.                             }
  605.                             break;
  606.                         case "getFocolareaperto":
  607.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  608.                                 $focAperto=1;
  609.                                 $nomefunzione=$method;
  610.                                 $campi=array("nome","incentivi","misure","pot_nom","u_fumi","c_nrg","certificazioni");                                       
  611.                                 //aggiungo un dato come filler
  612.                                 $arrayTestNew[]=$campi;                                        
  613.                             }
  614.                             break;
  615.                         case "getStufalegnaaria":
  616.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  617.                                 $stufAria=1;
  618.                                 $nomefunzione=$method;
  619.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  620.                                 //aggiungo un dato come filler
  621.                                 $arrayTestNew[]=$campi;                                        
  622.                             }
  623.                             break;
  624.                         case "getStufalegnaidro":
  625.                             if (!is_null(call_user_func(array($tiretype,$method))) && strlen(call_user_func(array($tiretype,$method))->getCombustibile())>0) {
  626.                                 $stufIdro=1;
  627.                                 $nomefunzione=$method;
  628.                                 $campi=array("nome","incentivi","misure","pot_bruc","pot_nom","pot_acq","rend_nom","carico_cons","u_fumi","c_nrg","certificazioni");                                       
  629.                                 //aggiungo un dato come filler
  630.                                 $arrayTestNew[]=$campi;                                        
  631.                             }
  632.                             break;
  633.                         default :
  634.                             //echo "Prodotti senza dati tecnici";
  635.                             //return;
  636.                             break;
  637.                     }
  638.                 }
  639.                 if (strlen($nomefunzione)<5) {
  640.                     //echo "Prodotto senza dati tecnici";
  641.                     //return;
  642.                 } else {
  643.                     //echo $nomefunzione."<br/>";
  644.                     //print_r($arrayTestNew);
  645.                     foreach ($prodbaselist as $prodbase) {
  646.                         $campoTest$prodbase->getId_prod() ?: $prodbase->getId();
  647.                         // echo $campoTest;
  648.                         if ($campoTest == $pbase_idprod_prec or is_null($prodbase->getDatitec()) or is_null(call_user_func(array($prodbase->getDatitec(),$nomefunzione)))) {
  649.                             //id_prodotto uguale a quello di prima, non faccio nulla
  650.                             //non c'è il brick, non faccio nulla
  651.                             //echo "Non c'è".$nomefunzione."<br/>";
  652.                         } else {
  653.                             //recupero il dato del brick
  654.                             $datoRiga=call_user_func(array($prodbase->getDatitec(),$nomefunzione)); 
  655.                             foreach ($campi as $campo) {
  656.                                 $dato='';
  657.                                 $datoh='';
  658.                                 //echo "CAMPO:".$campo."<br/>";
  659.                                 switch ($campo) {
  660.                                     case 'nome':
  661.                                         $datoh=$this->get("translator")->trans("list_dati_nome");
  662.                                         $dato=$prodbase->getKey();
  663.                                         break;
  664.                                     case 'misure':
  665.                                         $datoh=$this->get("translator")->trans("list_dati_misure");
  666.                                         if (!is_null($prodbase->getDatitec()->getMisure())) {
  667.                                             $dato=explode(" ",$prodbase->getDatitec()->getMisure()->getLar())[0]."x".explode(" ",$prodbase->getDatitec()->getMisure()->getProf())[0]."x".$prodbase->getDatitec()->getMisure()->getAlt();
  668.                                             if (!is_null($prodbase->getDatitec()->getMisure()->getPeso())) $dato=$dato."<br/>".$prodbase->getDatitec()->getMisure()->getPeso();
  669.                                             if (substr($dato,0,1)=='0'$dato="";
  670.                                         }
  671.                                         break;
  672.                                     case 'combustibile':
  673.                                         $datoh=$this->get("translator")->trans("list_dati_combustibile");
  674.                                         $dato=(string)$datoRiga->getCombustibile();
  675.                                         break;
  676.                                     case 'pot_nom':
  677.                                         $datoh=$this->get("translator")->trans("list_dati_pot_nom");
  678.                                         $dato=(string)$datoRiga->getPot_nom();
  679.                                         break;
  680.                                     case 'pot_acq':
  681.                                         $datoh=$this->get("translator")->trans("list_dati_pot_acq");
  682.                                         $dato=(string)$datoRiga->getPot_acq();
  683.                                         break;
  684.                                     case 'pot_bruc':
  685.                                         $datoh=$this->get("translator")->trans("list_dati_pot_bruc");
  686.                                         $dato=(string)$datoRiga->getPot_bruc();
  687.                                         break;
  688.                                     case 'rend_nom':
  689.                                         $datoh=$this->get("translator")->trans("list_dati_rend_nom");
  690.                                         $dato=(string)$datoRiga->getRend_nom();
  691.                                         break;
  692.                                     case 'auton':
  693.                                         $datoh=$this->get("translator")->trans("list_dati_auton");
  694.                                         $dato=(string)$datoRiga->getAuton();
  695.                                         break;
  696.                                     case 'capacita_serb':
  697.                                         $datoh=$this->get("translator")->trans("list_dati_capacita_serb");
  698.                                         $dato=(string)$datoRiga->getCapacita_serb();
  699.                                         break;
  700.                                     case 'consumi':
  701.                                         $datoh=$this->get("translator")->trans("list_dati_consumi");
  702.                                         $dato=explode(" ",$datoRiga->getConsumo_min())[0]." - ".$datoRiga->getConsumo_max();
  703.                                         break;
  704.                                     case 'carico_cons':
  705.                                         $datoh=$this->get("translator")->trans("list_dati_carico_cons");
  706.                                         $dato=(string)$datoRiga->getCarico_cons();
  707.                                         break;
  708.                                     case 'u_fumi':
  709.                                         $datoh=$this->get("translator")->trans("list_dati_u_fumi");
  710.                                         $dato=(string)$datoRiga->getU_fumi();
  711.                                         break;
  712.                                     case 'c_nrg':
  713.                                         $datoh=$this->get("translator")->trans("list_dati_c_nrg");
  714.                                         $dato=$datoRiga->getClasse_nrg();
  715.                                         break;
  716.                                     case 'certificazioni':
  717.                                         $datoh=$this->get("translator")->trans("list_dati_certificazioni");
  718.                                         $allinc=$prodbase->getCertificazioni();
  719.                                         if (!is_null($allinc)) {
  720.                                             $content="";
  721.                                             foreach ($allinc as $key3) {
  722.                                                 $miopic $key3->getImg_cert();
  723.                                                 if (!is_null($miopic) && $miopic instanceof \Pimcore\Model\Asset\Image) {
  724.                                                     $dato=$dato.$miopic->getThumbnail("listmini")->getHtml(); 
  725.                                                 }
  726.                                             }
  727.                                         }
  728.                                         break;
  729.                                     case 'incentivi':
  730.                                         $datoh=$this->get("translator")->trans("list_dati_incentivi");
  731.                                         $allinc=$prodbase->getIncentivi();
  732.                                         if (!is_null($allinc)) {
  733.                                             foreach ($allinc as $key2) {
  734.                                                 $miopic $key2->getImg_inc();
  735.                                                 if (!is_null($miopic) && $miopic instanceof \Pimcore\Model\Asset\Image) {
  736.                                                     $dato=$dato.$miopic->getThumbnail("listmini")->getHtml();
  737.                                                 }
  738.                                             }
  739.                                         }
  740.                                         break;
  741.                                     default:
  742.                                         # code...
  743.                                         break;
  744.                                 }
  745.                                 $rigaDatiNewh[$campo]=$datoh;
  746.                                 $rigaDatiNew[$campo]=$dato;
  747.                             }                           
  748.                             $arrayTestNew[]=$rigaDatiNew;
  749.                             $pbase_idprod_prec=$prodbase->getId_prod() ?: $prodbase->getId();
  750.                         } //if uguale al precedente o mancano dati
  751.                     //foreach sui prodotti base
  752.                 //if di nomefunzione
  753.                 
  754.                 $myArrayNew=$arrayTestNew;
  755.                 $myArrayh=$rigaDatiNewh;
  756.                 //************************ FINE TABELLA INFERIORE ***************************
  757.                 //aggiunge il design e i prodotti all'array da renderizzare
  758.                 $pagesToRender[]=array("design"=>$design,"prodottibase"=>$prodbaselist,"focolari"=>$compFocolari,"focolari2D"=>$compFocolari2D,"kit"=>$compKit,"raggruppa"=>$raggruppa,"optional"=>$myAccAll,"plus"=>$myPlusAll,"datih"=>$rigaDatiNewh,"dati"=>$arrayTestNew);
  759.             } else {
  760.             }
  761.         } //foreach design
  762.         $this->view->pages $pagesToRender;
  763.     }
  764.     public function listpagepalexpdfAction(Request $request)
  765.     {
  766.     }
  767.     public function listcleanmultiAction(Request $request)
  768.     {
  769.     }
  770.     public function deslistAction(Request $request)
  771.     {
  772.     }
  773.     public function assegnaAction(Request $request)
  774.     {
  775.     }
  776.     public function addplusAction(Request $request)
  777.     {
  778.     }
  779.     public function addcertAction(Request $request)
  780.     {
  781.     }
  782.     public function addincAction(Request $request)
  783.     {
  784.     }
  785.     public function addaccAction(Request $request)
  786.     {
  787.     }
  788.     public function addcompAction(Request $request)
  789.     {
  790.     }
  791.     //*********************  FUNZIONI COMODE PER ESTRAZIONE DATI  ********************************************
  792.     public function getAllDesign($myIDParent) {
  793.         //estrae tutti i design dal folder e poi disegna la pagina:
  794.         $entriesD = new \Pimcore\Model\DataObject\Design\Listing();
  795.         $entriesD->setObjectTypes([\Pimcore\Model\DataObject\AbstractObject::OBJECT_TYPE_OBJECT]);
  796.         $entriesD->setLimit(300);
  797.         $entriesD->setOrderKey("ordinamento");
  798.         $entriesD->setOrder("asc");
  799.         $entriesD->setCondition("o_parentId = '".$myIDParent."'");
  800.         $entriesD->load();
  801.         return $entriesD;
  802.     }
  803.     public function getAllDesignUL() {
  804.         //estrae tutti i design dal folder e poi disegna la pagina:
  805.         $entriesD = new \Pimcore\Model\DataObject\Design\Listing();
  806.         $entriesD->setObjectTypes([\Pimcore\Model\DataObject\AbstractObject::OBJECT_TYPE_OBJECT]);
  807.         $entriesD->setLimit(3000);
  808.         $entriesD->setOrderKey("o_path");
  809.         $entriesD->setOrder("asc");
  810.         $entriesD->load();
  811.         return $entriesD;
  812.     }
  813.     public function getPrezzo($mycode,$listino) {
  814.         if(!is_null($mycode->getPrz()) and !is_null($mycode->getPrz()->getPrezzi()) ) { //and !is_null($mycode->getPrz()->getPrezzi()->getLis_it_curr())) {
  815.             //echo $mycode.PHP_EOL;
  816.             $myclass=get_class($mycode);
  817.             return explode(" ",call_user_func(array($mycode->getPrz()->getPrezzi(),$listino)))[0];
  818.             //return explode(" ",$mycode->getPrz()->getPrezzi()->getLis_it_curr())[0];
  819.         }
  820.         return '';
  821.     }
  822.     public function getCosto($mycode,$listino) {
  823.         if(!is_null($mycode->getPrz()) and !is_null($mycode->getPrz()->getPrezzi())) {
  824.             //echo $mycode.PHP_EOL;
  825.             $myclass=get_class($mycode);
  826.             return explode(" ",call_user_func(array($mycode->getPrz()->getPrezzi(),"getCost_standard_curr")))[0];
  827.             //return explode(" ",$mycode->getPrz()->getPrezzi()->getLis_it_curr())[0];
  828.         }
  829.         return '';
  830.     }
  831.     public function getPrezzoCodice($mycodestring,$listino) {
  832.         $mycode = \Pimcore\Model\DataObject\Codice::getByCodice($mycodestring,1);
  833.         return \AppBundle\Controller\ProvaController::getPrezzo($mycode,$listino);
  834.     }
  835.     public function getDati($mycode,$listinoO,$listinoN) {
  836.         $prezzoO=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode,$listinoO)));
  837.         $prezzoN=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode,$listinoN)));
  838.         $costo=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getCosto($mycode,"null")));
  839.         $delta= (intval($prezzoO)==0) ? number_format(($prezzoN-$prezzoO)/$prezzoO*100,1);
  840.         $nettoNew=$prezzoN*0.6*0.9;
  841.         $marg= (intval($prezzoN)==0) ? number_format(($nettoNew-$costo)/$nettoNew*100,1);
  842.         $margAss= (intval($prezzoN)==|| intval($costo)==) ? number_format($nettoNew-$costo,0);
  843.         $dati=array("codice"=>$mycode->getCodice(),"prezzoO"=>$prezzoO,"prezzoN"=>$prezzoN,"costo"=>$costo,"deltaPp"=>$delta,"prezzoNnet"=>$nettoNew,"margNp"=>$marg,"margN"=>$margAss);
  844.         return $dati;
  845.     }
  846.     public function getDatiPrezziAll($mycode$curr_or_new) {
  847.         $prezzo_IT '';
  848.         $prezzo_ES '';
  849.         $prezzo_FR '';
  850.         $prezzo_DE '';
  851.         $prezzo_UN '';
  852.         if ($curr_or_new == 'curr') {
  853.             $prezzo_IT=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_it_curr')));
  854.             $prezzo_ES=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_es_curr')));
  855.             $prezzo_FR=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_fr_curr')));
  856.             $prezzo_DE=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_de_curr')));
  857.             $prezzo_UN=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_row_curr')));
  858.         } else {
  859.             $prezzo_IT=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_it_new')));
  860.             $prezzo_ES=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_es_new')));
  861.             $prezzo_FR=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_fr_new')));
  862.             $prezzo_DE=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_de_new')));
  863.             $prezzo_UN=intval(str_replace(".""", \AppBundle\Controller\ProvaController::getPrezzo($mycode'getLis_row_new')));
  864.         }
  865.         return array("codice"=>$mycode->getCodice(), "prezzo_IT"=>$prezzo_IT,"prezzo_ES"=>$prezzo_ES,"prezzo_FR"=>$prezzo_FR"prezzo_DE"=>$prezzo_DE"prezzo_UN"=>$prezzo_UN);
  866.     }
  867.     //*********************  FUNZIONI COMODE PER RENDERIZZARE  ***********************************************
  868.     public function renderHeader($title) {
  869.         return '<tr>
  870.                     <th class="prima titolo_tab" align="left" colspan="2">'.$title.'</th>
  871.                     <th class="prima titolo_tab" align="center">€_old</th>
  872.                     <th class="prima titolo_tab" align="center">€_new</th>
  873.                     <th class="prima titolo_tab" align="center">[€]</th>
  874.                     <th class="prima titolo_tab" align="center">&#916;%</th>
  875.                     <th class="prima titolo_tab" align="right">&#916;€</th>
  876.                 </tr>';
  877.     }
  878.     public function renderDati($desc,$mycode,$listinoO,$listinoN) {
  879.         $dati=\AppBundle\Controller\ProvaController::getDati($mycode,$listinoO,$listinoN);
  880.         return '<tr>
  881.                     <td class="prima descrizione_opt" width="40%">'.$desc.'</td>
  882.                     <td align="center" width="10%" class="codice"><a href="http://pim.palazzetti.it/admin/login/deeplink?object_'.$mycode->getId().'_object" target="_new">'.$dati["codice"].'</a></td>
  883.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzoO"].'</td>
  884.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzoN"].'</td>
  885.                     <td align="center" width="10%" class="prezzo">'.$dati["costo"].'</td>
  886.                     <td align="center" width="10%" class="prezzo">'.$dati["margNp"].'%</td>
  887.                     <td align="right"  width="10%" class="prezzo">'.$dati["margN"].'</td>
  888.                 </tr>';
  889.     }
  890.     public function renderHeaderDatiAll($title) {
  891.         return '<tr>
  892.                     <th class="prima titolo_tab" align="left" colspan="2">'.$title.'</th>
  893.                     <th class="prima titolo_tab" align="center">€ IT</th>
  894.                     <th class="prima titolo_tab" align="center">€ ES</th>
  895.                     <th class="prima titolo_tab" align="center">€ FR</th>
  896.                     <th class="prima titolo_tab" align="center">€ DE</th>
  897.                     <th class="prima titolo_tab" align="center">€ EN</th>
  898.                 </tr>';
  899.     }
  900.     public function renderDatiAll($desc,$mycode,$curr_or_new) {
  901.         $dati=\AppBundle\Controller\ProvaController::getDatiPrezziAll($mycode$curr_or_new);
  902.         return '<tr>
  903.                     <td class="prima descrizione_opt" width="40%">'.$desc.'</td>
  904.                     <td align="center" width="10%" class="codice"><a href="http://pim.palazzetti.it/admin/login/deeplink?object_'.$mycode->getId().'_object" target="_new">'.$dati["codice"].'</a></td>
  905.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzo_IT"].'</td>
  906.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzo_ES"].'</td>
  907.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzo_FR"].'</td>
  908.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzo_DE"].'</td>
  909.                     <td align="center" width="10%" class="prezzo">'.$dati["prezzo_UN"].'</td>
  910.                 </tr>';
  911.     }
  912.     public function renderTable($myArrayh2,$myArray) {
  913.         $campi=$myArray[0];
  914.         $corpo='';
  915.         if (!is_null($myArrayh2) && !is_null($campi)) {
  916.             $corpo='<!-- CLASS RENDERER -->
  917.                 <table class="display compact" width="100%" style="font-size: 8pt;border-collapse: collapse; margin-top: 10px;">
  918.                 <thead><tr style="background:#cfd0d1">';
  919.             foreach ($campi as $dettS) {
  920.                 if ($dettS=="incentivi") {
  921.                     $corpo=$corpo.'<th width="100px" ';
  922.                 } elseif ($dettS=="certificazioni") {
  923.                     $corpo=$corpo.'<th width="130px" ';
  924.                 } else  {
  925.                     $corpo=$corpo.'<th ';
  926.                 }
  927.                 $corpo=$corpo.' style="border: 1px solid #878786;text-align:center;">'.$myArrayh2[$dettS].'</th>';
  928.             }
  929.             $corpo=$corpo.'</tr></thead><tbody>';                 
  930.             //$myArray=$myArrayNew2;
  931.             $tot=count($myArray);
  932.             $newSpanner=array();
  933.             $i=1;
  934.             foreach ($campi as $dettS) {
  935.                 $i=1;
  936.                 $newSpanner[$i][$dettS]=1;
  937.                 for ($j $i+1$j count($myArray); $j++) {
  938.                     if ($myArray[$i][$dettS]==$myArray[$j][$dettS]  ) {
  939.                         $newSpanner[$i][$dettS]++;
  940.                         $newSpanner[$j][$dettS]=0;
  941.                     } else  {
  942.                         $newSpanner[$j][$dettS]=1;
  943.                         $i=$j;
  944.                     }
  945.                 }
  946.             }
  947.             for ($k 1$k count($myArray); $k++) {
  948.                 $corpo=$corpo.'<tr>';
  949.                     foreach ($campi as $dettS) {
  950.                         if($newSpanner[$k][$dettS]==0) {
  951.                         } else if ($newSpanner[$k][$dettS]==1) {
  952.                             $corpo=$corpo.'<td style="border: 1px solid #878786;text-align:center;">'.$myArray[$k][$dettS].'</td>';
  953.                         } else {
  954.                             $corpo=$corpo.'<td style="border: 1px solid #878786;text-align:center;" rowspan="'.$newSpanner[$k][$dettS].'">'.$myArray[$k][$dettS].'</td>';
  955.                         }
  956.                     }                                       
  957.                 $corpo=$corpo.'</tr>';
  958.             }
  959.             $corpo=$corpo.'</tbody></table>';
  960.             return $corpo;
  961.         } else {
  962.             return '';
  963.         }
  964.     }
  965. }