/bbcsadmin/modules/utility/view-car_type.php
PHP | 120 lines | 89 code | 17 blank | 14 comment | 33 complexity | 34734953dc228eacc61c27b2630e31cd MD5 | raw file
- <?
- #echo "<pre>";
- #print_r($_REQUEST);exit;
- $ssql = "";
- $alp = $_REQUEST['alp'];
- $option = $_REQUEST['option'];
- $keyword = $_REQUEST['keyword'];
- if($_REQUEST['sortby'] == ''){
- $sortby = 1;
- }else{
- $sortby = $_REQUEST['sortby'];
- }
- if($_REQUEST['order'] == ''){
- $order = 0;
- }else{
- $order = $_REQUEST['order'];
- }
- if($option != '' && $keyword != ''){
- $ssql.= " AND ".stripslashes($option)." LIKE '%".stripslashes($keyword)."%'";
- }
- if($alp != ''){
- $ssql.= " AND vTitle_EN LIKE '".stripslashes($alp)."%'";
- }
- if($sortby == 1){
- if($order == 0)
- $ord.= " order by vTitle_EN ASC";
- else
- $ord.= " order by vTitle_EN DESC";
- }
- // sortby 2 for eStatus Name
- if($sortby == 2){
- if($order == 0)
- $ord.= " order by eStatus ASC";
- else
- $ord.= " order by eStatus DESC";
- }
- $sql = "SELECT iCarTypeId, vTitle_EN, eStatus from car_type where 1=1 $ssql $ord";
- $dbfaq = $obj->MySQLSelect($sql);
- $num_totrec = count($dbfaq);
- //echo "<pre>"; print_r($dbfaq); exit;
- include(TPATH_CLASS_GEN."admin.paging.inc.php");
- #Listing Starts from here
- $sql_faq = "SELECT iCarTypeId,vTitle_EN,eStatus from car_type where 1=1 $ssql $ord $var_limit";
- $db_faq = $obj->MySQLSelect($sql_faq);
- /*echo "<pre>";
- print_r($db_faq);
- exit;
- nds here*/
- if(!isset($start))
- $start = 1;
- $num_limit = ($start-1)*$rec_limit;
- $startrec = $num_limit;
-
- $lastrec = $startrec + $rec_limit;
- $startrec = $startrec + 1;
- if($lastrec > $num_totrec)
- $lastrec = $num_totrec;
- if($num_totrec > 0 )
- {
- $recmsg = "Showing ".$startrec." - ".$lastrec." Records Of ".$num_totrec;
- }
- else
- {
- $recmsg="No Records Found.";
- }
- if(!count($db_faq)>0 && $keyword != ""){
- $var_msg_new = "Your search for <font color=#2e71b3>$keyword</font> has found <font color=#2e71b3>0</font> matches:";
- }else if($keyword != ""){
- $var_msg_new = "Your search for <font color=#2e71b3>$keyword</font> has found <font color=#2e71b3>$num_totrec</font> matches:";
- }else if($alp !=''){
- $var_msg_new = "Your search for <font color=#2e71b3>$alp</font> has found <font color=#2e71b3>$num_totrec</font> matches:";
- }
- $sql_alp = "select vTitle_EN from car_type where 1=1 $ssql";
- $db_alp = $obj->MySQLSelect($sql_alp);
- for($i=0;$i<count($db_faq);$i++){
- $db_alp[$i] = strtoupper(substr($db_alp[$i]['vTitle_EN'], 0,1));
- }
- #echo "<pre>";
- #print_r($db_alp);exit;
- $alpha_rs =implode(",",$db_alp);
- #echo $alpha_rs;exit;
- $AlphaChar = @explode(',',$alpha_rs);
- #echo "<pre>";
- #print_r($AlphaChar);exit;
- $AlphaBox.='<ul class="pagination">';
- for($i=65;$i<=90;$i++){
-
- if(!@in_array(chr($i),$AlphaChar)){
- $AlphaBox.= '<li ><a href="#" onclick="return false;" id="alch_'.$i.'">'.chr($i).'</a></li>';
- }else{
- $AlphaBox.= '<li class="page"><a href="javascript:void(0);" onclick="AlphaSearch(\''.chr($i).'\');" id="alch_'.$i.'" >'.chr($i).'</a></li>';
- }
- }
- $AlphaBox.='</ul>';
- $smarty->assign("db_faq",$db_faq);
- $smarty->assign("AlphaBox",$AlphaBox);
- $smarty->assign("recmsg",$recmsg);
- $smarty->assign("var_msg",$var_msg);
- $smarty->assign("keyword",$keyword);
- $smarty->assign("option",$option);
- $smarty->assign("page_link",$page_link);
- $smarty->assign("var_msg_new",$var_msg_new);
- $smarty->assign("sortby",$sortby);
- $smarty->assign("order",$order);
- ?>