yFunc.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. class YFunc {
  3. public static function KategoriListesi($id = 0,$secim = 0,$tire = 0,$select = ''){
  4. $sorgu = DB::where('ust_kategori_id',$id,'and')->where('durum','1')->get('kategori')->result();
  5. $se = '';
  6. foreach ($sorgu as $key) {
  7. if ($key->ust_kategori_id == 0) {
  8. $tire = 0;
  9. $style = 'color:#000;font-weight:bolder;font-size:13px;';
  10. $se = 'disabled';
  11. }
  12. if ($secim != $key->ust_kategori_id){
  13. $secim = $key->ust_kategori_id;
  14. $style = 'color:#000';
  15. $tire++;
  16. }
  17. if($key->id == $select){$sel = 'selected';}else{$sel='';}
  18. echo '<option value="'.$key->id.'" style="'.$style.'"'.$se.$sel.' >'.str_repeat('-&nbsp;',$tire).$key->kategori."</option>";
  19. yfunc::KategoriListesi($key->id,$secim,$tire,$select);
  20. }
  21. }
  22. public static function KategoriTablosu($id = 0,$secim = 0,$tire = 0){
  23. $sorgu = DB::where('ust_kategori_id',$id)->get('kategori')->result();
  24. foreach ($sorgu as $key) {
  25. if ($key->ust_kategori_id == 0) {
  26. $tire = 0;
  27. $style = 'color:#000;font-weight:bolder;font-size:13px;';
  28. }
  29. if ($secim != $key->ust_kategori_id){
  30. $secim = $key->ust_kategori_id;
  31. $style = 'color:#000';
  32. $tire++;
  33. }
  34. $duzenle = baseUrl().'yonetim/kategori/duzenle/'.$key->id;
  35. $sil = baseUrl().'yonetim/kategori/sil/'.$key->id;
  36. echo '<tr>
  37. <td style="'.$style.'">'.str_repeat('-&nbsp;',$tire).$key->kategori.'</td>
  38. <td class="islemler" style="text-align: center;">
  39. <a href="'.$duzenle.'"><i class="icon-pencil"></i></a>
  40. <a href="'.$sil.'"><i class="icon-remove"></i></a>
  41. </td>
  42. </tr>';
  43. yFunc::KategoriTablosu($key->id,$secim,$tire);
  44. }
  45. }
  46. public static function ykat($id = ''){
  47. if ($id) {
  48. return DB::where('ust_kategori_id',$id)->get('kategori')->result();
  49. }else{
  50. return DB::orderBy('kategori','asc')->get('kategori')->result();
  51. }
  52. }
  53. public static function yonetimKategori($id = 0,$secim = 0,$tire = 0){
  54. $sorgu = DB::where('ust_kategori_id',$id)->get('kategori')->result();
  55. foreach ($sorgu as $key) {
  56. if ($key->ust_kategori_id == 0) {
  57. $tire = 0;
  58. $style = 'color:#000;font-weight:bolder;font-size:13px;';
  59. }
  60. if ($secim != $key->ust_kategori_id){
  61. $secim = $key->ust_kategori_id;
  62. $style = 'color:#000';
  63. $tire++;
  64. }
  65. echo '<option value="'.$key->id.'" style="'.$style.'">'.str_repeat('-&nbsp;',$tire).$key->kategori."</option>";
  66. yFunc::yonetimKategori($key->id,$secim,$tire);
  67. }
  68. }
  69. public static function seo($s) {
  70. $tr = array('ş','Ş','ı','I','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç','(',')','/',':',',');
  71. $eng = array('s','s','i','i','i','g','g','u','u','o','o','c','c','','','-','-','-');
  72. $s = str_replace($tr,$eng,$s);
  73. $s = strtolower($s);
  74. $s = preg_replace('/&amp;amp;amp;amp;amp;amp;amp;amp;amp;.+?;/', '', $s);
  75. $s = preg_replace('/\s+/', '-', $s);
  76. $s = preg_replace('|-+|', '-', $s);
  77. $s = preg_replace('/#/', '', $s);
  78. $s = str_replace('.', '', $s);
  79. $s = trim($s, '-');
  80. return $s;
  81. }
  82. public static function menuname(){
  83. return DB::orderBy('menu_name','asc')->get('menuname')->result();
  84. }
  85. public static function yazilar(){
  86. return DB::orderBy('baslik','asc')->get('icerik')->result();
  87. }
  88. public static function kategoriler(){
  89. return DB::orderBy('kategori','asc')->get('kategori')->result();
  90. }
  91. public static function tcevir($tarih) {
  92. $bosluk = explode(' ', $tarih);
  93. $tr = explode("-",$bosluk['0']);
  94. $tarih1 = $tr['2']."-".$tr['1']."-".$tr['0'].' '.isset($bosluk['1']);
  95. return $tarih1;
  96. }
  97. }