src/Twig/AppExtension.php line 1613

Open in your IDE?
  1. <?php
  2. // src/Twig/AppExtension.php
  3. namespace App\Twig;
  4. use App\Entity\Dil;
  5. use SebastianBergmann\Environment\Runtime;
  6. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  7. use Twig\Extension\AbstractExtension;
  8. use Twig\TwigFilter;
  9. use App\Twig\AppRuntime;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use App\Entity\Ceviri;
  12. use App\Entity\Istatistik;
  13. class AppExtension extends AbstractExtension
  14. {
  15.     private $em;
  16.     private $session;
  17.     public function __construct(SessionInterface $session ,EntityManagerInterface $em) {
  18.         $this->em $em;
  19.         $this->session $session;
  20.     }
  21.     public function getFilters()
  22.     {
  23.         return [
  24.             /*            new TwigFilter('test', [AppRuntime::class, 'test']),*/
  25.             new TwigFilter('imgOlustur', [$this'imgOlustur']),
  26.             new TwigFilter('timthumb', [$this'timthumb']),
  27.             new TwigFilter('seo', [$this'seo']),
  28.             new TwigFilter('tarih_yaz', [$this'tarih_yaz']),
  29.             new TwigFilter('base64_encode', [$this'base64_encode']),
  30.             new TwigFilter('base64_decode', [$this'base64_decode']),
  31.             new TwigFilter('yandexToken', [$this'yandexToken']),
  32.             new TwigFilter('cevir', [$this'cevir']),
  33.             new TwigFilter('ceviri', [$this'ceviri']),
  34.             new TwigFilter('ayarlar', [$this'ayarlar']),
  35.             new TwigFilter('dilSay', [$this'dilSay']),
  36.             new TwigFilter('panelSayfaGetir', [$this'panelSayfaGetir']),
  37.             new TwigFilter('panelKategoriGetir', [$this'panelKategoriGetir']),
  38.             new TwigFilter('mesajSay', [$this'mesajSay']),
  39.             new TwigFilter('mesajBul', [$this'mesajBul']),
  40.             new TwigFilter('bildirimSay', [$this'bildirimSay']),
  41.             new TwigFilter('bildirimBul', [$this'bildirimBul']),
  42.             new TwigFilter('altKategoriBul', [$this'altKategoriBul']),
  43.             new TwigFilter('altKategoriBul2', [$this'altKategoriBul2']),
  44.             new TwigFilter('altKategoriGeriYaz', [$this'altKategoriGeriYaz']),
  45.             new TwigFilter('altKategoriListe', [$this'altKategoriListe']),
  46.             new TwigFilter('kategoriDetay', [$this'kategoriDetay']),
  47.             new TwigFilter('istatistik', [$this'istatistik']),
  48.             new TwigFilter('yetkiler', [$this'yetkiler']),
  49.             new TwigFilter('GetIP', [$this'GetIP']),
  50.             new TwigFilter('get_browser_name', [$this'get_browser_name']),
  51.             new TwigFilter('html_entity_decode', [$this'html_entity_decode']),
  52.             new TwigFilter('site_istatistik', [$this'site_istatistik']),
  53.             new TwigFilter('site_anaLink', [$this'site_anaLink']),
  54.             new TwigFilter('site_menuGetir', [$this'site_menuGetir']),
  55.             new TwigFilter('site_footerMetin', [$this'site_footerMetin']),
  56.             new TwigFilter('site_footerSayfa', [$this'site_footerSayfa']),
  57.             new TwigFilter('site_iletisimBilgileri', [$this'site_iletisimBilgileri']),
  58.             new TwigFilter('site_sosyalAglar', [$this'site_sosyalAglar']),
  59.             new TwigFilter('site_sliders', [$this'site_sliders']),
  60.             new TwigFilter('site_sayfaIcerik', [$this'site_sayfaIcerik']),
  61.             new TwigFilter('site_sayfaIcerikDirek', [$this'site_sayfaIcerikDirek']),
  62.             new TwigFilter('site_sayfaIcerikKategori', [$this'site_sayfaIcerikKategori']),
  63.             new TwigFilter('site_dilGetir', [$this'site_dilGetir']),
  64.             new TwigFilter('site_dilGetir2', [$this'site_dilGetir2']),
  65.             new TwigFilter('site_popupGetir', [$this'site_popupGetir']),
  66.             new TwigFilter('site_bannerGetir', [$this'site_bannerGetir']),
  67.             new TwigFilter('site_formGetir', [$this'site_formGetir']),
  68.             new TwigFilter('site_kategoriGeriLi', [$this'site_kategoriGeriLi']),
  69.             new TwigFilter('site_sayfaKategori', [$this'site_sayfaKategori']),
  70.             new TwigFilter('site_formVeriGetir', [$this'site_formVeriGetir']),
  71.             new TwigFilter('digerDiller', [$this'digerDiller']),
  72.             new TwigFilter('taslakBul', [$this'taslakBul']),
  73.             new TwigFilter('popupGetir', [$this'popupGetir']),
  74.             new TwigFilter('IdBul', [$this'IdBul']),
  75.             new TwigFilter('anasayfaIcerikleri', [$this'anasayfaIcerikleri']),
  76.             new TwigFilter('ustMenuler', [$this'ustMenuler']),
  77.             new TwigFilter('veriYenile', [$this'veriYenile']),
  78.             new TwigFilter('kategoriVeriYenile', [$this'kategoriVeriYenile']),
  79.             new TwigFilter('icerikSolMenuler', [$this'icerikSolMenuler']),
  80.             new TwigFilter('footerSayfaDilgrup', [$this'footerSayfaDilgrup']),
  81.         ];
  82.     }
  83.     public function html_entity_decode($degisken){
  84.         $degisken html_entity_decode($degiskenENT_QUOTES,"UTF-8");
  85.         return $degisken;
  86.     }
  87.     public function timthumb($resim$yol$w$h$zc$q)
  88.     {
  89.         return $this->ayarlar('siteYolu') . 'timthumb.php?src=' $yol $resim '&w=' $w '&h=' $h '&zc=' $zc '&q=' $q;
  90.     }
  91.     function seo($url,$dil=1)
  92.     {
  93.         if($dil==1) {
  94.             $tr = array('ş','Ş','ı','I','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç','(',')','/',':',',');
  95.             $eng = array('s','s','i','i','i','g','g','u','u','o','o','c','c','','','-','-','');
  96.             $s str_replace($tr,$eng,$url);
  97.             $find = array('/[^A-Za-z0-9\-<>]/''/[\-]+/''/<[^>]*>/');
  98.             $repl = array('-''-''-');
  99.             $s preg_replace($find$repl$s);
  100.             $s strtolower($s);
  101.             $s preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;amp;.+?;/'''$s);
  102.             $s preg_replace('/\s+/''-'$s);
  103.             $s preg_replace('|-+|''-'$s);
  104.             $s preg_replace('/#/'''$s);
  105.             $s str_replace('.'''$s);
  106.             $s trim($s'-');
  107.             $s strtolower($s);
  108.             return $s;
  109.         }else{
  110.             $tr = array('('')''/'':'',');
  111.             $eng = array('''''-''-''');
  112.             $s str_replace($tr$eng$url);
  113.             $find = array('/[^A-Za-z0-9\-<>]/''/[\-]+/''/<[^>]*>/');
  114.             $repl = array('-''-''-');
  115.             $s preg_replace($find$repl$s);
  116.             $s strtolower($s);
  117.             $s preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;amp;.+?;/'''$s);
  118.             $s preg_replace('/\s+/''-'$s);
  119.             $s preg_replace('|-+|''-'$s);
  120.             $s preg_replace('/#/'''$s);
  121.             $s str_replace('.'''$s);
  122.             $s trim($s'-');
  123.             $s strtolower($s);
  124.             return $s;
  125.         }
  126.     }
  127.     public function tarih_yaz($tarih){
  128.         $aylar = array('January','February','March','April','May','June','July','August','September','October','November','December','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  129.         $aylar2 = array('Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık','Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi');
  130.         $return str_replace($aylar$aylar2$tarih);
  131.         return $return;
  132.     }
  133.     public function base64_encode($veri){
  134.         return base64_encode($veri);
  135.     }
  136.     public function base64_decode($veri){
  137.         return base64_decode($veri);
  138.     }
  139.     function yandexToken(){
  140.         $curl curl_init();
  141.         curl_setopt_array($curl, array(
  142.             CURLOPT_URL => 'https://iam.api.cloud.yandex.net/iam/v1/tokens',
  143.             CURLOPT_RETURNTRANSFER => true,
  144.             CURLOPT_ENCODING => '',
  145.             CURLOPT_MAXREDIRS => 10,
  146.             CURLOPT_TIMEOUT => 0,
  147.             CURLOPT_FOLLOWLOCATION => true,
  148.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  149.             CURLOPT_CUSTOMREQUEST => 'POST',
  150.             CURLOPT_POSTFIELDS =>'{
  151.     "yandexPassportOauthToken":"y0_AgAAAAAZYEETAATuwQAAAADuaUPsZ3x4KXscRqel7NbnsyEYPaf2HWE"
  152. }',
  153.             CURLOPT_HTTPHEADER => array(
  154.                 'Content-Type: application/json'
  155.             ),
  156.         ));
  157.         $response curl_exec($curl);
  158.         $response json_decode($responsetrue);
  159.         return $response['iamToken'];
  160.     }
  161.     function cevir($deger,$dil){
  162.         $token $this->yandexToken();
  163.         $curl curl_init();
  164.         curl_setopt_array($curl, array(
  165.             CURLOPT_URL => 'https://translate.api.cloud.yandex.net/translate/v2/translate',
  166.             CURLOPT_RETURNTRANSFER => true,
  167.             CURLOPT_ENCODING => '',
  168.             CURLOPT_MAXREDIRS => 10,
  169.             CURLOPT_TIMEOUT => 0,
  170.             CURLOPT_FOLLOWLOCATION => true,
  171.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  172.             CURLOPT_CUSTOMREQUEST => 'POST',
  173.             CURLOPT_POSTFIELDS =>'{
  174.     "folderId": "b1g1l9b33ueptm8liaou",
  175.     "texts": "'.$deger.'",
  176.     "targetLanguageCode": "'.$dil.'"
  177. }',
  178.             CURLOPT_HTTPHEADER => array(
  179.                 'Authorization: Bearer '.$token,
  180.                 'Content-Type: application/json'
  181.             ),
  182.         ));
  183.         $response curl_exec($curl);
  184.         $response json_decode($responsetrue);
  185.         return $response['translations'][0]['text'];
  186.     }
  187.     public function ceviri($deger,$suanDil='')
  188.     {
  189.         $em $this->em;
  190.         if ($suanDil=='') {
  191.             $suanDil $this->session->get('dil');
  192.         }else{
  193.             $qb $em->createQueryBuilder();
  194.             $dill=$qb->select('d.id,d.kisa,d.uzun')
  195.                 ->from('App:Dil''d')
  196.                 ->where('d.id='.$suanDil)
  197.                 ->getQuery()
  198.                 ->getScalarResult();
  199.             $suanDil $dill[0];
  200.         }
  201.         $qb $em->createQueryBuilder();
  202.         $ceviriTara=$qb->select('c.deger,c.id')
  203.             ->from('App:Ceviri''c')
  204.             ->join('c.dil','d')
  205.             ->where("c.deger='$deger'")
  206.             ->getQuery()
  207.             ->getScalarResult();
  208.         if (count($ceviriTara) > 0) {
  209.             if ($suanDil['id'] != 1) {
  210.                 $qb $em->createQueryBuilder();
  211.                 $ceviriTara2=$qb->select('c.deger')
  212.                     ->from('App:Ceviri''c')
  213.                     ->join('c.dil','d')
  214.                     ->where("d.id=".$suanDil['id']." and c.trId=".$ceviriTara[0]['id'])
  215.                     ->getQuery()
  216.                     ->getScalarResult();
  217.                 if (count($ceviriTara2) > 0) {
  218.                     $veri $ceviriTara2[0]['deger'];
  219.                 } else {
  220.                     if ($this->session->get('dil')['id'] != '1') {
  221.                         $deger $this->cevir($deger,$suanDil['kisa']);
  222.                         $dill $em->getReference(Dil::class,$suanDil['id']);
  223.                         $ceviri = new Ceviri();
  224.                         $ceviri->setDil($dill);
  225.                         $ceviri->setDeger($deger);
  226.                         $ceviri->setTrId($ceviriTara[0]['id']);
  227.                         $em->persist($ceviri);
  228.                         $em->flush();
  229.                         $veri $deger;
  230.                     }
  231.                 }
  232.             } else {
  233.                 $veri $deger;
  234.             }
  235.         }
  236.         else {
  237.             if ($suanDil['id'] == 1) {
  238.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  239.                 $ceviri = new Ceviri();
  240.                 $ceviri->setDil($dill);
  241.                 $ceviri->setDeger($deger);
  242.                 $ceviri->setTrId(0);
  243.                 $em->persist($ceviri);
  244.                 $em->flush();
  245.                 $veri $deger;
  246.             }
  247.             else {
  248.                 $dilTr $em->getReference(Dil::class,1);
  249.                 $ceviri = new Ceviri();
  250.                 $ceviri->setDil($dilTr);
  251.                 $ceviri->setDeger($deger);
  252.                 $ceviri->setTrId(0);
  253.                 $em->persist($ceviri);
  254.                 $em->flush();
  255.                 $deger $this->cevir($deger,$suanDil['kisa']);
  256.                 $dill $em->getReference(Dil::class,$suanDil['id']);
  257.                 $ceviriDil = new Ceviri();
  258.                 $ceviriDil->setDil($dill);
  259.                 $ceviriDil->setDeger($deger);
  260.                 $ceviriDil->setTrId($ceviri->getId());
  261.                 $em->persist($ceviriDil);
  262.                 $em->flush();
  263.                 $veri $deger;
  264.             }
  265.         }
  266.         return $veri;
  267.     }
  268.     public function ayarlar($alan,$dil='')
  269.     {
  270.         if($dil=='') {
  271.             $em $this->em;
  272.             $qb $em->createQueryBuilder();
  273.             $dd $qb->select("e.id")
  274.                 ->from('App:Dil''e')
  275.                 ->where('e.aktif=1 and e.varsayilan=1')
  276.                 ->getQuery()
  277.                 ->setResultCacheId('varsayilan_dil')
  278.                 ->setResultCacheLifetime(60)
  279.                 ->getScalarResult();
  280.             $dil=$dd[0]['id'];
  281.         }
  282.         $em $this->em;
  283.         $qb $em->createQueryBuilder();
  284.         $ayarlar=$qb->select("e.$alan")
  285.             ->from('App:Ayarlar''e')
  286.             ->where('e.dil='.$dil)
  287.             ->getQuery()
  288.             ->setResultCacheId($alan)
  289.             ->setResultCacheLifetime(60)
  290.             ->getScalarResult();
  291.         return $ayarlar[0][$alan];
  292.     }
  293.     public function dilSay(){
  294.         $em $this->em;
  295.         $qb $em->createQueryBuilder();
  296.         $ayarlar=$qb->select("e.id")
  297.             ->from('App:Dil''e')
  298.             ->where('e.aktif=1')
  299.             ->getQuery()
  300.             ->setResultCacheId('dil_aktif')
  301.             ->setResultCacheLifetime(60)
  302.             ->getScalarResult();
  303.         return count($ayarlar);
  304.     }
  305.     public function panelSayfaGetir(){
  306.         $em $this->em;
  307.         $qb $em->createQueryBuilder();
  308.         $sayfalar=$qb->select("s.adi,s.dilgrup,s.id")
  309.             ->from('App:Sayfa''s')
  310.             ->orderBy('s.sira','ASC')
  311.             ->groupBy('s.dilgrup')
  312.             ->getQuery()
  313.             ->getScalarResult();
  314.         $veri ='';
  315.         foreach ($sayfalar as $key=>$sayfa){
  316.             $veri.='<li><a class="d-flex align-items-center" href="/rv/icerik/'.$sayfa['id'].'/"><i data-feather="circle"></i><span class="menu-item text-truncate" data-i18n="'.$sayfa['adi'].'">'.$sayfa['adi'].'</span></a></li>';
  317.         }
  318.         return $veri;
  319.     }
  320.     public function panelKategoriGetir(){
  321.         $em $this->em;
  322.         $qb $em->createQueryBuilder();
  323.         $sayfalar=$qb->select("s.id,s.adi,s.dilgrup")
  324.             ->from('App:Sayfa''s')
  325.             ->where('s.kategori=1')
  326.             ->orderBy('s.sira','ASC')
  327.             ->groupBy('s.dilgrup')
  328.             ->getQuery()
  329.             ->getScalarResult();
  330.         $veri ='';
  331.         foreach ($sayfalar as $key=>$sayfa){
  332.             $veri.='<li><a class="d-flex align-items-center" href="/rv/kategori/'.$sayfa['id'].'/"><i data-feather="circle"></i><span class="menu-item text-truncate" data-i18n="'.$sayfa['adi'].'">'.$sayfa['adi'].'</span></a></li>';
  333.         }
  334.         return $veri;
  335.     }
  336.     public function mesajSay(){
  337.         $em $this->em;
  338.         $qb $em->createQueryBuilder();
  339.         $veriler=$qb->select("m.id")
  340.             ->from('App:FormKayit''m')
  341.             ->where('m.okuma=0')
  342.             ->getQuery()
  343.             ->getScalarResult();
  344.         return count($veriler);
  345.     }
  346.     public function mesajBul(){
  347.         $em $this->em;
  348.         $qb $em->createQueryBuilder();
  349.         $veriler=$qb->select("m.kayit,f.alan,f.adi,m.okuma,m.tarih")
  350.             ->from('App:FormKayit''m')
  351.             ->join('m.form','f')
  352.             ->orderBy('f.tarih','DESC')
  353.             ->orderBy('m.okuma','ASC')
  354.             ->getQuery()
  355.             ->getScalarResult();
  356.         return $veriler;
  357.     }
  358.     public function bildirimSay(){
  359.         $em $this->em;
  360.         $qb $em->createQueryBuilder();
  361.         $veriler=$qb->select("b.id")
  362.             ->from('App:Bildirim''b')
  363.             ->where('b.okuma=0')
  364.             ->getQuery()
  365.             ->getScalarResult();
  366.         return count($veriler);
  367.     }
  368.     public function bildirimBul(){
  369.         $em $this->em;
  370.         $qb $em->createQueryBuilder();
  371.         $veriler=$qb->select("b.id,b.baslik,b.metin,b.okuma,b.tarih")
  372.             ->from('App:Bildirim''b')
  373.             ->orderBy('b.tarih','DESC')
  374.             ->orderBy('b.okuma','ASC')
  375.             ->getQuery()
  376.             ->getScalarResult();
  377.         return $veriler;
  378.     }
  379.     function altKategoriBul($dilgrup,$selected=0,$kendisi=0,$bosluk=''){
  380.         $em $this->em;
  381.         $qb $em->createQueryBuilder();
  382.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi')
  383.             ->from('App:Kategori''k')
  384.             ->where('k.ustid='.$dilgrup)
  385.             ->groupBy('k.dilgrup')
  386.             ->orderBy('k.sira','ASC')
  387.             ->getQuery()
  388.             ->getScalarResult();
  389.         $bosluk.='&nbsp;&nbsp;&nbsp;&nbsp;';
  390.         $veriler='';
  391.         foreach ($kategoriler as $k){
  392.             $select='';
  393.             if($selected==$k['id']){
  394.                 $select 'selected';
  395.             }
  396.             $disabled='';
  397.             if($kendisi==$k['id']){
  398.                 $disabled 'disabled';
  399.             }
  400.             $veriler.='<option '.$disabled.' '.$select.' value="'.$k['id'].'">'.$bosluk.$k['adi'].'</option>'.$this->altKategoriBul($k['dilgrup'],$selected,$kendisi,$bosluk);
  401.         }
  402.         return $veriler;
  403.     }
  404.     function altKategoriBul2($dilgrup,$selected=0,$kendisi=0,$bosluk=''){
  405.         $em $this->em;
  406.         $qb $em->createQueryBuilder();
  407.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi')
  408.             ->from('App:Kategori''k')
  409.             ->where('k.ustid='.$dilgrup)
  410.             ->groupBy('k.dilgrup')
  411.             ->orderBy('k.sira','ASC')
  412.             ->getQuery()
  413.             ->getScalarResult();
  414.         $bosluk.='&nbsp;&nbsp;&nbsp;&nbsp;';
  415.         $veriler='';
  416.         foreach ($kategoriler as $k){
  417.             $select='';
  418.             if($selected==$k['dilgrup']){
  419.                 $select 'selected';
  420.             }
  421.             $disabled='';
  422.             if($kendisi==$k['dilgrup']){
  423.                 $disabled 'disabled';
  424.             }
  425.             $veriler.='<option '.$disabled.' '.$select.' value="'.$k['dilgrup'].'">'.$bosluk.$k['adi'].'</option>'.$this->altKategoriBul($k['dilgrup'],$selected,$kendisi,$bosluk);
  426.         }
  427.         return $veriler;
  428.     }
  429.     function altKategoriGeriYaz($ustid,$dil=1){
  430.         $em $this->em;
  431.         $qb $em->createQueryBuilder();
  432.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,k.ustid')
  433.             ->from('App:Kategori''k')
  434.             ->join('k.dil','d')
  435.             ->where('k.dilgrup='.$ustid.' and d.id='.$dil)
  436.             ->groupBy('k.dilgrup')
  437.             ->orderBy('k.sira','ASC')
  438.             ->getQuery()
  439.             ->getScalarResult();
  440.         $veriler='';
  441.         foreach ($kategoriler as $k){
  442.             $veriler.=$this->altKategoriGeriYaz($k['ustid'],$dil).$k['seourl'].'/';
  443.         }
  444.         return $veriler;
  445.     }
  446.     function altKategoriListe($dilgrup,$sSeo){
  447.         $em $this->em;
  448.         $qb $em->createQueryBuilder();
  449.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,d.kisa as dKisa,k.ustid')
  450.             ->from('App:Kategori''k')
  451.             ->join('k.dil','d')
  452.             ->where('k.ustid='.$dilgrup)
  453.             ->groupBy('k.dilgrup')
  454.             ->orderBy('k.sira','ASC')
  455.             ->getQuery()
  456.             ->getScalarResult();
  457.         $veriler='';
  458.         if(count($kategoriler)>0) {
  459.             $veriler .= '<ul class="kategori_sirala' $dilgrup '">';
  460.             foreach ($kategoriler as $k) {
  461.                 if ($this->dilSay() > 1) {
  462.                     $link '<a class="text-primary" href="' $this->ayarlar('siteYolu') . $k['dKisa'] . '/' $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . '" target="_blank"> ' $this->ayarlar('siteYolu') . $k['dKisa'] . '/' $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . ' </a>';
  463.                 } else {
  464.                     $link '<a class="text-primary" href="' $this->ayarlar('siteYolu') . $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . '" target="_blank"> ' $this->ayarlar('siteYolu') . $sSeo '/' $this->altKategoriGeriYaz($k['ustid']) . $k['seourl'] . ' </a>';
  465.                 }
  466.                 $veriler .= ' <div id="listItem_' $k['dilgrup'] . '">';
  467.                 $veriler .= '<li class="kategoriLi row" >
  468.             <div class="col-md-9">' $k['adi'] . '
  469.                 <br>
  470.                 
  471.                 ' $link '
  472.             
  473.             </div>
  474.             <div class="col-md-3 text-right">
  475.                 <a class="btn btn-sm btn-info waves-effect waves-light handle' $dilgrup ' text-white"><i data-feather="move"></i></a>
  476.                 <button class="btn btn-sm btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">İŞLEM</button>
  477.                 <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
  478.                     <a class="dropdown-item" href="javascript:void(0);" onclick="seoAyarAc(' $k['dilgrup'] . ');" data-toggle="modal" data-target=".seoAyar">Seo Ayarları</a>
  479.                     <a class="dropdown-item" href="javascript:void(0);" onclick="kategoriDuzenleAc(' $k['dilgrup'] . ');" data-toggle="modal" data-target=".kategoriDuzenle">Düzenle</a>
  480.                     <a class="dropdown-item" href="javascript:void(0);" onclick="kategoriSil(' $k['dilgrup'] . ')">Sil</a>
  481.                 </div>
  482.             </div>
  483.         </li>';
  484.                 $veriler .= $this->altKategoriListe($k['dilgrup'], $sSeo);;
  485.                 $veriler .= '</div>';
  486.             }
  487.             $veriler .= '</ul>';
  488.             $veriler .= '<script>
  489.             $().ready(function() {
  490.               kategoriSirala(' $dilgrup ');
  491.             });
  492.             </script>';
  493.         }
  494.         return $veriler;
  495.     }
  496.     public function kategoriDetay($dilgrup,$alan){
  497.         if($dilgrup==''){
  498.             return '';
  499.         }
  500.         $em $this->em;
  501.         $qb $em->createQueryBuilder();
  502.         $kategori=$qb->select("e.$alan")
  503.             ->from('App:Kategori''e')
  504.             ->where('e.dilgrup='.$dilgrup)
  505.             ->getQuery()
  506.             ->getScalarResult();
  507.         return $kategori[0][$alan];
  508.     }
  509.     public function istatistik($start,$end){
  510.         $em $this->em;
  511.         $qb $em->createQueryBuilder();
  512.         $istatistikKullanici=$qb->select('i.id')
  513.             ->from('App:Istatistik''i')
  514.             ->where("i.tarih > '$start 00:00:00' and i.tarih < '$end 23:59:59'")
  515.             ->groupBy('i.ip')
  516.             ->getQuery()
  517.             ->getScalarResult();
  518.         $qb $em->createQueryBuilder();
  519.         $istatistikSG=$qb->select('i.id')
  520.             ->from('App:Istatistik''i')
  521.             ->where("i.tarih > '$start 00:00:00' and i.tarih < '$end 23:59:59'")
  522.             ->getQuery()
  523.             ->getScalarResult();
  524.         return count($istatistikKullanici).'--'.count($istatistikSG);
  525.     }
  526.     public function yetkiler($yetkiler,$rol){
  527.         if ($yetkiler==''){
  528.             return 1;
  529.         }
  530.         $yetkiler explode('~',str_replace(array('{','}'),array('',''),substr($yetkiler,0,strlen($yetkiler)-1)));
  531.         $return = [];
  532.         foreach ($yetkiler as $y){
  533.             $x explode(':',$y);
  534.             $z explode(',',$x[1]);
  535.             $return[$x[0]]['gorme']=$z[0];
  536.             $return[$x[0]]['ekleme']=$z[1];
  537.             $return[$x[0]]['duzenleme']=$z[2];
  538.             $return[$x[0]]['silme']=$z[3];
  539.         }
  540.         if($rol=='ROLE_DEV' or $rol=='ROLE_ADMIN'){
  541.             return 1;
  542.         }else{
  543.             return $return;
  544.         }
  545.     }
  546.     function GetIP()
  547.     {
  548.         if (getenv("HTTP_CLIENT_IP")) {
  549.             $ip getenv("HTTP_CLIENT_IP");
  550.         } elseif (getenv("HTTP_X_FORWARDED_FOR")) {
  551.             $ip getenv("HTTP_X_FORWARDED_FOR");
  552.             if (strstr($ip',')) {
  553.                 $tmp explode(','$ip);
  554.                 $ip trim($tmp[0]);
  555.             }
  556.         } else {
  557.             $ip getenv("REMOTE_ADDR");
  558.         }
  559.         return $ip;
  560.     }
  561.     function get_browser_name($user_agent)
  562.     {
  563.         if (strpos($user_agent'Opera') || strpos($user_agent'OPR/')) return 'Opera';
  564.         elseif (strpos($user_agent'Edge')) return 'Edge';
  565.         elseif (strpos($user_agent'Chrome')) return 'Chrome';
  566.         elseif (strpos($user_agent'Safari')) return 'Safari';
  567.         elseif (strpos($user_agent'Firefox')) return 'Firefox';
  568.         elseif (strpos($user_agent'MSIE') || strpos($user_agent'Trident/7')) return 'İnternet Explorer';
  569.         return 'Diğer';
  570.     }
  571.     public function site_istatistik($bos)
  572.     {
  573.         if($this->ayarlar('debug')!=1) {
  574.             $em $this->em;
  575.             $tarih = new \DateTime('now');
  576.             $ip $this->GetIP();
  577.             if (@$_SERVER['HTTP_REFERER']!=''){
  578.                 $referer $_SERVER['HTTP_REFERER'];
  579.             }else{
  580.                 $referer '';
  581.             }
  582.             $user_agent $this->get_browser_name($_SERVER['HTTP_USER_AGENT']);
  583.             $request_uri $this->ayarlar('siteYolu') . substr($_SERVER['REQUEST_URI'], 1strlen($_SERVER['REQUEST_URI']) - 1);
  584.             $istatistik = new Istatistik();
  585.             $istatistik->setTarih($tarih);
  586.             $istatistik->setIp($ip);
  587.             $istatistik->setReferer($referer);
  588.             $istatistik->setTarayici($user_agent);
  589.             $istatistik->setUrl($request_uri);
  590.             $em->persist($istatistik);
  591.             $em->flush();
  592.             return '';
  593.         }
  594.     }
  595.     public function site_anaLink(){
  596.         $dil $this->session->get('dil');
  597.         if ($this->dilSay()>1){
  598.             return $this->ayarlar('siteYolu').$dil['kisa'].'/';
  599.         }else{
  600.             return $this->ayarlar('siteYolu');
  601.         }
  602.     }
  603.     public function site_menuGetir(){
  604.         $em $this->em;
  605.         $dil $this->session->get('dil');
  606.         $qb $em->createQueryBuilder();
  607.         $sayfalar=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan')
  608.             ->from('App:Sayfa''s')
  609.             ->join('s.dil''d')
  610.             ->join('s.modul''m')
  611.             ->where('d.id='.$dil['id'].'and s.menu=1')
  612.             ->orderBy('s.sira','ASC')
  613.             ->getQuery()
  614.             ->setResultCacheId('menu_sayfalar')
  615.             ->setResultCacheLifetime(60)
  616.             ->getScalarResult();
  617.         $menu = [];
  618.         $menu[] =['link'=>$this->site_anaLink(),'adi'=>$this->ceviri('Anasayfa')];
  619.         foreach ($sayfalar as $sayfa){
  620.             $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  621.             $sLink $this->site_anaLink().$sayfa['seo'];
  622.  
  623.                 //  ($sayfa['dilgrup']==6) alanı alt menü görünmesin istiyorsak
  624.                 if (($sayfa['tekVeri'] == and $sayfa['icIcerik'] == 0) or $sayfa['tekVeri'] == 1) {
  625.                     $menu[] =['link'=>$sLink,'adi'=>$sayfa['adi']];
  626.                 } else {
  627.                    
  628.                     if ($sayfa['kategori'] == 0) {
  629.                         //İçerikler
  630.                         $sayfaAlan explode(','$sayfa['alan']);
  631.                         $icerikalani = [];
  632.                         foreach ($sayfaAlan as $sA) {
  633.                             if ($sA == 'seo url' or $sA == 'sayfa başlığı' or $sA == 'anahtar kelimeler' or $sA == 'sayfa açıklaması') {
  634.                             } else {
  635.                                 $icerikalani[] = str_replace(' '''$sA);
  636.                             }
  637.                         }
  638.                         $qb $em->createQueryBuilder();
  639.                         $icerikler $qb->select('t.' $this->seo($icerikalani[0]) . ' as baslik,t.seourl,t.dilgrup,d.kisa as dKisa,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  640.                             ->from('App:' $sayfa['tabloAdi'], 't')
  641.                             ->leftjoin('t.kategori''k')
  642.                             ->join('t.sayfa''s')
  643.                             ->join('t.dil''d')
  644.                             ->where('s.id=' $sId ' and d.id=' $dil['id'])
  645.                             ->addOrderBy('t.sira''ASC')
  646.                             ->addOrderBy('t.id''DESC')
  647.                             ->setMaxResults(10)
  648.                             ->getQuery()
  649.                             ->setResultCacheId('menu_icerikler')
  650.                             ->setResultCacheLifetime(60)
  651.                             ->getScalarResult();
  652.                     }
  653.                     else {
  654.                       
  655.                         //Kategoriler
  656.                         $qb $em->createQueryBuilder();
  657.                         $icerikler $qb->select('k.dilgrup,k.adi as baslik,k.seourl')
  658.                             ->from('App:Kategori''k')
  659.                             ->join('k.sayfa''s')
  660.                             ->join('k.dil''d')
  661.                             ->where('s.id=' $sId ' and k.ustid=0 and d.id=' $dil['id'])
  662.                             ->orderBy('k.sira''ASC')
  663.                             ->setMaxResults(10)
  664.                             ->getQuery()
  665.                             ->setResultCacheId('menu_kategoriler')
  666.                             ->setResultCacheLifetime(60)
  667.                             ->getScalarResult();
  668.                             
  669.                            
  670.                     }
  671.            
  672.                   $altMenuler = [];
  673.                     foreach ($icerikler as $icerik) {
  674.                         $kat '';
  675.                         if (!empty($icerik['kategoriId'])) {
  676.                             $kat $this->altKategoriGeriYaz($icerik['kategoriId'], $dil['id']);
  677.                         }
  678.                         $sLink2 $this->site_anaLink() . $sayfa['seo'] . '/' $kat $icerik['seourl'];
  679.                         $altMenuler[] =['link'=>$sLink2,'adi'=>ucfirst($icerik['baslik'])];
  680.                     }
  681.                     $menu[] =['link'=>$sLink,'adi'=>$sayfa['adi'],'altmenuler'=>$altMenuler];
  682.                 }
  683.         }
  684.         return $menu;
  685.     }
  686.     public function site_footerMetin(){
  687.         $em $this->em;
  688.         $dil $this->session->get('dil');
  689.         $qb $em->createQueryBuilder();
  690.         $metin=$qb->select('s.kurumsalaciklama')
  691.             ->from('App:Footermetin''s')
  692.             ->join('s.dil''d')
  693.             ->where('d.id='.$dil['id'])
  694.             ->getQuery()
  695.             ->setResultCacheId('footermetin')
  696.             ->setResultCacheLifetime(60)
  697.             ->getScalarResult();
  698.         return $metin[0]['kurumsalaciklama'];
  699.     }
  700.     public function site_footerSayfa($sDilgrup,$max=10){
  701.         $em $this->em;
  702.         $dil $this->session->get('dil');
  703.         $qb $em->createQueryBuilder();
  704.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan')
  705.             ->from('App:Sayfa''s')
  706.             ->join('s.dil''d')
  707.             ->join('s.modul''m')
  708.             ->where('d.id='.$dil['id'].'and s.menu=1 and s.dilgrup='.$sDilgrup)
  709.             ->orderBy('s.sira','ASC')
  710.             ->getQuery()
  711.             ->setResultCacheId('footer_sayfa')
  712.             ->setResultCacheLifetime(60)
  713.             ->getScalarResult();
  714.         $sayfa $sayfa[0];
  715.         $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  716.         if ($sayfa['kategori'] == 0) {
  717.             //İçerikler
  718.             $sayfaAlan explode(','$sayfa['alan']);
  719.             $icerikalani '';
  720.             foreach ($sayfaAlan as $sA) {
  721.                 if ($sA == 'seo url' or $sA == 'sayfa başlığı' or $sA == 'anahtar kelimeler' or $sA == 'sayfa açıklaması') {
  722.                 } else {
  723.                     $icerikalani .= 't.'.$this->seo(str_replace(' '''$sA)).',';
  724.                 }
  725.             }
  726.             $qb $em->createQueryBuilder();
  727.             $icerikler $qb->select$icerikalani' t.seourl,t.dilgrup,d.kisa as dKisa,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  728.                 ->from('App:' $sayfa['tabloAdi'], 't')
  729.                 ->leftjoin('t.kategori''k')
  730.                 ->join('t.sayfa''s')
  731.                 ->join('t.dil''d')
  732.                 ->where('s.id=' $sId ' and d.id=' $dil['id'])
  733.                 ->addOrderBy('t.sira''ASC')
  734.                 ->addOrderBy('t.id''DESC')
  735.                 ->setMaxResults($max)
  736.                 ->getQuery()
  737.                 ->setResultCacheId('footer_icerik')
  738.                 ->setResultCacheLifetime(60)
  739.                 ->getScalarResult();
  740.         }
  741.         else {
  742.             //Kategoriler
  743.             $qb $em->createQueryBuilder();
  744.             $icerikler $qb->select('k.dilgrup,k.adi as baslik,k.seourl,k.resim')
  745.                 ->from('App:Kategori''k')
  746.                 ->join('k.sayfa''s')
  747.                 ->join('k.dil''d')
  748.                 ->where('s.id=' $sId ' and k.ustid=0 and d.id=' $dil['id'])
  749.                 ->orderBy('k.sira''ASC')
  750.                 ->setMaxResults($max)
  751.                 ->getQuery()
  752.                 ->setResultCacheId('footer_kategori')
  753.                 ->setResultCacheLifetime(60)
  754.                 ->getScalarResult();
  755.         }
  756.         $veri = [];
  757.         $veri[]=$sayfa;
  758.         $veri[]=$icerikler;
  759.         return $veri;
  760.     }
  761.     public function site_iletisimBilgileri($alan){
  762.         $em $this->em;
  763.         $dil $this->session->get('dil');
  764.         $qb $em->createQueryBuilder();
  765.         $iletisim=$qb->select('s.'.$alan)
  766.             ->from('App:Iletisim''s')
  767.             ->join('s.dil''d')
  768.             ->where('d.id='.$dil['id'])
  769.             ->getQuery()
  770.             ->setResultCacheId($alan)
  771.             ->setResultCacheLifetime(60)
  772.             ->getScalarResult();
  773.         return $iletisim[0][$alan];
  774.     }
  775.     public function site_sosyalAglar(){
  776.         $em $this->em;
  777.         $qb $em->createQueryBuilder();
  778.         $sosyalAglar=$qb->select('s.ad,s.url')
  779.             ->from('App:SosyalAg''s')
  780.             ->getQuery()
  781.             ->setResultCacheId('sosyal_aglar')
  782.             ->setResultCacheLifetime(60)
  783.             ->getScalarResult();
  784.         $veri = [];
  785.         foreach ($sosyalAglar as $ss){
  786.             if($ss['ad']=='Facebook' and $ss['url']!=''){
  787.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-facebook'];
  788.             }
  789.             elseif($ss['ad']=='Twitter' and $ss['url']!=''){
  790.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-twitter'];
  791.             }
  792.             elseif($ss['ad']=='İnstagram' and $ss['url']!=''){
  793.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-instagram'];
  794.             }
  795.             elseif($ss['ad']=='Pinterest' and $ss['url']!=''){
  796.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-pinterest'];
  797.             }
  798.             elseif($ss['ad']=='Youtube' and $ss['url']!=''){
  799.                 $veri[]= ['link'=>$ss['url'],'adi'=>$ss['ad'],'ikon'=>'fab fa-youtube'];
  800.             }
  801.         }
  802.         return $veri;
  803.     }
  804.     public function site_sliders()
  805.     {
  806.         $em $this->em;
  807.         $dil $this->session->get('dil');
  808.         $em $this->em;
  809.         $qb $em->createQueryBuilder();
  810.         $sliders=$qb->select('s.resim,s.aciklama,s.baslik')
  811.             ->from('App:Slider''s')
  812.             ->join('s.dil''d')
  813.             ->where('d.id='.$dil['id'])
  814.             ->orderBy('s.sira')
  815.             ->getQuery()
  816.             ->setResultCacheId('slider')
  817.             ->setResultCacheLifetime(60)
  818.             ->getScalarResult();
  819.         return $sliders;
  820.     }
  821.     public function site_sayfaIcerik($sDilgrup,$max=10){
  822.         $em $this->em;
  823.         $dil $this->session->get('dil');
  824.         $qb $em->createQueryBuilder();
  825.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  826.             ->from('App:Sayfa''s')
  827.             ->join('s.dil''d')
  828.             ->join('s.modul''m')
  829.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  830.             ->orderBy('s.sira','ASC')
  831.             ->getQuery()
  832.             ->setResultCacheId('sabit_sayfa')
  833.             ->setResultCacheLifetime(60)
  834.             ->getScalarResult();
  835.         $sId $this->IdBul('Sayfa',$sayfa[0]['dilgrup']);
  836.         $sayfa $sayfa[0];
  837.         $icerikler="";
  838.         if ($sayfa['kategori'] == 0) {
  839.             //İçerikler
  840.             $sayfaAlan explode(','$sayfa['alan']);
  841.             $icerikalani = [];
  842.             foreach ($sayfaAlan as $sA) {
  843.                 $icerikalani[] = 't.'.$this->seo(str_replace(' '''$sA));
  844.             }
  845.             $qb $em->createQueryBuilder();
  846.             $icerikler $qb->select(implode(',',$icerikalani).',t.dilgrup,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  847.                 ->from('App:' $sayfa['tabloAdi'], 't')
  848.                 ->leftjoin('t.kategori''k')
  849.                 ->join('t.sayfa''s')
  850.                 ->join('t.dil''d')
  851.                 ->where('s.id=' $sId ' and d.id=' $dil['id'])
  852.                 ->addOrderBy('t.sira''ASC')
  853.                 ->addOrderBy('t.id''DESC')
  854.                 ->setMaxResults($max)
  855.                 ->getQuery()
  856.                 ->setResultCacheId('sabit_icerik')
  857.                 ->setResultCacheLifetime(60)
  858.                 ->getScalarResult();
  859.         }
  860.         if ($sayfa['icIcerik']==1){
  861.             foreach ($icerikler as $key=>$ii){
  862.                 $alt='';
  863.                 if($sayfa['kategori']==1){
  864.                     $alt $this->altKategoriGeriYaz($ii['kategoriId'],$dil['id']);
  865.                 }
  866.                 $link $this->site_anaLink().$sayfa['seo'].'/'.$alt.$ii['seourl'];
  867.                 $icerikler[$key]['link']=$link;
  868.                 if (in_array('t.resimler',$icerikalani)){
  869.                     $resim explode(',',$ii['resimler']);
  870.                     $icerikler[$key]['resim'] = $resim[0];
  871.                 }
  872.             }
  873.         }
  874.         $veri = [];
  875.         $veri[]=$sayfa;
  876.         $veri[]=$icerikler;
  877.         return $veri;
  878.     }
  879.     public function site_sayfaIcerikDirek($sDilgrup,$max=10){
  880.         $em $this->em;
  881.         $dil $this->session->get('dil');
  882.         $qb $em->createQueryBuilder();
  883.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  884.             ->from('App:Sayfa''s')
  885.             ->join('s.dil''d')
  886.             ->join('s.modul''m')
  887.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  888.             ->orderBy('s.sira','ASC')
  889.             ->getQuery()
  890.             ->setResultCacheId('sabit_sayfa')
  891.             ->setResultCacheLifetime(60)
  892.             ->getScalarResult();
  893.         $sId $this->IdBul('Sayfa',$sayfa[0]['dilgrup']);
  894.         $sayfa $sayfa[0];
  895.         //İçerikler
  896.         $sayfaAlan explode(','$sayfa['alan']);
  897.         $icerikalani = [];
  898.         foreach ($sayfaAlan as $sA) {
  899.             $icerikalani[] = 't.'.$this->seo(str_replace(' '''$sA));
  900.         }
  901.         $qb $em->createQueryBuilder();
  902.         $icerikler $qb->select(implode(',',$icerikalani).',t.dilgrup,k.dilgrup as kategoriId,d.id as did,s.dilgrup as sayfaId')
  903.             ->from('App:' $sayfa['tabloAdi'], 't')
  904.             ->leftjoin('t.kategori''k')
  905.             ->join('t.sayfa''s')
  906.             ->join('t.dil''d')
  907.             ->where('s.id=' $sId ' and d.id=' $dil['id'])
  908.             ->addOrderBy('t.sira''ASC')
  909.             ->addOrderBy('t.id''DESC')
  910.             ->setMaxResults($max)
  911.             ->getQuery()
  912.             ->setResultCacheId('sabit_icerik')
  913.             ->setResultCacheLifetime(60)
  914.             ->getScalarResult();
  915.         if ($sayfa['icIcerik']==1){
  916.             foreach ($icerikler as $key=>$ii){
  917.                 $alt='';
  918.                 if($sayfa['kategori']==1){
  919.                     $alt $this->altKategoriGeriYaz($ii['kategoriId'],$dil['id']);
  920.                 }
  921.                 $link $this->site_anaLink().$sayfa['seo'].'/'.$alt.$ii['seourl'];
  922.                 $icerikler[$key]['link']=$link;
  923.                 if (in_array('t.resimler',$icerikalani)){
  924.                     $resim explode(',',$ii['resimler']);
  925.                     $icerikler[$key]['resim'] = $resim[0];
  926.                 }
  927.             }
  928.         }
  929.         $veri = [];
  930.         $veri[]=$sayfa;
  931.         $veri[]=$icerikler;
  932.         return $veri;
  933.     }
  934.     public function site_sayfaIcerikKategori($sDilgrup,$kat,$max=10){
  935.         $em $this->em;
  936.         $dil $this->session->get('dil');
  937.         $qb $em->createQueryBuilder();
  938.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  939.             ->from('App:Sayfa''s')
  940.             ->join('s.dil''d')
  941.             ->join('s.modul''m')
  942.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  943.             ->orderBy('s.sira','ASC')
  944.             ->getQuery()
  945.             ->setResultCacheId('sabit_sayfa')
  946.             ->setResultCacheLifetime(60)
  947.             ->getScalarResult();
  948.         $sayfa $sayfa[0];
  949.         //İçerikler
  950.         $sayfaAlan explode(','$sayfa['alan']);
  951.         $icerikalani = [];
  952.         foreach ($sayfaAlan as $sA) {
  953.             $icerikalani[] = 't.'.$this->seo(str_replace(' '''$sA));
  954.         }
  955.         $qb $em->createQueryBuilder();
  956.         $icerikler $qb->select(implode(',',$icerikalani).',t.dilgrup,t.kategoriId,d.id as did,t.sayfaId')
  957.             ->from('App:' $sayfa['tabloAdi'], 't')
  958.             ->join('t.dil''d')
  959.             ->where('t.sayfaId=' $sayfa['dilgrup'] . ' and t.kategoriId=' $kat ' and d.id=' $dil['id'])
  960.             ->addOrderBy('t.sira''ASC')
  961.             ->addOrderBy('t.id''DESC')
  962.             ->setMaxResults($max)
  963.             ->getQuery()
  964.             ->setResultCacheId('sabit_kategori')
  965.             ->setResultCacheLifetime(60)
  966.             ->getScalarResult();
  967.         $veri = [];
  968.         $veri[]=$sayfa;
  969.         $veri[]=$icerikler;
  970.         return $veri;
  971.     }
  972.     public function site_dilGetir(){
  973.         $em $this->em;
  974.         $dil $this->session->get('dil');
  975.         $qb $em->createQueryBuilder();
  976.         $diller=$qb->select('d.id,d.kisa,d.uzun')
  977.             ->from('App:Dil''d')
  978.             ->where('d.aktif=1 and d.id not in('.$dil['id'].')')
  979.             ->orderBy('d.aktif','DESC')
  980.             ->getQuery()
  981.             ->setResultCacheId('dil_getir')
  982.             ->setResultCacheLifetime(60)
  983.             ->getScalarResult();
  984.         $veri='';
  985.         foreach ($diller as $d){
  986.             $veri .='<li><a href="'.$this->ayarlar('siteYolu').$d['kisa'].'/"><img src="/assets/flag/'.$d['kisa'].'.webp" width="18" height="14" alt="'.$d['kisa'].'"> '.$this->ceviri($d['uzun']).' ('.strtoupper($d['kisa']).')</a></li>';
  987.         }
  988.         return $veri;
  989.     }
  990.     public function site_dilGetir2(){
  991.         $em $this->em;
  992.         $dil $this->session->get('dil');
  993.         $qb $em->createQueryBuilder();
  994.         $diller=$qb->select('d.id,d.kisa,d.uzun')
  995.             ->from('App:Dil''d')
  996.             ->where('d.aktif=1')
  997.             ->orderBy('d.aktif','DESC')
  998.             ->getQuery()
  999.             ->setResultCacheId('dil_getir')
  1000.             ->setResultCacheLifetime(60)
  1001.             ->getScalarResult();
  1002.         $veri='';
  1003.         foreach ($diller as $d){
  1004.             $active "";
  1005.             if ($d['id']==$dil['id']){
  1006.                 $active 'selected';
  1007.             }
  1008.             $veri .=' <a class="dropdown-item '.$active.'" href="'.$this->ayarlar('siteYolu').$d['kisa'].'/">
  1009.                                         <img src="/assets/flag/'.$d['kisa'].'.webp" alt="'.$d['kisa'].'">
  1010.                                         '.$this->ceviri($d['uzun']).'
  1011.                                     </a>';
  1012.         }
  1013.         return $veri;
  1014.     }
  1015.     /*  public function site_popupGetir($sDilgrup){
  1016.           $em = $this->em;
  1017.           $veri = '';
  1018.           if($sDilgrup==0){
  1019.               if ($this->ayarlar('popup')!=''){
  1020.                   if(!$this->session->get('system_popup'.$sDilgrup)) {
  1021.                       $veri .= '<a href="/uploads/' . $this->ayarlar('popup') . '" class="system_popup" data-fancybox style="display: none;"></a>';
  1022.                       $this->session->set('system_popup'.$sDilgrup,1);
  1023.                   }
  1024.               }
  1025.           }else{
  1026.               $qb = $em->createQueryBuilder();
  1027.               $sayfa=$qb->select('s.popup')
  1028.                   ->from('App:Sayfa', 's')
  1029.                   ->where("s.dilgrup =".$sDilgrup)
  1030.                   ->getQuery()
  1031.                   ->setResultCacheId('popup')
  1032.                   ->setResultCacheLifetime(60)
  1033.                   ->getScalarResult();
  1034.               if ($sayfa[0]['popup']!=''){
  1035.                   if(!$this->session->get('system_popup'.$sDilgrup)) {
  1036.                       $veri .= '<a href="/uploads/' . $sayfa[0]['popup'] . '" class="system_popup" data-fancybox style="display: none;"></a>';
  1037.                       $this->session->set('system_popup'.$sDilgrup,1);
  1038.                   }
  1039.               }
  1040.           }
  1041.           return $veri;
  1042.       }*/
  1043.     public function site_bannerGetir($sDilgrup){
  1044.         $em $this->em;
  1045.         $veri '';
  1046.         $qb $em->createQueryBuilder();
  1047.         $sayfa=$qb->select('s.bannerDurum,s.bannerUrl')
  1048.             ->from('App:Sayfa''s')
  1049.             ->where("s.dilgrup =".$sDilgrup)
  1050.             ->getQuery()
  1051.             ->setResultCacheId('banner_getir')
  1052.             ->setResultCacheLifetime(60)
  1053.             ->getScalarResult();
  1054.         if ($sayfa[0]['bannerDurum']=='1'){
  1055.             $veri.=$this->ayarlar('siteYolu').'storage/'.$sayfa[0]['bannerUrl'];
  1056.         }
  1057.         return $veri;
  1058.     }
  1059.     public function site_formGetir($formId){
  1060.         $em $this->em;
  1061.         $veri='';
  1062.         $qb $em->createQueryBuilder();
  1063.         $form=$qb->select('f.adi,f.tip,f.veri,f.alan,f.zorunlu,f.id')
  1064.             ->from('App:Form''f')
  1065.             ->where("f.id =".$formId)
  1066.             ->getQuery()
  1067.             ->setResultCacheId('sabit_formlar')
  1068.             ->setResultCacheLifetime(60)
  1069.             ->getScalarResult();
  1070.         $tipler explode('~',$form[0]['tip']);
  1071.         $alanlar explode('~',$form[0]['alan']);
  1072.         $zorunlular explode('~',$form[0]['zorunlu']);
  1073.         $fVeriler explode('~',$form[0]['veri']);
  1074.         $veri .= '<form method="post" enctype="multipart/form-data" class="'.$this->seo($form[0]['adi']).'" action="'.$this->site_anaLink().'form-kayit">';
  1075.         $veri .= '<input type="hidden" name="id" value="'.$formId.'">';
  1076.         $veri .= '<div class="row">';
  1077.         foreach ($tipler as $key=>$tip){
  1078.             if ($zorunlular[$key]==1){$required='required'$zorunlu'<span style="color:#ff0000;">* </span>';}else{ $required=''$zorunlu='';}
  1079.             if($tip=='input'){
  1080.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1081.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1082.                 $veri.='<input type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1083.                 $veri.='</div>';
  1084.             }
  1085.             elseif($tip=='inputPhone'){
  1086.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1087.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1088.                 $veri.='<input data-inputmask="\'mask\': \'+99(999) 999 99 99\'" type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1089.                 $veri.='</div>';
  1090.             }
  1091.             elseif($tip=='inputEmail'){
  1092.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1093.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1094.                 $veri.='<input type="email" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1095.                 $veri.='</div>';
  1096.             }
  1097.             elseif($tip=='inputNumeric'){
  1098.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1099.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1100.                 $veri.='<input type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput numeric" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1101.                 $veri.='</div>';
  1102.             }
  1103.             elseif($tip=='inputPrice'){
  1104.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1105.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1106.                 $veri.='<input type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput priceFormat" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1107.                 $veri.='</div>';
  1108.             }
  1109.             elseif($tip=='inputDate'){
  1110.                 $veri.='<div class="col-lg-6 col-md-6 col-sm-12" style="margin-top: 10px;">';
  1111.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).': '.$zorunlu.'</b><br>';
  1112.                 $veri.='<input data-inputmask="\'mask\': \'99/99/9999\'" type="text" name="'.$this->seo($alanlar[$key]).'" class="form-control formInput" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1113.                 $veri.='</div>';
  1114.             }
  1115.             elseif($tip=='textarea'){
  1116.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1117.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1118.                 $veri.='<textarea class="form-control formTextarea" name="'.$this->seo($alanlar[$key]).'" rows="3" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'></textarea>';
  1119.                 $veri.='</div>';
  1120.             }
  1121.             elseif($tip=='select'){
  1122.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1123.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1124.                 $veri.='<select class="form-control formSelect" '.$required.' name="'.$this->seo($alanlar[$key]).'">';
  1125.                 $veri.='<option value="">'.$this->ceviri($alanlar[$key].' Seçiniz').'</option>';
  1126.                 $icVeriler explode(',',$fVeriler[$key]);
  1127.                 foreach ($icVeriler as $iV){
  1128.                     $veri.='<option value="'.$this->ceviri($iV).'">'.$this->ceviri($iV).'</option>';
  1129.                 }
  1130.                 $veri.='</select>';
  1131.                 $veri.='</div>';
  1132.             }
  1133.             elseif($tip=='checkbox'){
  1134.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12 formCheck" style="margin-top: 10px;">';
  1135.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1136.                 $veri.='<div class="row">';
  1137.                 $icVeriler explode(',',$fVeriler[$key]);
  1138.                 foreach ($icVeriler as $keyCheck=>$iV){
  1139.                     $veri.=' <div class="col-lg-4 col-md-6 col-sm-12" style="margin-top: 3px;">
  1140.                                   <input type="checkbox" class="'.$this->seo($alanlar[$key]).'" name="'.$this->seo($alanlar[$key]).'[]" value="'.$this->ceviri($iV).'" id="'.$this->seo($iV).$keyCheck.'" '.$required.'>
  1141.                                   <label for="'.$this->seo($iV).$keyCheck.'">
  1142.                                     '.$this->ceviri($iV).
  1143.                                   </label>
  1144.                               </div>';
  1145.                 }
  1146.                 $veri.='</div>';
  1147.                 $veri.='</div>';
  1148.             }
  1149.             elseif($tip=='radio'){
  1150.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1151.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1152.                 $veri.='<div class="row">';
  1153.                 $icVeriler explode(',',$fVeriler[$key]);
  1154.                 foreach ($icVeriler as $keyRadio=>$iV){
  1155.                     $veri.=' <div class="col-lg-4 col-md-6 col-sm-12 formRadio" style="margin-top: 3px;">
  1156.                                  <input type="radio" value="'.$this->ceviri($iV).'" class="'.$this->seo($alanlar[$key]).'" name="'.$this->seo($alanlar[$key]).'" id="'.$this->seo($iV).$keyRadio.'" '.$required.'>
  1157.                                   <label for="'.$this->seo($iV).$keyRadio.'">
  1158.                                     '.$this->ceviri($iV).
  1159.                                   </label>
  1160.                               </div>';
  1161.                 }
  1162.                 $veri.='</div>';
  1163.                 $veri.='</div>';
  1164.             }
  1165.             elseif($tip=='file'){
  1166.                 $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1167.                 $veri.='<b style="font-size: 13px;">'.$this->ceviri($alanlar[$key]).' '.$zorunlu.':</b><br>';
  1168.                 $veri.='<input type="file" class="form-control fromFile" id="'.$this->seo($alanlar[$key]).'" name="'.$this->seo($alanlar[$key]).'" placeholder="'.$this->ceviri($alanlar[$key]).'" '.$required.'>';
  1169.                 $veri.='</div>';
  1170.             }
  1171.         }
  1172.         $veri.='<div class="col-lg-3 col-md-3 col-sm-3" style="margin-top: 10px;">';
  1173.         $veri.='<b style="font-size: 13px;">'.$this->ceviri('Güvenlik Kodu').' <span style="color:#ff0000;">* </span>:</b><br>';
  1174.         $veri.='<div style="padding: 10px; margin-top: 5px;  background-color: #000; text-align: center;"><img src="'.$this->ayarlar('siteYolu').'captcha" width="80"></div>';
  1175.         $veri.='</div>';
  1176.         $veri.='<div class="col-lg-9 col-md-9 col-sm-9" style="margin-top: 7px; padding-top: 27px;">';
  1177.         $veri.='<input type="text" name="captcha" class="form-control formInput" placeholder="'.$this->ceviri('Güvenlik kodunu giriniz.').'" required onblur="return hepsiBuyuk(this)">';
  1178.         $veri.='</div>';
  1179.         $veri.='<div class="col-lg-12 col-md-12 col-sm-12 hata_'.$this->seo($form[0]['adi']).'" style="margin-top: 10px;">';
  1180.         $veri.='</div>';
  1181.         $veri.='<div class="col-lg-12 col-md-12 col-sm-12" style="margin-top: 10px;">';
  1182.         $veri.='<button class="formBtn" type="button" onclick="formKayit(\''.$this->seo($form[0]['adi']).'\','.$form[0]['id'].');">'.$this->ceviri('Gönder').'</button>';
  1183.         $veri.='</div>';
  1184.         $veri .= '</div>';
  1185.         $veri .= '</form>';
  1186.         return $veri;
  1187.     }
  1188.     function site_kategoriGeriLi($ustid,$dil=1){
  1189.         $em $this->em;
  1190.         $qb $em->createQueryBuilder();
  1191.         $kategoriler=$qb->select('k.id,k.dilgrup,k.adi,k.seourl,k.ustid,k.adi')
  1192.             ->from('App:Kategori''k')
  1193.             ->join('k.dil','d')
  1194.             ->where('k.dilgrup='.$ustid.' and d.id='.$dil)
  1195.             ->groupBy('k.dilgrup')
  1196.             ->orderBy('k.sira','ASC')
  1197.             ->getQuery()
  1198.             ->setResultCacheId('katgerili')
  1199.             ->setResultCacheLifetime(60)
  1200.             ->getScalarResult();
  1201.         $veriler='';
  1202.         foreach ($kategoriler as $k){
  1203.             $veriler.=$this->site_kategoriGeriLi($k['ustid'],$dil).$k['adi'].'#'.$this->altKategoriGeriYaz($k['ustid'],$dil).$k['seourl'].'~';
  1204.         }
  1205.         return $veriler;
  1206.     }
  1207.     public function site_sayfaKategori($sDilgrup,$max=10){
  1208.         $em $this->em;
  1209.         $dil $this->session->get('dil');
  1210.         $qb $em->createQueryBuilder();
  1211.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan,s.description')
  1212.             ->from('App:Sayfa''s')
  1213.             ->join('s.dil''d')
  1214.             ->join('s.modul''m')
  1215.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sDilgrup)
  1216.             ->orderBy('s.sira','ASC')
  1217.             ->getQuery()
  1218.             ->setResultCacheId('sayfa_kategori')
  1219.             ->setResultCacheLifetime(60)
  1220.             ->getScalarResult();
  1221.         $sayfa $sayfa[0];
  1222.         $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  1223.         if ($sayfa['kategori'] == 1) {
  1224.             //İçerikler
  1225.             $qb $em->createQueryBuilder();
  1226.             $kategoriler $qb->select('k.adi,k.ustid,k.resim,k.dilgrup,k.seourl')
  1227.                 ->from('App:Kategori''k')
  1228.                 ->join('k.dil''d')
  1229.                 ->join('k.sayfa''s')
  1230.                 ->where('s.id=' $sId ' and d.id=' $dil['id'])
  1231.                 ->addOrderBy('k.sira''ASC')
  1232.                 ->addOrderBy('k.id''DESC')
  1233.                 ->setMaxResults($max)
  1234.                 ->getQuery()
  1235.                 ->setResultCacheId('sayfa_kategoriic')
  1236.                 ->setResultCacheLifetime(60)
  1237.                 ->getScalarResult();
  1238.             foreach ($kategoriler as $key=>$ii){
  1239.                 $link $this->site_anaLink().$sayfa['seo'].'/'.$ii['seourl'];
  1240.                 $kategoriler[$key]['link']=$link;
  1241.             }
  1242.         }
  1243.         $veri = [];
  1244.         $veri[]=$sayfa;
  1245.         $veri[]=$kategoriler;
  1246.         return $veri;
  1247.     }
  1248.     public function site_formVeriGetir($formid){
  1249.         $em $this->em;
  1250.         $qb $em->createQueryBuilder();
  1251.         $veri=$qb->select('fk.tarih,fk.kayit')
  1252.             ->from('App:FormKayit''fk')
  1253.             ->join('fk.form''f')
  1254.             ->where('f.id='.$formid)
  1255.             ->orderBy('fk.tarih','DESC')
  1256.             ->getQuery()
  1257.             ->setResultCacheId('formVerisi')
  1258.             ->setResultCacheLifetime(60)
  1259.             ->getScalarResult();
  1260.         return $veri;
  1261.     }
  1262.     public function digerDiller($id){
  1263.         $em $this->em;
  1264.         $qb $em->createQueryBuilder();
  1265.         $sabitler=$qb->select('c.id,d.kisa as diladi,d.aktif,c.deger,c.trId')
  1266.             ->from('App:Ceviri''c')
  1267.             ->join('c.dil''d')
  1268.             ->where('c.trId='.$id.' and d.aktif=1')
  1269.             ->getQuery()
  1270.             ->getScalarResult();
  1271.         return $sabitler;
  1272.     }
  1273.     public function taslakBul($dilgrup){
  1274.         return $this->session->get('taslak_'.$dilgrup);
  1275.     }
  1276.     public function popupGetir($sayfaId){
  1277.         $em $this->em;
  1278.         $qb $em->createQueryBuilder();
  1279.         $popup=$qb->select('p.id,p.veri,p.tip,p.link,p.dilgrup')
  1280.             ->from('App:Popup''p')
  1281.             ->where("p.sayfaId=".$sayfaId)
  1282.             ->orderBy('p.dil','asc')
  1283.             ->getQuery()
  1284.             ->getScalarResult();
  1285.         return $popup;
  1286.     }
  1287.     public function site_popupGetir($path){
  1288.         $em $this->em;
  1289.         $dil $this->session->get('dil');
  1290.         $path2 explode('/',$path);
  1291.         if ($this->dilSay()>1) {
  1292.             if (count($path2) > 2) {
  1293.                 $path str_replace$dil['kisa'].'/'''$path);
  1294.             } else {
  1295.                 $path str_replace($dil['kisa'], ''$path);
  1296.             }
  1297.         }
  1298.         $path explode('/',$path);
  1299.         if (empty($path[1])){
  1300.             if(!$this->session->get('system_popup0')) {
  1301.                 $qb $em->createQueryBuilder();
  1302.                 $popup $qb->select('p.veri,p.link,p.tip,p.dilgrup')
  1303.                     ->from('App:Popup''p')
  1304.                     ->join('p.dil''d')
  1305.                     ->where("p.sayfaId=0 and d.id=" $dil['id'])
  1306.                     ->getQuery()
  1307.                     ->getScalarResult();
  1308.                 $this->session->set('system_popup0',1);
  1309.             } else {
  1310.                 $popup "";
  1311.             }
  1312.         } else {
  1313.             $qb $em->createQueryBuilder();
  1314.             $sayfa=$qb->select('s.dilgrup')
  1315.                 ->from('App:Sayfa''s')
  1316.                 ->join('s.dil','d')
  1317.                 ->where("s.seo='".$path[1]."'")
  1318.                 ->getQuery()
  1319.                 ->getScalarResult();
  1320.             if(!$this->session->get('system_popup'.$sayfa[0]['dilgrup'])) {
  1321.                 $qb $em->createQueryBuilder();
  1322.                 $popup $qb->select('p.veri,p.link,p.tip,p.dilgrup')
  1323.                     ->from('App:Popup''p')
  1324.                     ->join('p.dil''d')
  1325.                     ->where("p.sayfaId=" $sayfa[0]['dilgrup'] . " and d.id=" $dil['id'])
  1326.                     ->getQuery()
  1327.                     ->getScalarResult();
  1328.                 $this->session->set('system_popup'.$sayfa[0]['dilgrup'],1);
  1329.             } else {
  1330.                 $popup "";
  1331.             }
  1332.         }
  1333.         if (empty($popup)){
  1334.             return "";
  1335.         }else{
  1336.             return $popup[0];
  1337.         }
  1338.     }
  1339.     public function IdBul($entity,$id){
  1340.         $em $this->em;
  1341.         $qb $em->createQueryBuilder();
  1342.         $veriler=$qb->select('x.id')
  1343.             ->from('App:'.$entity'x')
  1344.             ->join('x.dil','d')
  1345.             ->where('x.dilgrup='.$id)
  1346.             ->groupBy('x.dil')
  1347.             ->getQuery()
  1348.             ->getScalarResult();
  1349.         return $veriler[0]['id'];
  1350.     }
  1351.     public function imgOlustur($resim,$yukseklik=300,$radius=0,$size='cover'){
  1352.         if ($resim==''){
  1353.             $resim="resimyok.webp";
  1354.         }
  1355.         return '<div style="background-image: url(/storage/'.$resim.');background-size: '.$size.'; background-repeat: no-repeat; overflow: hidden; width: 100%; height: '.$yukseklik.'px; background-position: center;border-radius: '.$radius.'px;"></div>';
  1356.     }
  1357.     function anasayfaIcerikleri()
  1358.     {
  1359.         $em $this->em;
  1360.         $dil $this->session->get('dil');
  1361.         $qb $em->createQueryBuilder();
  1362.         $sayfalar=$qb->select('s.id,s.adi,s.dilgrup,s.seo,s.kategori,s.tekVeri,s.icIcerik,m.tabloAdi,m.alan')
  1363.             ->from('App:Sayfa''s')
  1364.             ->join('s.dil''d')
  1365.             ->join('s.modul''m')
  1366.             ->where('d.id='.$dil['id'])
  1367.             ->orderBy('s.sira','ASC')
  1368.             ->getQuery()
  1369.             ->setResultCacheId('menu_sayfalar')
  1370.             ->setResultCacheLifetime(60)
  1371.             ->getScalarResult();
  1372.         $veriler = [];
  1373.         foreach ($sayfalar as $sayfa){
  1374.             $sId $this->IdBul('Sayfa',$sayfa['dilgrup']);
  1375.             $sLink $this->site_anaLink().$sayfa['seo'];
  1376.             if ($sayfa['kategori'] == 0) {
  1377.                 $veriler[$sayfa['dilgrup']]= $this->site_sayfaIcerik($sayfa['dilgrup']);
  1378.             }
  1379.             else {
  1380.                 $veriler[$sayfa['dilgrup']]= $this->site_sayfaKategori($sayfa['dilgrup']);
  1381.             }
  1382.         }
  1383.         return $veriler;
  1384.     }
  1385.     function ustMenuler($sayfa,$kategori="",$icerik="",$kategoriV="")
  1386.     {
  1387.         $em $this->em;
  1388.         $dil $this->session->get('dil');
  1389.         $veriler = [];
  1390.         $veriler[] = ['adi'=>$this->ceviri('Anasayfa'),'link'=>$this->site_anaLink()];
  1391.         $qb $em->createQueryBuilder();
  1392.         $sayfa=$qb->select('s.id,s.adi,s.dilgrup,s.seo')
  1393.             ->from('App:Sayfa''s')
  1394.             ->join('s.dil''d')
  1395.             ->join('s.modul''m')
  1396.             ->where('d.id='.$dil['id'].' and s.dilgrup='.$sayfa)
  1397.             ->getQuery()
  1398.             ->setResultCacheId('menuSayfa')
  1399.             ->setResultCacheLifetime(60)
  1400.             ->getScalarResult();
  1401.         $veriler[] = ['adi'=>$sayfa[0]['adi'],'link'=>$this->site_anaLink().$sayfa[0]['seo']];
  1402.         if ($kategori!=''){
  1403.             $kattlar explode('~',$this->site_kategoriGeriLi($kategori,$dil['id']));
  1404.             foreach ($kattlar as $kat){
  1405.                 if($kat!=''){
  1406.                     $x explode('#',$kat);
  1407.                     $veriler[] = ['adi'=>$x[0],'link'=>$this->site_anaLink().$sayfa[0]['seo'].'/'.$x[1]];
  1408.                 }
  1409.             }
  1410.         }
  1411.         if ($icerik!='-'){
  1412.             $ii explode('-',$icerik);
  1413.             $veriler[] = ['adi'=>$ii[0],'link'=>'#'];
  1414.         }
  1415.         if ($kategoriV!=''){
  1416.             $veriler[] = ['adi'=>$kategoriV,'link'=>'#'];
  1417.         }
  1418.         return $veriler;
  1419.     }
  1420.     function veriYenile($veriler,$sayfaSeo,$kategori=0)
  1421.     {
  1422.         $em $this->em;
  1423.         $dil $this->session->get('dil');
  1424.         $yeniVeri=[];
  1425.         foreach ($veriler as $key=>$veri){
  1426.             $alt='';
  1427.             if($kategori==1){
  1428.                 $alt $this->altKategoriGeriYaz($veri['kategoriId'],$dil['id']);
  1429.             }
  1430.             $veri['link'] = $this->site_anaLink().$sayfaSeo.'/'.$alt.$veri['seourl'];
  1431.             if (array_key_exists('resimler'$veri)) {
  1432.                 $veri['resim'] = explode(',',$veri['resimler'])[0];
  1433.             }
  1434.             $yeniVeri[]=$veri;
  1435.         }
  1436.         return $yeniVeri;
  1437.     }
  1438.     function kategoriVeriYenile($veriler,$sayfaSeo)
  1439.     {
  1440.         $em $this->em;
  1441.         $dil $this->session->get('dil');
  1442.         $yeniVeri=[];
  1443.         foreach ($veriler as $key=>$veri){
  1444.             $alt $this->altKategoriGeriYaz($veri['ustid'],$dil['id']);
  1445.             $veri['link'] = $this->site_anaLink().$sayfaSeo.'/'.$alt.$veri['seourl'];
  1446.             $yeniVeri[]=$veri;
  1447.         }
  1448.         return $yeniVeri;
  1449.     }
  1450.     function icerikSolMenuler($sayfaDilgrup,$kategoriDilgrup)
  1451.     {
  1452.         $em $this->em;
  1453.         $dil $this->session->get('dil');
  1454.         $yeniVeri=[];
  1455.         if ($kategoriDilgrup!=''){
  1456.             $veriler $this->site_sayfaIcerikDirek($sayfaDilgrup);
  1457.         }else{
  1458.             $veriler $this->site_sayfaIcerik($sayfaDilgrup);
  1459.         }
  1460.         foreach ($veriler[1] as $veri) {
  1461.             $yeniVeri[]=$veri;
  1462.         }
  1463.         return $yeniVeri;
  1464.     }
  1465.     function footerSayfaDilgrup()
  1466.     {
  1467.         $em $this->em;
  1468.         $qb $em->createQueryBuilder();
  1469.         $sss=$qb->select('s.dilgrup')
  1470.             ->from('App:Sayfa''s')
  1471.             ->where('s.footer=1')
  1472.             ->getQuery()
  1473.             ->getScalarResult();
  1474.         return $sss[0]['dilgrup'];
  1475.     }
  1476. }