| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* |
| 8 |
*/ |
| 9 |
class CJT_Models_Block_Assignmentpanel_Post |
| 10 |
extends CJT_Models_Block_Assignmentpanel_Postbase { |
| 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['offset'] = 0; |
| 22 |
$args['numberposts'] = -1; |
| 23 |
$args['post_type'] = $params['type']; |
| 24 |
// Query posts. |
| 25 |
return count(get_posts($args)); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* put your comment there... |
| 30 |
* |
| 31 |
*/ |
| 32 |
protected function isHierarchical() { |
| 33 |
// Initialize. |
| 34 |
$typeParams =& $this->getTypeParams(); |
| 35 |
// Check if post_type hierarchical. |
| 36 |
return is_post_type_hierarchical($typeParams['type']); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* put your comment there... |
| 41 |
* |
| 42 |
* |
| 43 |
*/ |
| 44 |
protected function queryItems() { |
| 45 |
// Initialize. |
| 46 |
$args = $this->args; |
| 47 |
$params =& $this->getTypeParams(); |
| 48 |
// Set User passed parameters used to query 'posts' |
| 49 |
if ($this->isHierarchical()) { |
| 50 |
// Fetch all for Hierarchical posts. |
| 51 |
$args['offset'] = 0; |
| 52 |
$args['numberposts'] = -1; |
| 53 |
} |
| 54 |
else { |
| 55 |
$args['offset'] = $this->getOffset(); |
| 56 |
$args['numberposts'] = $this->getIPerPage(); |
| 57 |
} |
| 58 |
$args['post_type'] = $params['type']; |
| 59 |
// Query posts. |
| 60 |
return get_posts($args); |
| 61 |
} |
| 62 |
|
| 63 |
} // End class. |