| @@ 1502-1529 (lines=28) @@ | ||
| 1499 | }  | 
                                |
| 1500 | ||
| 1501 | ||
| 1502 | public function get_categories($per_page = 10, $current_page = 1, $count = false)  | 
                                |
| 1503 |     { | 
                                |
| 1504 | ||
| 1505 | // testing term stuff  | 
                                |
| 1506 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';  | 
                                |
| 1507 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';  | 
                                |
| 1508 | $limit = ($current_page - 1) * $per_page;  | 
                                |
| 1509 |         $where = array('taxonomy' => 'espresso_venue_categories'); | 
                                |
| 1510 |         if (isset($this->_req_data['s'])) { | 
                                |
| 1511 | $sstr = '%' . $this->_req_data['s'] . '%';  | 
                                |
| 1512 | $where['OR'] = array(  | 
                                |
| 1513 |                 'Term.name'   => array('LIKE', $sstr), | 
                                |
| 1514 |                 'description' => array('LIKE', $sstr), | 
                                |
| 1515 | );  | 
                                |
| 1516 | }  | 
                                |
| 1517 | ||
| 1518 | $query_params = array(  | 
                                |
| 1519 | $where,  | 
                                |
| 1520 | 'order_by' => array($orderby => $order),  | 
                                |
| 1521 | 'limit' => $limit . ',' . $per_page,  | 
                                |
| 1522 |             'force_join' => array('Term'), | 
                                |
| 1523 | );  | 
                                |
| 1524 | ||
| 1525 | $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')  | 
                                |
| 1526 | : EEM_Term_Taxonomy::instance()->get_all($query_params);  | 
                                |
| 1527 | ||
| 1528 | return $categories;  | 
                                |
| 1529 | }  | 
                                |
| 1530 | ||
| 1531 | ||
| 1532 | /* end category stuff */  | 
                                |
| @@ 2597-2621 (lines=25) @@ | ||
| 2594 | * @param bool $count  | 
                                |
| 2595 | * @return EE_Base_Class[]|EE_Term_Taxonomy[]|int  | 
                                |
| 2596 | */  | 
                                |
| 2597 | public function get_categories($per_page = 10, $current_page = 1, $count = false)  | 
                                |
| 2598 |     { | 
                                |
| 2599 | // testing term stuff  | 
                                |
| 2600 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';  | 
                                |
| 2601 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';  | 
                                |
| 2602 | $limit = ($current_page - 1) * $per_page;  | 
                                |
| 2603 |         $where = array('taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY); | 
                                |
| 2604 |         if (isset($this->_req_data['s'])) { | 
                                |
| 2605 | $sstr = '%' . $this->_req_data['s'] . '%';  | 
                                |
| 2606 | $where['OR'] = array(  | 
                                |
| 2607 |                 'Term.name'   => array('LIKE', $sstr), | 
                                |
| 2608 |                 'description' => array('LIKE', $sstr), | 
                                |
| 2609 | );  | 
                                |
| 2610 | }  | 
                                |
| 2611 | $query_params = array(  | 
                                |
| 2612 | $where,  | 
                                |
| 2613 | 'order_by' => array($orderby => $order),  | 
                                |
| 2614 | 'limit' => $limit . ',' . $per_page,  | 
                                |
| 2615 |             'force_join' => array('Term'), | 
                                |
| 2616 | );  | 
                                |
| 2617 | $categories = $count  | 
                                |
| 2618 | ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')  | 
                                |
| 2619 | : EEM_Term_Taxonomy::instance()->get_all($query_params);  | 
                                |
| 2620 | return $categories;  | 
                                |
| 2621 | }  | 
                                |
| 2622 | ||
| 2623 | /* end category stuff */  | 
                                |
| 2624 | /**************/  | 
                                |