public function action_index() { $this->auto_render = FALSE; $info = array('title' => 'RSS ' . htmlspecialchars(Core::config('general.site_name')), 'pubDate' => date("r"), 'description' => __('Latest published'), 'generator' => 'Open Classifieds'); $items = array(); //last ads, you can modify this value at: advertisement.feed_elements $ads = new Model_Ad(); $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED)->order_by('published', 'desc')->limit(Core::config('advertisement.feed_elements')); //filter by category aor location if (Model_Category::current()->loaded()) { $ads->where('id_category', '=', Model_Category::current()->id_category); } if (Model_Location::current()->loaded()) { $ads->where('id_location', '=', Model_Location::current()->id_location); } $ads = $ads->cached()->find_all(); foreach ($ads as $a) { $url = Route::url('ad', array('category' => $a->category->seoname, 'seotitle' => $a->seotitle)); $item = array('title' => htmlspecialchars($a->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($a->published), 'description' => htmlspecialchars(Text::removebbcode($a->description), ENT_QUOTES), 'guid' => $url); if ($a->get_first_image() !== NULL) { $item['description'] = '<img src="' . $a->get_first_image() . '" />' . $item['description']; } $items[] = $item; } $xml = Feed::create($info, $items); $this->response->headers('Content-type', 'text/xml'); $this->response->body($xml); }
/** * Automatically executed before the widget action. Can be used to set * class properties, do authorization checks, and execute other custom code. * * @return void */ public function before() { $cat = new Model_Category(); // loaded category if (Model_Category::current()->loaded()) { $category = Model_Category::current()->id_category; // id_category //list of children of current category // if list_cat dosent have siblings take brothers $list_cat = $cat->where('id_category_parent', '=', $category)->order_by('order', 'asc')->cached()->find_all(); if (count($list_cat) == 0) { $list_cat = $cat->where('id_category_parent', '=', Model_Category::current()->id_category_parent)->order_by('order', 'asc')->cached()->find_all(); } //parent of current category $cat_parent_deep = $cat->where('id_category', '=', Model_Category::current()->id_category_parent)->limit(1)->find(); // array with name and seoname of a category and his parent. Is to build breadcrumb in widget $current_and_parent = array('name' => Model_Category::current()->name, 'id' => Model_Category::current()->id_category, 'seoname' => Model_Category::current()->seoname, 'parent_name' => $cat_parent_deep->name, 'id_parent' => $cat_parent_deep->id_category_parent, 'parent_seoname' => $cat_parent_deep->seoname); } else { $list_cat = $cat->where('id_category_parent', '=', 1)->order_by('order', 'asc')->cached()->find_all(); $current_and_parent = NULL; } $this->cat_items = $list_cat; $this->cat_breadcrumb = $current_and_parent; $this->loc_seoname = NULL; if (Model_Location::current()->loaded()) { if (Model_Location::current()->id_location != 1) { $this->loc_seoname = Model_Location::current()->seoname; } } }
/** * Automatically executed before the widget action. Can be used to set * class properties, do authorization checks, and execute other custom code. * * @return void */ public function before() { $loc = new Model_Location(); // loaded locations if (Model_Location::current()->loaded()) { $location = Model_Location::current()->id_location; // id_location //list of children of current location // if list_loc dosent have siblings take brothers // $list_loc = $loc->where('id_location_parent', '=', $location)->order_by('order', 'asc')->cached()->find_all(); if (count($list_loc) == 0) { $list_loc = $loc->where('id_location_parent', '=', Model_Location::current()->id_location_parent)->order_by('order', 'asc')->cached()->find_all(); } //parent of current location $loc_parent_deep = $loc->where('id_location', '=', Model_Location::current()->id_location_parent)->limit(1)->find(); // array with name and seoname of a location and his parent. Is to build breadcrumb in widget $current_and_parent = array('name' => Model_Location::current()->name, 'id' => Model_Location::current()->id_location, 'seoname' => Model_Location::current()->seoname, 'parent_name' => $loc_parent_deep->name, 'id_parent' => $loc_parent_deep->id_location_parent, 'parent_seoname' => $loc_parent_deep->seoname); } else { $list_loc = $loc->where('id_location_parent', '=', 1)->order_by('order', 'asc')->cached()->find_all(); $current_and_parent = NULL; } $this->locations = $this->locations; $this->loc_items = $list_loc; $this->loc_breadcrumb = $current_and_parent; $this->cat_seoname = URL::title(__('all')); if (Model_Category::current()->loaded()) { $this->cat_seoname = Model_Category::current()->seoname; } }
/** * Automatically executed before the widget action. Can be used to set * class properties, do authorization checks, and execute other custom code. * * @return void */ public function before() { // get all categories if ($this->advanced != FALSE) { $this->cat_items = Model_Category::get_as_array(); $this->cat_order_items = Model_Category::get_multidimensional(); $this->selected_category = NULL; if (core::request('category')) { $this->selected_category = core::request('category'); } elseif (Model_Category::current()->loaded()) { $this->selected_category = core::config('general.search_multi_catloc') ? array(Model_Category::current()->seoname) : Model_Category::current()->seoname; } // get all locations $this->loc_items = Model_Location::get_as_array(); $this->loc_order_items = Model_Location::get_multidimensional(); $this->selected_location = NULL; if (core::request('location')) { $this->selected_location = core::request('location'); } elseif (Model_Location::current()->loaded()) { $this->selected_location = core::config('general.search_multi_catloc') ? array(Model_Location::current()->seoname) : Model_Location::current()->seoname; } } if ($this->custom != FALSE) { $fields = Model_Field::get_all(); $this->custom_fields = $fields; } }
/** * gets the fragment name, unique using i18n theme and skin and cat and loc * @param string $name * @return string */ public static function fragment_name($name) { $cat_seoname = ''; if (Model_Category::current()->loaded()) { $cat_seoname = '_category_' . Model_Category::current()->seoname; } return 'fragment_' . $name . '_' . i18n::lang() . '_' . Theme::$theme . $cat_seoname; //.Theme::$skin }
/** * Initialize properties before running the controller methods (actions), * so they are available to our action. */ public function before($template = NULL) { parent::before(); Theme::checker(); $this->maintenance(); $this->private_site(); /** * selected category */ self::$category = Model_Category::current(); /** * selected location */ self::$location = Model_Location::current(); //Gets a coupon if selected Model_Coupon::current(); if ($this->auto_render === TRUE) { // Load the template if ($template !== NULL) { $this->template = $template; } $this->template = View::factory($this->template); // Initialize template values $this->template->title = core::config('general.site_name'); $this->template->meta_keywords = ''; $this->template->meta_description = ''; $this->template->meta_copyright = 'Open Classifieds ' . Core::VERSION; $this->template->meta_copywrite = $this->template->meta_copyright; //legacy for old themes $this->template->content = ''; $this->template->styles = array(); $this->template->scripts = array(); $this->template->amphtml = NULL; $this->template->header = View::factory('header'); $this->template->footer = View::factory('footer'); // header_front_login fragment since CSRF gets cached :( // possible workaround ? @see http://kohanaframework.org/3.0/guide/kohana/fragments // if (Auth::instance()->logged_in()) // $this->template->header = View::fragment('header_front_login','header'); // else // $this->template->header = View::fragment('header_front','header'); //$this->template->footer = View::fragment('footer_front','footer'); } }
public function action_index() { $this->auto_render = FALSE; $info = array('title' => 'RSS ' . htmlspecialchars(Core::config('general.site_name')), 'pubDate' => date("D, d M Y H:i:s T"), 'description' => __('Latest published'), 'generator' => 'Open eShop'); $items = array(); //last products, you can modify this value at: general.feed_elements $products = DB::select('p.seotitle')->select(array('c.seoname', 'category'), 'p.title', 'p.description', 'p.created', 'p.updated')->from(array('products', 'p'))->join(array('categories', 'c'), 'INNER')->on('p.id_category', '=', 'c.id_category')->where('p.status', '=', Model_Product::STATUS_ACTIVE)->order_by('updated', 'desc')->limit(Core::config('general.feed_elements')); //filter by category aor location if (Model_Category::current()->loaded()) { $products->where('p.id_category', '=', Model_Category::current()->id_category); } $products = $products->as_object()->cached()->execute(); foreach ($products as $p) { $url = Route::url('product', array('category' => $p->category, 'seotitle' => $p->seotitle)); $items[] = array('title' => htmlspecialchars($p->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($p->updated), 'description' => htmlspecialchars(Text::removebbcode($p->description), ENT_QUOTES)); } $xml = Feed::create($info, $items); $this->response->headers('Content-type', 'text/xml'); $this->response->body($xml); }
/** * Initialize properties before running the controller methods (actions), * so they are available to our action. */ public function before($template = NULL) { parent::before(); Theme::checker(); $this->maintenance(); $this->private_site(); //get category, deprecated, to keep backwards compatibility with themes self::$category = Model_Category::current(); //Gets a coupon if selected self::$coupon = Model_Coupon::current(); //get the affiliate if any Model_Affiliate::current(); if ($this->auto_render === TRUE) { // Load the template if ($template !== NULL) { $this->template = $template; } $this->template = View::factory($this->template); // Initialize template values $this->template->title = core::config('general.site_name'); $this->template->meta_keywords = ''; $this->template->meta_description = ''; $this->template->meta_copyright = 'Open eShop ' . Core::VERSION; $this->template->content = ''; $this->template->styles = array(); $this->template->scripts = array(); //we can not cache this view since theres dynamic parts //$this->template->header = View::factory('header'); //setting inner views try to get from fragment // if (Auth::instance()->logged_in()) // $this->template->header = View::fragment('header_front_login','header'); // else $this->template->header = View::factory('header'); //no fragment since CSRF gets cached :( $this->template->footer = View::fragment('footer_front', 'footer'); } }
} ?> </div><!--end of recomentadion--> <?php if (count($ads)) { ?> <div class="btn-group pull-right"> <?php if (core::config('advertisement.map') == 1) { ?> <a href="<?php echo Route::url('map'); ?> ?category=<?php echo Model_Category::current()->loaded() ? Model_Category::current()->seoname : NULL; ?> &location=<?php echo Model_Location::current()->loaded() ? Model_Location::current()->seoname : NULL; ?> " class="btn btn-default btn-sm <?php echo core::cookie('list/grid') == 0 ? 'active' : ''; ?> "> <span class="glyphicon glyphicon-globe"></span> <?php echo __('Map'); ?> </a> <?php }
?> <link rel="alternate" type="application/atom+xml" title="RSS <?php echo HTML::chars(Core::config('general.site_name') . ' - ' . Model_Location::current()->name); ?> " href="<?php echo Route::url('rss', array('category' => URL::title(__('all')), 'location' => Model_Location::current()->seoname)); ?> " /> <?php } elseif (Model_Category::current()->loaded()) { ?> <link rel="alternate" type="application/atom+xml" title="RSS <?php echo HTML::chars(Core::config('general.site_name') . ' - ' . Model_Category::current()->name); ?> " href="<?php echo Route::url('rss', array('category' => Model_Category::current()->seoname)); ?> " /> <?php } ?> <?php if (core::config('advertisement.logbee') == 1 and Model_Ad::current() !== NULL and Model_Ad::current()->loaded()) { ?> <meta property="logbee:type" content="various"/> <meta property="logbee:title" content="<?php echo Model_Ad::current()->title; ?> "/>
/** * Publis all adver.-s without filter */ public function action_listing() { if (Theme::get('infinite_scroll')) { $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/jquery.infinitescroll/2.0b2/jquery.infinitescroll.js'; $this->template->scripts['footer'][] = 'js/listing.js'; } if (core::config('general.auto_locate')) { Theme::$scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false&libraries=geometry&v=3.7'; Theme::$scripts['footer'][] = '//cdn.jsdelivr.net/gmaps/0.4.15/gmaps.min.js'; } $this->template->scripts['footer'][] = 'js/jquery.toolbar.js'; $this->template->scripts['footer'][] = 'js/sort.js'; Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); /** * we get the model of category and location from controller to filter and generate urls titles etc... */ $location = NULL; $location_parent = NULL; $location_name = NULL; if (Model_Location::current()->loaded()) { $location = Model_Location::current(); if ($location->id_location != 1) { $location_name = $location->name; } //adding the location parent if ($location->id_location_parent != 1 and $location->parent->loaded()) { $location_parent = $location->parent; } } $category = NULL; $category_parent = NULL; $category_name = NULL; if (Model_Category::current()->loaded()) { $category = Model_Category::current(); if ($category->id_category != 1) { $category_name = $category->name; } //adding the category parent if ($category->id_category_parent != 1 and $category->parent->loaded()) { $category_parent = $category->parent; } } //base title if ($category !== NULL) { //category image if (($icon_src = $category->get_icon()) !== FALSE) { Controller::$image = $icon_src; } $this->template->title = $category_name; if ($category->description != '') { $this->template->meta_description = $category->description; } else { $this->template->meta_description = __('All') . ' ' . $category_name . ' ' . __('in') . ' ' . core::config('general.site_name'); } } else { $this->template->title = __('all'); if ($location !== NULL) { if ($location->description != '') { $this->template->meta_description = $location->description; } else { $this->template->meta_description = __('List of all postings in') . ' ' . $location_name; } } else { $this->template->meta_description = __('List of all postings in') . ' ' . core::config('general.site_name'); } } //adding location titles and breadcrumbs if ($location !== NULL) { //in case we dont have the category image we use the location if (($icon_src = $location->get_icon()) !== FALSE and Controller::$image === NULL) { Controller::$image = $icon_src; } $this->template->title .= ' - ' . $location->name; if ($location_parent !== NULL) { $this->template->title .= ' (' . $location_parent->name . ')'; Breadcrumbs::add(Breadcrumb::factory()->set_title($location_parent->name)->set_url(Route::url('list', array('location' => $location_parent->seoname)))); } Breadcrumbs::add(Breadcrumb::factory()->set_title($location->name)->set_url(Route::url('list', array('location' => $location->seoname)))); if ($category_parent !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category_parent->name)->set_url(Route::url('list', array('category' => $category_parent->seoname, 'location' => $location->seoname)))); } if ($category !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category->name)->set_url(Route::url('list', array('category' => $category->seoname, 'location' => $location->seoname)))); } } else { if ($category_parent !== NULL) { $this->template->title .= ' (' . $category_parent->name . ')'; Breadcrumbs::add(Breadcrumb::factory()->set_title($category_parent->name)->set_url(Route::url('list', array('category' => $category_parent->seoname)))); } if ($category !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category->name)->set_url(Route::url('list', array('category' => $category->seoname)))); } } $data = $this->list_logic($category, $location); $this->template->bind('content', $content); $this->template->content = View::factory('pages/ad/listing', $data); }
public function action_listing() { if (Theme::get('infinite_scroll')) { $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/jquery.infinitescroll/2.0b2/jquery.infinitescroll.js'; $this->template->scripts['footer'][] = 'js/listing.js'; } $this->template->scripts['footer'][] = 'js/sort.js'; Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); /** * we get the model of category from controller to filter and generate urls titles etc... */ $category = NULL; $category_parent = NULL; if (Model_Category::current()->loaded()) { $category = Model_Category::current(); //adding the category parent if ($category->id_category_parent != 1 and $category->parent->loaded()) { $category_parent = $category->parent; } } //base title if ($category !== NULL) { //category image if (($icon_src = $category->get_icon()) !== FALSE) { Controller::$image = $icon_src; } $this->template->title = $category->name; if ($category->description != '') { $this->template->meta_description = $category->description; } else { $this->template->meta_description = $category->name . ' ' . __('sold in') . ' ' . Core::config('general.site_name'); } } else { $this->template->title = __('all'); $this->template->meta_description = __('List of all products in') . ' ' . Core::config('general.site_name'); } if ($category_parent !== NULL) { $this->template->title .= ' (' . $category_parent->name . ')'; Breadcrumbs::add(Breadcrumb::factory()->set_title($category_parent->name)->set_url(Route::url('list', array('category' => $category_parent->seoname)))); } if ($category !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category->name)->set_url(Route::url('list', array('category' => $category->seoname)))); } //user recognition $user = Auth::instance()->get_user() == NULL ? NULL : Auth::instance()->get_user(); $products = new Model_Product(); //filter by category if ($category !== NULL) { $products->where('id_category', 'in', $category->get_siblings_ids()); } //only published products $products->where('status', '=', Model_Product::STATUS_ACTIVE); $res_count = $products->count_all(); // check if there are some advet.-s if ($res_count > 0) { // pagination module $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count, 'items_per_page' => core::config('general.products_per_page')))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'category' => $category !== NULL ? $category->seoname : NULL)); Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page)); /** * order depending on the sort parameter */ switch (core::request('sort', core::config('general.sort_by'))) { //title z->a case 'title-asc': $products->order_by('title', 'asc')->order_by('created', 'desc'); break; //title a->z //title a->z case 'title-desc': $products->order_by('title', 'desc')->order_by('created', 'desc'); break; //cheaper first //cheaper first case 'price-asc': $products->order_by('price', 'asc')->order_by('created', 'desc'); break; //expensive first //expensive first case 'price-desc': $products->order_by('price', 'desc')->order_by('created', 'desc'); break; //featured //featured case 'featured': default: $products->order_by('featured', 'desc')->order_by('created', 'desc'); break; //oldest first //oldest first case 'published-asc': $products->order_by('created', 'asc'); break; //newest first //newest first case 'published-desc': $products->order_by('created', 'desc'); break; } //we sort all products with few parameters $products = $products->limit($pagination->items_per_page)->offset($pagination->offset)->find_all(); // array of categories sorted for view $data = array('products' => $products, 'pagination' => $pagination, 'user' => $user, 'category' => $category); } else { // array of categories sorted for view $data = array('products' => NULL, 'pagination' => NULL, 'user' => $user, 'category' => $category); } $this->template->bind('content', $content); $this->template->content = View::factory('pages/product/listing', $data); }
<!-- end navbar top--> <div class="subnav navbar <?php echo (Request::current()->controller() !== 'faq' and Theme::get('fixed_toolbar') == 1) ? '' : 'fixed_header'; ?> "> <div class="container"> <ul class="nav nav-pills"> <?php $cats = Model_Category::get_category_count(); $cat_id = NULL; $cat_parent = NULL; if (Model_Category::current()->loaded()) { $cat_id = Model_Category::current()->id_category; $cat_parent = Model_Category::current()->id_category_parent; } ?> <?php foreach ($cats as $c) { ?> <?php if ($c['id_category_parent'] == 1 && $c['has_siblings'] == FALSE) { ?> <li class="<?php echo $c['id_category'] == $cat_id ? 'active' : ''; ?> "> <a title="<?php echo HTML::chars($c['name']); ?>
/** * Publis all adver.-s without filter */ public function action_listing() { if (Theme::get('infinite_scroll')) { $this->template->scripts['footer'][] = '//cdn.jsdelivr.net/jquery.infinitescroll/2.0b2/jquery.infinitescroll.js'; $this->template->scripts['footer'][] = 'js/listing.js'; } if (core::config('general.auto_locate') or core::config('advertisement.map')) { Theme::$scripts['async_defer'][] = '//maps.google.com/maps/api/js?libraries=geometry,places&v=3&key=' . core::config("advertisement.gm_api_key") . '&callback=initLocationsGMap'; } $this->template->scripts['footer'][] = 'js/jquery.toolbar.js'; $this->template->scripts['footer'][] = 'js/sort.js'; Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); /** * we get the model of category and location from controller to filter and generate urls titles etc... */ $location = NULL; $location_parent = NULL; $location_name = NULL; if (Model_Location::current()->loaded()) { $location = Model_Location::current(); if ($location->id_location != 1) { $location_name = $location->name; } //adding the location parent if ($location->id_location_parent != 1 and $location->parent->loaded()) { $location_parent = $location->parent; } } $category = NULL; $category_parent = NULL; $category_name = NULL; if (Model_Category::current()->loaded()) { $category = Model_Category::current(); if ($category->id_category != 1) { $category_name = $category->name; } //adding the category parent if ($category->id_category_parent != 1 and $category->parent->loaded()) { $category_parent = $category->parent; } } //base title if ($category !== NULL) { //category image if (($icon_src = $category->get_icon()) !== FALSE) { Controller::$image = $icon_src; } $this->template->title = $category_name; if ($category->description != '') { $this->template->meta_description = $category->description; } else { $this->template->meta_description = __('All') . ' ' . $category_name . ' ' . __('in') . ' ' . core::config('general.site_name'); } } else { $this->template->title = __('all'); if ($location !== NULL) { if ($location->description != '') { $this->template->meta_description = $location->description; } else { $this->template->meta_description = __('List of all postings in') . ' ' . $location_name; } } else { $this->template->meta_description = __('List of all postings in') . ' ' . core::config('general.site_name'); } } //adding location titles and breadcrumbs if ($location !== NULL) { //in case we dont have the category image we use the location if (($icon_src = $location->get_icon()) !== FALSE and Controller::$image === NULL) { Controller::$image = $icon_src; } $this->template->title .= ' - ' . $location->name; if ($location_parent !== NULL) { $this->template->title .= ' (' . $location_parent->name . ')'; Breadcrumbs::add(Breadcrumb::factory()->set_title($location_parent->name)->set_url(Route::url('list', array('location' => $location_parent->seoname)))); } Breadcrumbs::add(Breadcrumb::factory()->set_title($location->name)->set_url(Route::url('list', array('location' => $location->seoname)))); if ($category_parent !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category_parent->name)->set_url(Route::url('list', array('category' => $category_parent->seoname, 'location' => $location->seoname)))); } if ($category !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category->name)->set_url(Route::url('list', array('category' => $category->seoname, 'location' => $location->seoname)))); } } else { if ($category_parent !== NULL) { $this->template->title .= ' (' . $category_parent->name . ')'; Breadcrumbs::add(Breadcrumb::factory()->set_title($category_parent->name)->set_url(Route::url('list', array('category' => $category_parent->seoname)))); } if ($category !== NULL) { Breadcrumbs::add(Breadcrumb::factory()->set_title($category->name)->set_url(Route::url('list', array('category' => $category->seoname)))); } } $data = $this->list_logic($category, $location); //if home page is the listing if (($landing = json_decode(core::config('general.landing_page'))) != NULL and $landing->controller == 'ad' and $landing->action == 'listing' and (isset($data['pagination']) and $data['pagination']->current_page == 1) and $location === NULL and $category === NULL) { //only show site title $this->template->title = NULL; // if we have site description lets use that ;) if (core::config('general.site_description') != '') { $this->template->meta_description = core::config('general.site_description'); } } $this->template->bind('content', $content); $this->template->content = View::factory('pages/ad/listing', $data); }
public function action_index() { $this->auto_render = FALSE; $info = array('title' => 'RSS ' . htmlspecialchars(Core::config('general.site_name'), ENT_QUOTES), 'pubDate' => date("r"), 'description' => htmlspecialchars(__('Latest published'), ENT_QUOTES), 'generator' => 'Yclas'); $items = array(); //last ads, you can modify this value at: advertisement.feed_elements $ads = new Model_Ad(); //only published ads $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED); //filter by category aor location if (Model_Category::current()->loaded()) { $ads->where('id_category', '=', Model_Category::current()->id_category); } if (Model_Location::current()->loaded()) { $ads->where('id_location', '=', Model_Location::current()->id_location); } //order depending on the sort parameter switch (core::request('sort', core::config('advertisement.sort_by'))) { //title z->a case 'title-asc': $ads->order_by('title', 'asc')->order_by('published', 'desc'); break; //title a->z //title a->z case 'title-desc': $ads->order_by('title', 'desc')->order_by('published', 'desc'); break; //cheaper first //cheaper first case 'price-asc': $ads->order_by('price', 'asc')->order_by('published', 'desc'); break; //expensive first //expensive first case 'price-desc': $ads->order_by('price', 'desc')->order_by('published', 'desc'); break; //featured //featured case 'featured': $ads->order_by('featured', 'desc')->order_by('published', 'desc'); break; //rating //rating case 'rating': $ads->order_by('rate', 'desc')->order_by('published', 'desc'); break; //favorited //favorited case 'favorited': $ads->order_by('favorited', 'desc')->order_by('published', 'desc'); break; //oldest first //oldest first case 'published-asc': $ads->order_by('published', 'asc'); break; //newest first //newest first case 'published-desc': default: $ads->order_by('published', 'desc'); break; } $ads = $ads->limit(Core::config('advertisement.feed_elements'))->cached()->find_all(); foreach ($ads as $a) { $url = Route::url('ad', array('category' => $a->category->seoname, 'seotitle' => $a->seotitle)); $item = array('title' => htmlspecialchars($a->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($a->published), 'description' => htmlspecialchars(Text::removebbcode($a->description), ENT_QUOTES), 'guid' => $url); if ($a->get_first_image() !== NULL) { $item['description'] = '<img src="' . $a->get_first_image() . '" />' . $item['description']; } $items[] = $item; } $xml = Feed::create($info, $items); $this->response->headers('Content-type', 'text/xml'); $this->response->body($xml); }
?> <div class="panel-heading"> <h3 class="panel-title"><?php echo $widget->map_title; ?> </h3> </div> <?php } ?> <div class="panel-body"> <iframe frameborder="0" noresize="noresize" height="<?php echo $widget->map_height + $widget->map_height * 0.1; ?> px" width="100%" src="<?php echo Route::url('map'); ?> ?height=<?php echo $widget->map_height; ?> &controls=0&zoom=<?php echo $widget->map_zoom; echo Model_Category::current()->loaded() ? '&category=' . Model_Category::current()->seoname : ''; echo Model_Location::current()->loaded() ? '&location=' . Model_Location::current()->seoname : ''; ?> "> </iframe> </div>