Remove functions definition from operator/groups.php

This commit is contained in:
Dmitriy Simushev 2014-01-24 14:01:57 +00:00
parent 74c448d0d0
commit c2336a753e
3 changed files with 15 additions and 14 deletions

View File

@ -150,6 +150,18 @@ function group_is_online($group) {
&& $group['ilastseen'] < Settings::get('online_timeout')); && $group['ilastseen'] < Settings::get('online_timeout'));
} }
/**
* Check if group is away
*
* @param array $group Associative group array. Should contain 'ilastseenaway'
* key.
* @return bool
*/
function group_is_away($group) {
return $group['ilastseenaway'] !== NULL
&& $group['ilastseenaway'] < Settings::get('online_timeout');
}
/** /**
* Return local or common group description depending on current locale. * Return local or common group description depending on current locale.
* *

View File

@ -17,12 +17,12 @@
// Import namespaces and classes of the core // Import namespaces and classes of the core
use Mibew\Database; use Mibew\Database;
use Mibew\Settings;
use Mibew\Style\PageStyle; use Mibew\Style\PageStyle;
// Initialize libraries // Initialize libraries
require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(dirname(dirname(__FILE__)).'/libs/init.php');
require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php');
require_once(MIBEW_FS_ROOT.'/libs/groups.php');
$operator = check_login(); $operator = check_login();
csrfchecktoken(); csrfchecktoken();
@ -49,17 +49,6 @@ if (isset($_GET['act']) && $_GET['act'] == 'del') {
} }
} }
function is_online($group)
{
return $group['ilastseen'] !== NULL && $group['ilastseen'] < Settings::get('online_timeout') ? "1" : "";
}
function is_away($group)
{
return $group['ilastseenaway'] !== NULL && $group['ilastseenaway'] < Settings::get('online_timeout') ? "1" : "";
}
$page = array(); $page = array();
$sort['by'] = verifyparam("sortby", "/^(name|lastseen|weight)$/", "name"); $sort['by'] = verifyparam("sortby", "/^(name|lastseen|weight)$/", "name");
$sort['desc'] = (verifyparam("sortdirection", "/^(desc|asc)$/", "desc") == "desc"); $sort['desc'] = (verifyparam("sortdirection", "/^(desc|asc)$/", "desc") == "desc");

View File

@ -102,9 +102,9 @@ if(count($page['groups']) > 0) {
<?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "&lt;none&gt;" ?> <?php echo $grp['vclocaldescription'] ? htmlspecialchars(topage($grp['vclocaldescription'])) : "&lt;none&gt;" ?>
</td> </td>
<td class="notlast"> <td class="notlast">
<?php if(is_online($grp)) { ?> <?php if(group_is_online($grp)) { ?>
<?php echo getlocal("page.groups.isonline") ?> <?php echo getlocal("page.groups.isonline") ?>
<?php } else if(is_away($grp)) { ?> <?php } else if(group_is_away($grp)) { ?>
<?php echo getlocal("page.groups.isaway") ?> <?php echo getlocal("page.groups.isaway") ?>
<?php } else { ?> <?php } else { ?>
<?php echo date_to_text(time() - ($grp['ilastseen'] ? $grp['ilastseen'] : time())) ?> <?php echo date_to_text(time() - ($grp['ilastseen'] ? $grp['ilastseen'] : time())) ?>