| @@ 107-122 (lines=16) @@ | ||
| 104 | return count($totalcats); |
|
| 105 | } |
|
| 106 | ||
| 107 | function lx_countWords () { |
|
| 108 | global $xoopsUser, $xoopsDB; |
|
| 109 | $gperm_handler = xoops_gethandler('groupperm'); |
|
| 110 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 111 | $module_handler = xoops_gethandler('module'); |
|
| 112 | $module = $module_handler->getByDirname('lexikon'); |
|
| 113 | $module_id = $module->getVar('mid'); |
|
| 114 | $allowed_cats = $gperm_handler->getItemIds("lexikon_view", $groups, $module_id); |
|
| 115 | $catids = implode(',', $allowed_cats); |
|
| 116 | $catperms = " AND categoryID IN ($catids) "; |
|
| 117 | ||
| 118 | $pubwords = $xoopsDB -> query( "SELECT * FROM " . $xoopsDB -> prefix( "lxentries" ) . " WHERE submit = '0' AND offline ='0' AND request = '0' ".$catperms." " ); |
|
| 119 | $publishedwords = $xoopsDB -> getRowsNum ( $pubwords ); |
|
| 120 | ||
| 121 | return $publishedwords; |
|
| 122 | } |
|
| 123 | ||
| 124 | // To display the list of categories |
|
| 125 | function lx_CatsArray(){ |
|
| @@ 282-299 (lines=18) @@ | ||
| 279 | /** |
|
| 280 | * @return mixed |
|
| 281 | */ |
|
| 282 | public static function countWords() |
|
| 283 | { |
|
| 284 | global $xoopsUser, $xoopsDB; |
|
| 285 | $gpermHandler = xoops_getHandler('groupperm'); |
|
| 286 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 287 | /** @var XoopsModuleHandler $moduleHandler */ |
|
| 288 | $moduleHandler = xoops_getHandler('module'); |
|
| 289 | $module = $moduleHandler->getByDirname('lexikon'); |
|
| 290 | $module_id = $module->getVar('mid'); |
|
| 291 | $allowed_cats = $gpermHandler->getItemIds('lexikon_view', $groups, $module_id); |
|
| 292 | $catids = implode(',', $allowed_cats); |
|
| 293 | $catperms = " AND categoryID IN ($catids) "; |
|
| 294 | ||
| 295 | $pubwords = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit = '0' AND offline ='0' AND request = '0' " . $catperms . ' '); |
|
| 296 | $publishedwords = $xoopsDB->getRowsNum($pubwords); |
|
| 297 | ||
| 298 | return $publishedwords; |
|
| 299 | } |
|
| 300 | ||
| 301 | // To display the list of categories |
|
| 302 | /** |
|