/findstudent_test.php
PHP | 173 lines | 138 code | 20 blank | 15 comment | 41 complexity | 016f942c45426bb7457a57a8308d5353 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
- <?php
- session_start();
- /*include("general_include.php");
- $action_arr=array("list_order","list_search","list_paginate");
- if(in_array($action,$action_arr))
- {
- $IsProcess = 'Y';
- $smarty->assign('IsProcess',"Y");
-
- }
- if($IsProcess <> 'Y')
- include "top.php";
-
- $page_name='findstudent.php';
- $action=$_REQUEST['action'];*/
- $page_name=basename($_SERVER['SCRIPT_FILENAME']);
- $IsPreserved = 'Y';
- $IsProcess = $_REQUEST['IsProcess'];
- $action = $_REQUEST['action'];
- $action_arr = array("getSrchResult");
- if(in_array($action,$action_arr))
- {
- $IsProcess = 'Y';
- }
- include "general_include.php";
-
- $game_id = $_REQUEST['game_id'];
- $availability = $_REQUEST['availability'];
- $language_id = $_REQUEST['language_id'];
- $price = $_REQUEST['price'];
- if($price == '')
- $price = '0;100';
- if($game_id == '')
- $game_id =array();
- if($availability == '')
- $availability = array();
- if($language_id == '')
- $language_id = array();
-
-
- if(count($game_id)>0&& is_array($game_id)&& !empty($game_id))
- {
- $game_ids = implode(',',$game_id);
- $smarty->assign('games',$game_ids);
- $sqlPart .= " AND ug.game_id IN($game_ids) AND ug.user_id=u.user_id";
- }
-
- if(count($language_id)>0&& is_array($language_id)&& !empty($language_id))
- {
- $language_ids = implode(',',$language_id);
- $smarty->assign('languages',$language_ids);
- foreach($language_id as $val)
- $sqlPart .= " AND FIND_IN_SET($val,u.language_ids)";
- }
- if(!empty($price))
- {
- $price_range = explode(";",$price);
- $min_price = $price_range[0];
- $max_price = $price_range[1];
- if($min_price == '0' && $max_price == '100')
- $sqlPart .='';
- else if($min_price == '0' && $max_price <100)
- $sqlPart .=" AND u.rate <='$max_price'";
- else if($min_price >'0' && $max_price == '100')
- $sqlPart .=" AND u.rate >='$min_price'";
- else
- $sqlPart .=" AND u.rate BETWEEN '$min_price' AND '$max_price'";
- }
- if(count($availability)>0&& is_array($availability)&& !empty($availability))
- {
- $availabilitys = implode(',',$availability);
- $smarty->assign('availabilitys',$availabilitys);
- for($v=0;$v<count($availability);$v++)
- {
- if($v==1)
- $Part .=" AND u.availability_type = '".$availability[$v]."'";
- else
- $Part .="u.availability_type = '".$availability[$v]."'";
- }
- $sqlPart .=" AND $Part";
- }
-
-
-
- if($IsProcess <> 'Y')
- {
- include "top.php";
- }
- $record_per_page = !empty($record_per_page)?$record_per_page:2;
- $paginationObj = new PaginationClassFrontAjax($record_per_page,4,1,'Next','Previous');
-
-
- function findlanguage($language_id)
- {
- if($language_id=='')
- return false;
-
- $SelectTypeSql = "SELECT language_name FROM ".TABLEPREFIX."_language WHERE language_id=$language_id";
- $SelectType = mysql_fetch_array(mysql_query($SelectTypeSql));
- return $SelectType[0];
- }
-
-
- function findvalue($table,$fld_name,$fld_value,$find_value)
- {
- if($fld_value=='')
- return false;
-
- $SelectTypeSql = "SELECT ".$find_value." FROM ".$table." WHERE $fld_name=".$fld_value;
- $SelectType = mysql_fetch_array(mysql_query($SelectTypeSql));
- return $SelectType[0];
- }
- $SelectstudentSQL="SELECT DISTINCT u.*,ur.user_id FROM ".TABLEPREFIX."_user u ,".TABLEPREFIX."_user_type_user_relation ur,".TABLEPREFIX."_user_game ug WHERE ur.user_type_id=2 AND ur.user_id=u.user_id AND u.is_active='Y'".$sqlPart." ORDER BY u.name ASC";
-
- $item_per_page_selected=6;
- $PaginationObjAjaxLatest=new PaginationClassAjax($item_per_page_selected,"prev",'',"next","active",$adodbcon);
- $pagination_arr = $PaginationObjAjaxLatest->PaginationAjax($SelectstudentSQL,$page_name."?action=".$action,"ManagerGeneral");
- $StudentArr=$UserManagerObjAjax->GetRecords("All",$pagination_arr[0]);
- //echo $pagination_arr[0];
- $NumStudent=count($StudentArr);
-
- for($i=0;$i<$NumStudent;$i++)
- {
- $StudentArr[$i]['name']=show_to_control($StudentArr[$i]['name']);
- $StudentArr[$i]['about']=show_to_control($StudentArr[$i]['user_about']);
- $slanguage = explode(",",$StudentArr[$i]['language_ids']);
- $language='';
- for($l=0;$l<count($slanguage);$l++)
- {
- if($slanguage[$l]<>'')
- $language .=findlanguage($slanguage[$l]).',';
- }
- $StudentArr[$i]['language']=substr($language,0,-1);
- $game='';
- $studentGame = "SELECT * FROM ".TABLEPREFIX."_user_game WHERE user_id='".$StudentArr[$i]['user_id']."'";
- $StudentGameArr = $UserManagerObjAjax->GetRecords("All",$studentGame);
- for($g=0;$g<count($StudentGameArr);$g++)
- {
- $game .= findvalue(TABLEPREFIX."_game","game_id",$StudentGameArr[$g]['game_id'],"game_name").",";
- }
- $StudentArr[$i]['game'] = substr($game,0,-1);
- if($StudentArr[$i]['availability_type'] == 'O')
- $StudentArr[$i]['availability_type'] = 'Online';
- if($StudentArr[$i]['availability_type'] == 'L')
- $StudentArr[$i]['availability_type'] = 'Local meet-up';
- }
-
-
-
- $studentSql="SELECT u.*,ur.* FROM ".TABLEPREFIX."_user u ,".TABLEPREFIX."_user_type_user_relation ur WHERE ur.user_type_id=2 and ur.user_id=u.user_id
- and u.is_active='Y'".$searchSql;
-
- $smarty->assign("IsProcess",$IsProcess);
- $smarty->assign("SearchTxt",$SearchTxt);
- $smarty->assign('catLink',$catLink);
- $smarty->assign('page_name',$page_name);
- $smarty->assign('record_per_page',$record_per_page);
- $smarty->assign('price',$price);
- $smarty->assign('language_id',$language_id);
- $smarty->assign('game_id',$game_id);
- $smarty->assign('availability',$availability);
- $smarty->assign("StudentArr",$StudentArr);
- $smarty->assign('pagination_arr',$pagination_arr);
- $smarty->assign("NumStudent",$NumStudent);
- $smarty->assign("totRec",$totRec);
- //$smarty->register_modifier("in_array","in_array");
-
- if($IsProcess <>'Y')
- include "student_leftpanel.php";
- $smarty->display('findstudent_test.tpl');
- if($IsProcess <> 'Y')
- include "footer.php";
- ?>