Minahito
minah****@users*****
2006年 7月 13日 (木) 19:55:29 JST
Index: xoops2jp/html/modules/user/class/users.php diff -u xoops2jp/html/modules/user/class/users.php:1.1.2.3 xoops2jp/html/modules/user/class/users.php:1.1.2.4 --- xoops2jp/html/modules/user/class/users.php:1.1.2.3 Thu Apr 27 19:26:39 2006 +++ xoops2jp/html/modules/user/class/users.php Thu Jul 13 19:55:29 2006 @@ -4,6 +4,9 @@ class UserUsersObject extends XoopsSimpleObject { + // + // TODO naming rule + // var $Groups = array(); function UserUsersObject() @@ -45,6 +48,19 @@ { return $this->Groups; } + + // + // TODO naming rule + // + function _loadGroups() + { + $handler =& xoops_getmodulehandler('groups_users_link'); + $links =& $handler->getObjects(new Criteria('uid', $this->get('uid'))); + foreach ($links as $link) { + $this->Groups[] = $link->get('groupid'); + } + } + } class UserUsersHandler extends XoopsObjectGenericHandler @@ -58,28 +74,32 @@ $obj =& parent::get($id); if (is_object($obj)) { - $this->_loadGroups($obj); + $obj->_loadGroups(); } return $obj; } - function &getObjects($criteria = null, $param1 = false, $param2 = false, $param3 = false) + function &getObjects($criteria = null, $limit = null, $start = null, $id_as_key = false) { - $objects =& parent::getObjects($criteria, $param1, $param2, $param3); + $objects =& parent::getObjects($criteria, $limit, $start, $id_as_key); if (count($objects)) { foreach (array_keys($objects) as $key) { - $this->_loadGroups($objects[$key]); + $objects[$key]->_loadGroups(); } } + + return $objects; } /** - * Return the array which consists of an integer as the uid. This member function is more speedy than getObjects(). + * Return the array which consists of an integer as the uid. This member + * function is more speedy than getObjects(). + * * @return Array */ - function &getUids($criteria = null, $param1 = false, $param2 = false, $param3 = false) + function &getUids($criteria = null, $limit = null, $start = null, $id_as_key = false) { $ret = array(); @@ -92,7 +112,7 @@ $where = $this->_makeCriteria4sql($criteria); if (trim($where)) { - $sql .= " WHERE ".$where; + $sql .= " WHERE " . $where; } $sorts = array(); @@ -106,7 +126,7 @@ $limit=$criteria->getLimit(); $start=$criteria->getStart(); - $ret =& $this->_getObjects($sql, $limit, $start, $param1); + $ret =& $this->getObjects($sql, $limit, $start, $param1); } else { $limit = $param1; @@ -149,15 +169,6 @@ return false; } - - function _loadGroups(&$user) - { - $handler =& xoops_getmodulehandler('groups_users_link'); - $links =& $handler->getObjects(new Criteria('uid', $user->get('uid'))); - foreach ($links as $link) { - $user->Groups[] = $link->get('groupid'); - } - } } ?>