/** * Gets current search category id * * @return int */ function osc_search_category_id() { $categories = osc_search_category(); $category = array(); $where = array(); foreach ($categories as $cat) { if (is_numeric($cat)) { $where[] = "a.pk_i_id = " . $cat; } else { $slug_cat = explode("/", trim($cat, "/")); $where[] = "b.s_slug = '" . $slug_cat[count($slug_cat) - 1] . "'"; } } if (empty($where)) { return null; } else { $categories = Category::newInstance()->listWhere(implode(" OR ", $where)); foreach ($categories as $cat) { $category[] = $cat['pk_i_id']; } return $category; } }
"><strong><?php echo osc_category_name(); ?> </strong></label> </li> <?php } ?> </ul> </div> <?php } ?> </fieldset> <?php if (osc_search_category() != '') { osc_run_hook('search_form', osc_search_category_id()); } else { osc_run_hook('search_form'); } ?> <button type="submit"><?php _e('Search', 'masjob'); ?> </button> </form> </div> </div> <script type="text/javascript"> function checkEmptyCategories() { var n = $("#sCategory:checked").length;
</div> </fieldset> <?php } ?> <div class="plugin-hooks"> <?php if (osc_search_category_id()) { osc_run_hook('search_form', osc_search_category_id()); } else { osc_run_hook('search_form'); } ?> </div> <?php $aCategories = osc_search_category(); foreach ($aCategories as $cat_id) { ?> <input type="hidden" name="sCategory[]" value="<?php echo osc_esc_html($cat_id); ?> "/> <?php } ?> <div class="actions"> <button type="submit" class="btn btn-success"> <?php _e('Apply', OSCLASSWIZARDS_THEME_FOLDER); ?> </button>
<?php if (osc_count_subcategories() > 0) { ?> <ul class="sub"> <?php while (osc_has_subcategories()) { ?> <li> <input type="checkbox" id="cat<?php echo osc_category_id(); ?> " name="sCategory[]" value="<?php echo osc_category_id(); ?> " <?php if ($parentSelected || in_array(osc_category_id(), osc_search_category()) || in_array(osc_category_slug() . "/", osc_search_category()) || in_array(osc_category_slug(), osc_search_category()) || count(osc_search_category()) == 0) { echo 'checked'; } ?> /> <label for="cat<?php echo osc_category_id(); ?> "><strong><?php echo osc_category_name(); ?> </strong></label> </li> <?php } ?>
/** * Gets current search category id * * @return int */ function osc_search_category_id() { $categories = osc_search_category(); $category = array(); $where = array(); $mCat = Category::newInstance(); foreach ($categories as $cat) { if (is_numeric($cat)) { $tmp = $mCat->findByPrimaryKey($cat); if (isset($tmp['pk_i_id'])) { $category[] = $tmp['pk_i_id']; } } else { $slug_cat = explode("/", trim($cat, "/")); $tmp = $mCat->findBySlug($slug_cat[count($slug_cat) - 1]); if (isset($tmp['pk_i_id'])) { $category[] = $tmp['pk_i_id']; } } } return $category; }
?> <?php osc_goto_first_category(); ?> <?php while (osc_has_categories()) { ?> <li> <input type="checkbox" id="cat<?php echo osc_category_id(); ?> " name="sCategory[]" value="<?php echo osc_category_id(); ?> " <?php echo in_array(osc_category_id(), osc_search_category()) || in_array(osc_category_slug() . "/", osc_search_category()) || count(osc_search_category()) == 0 ? 'checked' : ''; ?> /> <label for="cat<?php echo osc_category_id(); ?> "><strong><?php echo osc_category_name(); ?> </strong></label> </li> <?php } ?> </ul> </div> <?php
function pop_search_filters() { ?> <form id="filterForm" name="filterForm" action="<?php echo osc_base_url(true); ?> " method="get" class="nocsrf"> <input type="hidden" name="page" value="search" /> <input type="hidden" name="sOrder" value="<?php echo osc_search_order(); ?> " /> <input type="hidden" name="iOrderType" value="<?php $allowedTypesForSorting = Search::getAllowedTypesForSorting(); echo $allowedTypesForSorting[osc_search_order_type()]; ?> " /> <?php foreach (osc_search_user() as $userId) { ?> <input type="hidden" name="sUser[]" value="<?php echo $userId; ?> " /> <?php } ?> <fieldset class="form-group first"> <h6> <?php _e('Search text', 'pop'); ?> </h6> <input class="input-text" type="text" name="sPattern" id="query" value="<?php echo osc_esc_html(osc_search_pattern()); ?> " /> </fieldset> <fieldset class="form-group"> <h6> <?php _e('Region', 'pop'); ?> </h6> <div> <?php $sCountries = osc_get_countries(); $countryId = $sCountries[0]['pk_c_code']; $sRegions = osc_get_regions($countryId); ?> <?php //pop_region_autocomplete($sRegions); ?> <input type="hidden" id="countryId" name="countryId" value="<?php echo $countryId; ?> " /> <input class="input-text" type="text" id="region" name="sRegion" value="<?php echo osc_esc_html(osc_search_region()); ?> " /> <input type="hidden" id="regionId" name="regionId" /> </div> </fieldset> <fieldset class="form-group"> <h6> <?php _e('City', 'pop'); ?> </h6> <div> <input class="input-text" type="text" id="city" name="sCity" value="<?php echo osc_esc_html(osc_search_city()); ?> " /> <input type="hidden" id="cityId" name="cityId" /> </div> </fieldset> <?php if (osc_images_enabled_at_items()) { ?> <fieldset class="form-group"> <div class="checkbox"> <input type="checkbox" name="bPic" id="withPicture" value="1" <?php echo osc_search_has_pic() ? 'checked' : ''; ?> /> <label for="withPicture"> <?php _e('Listings with pictures', 'pop'); ?> </label> </div> </fieldset> <?php } ?> <?php if (osc_price_enabled_at_items()) { ?> <fieldset class="form-group"> <div class="price-slice"> <h6> <?php _e('Price', 'pop'); ?> </h6> <ul class="row"> <li class="col-md-6"> <span> <?php _e('Min', 'pop'); ?> :</span> <input class="input-text" type="text" id="priceMin" name="sPriceMin" value="<?php echo osc_esc_html(osc_search_price_min()); ?> " size="6" maxlength="6" /> </li> <li class="col-md-6"> <span> <?php _e('Max', 'pop'); ?> :</span> <input class="input-text" type="text" id="priceMax" name="sPriceMax" value="<?php echo osc_esc_html(osc_search_price_max()); ?> " size="6" maxlength="6" /> </li> </ul> </div> </fieldset> <?php } ?> <div class="form-group plugin-hooks"> <?php if (osc_search_category_id()) { osc_run_hook('search_form', osc_search_category_id()); } else { osc_run_hook('search_form'); } ?> </div> <?php $aCategories = osc_search_category(); foreach ($aCategories as $cat_id) { ?> <input type="hidden" name="sCategory[]" value="<?php echo osc_esc_html($cat_id); ?> " /> <?php } ?> <div class="actions"> <button type="submit" class="btn btn-primary"> <?php _e('Apply', 'pop'); ?> </button> <a class="clear" onclick="formReset($('#filterForm'))"> <i class="fa fa-times"></i><?php echo _e('Clear filters', 'pop'); ?> </a> </div> </form> <?php }