PageRenderTime 61ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/bbcsadmin/modules/utility/view-car_type.php

https://gitlab.com/zohaibsaleem/shipcliq
PHP | 120 lines | 89 code | 17 blank | 14 comment | 33 complexity | 34734953dc228eacc61c27b2630e31cd MD5 | raw file
  1. <?
  2. #echo "<pre>";
  3. #print_r($_REQUEST);exit;
  4. $ssql = "";
  5. $alp = $_REQUEST['alp'];
  6. $option = $_REQUEST['option'];
  7. $keyword = $_REQUEST['keyword'];
  8. if($_REQUEST['sortby'] == ''){
  9. $sortby = 1;
  10. }else{
  11. $sortby = $_REQUEST['sortby'];
  12. }
  13. if($_REQUEST['order'] == ''){
  14. $order = 0;
  15. }else{
  16. $order = $_REQUEST['order'];
  17. }
  18. if($option != '' && $keyword != ''){
  19. $ssql.= " AND ".stripslashes($option)." LIKE '%".stripslashes($keyword)."%'";
  20. }
  21. if($alp != ''){
  22. $ssql.= " AND vTitle_EN LIKE '".stripslashes($alp)."%'";
  23. }
  24. if($sortby == 1){
  25. if($order == 0)
  26. $ord.= " order by vTitle_EN ASC";
  27. else
  28. $ord.= " order by vTitle_EN DESC";
  29. }
  30. // sortby 2 for eStatus Name
  31. if($sortby == 2){
  32. if($order == 0)
  33. $ord.= " order by eStatus ASC";
  34. else
  35. $ord.= " order by eStatus DESC";
  36. }
  37. $sql = "SELECT iCarTypeId, vTitle_EN, eStatus from car_type where 1=1 $ssql $ord";
  38. $dbfaq = $obj->MySQLSelect($sql);
  39. $num_totrec = count($dbfaq);
  40. //echo "<pre>"; print_r($dbfaq); exit;
  41. include(TPATH_CLASS_GEN."admin.paging.inc.php");
  42. #Listing Starts from here
  43. $sql_faq = "SELECT iCarTypeId,vTitle_EN,eStatus from car_type where 1=1 $ssql $ord $var_limit";
  44. $db_faq = $obj->MySQLSelect($sql_faq);
  45. /*echo "<pre>";
  46. print_r($db_faq);
  47. exit;
  48. nds here*/
  49. if(!isset($start))
  50. $start = 1;
  51. $num_limit = ($start-1)*$rec_limit;
  52. $startrec = $num_limit;
  53. $lastrec = $startrec + $rec_limit;
  54. $startrec = $startrec + 1;
  55. if($lastrec > $num_totrec)
  56. $lastrec = $num_totrec;
  57. if($num_totrec > 0 )
  58. {
  59. $recmsg = "Showing ".$startrec." - ".$lastrec." Records Of ".$num_totrec;
  60. }
  61. else
  62. {
  63. $recmsg="No Records Found.";
  64. }
  65. if(!count($db_faq)>0 && $keyword != ""){
  66. $var_msg_new = "Your search for <font color=#2e71b3>$keyword</font> has found <font color=#2e71b3>0</font> matches:";
  67. }else if($keyword != ""){
  68. $var_msg_new = "Your search for <font color=#2e71b3>$keyword</font> has found <font color=#2e71b3>$num_totrec</font> matches:";
  69. }else if($alp !=''){
  70. $var_msg_new = "Your search for <font color=#2e71b3>$alp</font> has found <font color=#2e71b3>$num_totrec</font> matches:";
  71. }
  72. $sql_alp = "select vTitle_EN from car_type where 1=1 $ssql";
  73. $db_alp = $obj->MySQLSelect($sql_alp);
  74. for($i=0;$i<count($db_faq);$i++){
  75. $db_alp[$i] = strtoupper(substr($db_alp[$i]['vTitle_EN'], 0,1));
  76. }
  77. #echo "<pre>";
  78. #print_r($db_alp);exit;
  79. $alpha_rs =implode(",",$db_alp);
  80. #echo $alpha_rs;exit;
  81. $AlphaChar = @explode(',',$alpha_rs);
  82. #echo "<pre>";
  83. #print_r($AlphaChar);exit;
  84. $AlphaBox.='<ul class="pagination">';
  85. for($i=65;$i<=90;$i++){
  86. if(!@in_array(chr($i),$AlphaChar)){
  87. $AlphaBox.= '<li ><a href="#" onclick="return false;" id="alch_'.$i.'">'.chr($i).'</a></li>';
  88. }else{
  89. $AlphaBox.= '<li class="page"><a href="javascript:void(0);" onclick="AlphaSearch(\''.chr($i).'\');" id="alch_'.$i.'" >'.chr($i).'</a></li>';
  90. }
  91. }
  92. $AlphaBox.='</ul>';
  93. $smarty->assign("db_faq",$db_faq);
  94. $smarty->assign("AlphaBox",$AlphaBox);
  95. $smarty->assign("recmsg",$recmsg);
  96. $smarty->assign("var_msg",$var_msg);
  97. $smarty->assign("keyword",$keyword);
  98. $smarty->assign("option",$option);
  99. $smarty->assign("page_link",$page_link);
  100. $smarty->assign("var_msg_new",$var_msg_new);
  101. $smarty->assign("sortby",$sortby);
  102. $smarty->assign("order",$order);
  103. ?>