src/Controller/Backend/TMetaDataController.php line 88

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Backend;
  3. use App\Controller\Base\BaseController;
  4. use App\Entity\TDataGrafik;
  5. use App\Entity\TFileGrafik;
  6. use App\Entity\TGrafik;
  7. use App\Form\TGrafikType;
  8. use App\Entity\TGrafikDinamis;
  9. use App\Entity\TMetaData;
  10. use App\Entity\TVariabel;
  11. use App\Entity\TVariabelGrafik;
  12. use App\Repository\MKategoriDetailRepository;
  13. use App\Repository\MKategoriRepository;
  14. use App\Repository\TDivRepository;
  15. use App\Repository\TGrafikDinamisRepository;
  16. use App\Repository\TGrafikRepository;
  17. use App\Repository\TLogRepository;
  18. use App\Repository\TVariabelGrafikRepository;
  19. use App\Repository\TFileGrafikRepository;
  20. use Doctrine\Persistence\ManagerRegistry;
  21. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  22. use Symfony\Component\HttpFoundation\Response;
  23. use Symfony\Component\HttpFoundation\JsonResponse;
  24. use Symfony\Component\Routing\Annotation\Route;
  25. use Kematjaya\Breadcrumb\Lib\Builder as BreacrumbBuilder;
  26. use Symfony\Component\HttpFoundation\Request;
  27. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  28. use Kematjaya\ImportBundle\Manager\ImportManagerInterface;
  29. use Kematjaya\ImportBundle\DataSource\RemoteDataSource;
  30. use App\Transformer\PublikasiTransformer;
  31. use App\Transformer\VariabelTransformer;
  32. use DateTime;
  33. use Sonata\SeoBundle\Seo\SeoPageInterface;
  34. use PhpOffice\PhpSpreadsheet\IOFactory;
  35. use Knp\Component\Pager\PaginatorInterface;
  36. use App\Filter\TGrafikDinamisFilterType;
  37. use App\Filter\TMetaDataFilterType;
  38. use App\Repository\TDataGrafikRepository;
  39. use App\Repository\TMetaDataRepository;
  40. use App\Repository\TProgresRepository;
  41. use App\Repository\TRawDataRepository;
  42. use App\Repository\TVariabelRepository;
  43. use Symfony\Component\Process\Process;
  44. class TMetaDataController extends BaseController
  45. {
  46.     private $pageName 't_meta_data';
  47.     private $class TMetaData::class;
  48.     /**
  49.      * @Route("/t/meta/data", name="t_meta_data")
  50.      */
  51.     public function index(SeoPageInterface $seoPageBreacrumbBuilder $builderRequest $requestPaginatorInterface $paginatorInterface): Response
  52.     {
  53.         $userRoles $this->getUser()->getRoles();
  54.         $seoPage->addTitlePrefix("Dataset");
  55.         $builder->add('Dashboard '"dashboard", array(), "&nbsp;<i class='fa fa-home'></i>");
  56.         $builder->add('Meta Data');
  57.         $filter TMetaDataFilterType::class;
  58.         $form $this->get('form.factory')->create($filter$this->getFilters($filter));
  59.         $queryBuilder $this->getQueryBuilder($this->class);
  60.         // if ($userRoles[0] != 'ROLE_ADMINISTRATOR' && $userRoles[0] != 'ROLE_WALIDATA' && $userRoles[0] != 'ROLE_SUPER_USER'){
  61.         //     $queryBuilder = $queryBuilder->where('this.div = ' . $this->getUser()->getDiv()->getId());
  62.         // }
  63.         $queryBuilder $queryBuilder->where('this.id = 40');
  64.         $queryBuilder $this->buildFilter($request$form$queryBuilder)->addOrderBy("this.id""DESC");
  65.         $this->setSessionLimit($request);
  66.         $maxPerPage $request->getSession()->get("limit") ? $request->getSession()->get("limit") : $this->getLimit();
  67.         $pagination $paginatorInterface->paginate($queryBuilder$request->query->getInt('page'1), $maxPerPage);
  68.         return $this->render('backend/t_meta_data/index.html.twig', [
  69.             'page_name' => $this->pageName,
  70.             'button_credential' => $this->buttonCredentials(),
  71.             'filter' => $form->createView(),
  72.             'pagination' => $pagination,
  73.         ]);
  74.     }
  75.     /**
  76.      * @Route("/t_meta_data/{id}/detail", name="t_meta_data_detail", methods={"GET", "POST"})
  77.      */
  78.     public function detail(
  79.         BreacrumbBuilder $builder,
  80.         TMetaDataRepository $tMetaDataRepo,
  81.         TMetaData $tMetaData,
  82.         MKategoriRepository $mKategoriDetailRepo,
  83.         TVariabelRepository $tVariabelRepo,
  84.         TGrafikRepository $tGrafikRepo,
  85.         TFileGrafikRepository $tfileGrafikRepo
  86.     ) {
  87.         $builder->add('Dashboard '"dashboard", array(), "&nbsp;<i class='fa fa-home'></i>");
  88.         $builder->add('Meta Data'"t_meta_data");
  89.         $builder->add('Detail');
  90.         $detail $tMetaDataRepo->find($tMetaData);
  91.         // $files = $tfileGrafikRepo->findBy(['grafik' => $detail->getId()]);
  92.         // $kategori = $mKategoriDetailRepo->findBy(['reff_id' => $detail->getId(), 'reff_name' => 'PUBLIKASI']);
  93.         $variabel $tVariabelRepo->findBy(['reff_id' => $detail->getId(), 'reff_kode' => 'METADATA'], ['id' => 'ASC']);
  94.         // $opt_periode = $this->getPeriodeName($detail->getPeriode()->getId());
  95.         $grafik $tGrafikRepo->findOneBy(['reff_id' => $detail->getId()]);
  96.         $grafik_info = [];
  97.         // if ($grafik) {
  98.         //     // $variabel_x = $tVariabelRepo->find($grafik->getAxisX());
  99.         //     // $variabel_y = $tVariabelGrafikRepo->find($grafik->getAxisY());
  100.         //     $grafik_info = [
  101.         //         'title' => $grafik->getJudul(),
  102.         //         'tipe' => $grafik->getTipe(),
  103.         //         'varX' => $variabel_x->getNama()
  104.         //         // 'varY' => $variabel_y->getNama()
  105.         //     ];
  106.         // }
  107.         // dump($grafik_info); exit;
  108.         return $this->render('backend/t_meta_data/detail.html.twig', [
  109.             'page_name' => $this->pageName,
  110.             'button_credential' => $this->buttonCredentials(),
  111.             'meta_data' => $detail,
  112.             // 'kategori' => $kategori,
  113.             'variabel' => $variabel,
  114.             // 'grafik' => $grafik,
  115.             // 'opt_periode' => $opt_periode,
  116.             // 'grafik_info' => $grafik_info,
  117.             // 'files' => $files
  118.         ]);
  119.     }
  120.     /**
  121.      * @Route("/t_meta_data/{id}/delete_t_meta_data", name="t_meta_data_delete", methods={"GET"})
  122.      */
  123.     public function delete(?string $id nullTMetaDataRepository $tMetaDataRepoTLogRepository $tLogRepoTVariabelRepository $tVariabelRepo)
  124.     {
  125.         $meta_data $tMetaDataRepo->find($id);
  126.         // dump($meta_data); exit;
  127.         $entityManager $this->getDoctrine()->getManager();
  128.         $entityManager->remove($meta_data);
  129.         $entityManager->flush();
  130.         //hapus variable
  131.         $variabel $tVariabelRepo->findBy(['reff_id' => $meta_data->getId(), 'reff_kode' => 'METADATA'], ['id' => 'ASC']);
  132.         foreach ($variabel as $var) {
  133.             $entityManager->remove($var);
  134.             $entityManager->flush();
  135.         }
  136.         //hapus db
  137.         $connection $this->getDoctrine()->getConnection();
  138.         $tbl $meta_data->getNamaTabel();
  139.         $query $connection->prepare("select * from information_schema.tables WHERE table_schema='public' AND table_name='$tbl'");
  140.         $query->execute();
  141.         $hasil $query->fetchAll();
  142.         // print_r($hasil); exit;
  143.         if ($hasil) {
  144.             $stmt $connection->prepare("DROP TABLE $tbl");
  145.             $stmt->execute();
  146.         }
  147.         $tLogRepo->setLog($this->getDoctrine()->getManager(), null$meta_data->getId(), "Hapus Meta Data " $meta_data->getJudul() . ' nama_table: ' $meta_data->getNamaTabel(), $this->getUser()->getName());
  148.         $this->addFlash('notice''Meta Data "' $meta_data->getJudul() . '" berhasil dihapus');
  149.         return $this->redirectToRoute('t_meta_data');
  150.     }
  151.     /**
  152.      * @Route("/t_meta_data/new/{id}", defaults={"id"= null}, name="t_meta_data_new", methods={"POST", "GET"})
  153.      */
  154.     public function new(?string $idRequest $requestTMetaDataRepository $tMetaDataRepoManagerRegistry $managerRegistryTVariabelRepository $tVariabelRepo,  BreacrumbBuilder $builder)
  155.     {
  156.         $user $this->getUser();
  157.         $builder->add('Dashboard '"dashboard", array(), "&nbsp;<i class='fa fa-home'></i>");
  158.         $builder->add('Meta Data'"t_meta_data");
  159.         $builder->add('Form Meta Data');
  160.         $header $this->getDataHeader();
  161.         // print_r($header); exit;
  162.         $header $header[1]['head2'];
  163.         $isAdmin false;
  164.         if ($user->getRoles()[0] == "ROLE_ADMINISTRATOR" || $user->getRoles()[0] == "ROLE_SUPER_USER") {
  165.             $isAdmin true;
  166.         }
  167.         $em $managerRegistry->getManager();
  168.         if ($id) {
  169.             $t_meta_data $tMetaDataRepo->find($id);
  170.         } else {
  171.             $t_meta_data = new TMetaData();
  172.         }
  173.         if (!$t_meta_data) {
  174.             throw new NotFoundHttpException();
  175.         }
  176.         // dump($t_meta_data); exit;
  177.         if ($request->isMethod('POST')) {
  178.             $connection $this->getDoctrine()->getConnection();
  179.             //cek table
  180.             // print_r($var); exit;
  181.             //created_db
  182.             // $connection = DriverManager::getConnection($this->connParams);
  183.             // $tbl = 'table_ab';
  184.             // $var_static = 'no_pr VARCHAR(250)';
  185.             // $koloms =  [$var_static.','.implode(",",$var)];
  186.             // print_r($koloms); exit;
  187.             // $kolom = [];
  188.             // foreach($koloms as $key=>$value){
  189.             //     $kolom[] = $value. ' VARCHAR(250)';
  190.             // }
  191.             if (!$id) {
  192.                 //$countPub = $tGrafikDinamisRepo->findBy(['urusan'=>$request->get('urusan'), 'sektor'=>$request->get('sektor')]);
  193.                 // $kode = $this->generateKode($request->get('urusan'), $request->get('sektor'), count($countPub));
  194.                 //$publikasi->setKode($kode);
  195.                 $t_meta_data->setCreatedAt(new \DateTimeImmutable());
  196.             }
  197.             $t_meta_data->setJudul($request->get('judul'));
  198.             $t_meta_data->setDeskripsi($request->get('deskripsi'));
  199.             // $publikasi->setDeskripsi($request->get('deskripsi'));
  200.             // $publikasi->setUrusan($mUrusanRepo->find($request->get('urusan')));
  201.             // $publikasi->setSektor($mSektorRepo->find($request->get('sektor')));
  202.             // if ($isAdmin) {
  203.             //     $publikasi->setDiv($tDivRepo->find($request->get('opd')));
  204.             // } else {
  205.             //     $publikasi->setDiv($user->getDiv());
  206.             // }
  207.             // $publikasi->setStatus($mStatusRepo->find(13));
  208.             if (!$id) {
  209.                 $variable $request->get('variable');
  210.                 if (!$variable) {
  211.                     $this->addFlash('error''Simpan Gagal, Wajib memasukkan variable');
  212.                     return $this->redirectToRoute('t_meta_data_new');
  213.                 }
  214.                 $em->persist($t_meta_data);
  215.                 $em->flush();
  216.                 // print_r($variable); exit;
  217.                 $variable_tambahan = ['kategori_plant' => 'kategori_plant''regional' => 'regional''kategori_tahap' => 'kategori_tahap''nilai_saving_terhadap_anggaran' => 'nilai_saving_terhadap_anggaran''nilai_saving_terhadap_hps' => 'nilai_saving_terhadap_hps''saving_persen_terhadap_angggaran' => 'saving_persen_terhadap_angggaran''saving_persen_terhadap_hps' => 'saving_persen_terhadap_hps'];
  218.                 $header array_merge($header$variable_tambahan);
  219.                 $connection $this->getDoctrine()->getConnection();
  220.                 $tbl str_replace(" ""_"strtolower('tabel_' $t_meta_data->getId()));
  221.                 $t_meta_data->setNamaTabel($tbl);
  222.                 $em->persist($t_meta_data);
  223.                 $em->flush();
  224.                 // $query = $connection->prepare("select * from information_schema.tables WHERE table_schema='public' AND table_name='$tbl'");
  225.                 // $query->execute();
  226.                 // $hasil = $query->fetchAll();
  227.                 // if ($hasil) {
  228.                 //     $this->addFlash('error', 'Nama Table "' . $tbl . '" Sudah Ada');
  229.                 //     return $this->redirectToRoute('t_meta_data');
  230.                 // }
  231.                 $var = [];
  232.                 $variable array_unique(array_merge(array_values($variable), array_values($variable_tambahan)));
  233.                 // print_r($variable); exit;
  234.                 foreach ($variable as $key => $value) {
  235.                     if (in_array($value$variable_tambahan)) {
  236.                         $tipe_data 'VARCHAR(250)';
  237.                         $label_kolom $value;
  238.                         // $kolomx = $key;
  239.                         $nama_var $value;
  240.                     } else {
  241.                         $tipe_data = ($request->get('tipe_data')[$key] == 'VARCHAR') ? 'VARCHAR(250)' :  $request->get('tipe_data')[$key];
  242.                         $label_kolom $header[$value];
  243.                         $nama_var $this->cek_karakter($this->buang(strtolower($header[$value])));
  244.                         // $kolomx = $value;
  245.                     }
  246.                     $var[] =  $nama_var ' ' $tipe_data;
  247.                     if ($label_kolom == 'saving_persen_terhadap_angggaran') {
  248.                         $label_kolomx =   'Saving Tehadap Anggaran (%)';
  249.                     } else if ($label_kolom == 'saving_persen_terhadap_hps') {
  250.                         $label_kolomx =   'Saving Tehadap HPS (%)';
  251.                     } else {
  252.                         $label_kolomx =   str_replace("_"" "$label_kolom);
  253.                     }
  254.                     $variablex = new TVariabel();
  255.                     $variablex->setNama($nama_var);
  256.                     $variablex->setKolom($value);
  257.                     $variablex->setReffKode('METADATA');
  258.                     $variablex->setReffId($t_meta_data->getId());
  259.                     $variablex->setTipeData(str_replace("(250)"""$tipe_data));
  260.                     $variablex->setLabelKolom(ucwords($label_kolomx));
  261.                     $em->persist($variablex);
  262.                     $em->flush();
  263.                 }
  264.                 $kolom implode(","$var);
  265.                 $stmt $connection->prepare("CREATE TABLE $tbl(id serial PRIMARY KEY,$kolom)");
  266.                 $stmt->execute();
  267.                 //insert data
  268.                 $variabels $tVariabelRepo->findBy(['reff_id' => $t_meta_data->getId(), 'reff_kode' => 'METADATA'], ['id' => 'ASC']);
  269.                 $array $this->getDataTableCleansing(nullnullnullnull);
  270.                 $items $array['isi'] ?? [];
  271.                 // dump($items);
  272.                 // exit;
  273.                 $var = [];
  274.                 foreach ($variabels as $variabel) {
  275.                     $var[$variabel->getKolom()] = $variabel->getNama();
  276.                 }
  277.                 // Ambil hanya key dari var
  278.                 $keysVar array_keys($var);
  279.                 // Hasil akhir
  280.                 $result = [];
  281.                 foreach ($items as $index => $row) {
  282.                     // if ($row['Q'] == 'Ya') {
  283.                     //     continue;
  284.                     // }
  285.                     $result[$index] = array_intersect_key($rowarray_flip($keysVar));
  286.                 }
  287.                 // $tablex = $meta_data->getNamaTabel();
  288.                 $kolom array_values($var); // Nama kolom
  289.                 $kolomSql implode(","$kolom);
  290.                 // print_r($kolomSql); exit;
  291.                 // Ambil metadata tipe kolom dari database
  292.                 $schemaManager $connection->getSchemaManager();
  293.                 $columnsInfo $schemaManager->listTableColumns($tbl);
  294.                 // Buat peta: kolom => tipe data
  295.                 $columnTypes = [];
  296.                 foreach ($columnsInfo as $colName => $column) {
  297.                     $columnTypes[$colName] = $column->getType()->getName(); // contoh: 'date', 'string', 'integer'
  298.                 }
  299.                 // Proses setiap baris
  300.                 foreach ($result as $row) {
  301.                     $values = [];
  302.                     foreach ($kolom as $col) {
  303.                         $value trim($row[array_search($col$var)] ?? '');
  304.                         // Format jika date
  305.                         if ($columnTypes[$col] === 'date') {
  306.                             if (!$value || strtolower($value) === 'null') {
  307.                                 $values[] = "NULL";
  308.                             } else {
  309.                                 $formatted date('Y-m-d'strtotime($value));
  310.                                 $values[] = "'$formatted'";
  311.                             }
  312.                         } else {
  313.                             // Jika kolom numeric, bersihkan tanda koma
  314.                             if (in_array($columnTypes[$col], ['decimal''numeric''float'])) {
  315.                                 $cleanValue str_replace(','''$value);
  316.                                 $values[] = $cleanValue ?: 'NULL';
  317.                             } else {
  318.                                 $values[] = "'" addslashes(str_replace(["'"'"'], ""$value)) . "'";
  319.                             }
  320.                         }
  321.                     }
  322.                     $valuesSql implode(","$values);
  323.                     // print_r('table:' . $tablex);
  324.                     // print_r('kolom:' . $kolomSql);
  325.                     // print_r('valuesSql:' . $valuesSql);
  326.                     // exit;
  327.                     $stmt $connection->prepare("INSERT INTO $tbl($kolomSql) VALUES ($valuesSql)");
  328.                     $stmt->execute();
  329.                 }
  330.             }
  331.             $em->persist($t_meta_data);
  332.             $em->flush();
  333.             $this->addFlash('notice''Meta Data "' $t_meta_data->getJudul() . '" berhasil ditambahkan');
  334.             return $this->redirectToRoute('t_meta_data');
  335.         }
  336.         return $this->render('/backend/t_meta_data/new.html.twig', [
  337.             't_meta_data' => $t_meta_data,
  338.             'header' => $header,
  339.             // 'mUrusan' => $mUrusan,
  340.             // 'mSektor' => $mSektor,
  341.             // 'tDiv' => $tDiv,
  342.             'isAdmin' => $isAdmin,
  343.         ]);
  344.     }
  345.     /**
  346.      * @Route("/t_meta_data/{id}/sinkron", name="t_meta_data_sinkron", methods={"GET"})
  347.      */
  348.     public function sinkron(?string $id nullTMetaDataRepository $tMetaDataRepoTVariabelRepository $tVariabelRepoTRawDataRepository $tRawDataTMetaData $tMetaDataManagerRegistry $managerRegistry)
  349.     {
  350.         $meta_data $tMetaDataRepo->find($id);
  351.         $baseCmd sprintf('%s/bin/console app:meta-data "%s"'$this->getParameter('kernel.project_dir'), $id);
  352.         // print_r($baseCmd);
  353.         // exit;
  354.         if (strncasecmp(PHP_OS'WIN'3) === 0) {
  355.             $cmd 'start /B php ' $baseCmd;
  356.         } else {
  357.             $cmd 'php7.4 ' $baseCmd ' > /dev/null 2>&1 &';
  358.         }
  359.         $process Process::fromShellCommandline($cmd);
  360.         $process->disableOutput();
  361.         $process->start();
  362.         $this->addFlash('notice''Sinkron Meta Data "' $meta_data->getJudul() . '" berhasil');
  363.         return $this->redirectToRoute('t_meta_data');
  364.     }
  365.     // public function sinkron(?string $id = null, TMetaDataRepository $tMetaDataRepo, TVariabelRepository $tVariabelRepo, TRawDataRepository $tRawData, TMetaData $tMetaData, ManagerRegistry $managerRegistry)
  366.     // {
  367.     //     $connection = $this->getDoctrine()->getConnection();
  368.     //     $em = $managerRegistry->getManager();
  369.     //     $user = $this->getUser();
  370.     //     $meta_data = $tMetaDataRepo->find($id);
  371.     //     $variabels = $tVariabelRepo->findBy(['reff_id' => $meta_data->getId(), 'reff_kode' => 'METADATA'], ['id' => 'ASC']);
  372.     //     $array = $this->getDataTableCleansing(null, null, null, null);
  373.     //     $items = $array['isi'] ?? [];
  374.     //     // dump($items);
  375.     //     // exit;
  376.     //     $var = [];
  377.     //     foreach ($variabels as $variabel) {
  378.     //         $var[$variabel->getKolom()] = $variabel->getNama();
  379.     //     }
  380.     //     // Ambil hanya key dari var
  381.     //     $keysVar = array_keys($var);
  382.     //     // Hasil akhir
  383.     //     $result = [];
  384.     //     foreach ($items as $index => $row) {
  385.     //         // if ($row['Q'] == 'Ya') {
  386.     //         //     continue;
  387.     //         // }
  388.     //         $result[$index] = array_intersect_key($row, array_flip($keysVar));
  389.     //     }
  390.     //     $tablex = $meta_data->getNamaTabel();
  391.     //     $kolom = array_values($var); // Nama kolom
  392.     //     $kolomSql = implode(",", $kolom);
  393.     //     // print_r($kolomSql); exit;
  394.     //     // Ambil metadata tipe kolom dari database
  395.     //     $schemaManager = $connection->getSchemaManager();
  396.     //     $columnsInfo = $schemaManager->listTableColumns($tablex);
  397.     //     // Buat peta: kolom => tipe data
  398.     //     $columnTypes = [];
  399.     //     foreach ($columnsInfo as $colName => $column) {
  400.     //         $columnTypes[$colName] = $column->getType()->getName(); // contoh: 'date', 'string', 'integer'
  401.     //     }
  402.     //     // print_r($result); exit;
  403.     //     // Proses setiap baris
  404.     //     foreach ($result as $row) {
  405.     //         $values = [];
  406.     //         foreach ($kolom as $col) {
  407.     //             $value = trim($row[array_search($col, $var)] ?? '');
  408.     //             // Format jika date
  409.     //             if ($columnTypes[$col] === 'date') {
  410.     //                 if (!$value || strtolower($value) === 'null') {
  411.     //                     $values[] = "NULL";
  412.     //                 } else {
  413.     //                     $formatted = date('Y-m-d', strtotime($value));
  414.     //                     $values[] = "'$formatted'";
  415.     //                 }
  416.     //             } else {
  417.     //                 // Jika kolom numeric, bersihkan tanda koma
  418.     //                 if (in_array($columnTypes[$col], ['decimal', 'numeric', 'float'])) {
  419.     //                     $cleanValue = str_replace(',', '', $value);
  420.     //                     $values[] = $cleanValue ?: 'NULL';
  421.     //                 } else {
  422.     //                     $values[] = "'" . addslashes(str_replace(["'", '"'], "", $value)) . "'";
  423.     //                 }
  424.     //             }
  425.     //         }
  426.     //         $valuesSql = implode(",", $values);
  427.     //         //cek no_pr
  428.     //         $no_pr = $row['B'];
  429.     //         $stmt1 = $connection->prepare("SELECT * FROM $tablex WHERE no_pr = :no_pr");
  430.     //         $stmt1->bindValue('no_pr', $no_pr);
  431.     //         $stmt1->execute();
  432.     //         $hasil = $stmt1->fetchAssociative();
  433.     //         if ($hasil) {
  434.     //             $setParts = [];
  435.     //             foreach (array_combine($kolom, $values) as $colName => $val) {
  436.     //                 $setParts[] = "$colName = $val";
  437.     //             }
  438.     //             $setSql = implode(", ", $setParts);
  439.     //             $stmt = $connection->prepare("UPDATE $tablex SET $setSql WHERE no_pr = '$no_pr'");
  440.     //             $stmt->execute();
  441.     //         } else {
  442.     //             $stmt = $connection->prepare("INSERT INTO $tablex($kolomSql) VALUES ($valuesSql)");
  443.     //             $stmt->execute();
  444.     //         }
  445.     //     }
  446.     //     $this->addFlash('notice', 'Sinkron Meta Data "' . $meta_data->getJudul() . '" berhasil');
  447.     //     return $this->redirectToRoute('t_meta_data');
  448.     // }
  449.     /**
  450.      * @Route("/t_meta_data/{id}/dataset_table", name="t_meta_data_dataset_table", methods={"GET", "POST"})
  451.      */
  452.     public function dataset_table(?string $idRequest $request)
  453.     {
  454.         $item_per_page $_POST['length'];
  455.         $page = ($_POST['start'] / $item_per_page) + 1;
  456.         $page = ($page 1) * 10;
  457.         $dataset $this->getDataTableMetaData($id10$page$_POST);
  458.         $jumlah count($this->getDataTableMetaData($idnullnull$_POST));
  459.         $arrJson['aaData']                 = $dataset;
  460.         $arrJson['iTotalRecords']        = $jumlah;
  461.         $arrJson['iTotalDisplayRecords'] = $jumlah;
  462.         return new JsonResponse($arrJson);
  463.     }
  464.     /**
  465.      * @Route("/t_meta_data/progres", name="t_meta_data_progres", methods={"POST"})
  466.      */
  467.     public function progress(TProgresRepository $tProgresRepo)
  468.     {
  469.         $progress $tProgresRepo->findOneBy(['reff_kode' => 'META_DATA']);
  470.         $current null;
  471.         $total null;
  472.         if ($progress) {
  473.             $current $progress->getDataMasuk();
  474.             $total $progress->getJumlahData();
  475.         }
  476.         return new JsonResponse([
  477.             'show' => $progress true false,
  478.             'current' => $current,
  479.             'total' => $total
  480.         ]);
  481.     }
  482. }