| @@ 574-583 (lines=10) @@ | ||
| 571 | * |
|
| 572 | * @return array Array of {@link XoopsComment} objects |
|
| 573 | **/ |
|
| 574 | public function getCountByItemId($module_id, $item_id, $status = null) |
|
| 575 | { |
|
| 576 | $criteria = new CriteriaCompo(new Criteria('com_modid', (int)$module_id)); |
|
| 577 | $criteria->add(new Criteria('com_itemid', (int)$item_id)); |
|
| 578 | if (isset($status)) { |
|
| 579 | $criteria->add(new Criteria('com_status', (int)$status)); |
|
| 580 | } |
|
| 581 | ||
| 582 | return $this->getCount($criteria); |
|
| 583 | } |
|
| 584 | ||
| 585 | /** |
|
| 586 | * Get the top {@link XoopsComment}s |
|
| @@ 617-626 (lines=10) @@ | ||
| 614 | * |
|
| 615 | * @return array Array of {@link XoopsComment} objects |
|
| 616 | **/ |
|
| 617 | public function getThread($comment_rootid, $comment_id, $status = null) |
|
| 618 | { |
|
| 619 | $criteria = new CriteriaCompo(new Criteria('com_rootid', (int)$comment_rootid)); |
|
| 620 | $criteria->add(new Criteria('com_id', (int)$comment_id, '>=')); |
|
| 621 | if (isset($status)) { |
|
| 622 | $criteria->add(new Criteria('com_status', (int)$status)); |
|
| 623 | } |
|
| 624 | ||
| 625 | return $this->getObjects($criteria); |
|
| 626 | } |
|
| 627 | ||
| 628 | /** |
|
| 629 | * Update |
|
| @@ 912-921 (lines=10) @@ | ||
| 909 | * @param mixed $item_id |
|
| 910 | * @return |
|
| 911 | */ |
|
| 912 | function xoops_comment_count($module_id, $item_id = null) |
|
| 913 | { |
|
| 914 | $comment_handler = xoops_getHandler('comment'); |
|
| 915 | $criteria = new CriteriaCompo(new Criteria('com_modid', (int)$module_id)); |
|
| 916 | if (isset($item_id)) { |
|
| 917 | $criteria->add(new Criteria('com_itemid', (int)$item_id)); |
|
| 918 | } |
|
| 919 | ||
| 920 | return $comment_handler->getCount($criteria); |
|
| 921 | } |
|
| 922 | ||
| 923 | /** |
|
| 924 | * xoops_comment_delete() |
|
| @@ 342-353 (lines=12) @@ | ||
| 339 | * |
|
| 340 | * @return bool TRUE on success |
|
| 341 | */ |
|
| 342 | public function deleteByModule($gperm_modid, $gperm_name = null, $gperm_itemid = null) |
|
| 343 | { |
|
| 344 | $criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid)); |
|
| 345 | if (isset($gperm_name)) { |
|
| 346 | $criteria->add(new Criteria('gperm_name', $gperm_name)); |
|
| 347 | if (isset($gperm_itemid)) { |
|
| 348 | $criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid)); |
|
| 349 | } |
|
| 350 | } |
|
| 351 | ||
| 352 | return $this->deleteAll($criteria); |
|
| 353 | } |
|
| 354 | ||
| 355 | /** |
|
| 356 | * Check permission |
|