From: <du...@us...> - 2012-12-24 02:13:03
|
Revision: 10535 http://sourceforge.net/p/xoops/svn/10535 Author: dugris Date: 2012-12-24 02:13:00 +0000 (Mon, 24 Dec 2012) Log Message: ----------- Implement plugin for Waiting block Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/comments/class/plugin/system.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/blocks/system_blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/plugin/interface.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/comments/class/plugin/system.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/comments/class/plugin/system.php 2012-12-24 01:41:20 UTC (rev 10534) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/comments/class/plugin/system.php 2012-12-24 02:13:00 UTC (rev 10535) @@ -21,7 +21,6 @@ { public function UserSync($uid) { - $xoops = Xoops::getInstance(); $comment_handler = Comments::getInstance()->getHandlerComment(); $criteria = new CriteriaCompo(); @@ -29,4 +28,17 @@ $criteria->add(new Criteria('uid', $uid)); return $comment_handler->getCount($criteria); } + + public function Waiting() + { + $comment_handler = Comments::getInstance()->getHandlerComment(); + $criteria = new CriteriaCompo(new Criteria('status', COMMENTS_PENDING)); + + if ($ret['pendingnum'] = $comment_handler->getCount($criteria)) { + $ret['lang_linkname'] = Xoops::getInstance()->getHandlerModule()->getBydirname('comments')->getVar('name'); + $ret['adminlink'] = Xoops::getInstance()->url('modules/comments/admin/main.php'); + return $ret; + } + return false; + } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/blocks/system_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/blocks/system_blocks.php 2012-12-24 01:41:20 UTC (rev 10534) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/blocks/system_blocks.php 2012-12-24 02:13:00 UTC (rev 10535) @@ -181,106 +181,18 @@ return $block; } -// this block is deprecated function b_system_waiting_show() { - $xoops = Xoops::getInstance(); - $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); - $module_handler = $xoops->getHandlerModule(); $block = array(); - - // waiting content for news - if ($xoops->isActiveModule('news') && $module_handler->getCount(new Criteria('dirname', 'news'))) { - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("stories") . " WHERE published=0"); - if ($result) { - $block['modules'][0]['adminlink'] = XOOPS_URL . "/modules/news/admin/index.php?op=newarticle"; - list($block['modules'][0]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][0]['lang_linkname'] = _MB_SYSTEM_SUBMS; + $i=0; + $plugins = Xoops_Plugin::getAvailablePlugins('system'); + foreach ($plugins as $module) { + if (method_exists($module, 'Waiting')){ + if ($res = $module->Waiting()) { + $block['modules'][$i] = $res; + } } } - - // waiting content for mylinks - if ($xoops->isActiveModule('mylinks') && $module_handler->getCount(new Criteria('dirname', 'mylinks'))) { - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE status=0"); - if ($result) { - $block['modules'][1]['adminlink'] = XOOPS_URL . "/modules/mylinks/admin/index.php?op=listNewLinks"; - list($block['modules'][1]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][1]['lang_linkname'] = _MB_SYSTEM_WLNKS; - } - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_broken")); - if ($result) { - $block['modules'][2]['adminlink'] = XOOPS_URL . "/modules/mylinks/admin/index.php?op=listBrokenLinks"; - list($block['modules'][2]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][2]['lang_linkname'] = _MB_SYSTEM_BLNK; - } - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_mod")); - if ($result) { - $block['modules'][3]['adminlink'] = XOOPS_URL . "/modules/mylinks/admin/index.php?op=listModReq"; - list($block['modules'][3]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][3]['lang_linkname'] = _MB_SYSTEM_MLNKS; - } - } - - // waiting content for mydownloads - if ($xoops->isActiveModule('mydownloads') && $module_handler->getCount(new Criteria('dirname', 'mydownloads'))) { - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mydownloads_downloads") . " WHERE status=0"); - if ($result) { - $block['modules'][4]['adminlink'] = XOOPS_URL . "/modules/mydownloads/admin/index.php?op=listNewDownloads"; - list($block['modules'][4]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][4]['lang_linkname'] = _MB_SYSTEM_WDLS; - } - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mydownloads_broken") . ""); - if ($result) { - $block['modules'][5]['adminlink'] = XOOPS_URL . "/modules/mydownloads/admin/index.php?op=listBrokenDownloads"; - list($block['modules'][5]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][5]['lang_linkname'] = _MB_SYSTEM_BFLS; - } - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mydownloads_mod") . ""); - if ($result) { - $block['modules'][6]['adminlink'] = XOOPS_URL . "/modules/mydownloads/admin/index.php?op=listModReq"; - list($block['modules'][6]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][6]['lang_linkname'] = _MB_SYSTEM_MFLS; - } - } - - // waiting content for xoops comments - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("xoopscomments") . " WHERE com_status=1"); - if ($result) { - $block['modules'][7]['adminlink'] = XOOPS_URL . "/modules/system/admin.php?module=0&status=1&fct=comments"; - list($block['modules'][7]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][7]['lang_linkname'] = _MB_SYSTEM_COMPEND; - } - - // waiting content for TDMDownloads - if ($xoops->isActiveModule('TDMdownloads') && $module_handler->getCount(new Criteria('dirname', 'TDMDownloads'))) { - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("tdmdownloads_downloads") . " WHERE status=0"); - if ($result) { - $block['modules'][8]['adminlink'] = XOOPS_URL . "/modules/TDMDownloads/admin/downloads.php?op=list&statut_display=0"; - list($block['modules'][8]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][8]['lang_linkname'] = _MB_SYSTEM_TDMDOWNLOADS; - } - } - - // waiting content for extgallery - if ($xoops->isActiveModule('extgallery') && $module_handler->getCount(new Criteria('dirname', 'extgallery'))) { - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("extgallery_publicphoto") . " WHERE photo_approved=0"); - if ($result) { - $block['modules'][9]['adminlink'] = XOOPS_URL . "/modules/extgallery/admin/photo.php#pending-photo"; - list($block['modules'][9]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][9]['lang_linkname'] = _MB_SYSTEM_EXTGALLERY; - } - } - - // waiting content for smartsection - if ($xoops->isActiveModule('smartsection') && $module_handler->getCount(new Criteria('dirname', 'smartsection'))) { - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("smartsection_items") . " WHERE status=1"); - if ($result) { - $block['modules'][10]['adminlink'] = XOOPS_URL . "/modules/smartsection/admin/item.php"; - list($block['modules'][10]['pendingnum']) = $xoopsDB->fetchRow($result); - $block['modules'][10]['lang_linkname'] = _MB_SYSTEM_SMARTSECTION; - } - } - return $block; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/plugin/interface.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/plugin/interface.php 2012-12-24 01:41:20 UTC (rev 10534) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/plugin/interface.php 2012-12-24 02:13:00 UTC (rev 10535) @@ -19,5 +19,6 @@ interface SystemPluginInterface { public function UserSync($uid); + public function Waiting(); } |