assign("MOD", $mod_strings); $xtpl->assign("APP", $app_strings); $xtpl->assign("IMAGE_PATH",$image_path); if(isset($_REQUEST['query']) && $_REQUEST['query'] != '' && $_REQUEST['query'] == 'true') { $query_val = "true"; if (isset($_REQUEST['category'])) $category = $_REQUEST['category']; if (isset($_REQUEST['question'])) $question = $_REQUEST['question']; if (isset($_REQUEST['date'])) $date = $_REQUEST['date']; if (isset($_REQUEST['current_user_only'])) $current_user_only = $_REQUEST['current_user_only']; $search_query="select faq.id,question,answer,category,author_id,users.id,users.user_name from faq left join users on faq.author_id=users.id where faq.deleted ='0'"; if (isset($category) && $category !='') { $search_query .= " and faq.category like '".$category."%'"; $query_val .= "&category=".$category; $xtpl->assign("CATEGORY", $category); } if (isset($question) && $question !='') { $search_query .= " and faq.question like '".$question."%'"; $query_val .= "&question=".$question; $xtpl->assign("QUESTION", $question); } if (isset($date) && $date !='') { $date_criteria = $_REQUEST['date_crit']; if($date_criteria == 'is') { $search_query .= " and faq.date_created like '".$date."%'"; $xtpl->assign("IS", 'selected'); } if($date_criteria == 'isnot') { $search_query .= " and faq.date_created not like '".$date."%'"; $xtpl->assign("ISNOT", 'selected'); } if($date_criteria == 'before') { $search_query .= " and faq.date_created < '".$date." 23:59:59'"; $xtpl->assign("BEFORE", 'selected'); } if($date_criteria == 'after') { $search_query .= " and faq.date_created > '".$date." 00:00:00'"; $xtpl->assign("AFTER", 'selected'); } $query_val .= "&date=".$date; $query_val .= "&date_crit=".$date_criteria; $xtpl->assign("DATE", $date); } if (isset($current_user_only) && $current_user_only !='') { $search_query .= " and faq.author_id='".$current_user->id."'"; $query_val .= "¤t_user_only=".$current_user_only; $xtpl->assign("CURRENT_USER_ONLY", "checked"); } //echo $search_query; //echo '
'; //echo $_REQUEST['query']; $tktresult = $adb->query($search_query); } else { //Retreive the list from Database $tktresult = getFaqList(); $query_val = "false"; } //Retreiving the no of rows $noofrows = $adb->num_rows($tktresult); //Retreiving the start value from request if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') { $start = $_REQUEST['start']; } else { $start = 1; } //Setting the start value //Setting the start to end counter $starttoendvaluecounter = $list_max_entries_per_page - 1; //Setting the ending value if($noofrows > $list_max_entries_per_page) { $end = $start + $starttoendvaluecounter; if($end > $noofrows) { $end = $noofrows; } $startvalue = 1; $remainder = $noofrows % $list_max_entries_per_page; if($remainder > 0) { $endval = $noofrows - $remainder + 1; } elseif($remainder == 0) { $endval = $noofrows - $starttoendvaluecounter; } } else { $end = $noofrows; } //Setting the next and previous value if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') { $tempnextstartvalue = $_REQUEST['start'] + $list_max_entries_per_page; if($tempnextstartvalue <= $noofrows) { $nextstartvalue = $tempnextstartvalue; } $tempprevvalue = $_REQUEST['start'] - $list_max_entries_per_page; if($tempprevvalue > 0) { $prevstartvalue = $tempprevvalue; } } else { if($noofrows > $list_max_entries_per_page) { $nextstartvalue = $list_max_entries_per_page + 1; } } echo get_module_title("HelpDesk", "Faqs" , true); echo "
"; echo get_form_header("Faq Search", "", false); $xtpl->assign("FAQLISTHEADER", get_form_header("Faq's List", "", false )); $tkList = ''; for ($i=$start; $i<=$end; $i++) { if (($i%2)==0) $tkList .= ''; else $tkList .= ''; $tkList .= ''; $question = ''.$adb->query_result($tktresult,$i-1,"question").''; $tkList .= ''.$question.''; $tkList .= ''; $tkList .= ''.$adb->query_result($tktresult,$i-1,"category").''; $tkList .= ''; $tkList .= ''.$adb->query_result($tktresult,$i-1,"user_name").''; $tkList .= ''; $tkList .= '[ '.$app_strings['LNK_EDIT'].' ] [ '.$app_strings['LNK_DELETE'].' ]'; $tkList .= ''; } $xtpl->assign("FAQLIST", $tkList); if(isset($startvalue)) { $startoutput = 'Start'; } else { $startoutput = '[ Start ]'; } if(isset($endval)) { $endoutput = 'End'; } else { $endoutput = '[ End ]'; } if(isset($nextstartvalue)) { $nextoutput = 'Next'; } else { $nextoutput = '[ Next ]'; } if(isset($prevstartvalue)) { $prevoutput = 'Prev'; } else { $prevoutput = '[ Prev ]'; } $xtpl->assign("Start", $startoutput); $xtpl->assign("End", $endoutput); $xtpl->assign("Next", $nextoutput); $xtpl->assign("Prev", $prevoutput); $xtpl->parse("main"); $xtpl->out("main"); ?>