@@ 1416-1441 (lines=26) @@ | ||
1413 | ||
1414 | ||
1415 | ||
1416 | public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1417 | ||
1418 | //testing term stuff |
|
1419 | $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1420 | $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1421 | $limit = ($current_page-1)*$per_page; |
|
1422 | $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1423 | if ( isset( $this->_req_data['s'] ) ) { |
|
1424 | $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1425 | $where['OR'] = array( |
|
1426 | 'Term.name' => array( 'LIKE', $sstr), |
|
1427 | 'description' => array( 'LIKE', $sstr ) |
|
1428 | ); |
|
1429 | } |
|
1430 | ||
1431 | $query_params = array( |
|
1432 | $where, |
|
1433 | 'order_by' => array( $orderby => $order ), |
|
1434 | 'limit' => $limit . ',' . $per_page, |
|
1435 | 'force_join' => array('Term') |
|
1436 | ); |
|
1437 | ||
1438 | $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1439 | ||
1440 | return $categories; |
|
1441 | } |
|
1442 | ||
1443 | ||
1444 | /* end category stuff */ |
@@ 2318-2346 (lines=29) @@ | ||
2315 | ||
2316 | ||
2317 | ||
2318 | public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2319 | global $wpdb; |
|
2320 | ||
2321 | //testing term stuff |
|
2322 | $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2323 | $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2324 | $limit = ($current_page-1)*$per_page; |
|
2325 | ||
2326 | $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2327 | ||
2328 | if ( isset( $this->_req_data['s'] ) ) { |
|
2329 | $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2330 | $where['OR'] = array( |
|
2331 | 'Term.name' => array( 'LIKE', $sstr), |
|
2332 | 'description' => array( 'LIKE', $sstr ) |
|
2333 | ); |
|
2334 | } |
|
2335 | ||
2336 | $query_params = array( |
|
2337 | $where , |
|
2338 | 'order_by' => array( $orderby => $order ), |
|
2339 | 'limit' => $limit . ',' . $per_page, |
|
2340 | 'force_join' => array('Term') |
|
2341 | ); |
|
2342 | ||
2343 | $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2344 | ||
2345 | return $categories; |
|
2346 | } |
|
2347 | ||
2348 | ||
2349 |