Joomla模块学习之后台mod_status模块
2011-02-27 11:42
302 查看
Joomla模块学习之后台mod_status模块
用户状态模块
后台管理模块效果图
原理:
显示用户相关状态,如:消息,当前在线人数
mod_stats模块结构图:
关键代码
用户状态模块
后台管理模块效果图
原理:
显示用户相关状态,如:消息,当前在线人数
mod_stats模块结构图:
关键代码
$config =& JFactory::getConfig(); $user =& JFactory::getUser(); $db =& JFactory::getDBO(); $lang =& JFactory::getLanguage(); $session =& JFactory::getSession(); $sid = $session->getId(); $output = array(); // Legacy Mode if (defined('_JLEGACY')) { $output[] = '<span class="legacy-mode">'.JText::_('Legacy').': '._JLEGACY.'</span>'; } // Print the preview button $output[] = "<span class=/"preview/"><a href="/" mce_href="/""".JURI::root()."/" target=/"_blank/">".JText::_('Preview')."</a></span>"; // Get the number of unread messages in your inbox // 返回未读消息 $query = 'SELECT COUNT(*)' . ' FROM #__messages' . ' WHERE state = 0' . ' AND user_id_to = '.(int) $user->get('id'); $db->setQuery( $query ); $unread = $db->loadResult(); if (JRequest::getInt('hidemainmenu')) { $inboxLink = '<a>'; } else { $inboxLink = '<a href="index.php?option=com_messages" mce_href="index.php?option=com_messages">'; } // Print the inbox message // 消息链接 if ($unread) { $output[] = $inboxLink.'<span class="unread-messages">'.$unread.'</span></a>'; } else { $output[] = $inboxLink.'<span class="no-unread-messages">'.$unread.'</span></a>'; } // Get the number of logged in users // 返回登录用户数量 $query = 'SELECT COUNT( session_id )' . ' FROM #__session' . ' WHERE guest <> 1' ; $db->setQuery($query); $online_num = intval( $db->loadResult() ); //Print the logged in users message $output[] = "<span class=/"loggedin-users/">".$online_num."</span>"; // 如果当前为编辑操作或隐藏菜单,则不能退出 if ($task == 'edit' || $task == 'editA' || JRequest::getInt('hidemainmenu') ) { // Print the logout message $output[] = "<span class=/"logout/">".JText::_('Logout')."</span>"; } else { // Print the logout message $output[] = "<span class=/"logout/"><a href="/" mce_href="/""index.php?option=com_login&task=logout/">".JText::_('Logout')."</a></span>"; } // reverse rendering order for rtl display if ( $lang->isRTL() ) { $output = array_reverse( $output ); } // output the module foreach ($output as $item){ echo $item; }
相关文章推荐
- Joomla模块学习之后台mod_stats模块
- Joomla模块学习之后台mod_login模块
- Joomla模块学习之后台mod_latest模块
- Joomla模块学习之后台mod_menu模块
- Joomla模块学习之后台mod_logged模块
- Joomla模块学习之后台mod_popular模块
- Joomla模块学习之后台mod_feed模块
- Joomla模块学习之后台mod_quickicon模块
- Joomla组件学习之后台com_admin组件-系统信息
- joomla学习之mod_gk_weather Modules
- yii 学习笔记六、后台模块效果设计
- 【JAVAWEB学习笔记】网上商城实战5:后台的功能模块
- 【中文】Joomla1.7扩展介绍之MetaMod (模块管理)
- Joomla组件学习之后台com_banners组件-旗帜广告
- 关于后盾网yii框架的学习小结(5)--验证码的使用与规则的设置,为后台模块设置独立的布局
- Joomla学习之模块
- php学习笔记-后台模块
- 网上图书商城项目学习笔记-024后台模块介绍及管理员登录
- Joomla组件学习之后台com_admin组件-帮助信息
- joomla模块Dinamod使用指南