| @@ 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  | 
                                |
| @@ 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  | 
                                |
| @@ 933-942 (lines=10) @@ | ||
| 930 | * @param mixed $item_id  | 
                                |
| 931 | * @return  | 
                                |
| 932 | */  | 
                                |
| 933 | function xoops_comment_count($module_id, $item_id = null)  | 
                                |
| 934 | { | 
                                |
| 935 |     $comment_handler = xoops_getHandler('comment'); | 
                                |
| 936 |     $criteria        = new CriteriaCompo(new Criteria('com_modid', (int)$module_id)); | 
                                |
| 937 |     if (isset($item_id)) { | 
                                |
| 938 |         $criteria->add(new Criteria('com_itemid', (int)$item_id)); | 
                                |
| 939 | }  | 
                                |
| 940 | ||
| 941 | return $comment_handler->getCount($criteria);  | 
                                |
| 942 | }  | 
                                |
| 943 | ||
| 944 | /**  | 
                                |
| 945 | * xoops_comment_delete()  | 
                                |