You've already forked joomla_test
first commit
This commit is contained in:
80
administrator/modules/mod_logged/helper.php
Normal file
80
administrator/modules/mod_logged/helper.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Helper for mod_logged
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class ModLoggedHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of logged users.
|
||||
*
|
||||
* @param JRegistry $params The module parameters.
|
||||
*
|
||||
* @return mixed An array of users, or false on error.
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$user = JFactory::getUser();
|
||||
$query = $db->getQuery(true)
|
||||
->select('s.time, s.client_id, u.id, u.name, u.username')
|
||||
->from('#__session AS s')
|
||||
->join('LEFT', '#__users AS u ON s.userid = u.id')
|
||||
->where('s.guest = 0');
|
||||
$db->setQuery($query, 0, $params->get('count', 5));
|
||||
|
||||
try
|
||||
{
|
||||
$results = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
throw new RuntimeException($e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($results as $k => $result)
|
||||
{
|
||||
$results[$k]->logoutLink = '';
|
||||
|
||||
if ($user->authorise('core.manage', 'com_users'))
|
||||
{
|
||||
$results[$k]->editLink = JRoute::_('index.php?option=com_users&task=user.edit&id=' . $result->id);
|
||||
$results[$k]->logoutLink = JRoute::_('index.php?option=com_login&task=logout&uid=' . $result->id . '&' . JSession::getFormToken() . '=1');
|
||||
}
|
||||
|
||||
if ($params->get('name', 1) == 0)
|
||||
{
|
||||
$results[$k]->name = $results[$k]->username;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the alternate title for the module
|
||||
*
|
||||
* @param JRegistry $params The module parameters.
|
||||
*
|
||||
* @return string The alternate title for the module.
|
||||
*/
|
||||
public static function getTitle($params)
|
||||
{
|
||||
return JText::plural('MOD_LOGGED_TITLE', $params->get('count'));
|
||||
}
|
||||
}
|
1
administrator/modules/mod_logged/index.html
Normal file
1
administrator/modules/mod_logged/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
16
administrator/modules/mod_logged/mod_logged.php
Normal file
16
administrator/modules/mod_logged/mod_logged.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include dependancies.
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$users = ModLoggedHelper::getList($params);
|
||||
require JModuleHelper::getLayoutPath('mod_logged', $params->get('layout', 'default'));
|
85
administrator/modules/mod_logged/mod_logged.xml
Normal file
85
administrator/modules/mod_logged/mod_logged.xml
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="administrator">
|
||||
<name>mod_logged</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>January 2005</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>MOD_LOGGED_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_logged">mod_logged.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_logged.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_logged.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADMIN_LOGGED" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_LOGGED_FIELD_COUNT_LABEL"
|
||||
description="MOD_LOGGED_FIELD_COUNT_DESC" />
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="list"
|
||||
default="1"
|
||||
label="MOD_LOGGED_NAME"
|
||||
description="MOD_LOGGED_FIELD_NAME_DESC" >
|
||||
<option
|
||||
value="1">MOD_LOGGED_NAME</option>
|
||||
<option
|
||||
value="0">JGLOBAL_USERNAME</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="0"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="automatic_title"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="COM_MODULES_FIELD_AUTOMATIC_TITLE_LABEL"
|
||||
description="COM_MODULES_FIELD_AUTOMATIC_TITLE_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
|
49
administrator/modules/mod_logged/tmpl/default.php
Normal file
49
administrator/modules/mod_logged/tmpl/default.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
?>
|
||||
<div class="row-striped">
|
||||
<?php foreach ($users as $user) : ?>
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<?php if ($user->client_id == 0) : ?>
|
||||
<a class="hasTooltip" title="<?php echo JHtml::tooltipText('MOD_LOGGED_LOGOUT'); ?>" href="<?php echo $user->logoutLink; ?>" class="btn btn-danger btn-mini">
|
||||
<i class="icon-remove icon-white" title="<?php echo JText::_('JLOGOUT'); ?>"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<strong class="row-title">
|
||||
<?php if (isset($user->editLink)) : ?>
|
||||
<a href="<?php echo $user->editLink; ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('JGRID_HEADING_ID'); ?> : <?php echo $user->id; ?>">
|
||||
<?php echo $user->name;?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $user->name; ?>
|
||||
<?php endif; ?>
|
||||
</strong>
|
||||
|
||||
<small class="small hasTooltip" title="<?php echo JHtml::tooltipText('JCLIENT'); ?>">
|
||||
<?php if ($user->client_id) : ?>
|
||||
<?php echo JText::_('JADMINISTRATION'); ?>
|
||||
<?php else : ?>
|
||||
<?php echo JText::_('JSITE'); ?>
|
||||
<?php endif;?>
|
||||
</small>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<span class="small hasTooltip" title="<?php echo JHtml::tooltipText('MOD_LOGGED_LAST_ACTIVITY'); ?>">
|
||||
<i class="icon-calendar"></i> <?php echo JHtml::_('date', $user->time, 'Y-m-d'); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
1
administrator/modules/mod_logged/tmpl/index.html
Normal file
1
administrator/modules/mod_logged/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user