Minahito
minah****@users*****
2006年 2月 21日 (火) 20:54:02 JST
Index: xoops2jp/html/modules/base/class/comment.php diff -u xoops2jp/html/modules/base/class/comment.php:1.1.2.1 xoops2jp/html/modules/base/class/comment.php:1.1.2.2 --- xoops2jp/html/modules/base/class/comment.php:1.1.2.1 Thu Jan 26 01:18:11 2006 +++ xoops2jp/html/modules/base/class/comment.php Tue Feb 21 20:54:02 2006 @@ -2,6 +2,9 @@ class BaseCommentObject extends XoopsSimpleObject { + var $mUser = null; + var $mModule = null; + function BaseCommentObject() { $this->initVar('com_id', XOBJ_DTYPE_INT, '', true); @@ -25,6 +28,24 @@ $this->initVar('doimage', XOBJ_DTYPE_BOOL, '0', true); $this->initVar('dobr', XOBJ_DTYPE_BOOL, '0', true); } + + /** + * Load a user object who wrote this comment to $mUser. + */ + function loadUser() + { + $handler =& xoops_gethandler('member'); + $this->mUser =& $handler->getUser($this->get('com_uid')); + } + + /** + * Load a module object to $mModule. + */ + function loadModule() + { + $handler =& xoops_gethandler('module'); + $this->mModule =& $handler->get($this->get('com_modid')); + } } class BaseCommentHandler extends XoopsObjectGenericHandler @@ -32,6 +53,17 @@ var $mTable = "xoopscomments"; var $mPrimary = "com_id"; var $mClass = "BaseCommentObject"; + + /** + * Delete $comment and childlen of $comment. + */ + function delete(&$comment) + { + $criteria =& new Criteria('com_pid', $comment->get('com_id')); + $this->deleteAll($criteria); + + return parent::delete($comment); + } } ?>