| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* |
| 8 |
*/ |
| 9 |
class CJT_Models_Block_Assignmentpanel_Taxonomy |
| 10 |
extends CJT_Models_Block_Assignmentpanel_Taxonomybase { |
| 11 |
|
| 12 |
/** |
| 13 |
* put your comment there... |
| 14 |
* |
| 15 |
*/ |
| 16 |
public function getTotalCount() { |
| 17 |
// Initialize. |
| 18 |
$args = $this->args; |
| 19 |
$params =& $this->getTypeParams(); |
| 20 |
// Set args. |
| 21 |
$args['fields'] = 'ids'; |
| 22 |
// Query posts. |
| 23 |
return count(get_terms($params['type'], $args)); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* put your comment there... |
| 28 |
* |
| 29 |
*/ |
| 30 |
protected function isHierarchical() { |
| 31 |
// Initialize. |
| 32 |
$typeParams =& $this->getTypeParams(); |
| 33 |
// Check if post_type hierarchical. |
| 34 |
return is_taxonomy_hierarchical($typeParams['type']); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* put your comment there... |
| 39 |
* |
| 40 |
* |
| 41 |
*/ |
| 42 |
protected function queryItems() { |
| 43 |
// Initialize. |
| 44 |
$args = $this->args; |
| 45 |
$params =& $this->getTypeParams(); |
| 46 |
// Set User passed parameters used to query 'taxonomies' |
| 47 |
if ($this->isHierarchical()) { |
| 48 |
// Return them all for taxonomy doesn't |
| 49 |
// require the end-offset ($args['number']) to be set. |
| 50 |
$args['offset'] = 0; |
| 51 |
} |
| 52 |
else { |
| 53 |
$args['offset'] = $this->getOffset(); |
| 54 |
$args['number'] = $this->getIPerPage(); |
| 55 |
} |
| 56 |
// Query posts. |
| 57 |
return get_terms($params['type'], $args); |
| 58 |
} |
| 59 |
|
| 60 |
} // End class. |
| 61 |
|