function showfiltervalues($filter_array, $count_filter_array, $params) { $output = ""; $column = $this->column; $path = $this->path; $list = ""; $counter = 0; $extra = ""; $links = ""; $links = $this->generatelink($this->items); if (!empty($filter_array)) { if ($column == 'make') { $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS'); //$temp_arr = array_diff($filter_array,$all_makes); // commented as need to show the abpve makes with all other makes also $temp_arr = $filter_array; $srch_str = ""; if (isset($_REQUEST['abtesting']) && $_REQUEST['abtesting'] != "") { $srch_str = "a-b-testing/" . MakeURLSafe(strtolower($_REQUEST['abtesting'])); } else { if (isset($GLOBALS['ISC_SRCH_CATG_NAME']) && !isset($this->items['category'])) { $srch_str = MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])); } else { if (isset($GLOBALS['ISC_SRCH_BRAND_NAME'])) { $srch_str = MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME'])); } } } $ymm_link = $this->leftnavigationlink($srch_str, $links, $column, $params); foreach ($all_makes as $key => $value) { $counter++; // here applied the counter++ seperately as we are avoiding all & universal fit many vehicles. if ($srch_str == "" && preg_match('/%s/', $ymm_link)) { $ymm_link = sprintf($ymm_link, $value); } $list_val = "<li><a href='" . $ymm_link . MakeURLSafe(strtolower($value)) . "'>{$value}</a></li>"; if ($counter < 13) { $list .= $list_val; } else { $extra .= $list_val; } } if (count($temp_arr) > 0) { foreach ($temp_arr as $key => $value) { if (strtoupper($value) != "NON-SPEC VEHICLE" && strtolower($value) != "all") { $counter++; // here applied the counter++ seperately as we are avoiding all & universal fit many vehicles. if ($srch_str == "" && preg_match('/%s/', $ymm_link)) { $ymm_link = sprintf($ymm_link, $value); } $list_val = "<li><a href='" . $ymm_link . MakeURLSafe(strtolower($value)) . "'>{$value}</a></li>"; if ($counter < 13) { $list .= $list_val; } else { $extra .= $list_val; } } } } } else { $srch_str = ""; if ($_REQUEST['abtesting'] && $_REQUEST['abtesting'] != "") { $srch_str = "a-b-testing/" . MakeURLSafe(strtolower($_REQUEST['abtesting'])); } else { if (isset($GLOBALS['ISC_SRCH_CATG_NAME']) && !isset($this->items['category'])) { $srch_str = MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])); } else { if (isset($GLOBALS['ISC_SRCH_BRAND_NAME']) && $column != 'prodbrandid') { $srch_str = MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME'])); } } } $ymm_link = $this->leftnavigationlink($srch_str, $links, $column, $params); foreach ($filter_array as $key => $value) { if ($column == 'prodbrandid') { if (empty($params['search_query'])) { $srch_str = urlencode($value); } else { $srch_str = $params['search_query']; } $counter++; // here applied the counter++ seperately as we are avoiding all & universal fit many vehicles. //$column = 'brand'; if (!isset($GLOBALS['ISC_SRCH_CATG_NAME'])) { if ($GLOBALS['EnableSEOUrls'] == 1) { $list_val = "<li><a href='" . $this->path . "/" . MakeURLSafe(strtolower($value)); if ($links != "") { $list_val .= "/{$links}"; } $list_val .= "'>{$value} (" . $count_filter_array[$value] . ")</a></li>"; } else { $list_val = "<li><a href='" . $this->path . "/search.php?search_query={$value}" . $links . "'>{$value} (" . $count_filter_array[$value] . ")</a></li>"; } } else { $list_val = "<li><a href='{$ymm_link}" . MakeURLSafe(strtolower($value)) . "'>{$value} (" . $count_filter_array[$value] . ")</a></li>"; } if ($counter < 11) { $list .= $list_val; } else { $extra .= $list_val; } } else { if ($column == 'model' || $column == 'submodel' || $column == 'year') { //echo "<li><a href='$path/search.php?search_query=".$value."$links&$column=".urlencode($value)."'>$value</a> (".$count_filter_array[$value].")</li>"; // commented for backup if (strtoupper($value) != "NON-SPEC VEHICLE" && strtolower($value) != "all") { $counter++; // here applied the counter++ seperately as we are avoiding all & universal fit many vehicles. $ymm_new_link = $ymm_link; if ($srch_str == "" && preg_match('/%s/', $ymm_link)) { if (isset($params['make'])) { $ymm_new_link = sprintf($ymm_link, $params['make']); } else { $ymm_new_link = sprintf($ymm_link, $value); } } $list_val = "<li><a href='" . $ymm_new_link . MakeURLSafe(strtolower($value)) . "'>{$value}</a></li>"; if ($counter < 11) { $list .= $list_val; } else { $extra .= $list_val; } } } else { $counter++; // here applied the counter++ seperately as we are avoiding all & universal fit many vehicles. $list_val = "<li><a href='{$ymm_link}" . MakeURLSafe(strtolower($value)) . "'>{$value} (" . $count_filter_array[$value] . ")</a></li>"; if ($counter < 11) { $list .= $list_val; } else { $extra .= $list_val; } } } } if ($counter == 0) { $list .= "<li>No options available</li>"; } } } else { $list .= "<li>No options available</li>"; } if ($counter >= 11) { $GLOBALS['FilterID'] = $column; $GLOBALS['ExtraValues'] = $extra; $output .= "<ul>" . $list . "</ul>"; $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); } else { $output .= "<ul>" . $list . "</ul>"; } try { $ymm_tmp_column = isset($_GET['column']) ? MakeURLSafe($_GET['column']) : ""; $ymm_tmp_year = isset($_GET['year']) ? MakeURLSafe($_GET['year']) : ""; $ymm_tmp_make = isset($_GET['make']) ? MakeURLSafe($_GET['make']) : ""; $ymm_tmp_model = isset($_GET['model']) ? MakeURLSafe($_GET['model']) : ""; $fn = 'column=' . $ymm_tmp_column . '_year=' . $ymm_tmp_year . '_make=' . $ymm_tmp_make . '_model=' . $ymm_tmp_model; $fc = new file_cache($fn); $fc->save_cache($output); } catch (Exception $e) { return $e->getMessage(); } return $output; }
} //Get the user theme and enough info to be used in chat_format_message() which passes it along to if (!($USER = $DB->get_record('user', array('id' => $chatuser->userid)))) { // no optimisation here, it would break again in future! chat_print_error('ERROR', get_string('invaliduserid', 'error')); } if (!($chat = $DB->get_record('chat', array('id' => $chatuser->chatid)))) { chat_print_error('ERROR', get_string('invalidcoursemodule', 'error')); } if (!($cm = get_coursemodule_from_instance('chat', $chatuser->chatid, $course->id))) { chat_print_error('ERROR', get_string('invalidcoursemodule', 'error')); } // setup $PAGE so that format_text will work properly $PAGE->set_cm($cm, $course, $chat); if ($CFG->chat_use_cache) { $cache = new file_cache(); $users = $cache->get('user'); if (empty($users)) { $users = chat_get_users($chatuser->chatid, $chatuser->groupid, $cm->groupingid); $cache->set('user', $users); } } else { $users = chat_get_users($chatuser->chatid, $chatuser->groupid, $cm->groupingid); } $users = format_user_list($users, $course); if (!empty($chat_init)) { $response['users'] = $users; echo json_encode($response); exit; } // force deleting of timed out users if there is a silence in room or just entering
function _ProcessSearch() { $output = ""; $column = $this->column; if (empty($column)) { echo "<p>No options available</p>"; die; } if ($column == 'prodbrandid') { $selected_value = $_GET['brand']; // To get the originial value so tht it is not shown again in the list $_REQUEST['brand'] = ""; // Making the variable as empty so that all the list can be taken } else { if ($column == 'categories') { $selected_value = $_GET['catg_name']; // To get the originial value so tht it is not shown again in the list $_REQUEST[$column] = ""; // Making the variable as empty so that all the list can be taken $_GET['search_query'] = $_REQUEST['search_query'] = str_ireplace($selected_value, '', MakeURLNormal($_REQUEST['search_query'])); } else { $selected_value = isset($_GET[$column]) ? $_GET[$column] : ''; // To get the originial value so tht it is not shown again in the list $_GET[$column] = $_REQUEST[$column] = ""; // Making the variable as empty so that all the list can be taken } } $selected_value = MakeURLNormal($selected_value); $GLOBALS['ISC_CLASS_SEARCH'] = GetClass('ISC_SEARCH'); $params = $GLOBALS['ISC_CLASS_SEARCH']->_searchterms; /* Adding clerance paramter for clearance page - vikas */ if (isset($this->items['clearance'])) { $params['clearance'] = 1; unset($this->items['clearance']); } switch ($column) { case 'categories': $output = $this->searchcategories($params, $selected_value); break; default: //$output = $this->searchotherfilters($params,$selected_value); //NI Cloud.Liu 2010-05-28 //modify YMM logic to read from cache file first //if fail reading file then get info from original logic $fn = 'column=' . $column . '_year=' . (isset($params['year']) ? $params['year'] : '') . '_make=' . str_replace(' ', '_', isset($params['make']) ? $params['make'] : '') . '_model=' . str_replace('/', '_', str_replace(' ', '_', isset($params['model']) ? $params['model'] : '')); $fc = new file_cache($fn); $fc->file_dir = isset($GLOBALS['ISC_CFG']["cache_file_folder"]) ? $GLOBALS['ISC_CFG']["cache_file_folder"] : '/var/tmp/tc_ymm'; if (isset($GLOBALS['ISC_CFG']["cache_file_expire_time"])) { $fc->{$expire_time} = $GLOBALS['ISC_CFG']["cache_file_expire_time"]; } $cache = $fc->get_cache(); $GLOBALS['ISC_CLASS_DB']->Query("INSERT INTO isc_orderlogs(ordervalue) VALUES( 'cache1: ')"); //NI Cloud.Liu 2010-06-11 //accomplish make info if select column is model if ($cache && strtolower($column) === 'model' && isset($params['year'])) { $cache = str_replace('/make/' . $params['make'], '/make/' . $params['make'] . '/year/' . $params['year'], $cache); } //accomplish category and other info if (isset($cache)) { $NewLink = ''; if (isset($params['category'])) { $NewLink .= "/category/" . MakeURLSafe(strtolower($params['category'])); } if (isset($params['brand'])) { $NewLink .= "/brand/" . MakeURLSafe($params['brand']); } if (isset($params['series'])) { $NewLink .= "/series/" . MakeURLSafe($params['series']); } if (isset($params['searchtext'])) { $NewLink .= "/searchtext/" . MakeURLSafe(strtolower($params['searchtext'])); } if (isset($params['search'])) { $NewLink .= "/searchtext/" . MakeURLSafe(strtolower($params['search'])); } if (isset($params["search_query"]) && $params["search_query"] != '') { $NewLink = "/" . MakeURLSafe(strtolower($params['search_query'])) . $NewLink; } if (isset($NewLink) && $NewLink != '') { $cache = str_replace($GLOBALS["ShopPath"], $GLOBALS["ShopPath"] . $NewLink, $cache); } /* For clearance page, need to add clearance as the first paramter in URL to redirect to clearance page - vikas */ if (isset($params['clearance'])) { $cache = str_replace($GLOBALS["ShopPath"], $GLOBALS["ShopPath"] . "/clearance", $cache); } } $output = $cache ? $cache : $this->searchotherfilters($params, $selected_value); break; } $GLOBALS['ISC_CLASS_DB']->Query("INSERT INTO isc_orderlogs(ordervalue) VALUES( 'cache-op :')"); return $output; }