diff --git a/plugins/addons/dashboard/class_dashboard.inc b/plugins/addons/dashboard/class_dashboard.inc deleted file mode 100644 index 0b958b9c4f8a6a586c9bc9822f6472119bfec176..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/class_dashboard.inc +++ /dev/null @@ -1,138 +0,0 @@ -<?php -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org) - Copyright (C) 2010 Antoine Gallavardin - Copyright (C) 2011-2016 FusionDirectory project - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -class dashboard extends simplePlugin -{ - static function plInfo (): array - { - return [ - 'plShortName' => _('Dashboard'), - 'plTitle' => _('Dashboard'), - 'plDescription' => _('Statistics and various information'), - 'plIcon' => 'geticon.php?context=applications&icon=utilities-system-monitor&size=48', - 'plObjectType' => [ - 'dashboard' => [ - 'name' => _('Dashboard'), - 'tabClass' => 'dashboardTabs', - 'mainAttr' => FALSE - ] - ], - 'plSection' => ['reporting' => ['name' => _('Reporting'), 'priority' => 40]], - 'plPriority' => 10, - - 'plProvidedAcls' => [ - 'dashboard' => _('See dashboard') - ] - ]; - } - - static function getAttributesInfo (): array - { - return [ - 'stats' => [ - 'name' => _('Statistics'), - 'attrs' => [new FakeAttribute('stats')], - 'template' => get_template_path('main_stats.tpl', TRUE, dirname(__FILE__)), - ], - ]; - } - - function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE) - { - parent::__construct($dn, $object, $parent, $mainTab); - - $this->stats = $this->overview_stats(); - } - - /* Compute some statistics */ - function overview_stats () - { - global $config; - $stats = []; - foreach ($config->data['OBJECTS'] as $type => $infos) { - try { - $nb = count(objects::ls($type, NULL, NULL, '', TRUE)); - } catch (EmptyFilterException $e) { - $nb = 0; - } catch (FusionDirectoryException $e) { - $nb = 0; - $error = new FusionDirectoryError( - htmlescape(sprintf( - _('Statistics for type "%s" could not be computed because of the following error: %s'), - $type, - $e->getMessage() - )), - 0, - $e - ); - $error->display(); - } - if ($nb == 0) { - continue; - } - $node = [ - 'name' => $infos['name'], - 'nb' => $nb - ]; - if (isset($infos['icon'])) { - $node['img'] = $infos['icon']; - } else { - $node['img'] = 'images/empty.png'; - } - if (isset($infos['management']) && ($infos['management'] != '')) { - $pInfos = pluglist::pluginInfos($infos['management']); - $node['href'] = 'main.php?plug='.$pInfos['INDEX'].'&reset=1'; - $section = $pInfos['plSection']; - if (is_array($section)) { - $section = key($section); - } - $node['priority'] = $config->data['SECTIONS'][$section]['PRIORITY'] * 100 + (isset($pInfos['plPriority']) ? $pInfos['plPriority'] : 99); - } else { - $node['priority'] = 10000; - } - $stats[] = $node; - } - - usort($stats, - function ($a, $b) - { - return ($a['priority'] <=> $b['priority']); - } - ); - - return $stats; - } - - static function mainInc ($classname = NULL, $entry_dn = NULL, $tabs = TRUE, $edit_mode = FALSE, $objectType = FALSE) - { - global $config; - - if ($classname === NULL) { - $classname = get_called_class(); - } - - if ($entry_dn === NULL) { - $entry_dn = $config->current['BASE']; - } - - parent::mainInc($classname, $entry_dn, $tabs, $edit_mode, $objectType); - } -} diff --git a/plugins/addons/dashboard/class_dashboardPasswords.inc b/plugins/addons/dashboard/class_dashboardPasswords.inc deleted file mode 100644 index 888bfdf8288cdff1f0989affa756777cbf9049db..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/class_dashboardPasswords.inc +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org) - Copyright (C) 2016-2017 FusionDirectory project - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -class dashboardPassword extends simplePlugin -{ - static function plInfo (): array - { - return [ - 'plShortName' => _('Passwords'), - 'plDescription' => _('Statistics about passwords'), - 'plObjectType' => ['dashboard'], - 'plPriority' => 12, - - 'plProvidedAcls' => [] - ]; - } - - static function getAttributesInfo (): array - { - return [ - 'pwds' => [ - 'name' => _('Passwords statistics'), - 'attrs' => [new FakeAttribute('pwds_stats')], - 'template' => get_template_path('pwd_stats.tpl', TRUE, dirname(__FILE__)), - ], - ]; - } - - function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE) - { - parent::__construct($dn, $object, $parent, $mainTab); - - $this->pwds_stats = $this->computeStats(); - } - - function computeStats () - { - global $config; - - $temp = passwordMethod::get_available_methods(); - - $allowedMethods = $config->get_cfg_value('passwordAllowedHashes', $temp['name']); - $defaultMethod = $config->get_cfg_value('passwordDefaultHash', 'ssha'); - $forceDefault = ($config->get_cfg_value('forcePasswordDefaultHash', 'FALSE') == 'TRUE'); - try { - $users = objects::ls('user', ['userPassword' => '1', 'dn' => 'raw'], NULL, '', TRUE); - } catch (LDAPFailureException $e) { - $error = new FusionDirectoryError( - htmlescape(sprintf( - _('Password statistics could not be computed because of the following LDAP error: %s'), - $e->getMessage() - )), - 0, - $e - ); - $error->display(); - $users = []; - } - $nb_accounts = count($users); - $nb_locked_accounts = 0; - $methods_stats = []; - foreach ($users as $attrs) { - $userPassword = ''; - if (isset($attrs['userPassword'])) { - $userPassword = $attrs['userPassword']; - } - $method = passwordMethod::get_method($userPassword); - $methodName = $method->get_hash(); - if ($method->is_locked('', $userPassword)) { - $nb_locked_accounts++; - } - if (!isset($methods_stats[$methodName])) { - $methods_stats[$methodName] = [ - 'nb' => 0, - 'name' => $methodName, - ]; - if ($methodName == $defaultMethod) { - $methods_stats[$methodName]['style'] = 'default'; - } elseif ($methodName == 'clear') { - $methods_stats[$methodName]['style'] = 'clear'; - } elseif ($forceDefault || !in_array($methodName, $allowedMethods)) { - $methods_stats[$methodName]['style'] = 'forbidden'; - } else { - $methods_stats[$methodName]['style'] = 'none'; - } - } - $methods_stats[$methodName]['nb']++; - } - - return [ - 'methods' => $methods_stats, - 'nb' => $nb_accounts, - 'img' => 'geticon.php?context=types&icon=user&size=16', - 'locked_accounts' => [ - 'nb' => $nb_locked_accounts, - 'img' => 'geticon.php?context=status&icon=object-locked&size=16' - ], - ]; - } -} diff --git a/plugins/addons/dashboard/class_dashboardTabs.inc b/plugins/addons/dashboard/class_dashboardTabs.inc deleted file mode 100644 index f8f12e8a3d4bd7b7487f57295ef6b6ec8bcd2d7b..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/class_dashboardTabs.inc +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2011-2019 FusionDirectory - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -class dashboardTabs extends simpleTabs_noSpecial -{ - function __construct ($type, $dn, $copied_object = NULL) - { - parent::__construct($type, $dn, $copied_object); - if (!class_available('dhcpService') && !class_available('dnsZone')) { - unset($this->by_object['dashboardNetwork']); - unset($this->by_name['dashboardNetwork']); - } - } - - function save () - { - } -} diff --git a/plugins/addons/dashboard/class_dashboardUsers.inc b/plugins/addons/dashboard/class_dashboardUsers.inc deleted file mode 100644 index b7a3856c774e661a89972f1f7bc37cb8faf6436c..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/class_dashboardUsers.inc +++ /dev/null @@ -1,292 +0,0 @@ -<?php -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org) - Copyright (C) 2010 Antoine Gallavardin - Copyright (C) 2011-2016 FusionDirectory project - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -class dashboardUsers extends simplePlugin -{ - static function plInfo (): array - { - return [ - 'plShortName' => _('Users'), - 'plDescription' => _('Statistics about users'), - 'plObjectType' => ['dashboard'], - 'plPriority' => 10, - - 'plProvidedAcls' => [] - ]; - } - - static function getAttributesInfo (): array - { - return [ - 'userstats' => [ - 'name' => _('Users statistics'), - 'attrs' => [new FakeAttribute('users_stats')], - 'template' => get_template_path('users_stats.tpl', TRUE, dirname(__FILE__)), - ], - 'groupstats' => [ - 'name' => _('Groups statistics'), - 'attrs' => [new FakeAttribute('groups_stats')], - 'template' => get_template_path('groups_stats.tpl', TRUE, dirname(__FILE__)), - ], - 'expired_accounts' => [ - 'name' => _('Expired accounts'), - 'attrs' => [new FakeAttribute('expired')], - 'template' => get_template_path('users_accounts.tpl', TRUE, dirname(__FILE__)), - ], - ]; - } - - function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE) - { - parent::__construct($dn, $object, $parent, $mainTab); - - $this->expiredAccountsColumns = [ - 'user' => [ - 'uid' => _('Login'), - 'cn' => _('Name'), - 'telephoneNumber' => _('Phone number'), - 'expirationDate' => _('Expiration date'), - ], - 'manager' => [ - 'manager_cn' => _('Name'), - 'manager_mail' => _('Email'), - 'manager_phone' => _('Phone number'), - ] - ]; - $this->users_stats = $this->computeUsersStats(); - $this->groups_stats = $this->computeGroupsStats(); - $this->expired = $this->expired_accounts_info(); - } - - function computeUsersStats () - { - global $config; - /* User statistics */ - try { - $nb_accounts = count(objects::ls('user', NULL, NULL, '', TRUE)); - $nb_mail_accounts = count(objects::ls('user', NULL, NULL, '(objectClass=gosaMailAccount)', TRUE)); - $nb_posix_accounts = count(objects::ls('user', NULL, NULL, '(objectClass=posixAccount)', TRUE)); - $nb_samba_accounts = count(objects::ls('user', NULL, NULL, '(objectClass=sambaSamAccount)', TRUE)); - } catch (LDAPFailureException $e) { - $error = new FusionDirectoryError( - htmlescape(sprintf( - _('User statistics could not be computed because of the following LDAP error: %s'), - $e->getMessage() - )), - 0, - $e - ); - $error->display(); - $nb_accounts = 0; - $nb_mail_accounts = 0; - $nb_posix_accounts = 0; - $nb_samba_accounts = 0; - } - - return [ - 'accounts' => [ - ['name' => 'mail', 'nb' => $nb_mail_accounts, 'img' => 'geticon.php?context=applications&icon=internet-mail&size=16'], - ['name' => 'posix', 'nb' => $nb_posix_accounts, 'img' => 'geticon.php?context=applications&icon=os-linux&size=16'], - ['name' => 'samba', 'nb' => $nb_samba_accounts, 'img' => 'geticon.php?context=applications&icon=os-windows&size=16'] - ], - 'nb' => $nb_accounts, - 'img' => 'geticon.php?context=types&icon=user&size=16', - ]; - } - - function computeGroupsStats () - { - global $config; - /* Group statistics */ - try { - $nb_groups = count(objects::ls('group', NULL, NULL, '', TRUE)); - $nb_mail_groups = count(objects::ls('group', NULL, NULL, '(objectClass=fdGroupMail)', TRUE)); - $nb_samba_groups = count(objects::ls('group', NULL, NULL, '(objectClass=sambaGroupMapping)', TRUE)); - } catch (LDAPFailureException $e) { - $error = new FusionDirectoryError( - htmlescape(sprintf( - _('Group statistics could not be computed because of the following LDAP error: %s'), - $e->getMessage() - )), - 0, - $e - ); - $error->display(); - $nb_groups = 0; - $nb_mail_groups = 0; - $nb_samba_groups = 0; - } catch (NonExistingObjectTypeException $e) { - /* Posix plugin is not installed */ - $nb_groups = 0; - $nb_mail_groups = 0; - $nb_samba_groups = 0; - } - - return [ - 'groups' => [ - ['name' => 'mail', 'nb' => $nb_mail_groups, 'img' => 'geticon.php?context=applications&icon=internet-mail&size=16'], - ['name' => 'samba', 'nb' => $nb_samba_groups, 'img' => 'geticon.php?context=applications&icon=os-windows&size=16'] - ], - 'nb' => $nb_groups, - 'img' => 'geticon.php?context=types&icon=user-group&size=16', - ]; - } - - function expired_accounts_info () - { - global $config; - - /* Begin of code for selecting expired account */ - - /* getting the date in TIMESTAMP UNIX format */ - /* 24 * 60 * 60 = 86400 */ - $today = floor(time() / 86400); - - /* Fetch global value from fusiondirectory.conf */ - $next_expired_days = $config->get_cfg_value('dashboardExpiredAccountsDays', 15); - $next_expired_date = ($today + $next_expired_days); - - if (!class_available('posixAccount')) { - /* if shadowExpire is not available no way to check expiration */ - return [ - 'columns' => $this->expiredAccountsColumns, - 'accounts' => [], - 'accounts_next_days' => [], - 'next_days' => $next_expired_days, - ]; - } - - /* search all account with all date, mail, telephone */ - try { - $attributes = [ - 'dn' => 'raw', - 'uid' => '*', - 'cn' => '*', - 'telephoneNumber' => '*', - 'manager' => '*', - 'shadowExpire' => '*', - ]; - if (class_available('mailAccount')) { - $attributes['mail'] = 'raw'; - } - $users = objects::ls('user', $attributes, NULL, '(shadowExpire=*)', TRUE); - } catch (LDAPFailureException $e) { - $error = new FusionDirectoryError( - htmlescape(sprintf( - _('Expired user information could not be computed because of the following LDAP error: %s'), - $e->getMessage() - )), - 0, - $e - ); - $error->display(); - $users = []; - } catch (FusionDirectoryException $e) { - $error = new FusionDirectoryError( - htmlescape(sprintf( - _('Expired user information could not be computed because of the following error: %s'), - $e->getMessage() - )), - 0, - $e - ); - $error->display(); - $users = []; - } - - $expired_accounts = []; - $next_expired_accounts = []; - foreach ($users as $user) { - // Test if account is expired now - if ($user['shadowExpire'][0] <= $today) { - $expired_accounts[] = static::get_user_infos($user); - } elseif ($user['shadowExpire'][0] <= $next_expired_date) { - $next_expired_accounts[] = static::get_user_infos($user); - } - } - - uasort($expired_accounts, ['dashboardUsers','compareUsers']); - uasort($next_expired_accounts, ['dashboardUsers','compareUsers']); - - return [ - 'columns' => $this->expiredAccountsColumns, - 'accounts' => $expired_accounts, - 'accounts_next_days' => $next_expired_accounts, - 'next_days' => $next_expired_days, - ]; - } - - static function get_user_infos ($attrs) - { - global $config; - - if (isset($attrs['manager'][0])) { - $ldap = $config->get_ldap_link(); - $ldap->cat($attrs['manager'][0], ['cn', 'mail', 'telephoneNumber']); - if ($manager_attrs = $ldap->fetch()) { - $manager_cn = (isset($manager_attrs['cn'][0]) ? $manager_attrs['cn'][0] : ''); - $manager_mail = (isset($manager_attrs['mail'][0]) ? $manager_attrs['mail'][0] : ''); - $manager_phone = (isset($manager_attrs['telephoneNumber'][0]) ? $manager_attrs['telephoneNumber'][0] : ''); - } else { - $manager_cn = sprintf(_('Not found (%s)'), $attrs['manager'][0]); - $manager_mail = ''; - $manager_phone = ''; - } - } else { - $manager_cn = ''; - $manager_mail = ''; - $manager_phone = ''; - } - - if (isset($attrs['shadowExpire'][0])) { - /* 24 * 60 * 60 = 86400 */ - $human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400); - } else { - $human_shadowExpire = ''; - } - - return [ - 'uid' => $attrs['uid'][0], - 'cn' => $attrs['cn'][0], - 'telephoneNumber' => (isset($attrs['telephoneNumber'][0]) ? $attrs['telephoneNumber'][0] : ''), - 'mail' => (isset($attrs['mail'][0]) ? $attrs['mail'][0] : ''), - 'manager_cn' => $manager_cn, - 'manager_mail' => $manager_mail, - 'manager_phone' => $manager_phone, - 'expirationDate' => $human_shadowExpire, - ]; - } - - static function compareUsers ($a, $b) - { - if ($a['expirationDate'] < $b['expirationDate']) { - return -1; - } elseif ($a['expirationDate'] > $b['expirationDate']) { - return 1; - } elseif ($a['uid'] < $b['uid']) { - return -1; - } elseif ($a['uid'] > $b['uid']) { - return 1; - } else { - return 0; - } - } -} diff --git a/plugins/addons/dashboard/groups_stats.tpl b/plugins/addons/dashboard/groups_stats.tpl deleted file mode 100644 index 56452aae5570138bf3a1e9b7f642abdb2a241d6d..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/groups_stats.tpl +++ /dev/null @@ -1,24 +0,0 @@ -<div id="{$sectionId}" class="plugin-section"> - <span class="legend"> - {if !empty($sectionIcon)}<img src="{$sectionIcon|escape}" alt=""/>{/if}{$section|escape} - </span> - <div> - <img src="{$attributes.groups_stats.img|escape}" alt="group icon"/> - {if $attributes.groups_stats.nb > 0} - {t count=$attributes.groups_stats.nb 1=$attributes.groups_stats.nb plural="There are %1 groups:"}There is 1 group:{/t} - {else} - {t}There are no groups{/t} - {/if} - <ul> - {foreach from=$attributes.groups_stats.groups item=g} - <li style="list-style-image:url({$g.img|escape})"> - {if $g.nb > 0} - {t count=$g.nb 1=$g.name 2=$g.nb plural="%2 are %1 groups"}One of them is a %1 group{/t} - {else} - {t 1=$g.name}There is no %1 group{/t} - {/if} - </li> - {/foreach} - </ul> - </div> -</div> diff --git a/plugins/addons/dashboard/main_stats.tpl b/plugins/addons/dashboard/main_stats.tpl deleted file mode 100644 index 27ab1e8e9f55528ec970e61df1351e40ee0f7f84..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/main_stats.tpl +++ /dev/null @@ -1,18 +0,0 @@ -<div class="plugin-section"> - <span class="legend"> - {t}Statistics{/t} - </span> - <div> - <ul style="list-style-type:none;line-height:2em;"> - {foreach from=$attributes.stats item=stat} - <li> -{if isset($stat.href)} - <a href="{$stat.href}"><img style="vertical-align:middle;" src="{$stat.img|escape}" alt=""/> {$stat.name|escape} : {$stat.nb|escape}</a> -{else} - <img style="vertical-align:middle;" src="{$stat.img|escape}" alt=""/> {$stat.name|escape} : {$stat.nb|escape} -{/if} - </li> - {/foreach} - </ul> - </div> -</div> diff --git a/plugins/addons/dashboard/pwd_stats.tpl b/plugins/addons/dashboard/pwd_stats.tpl deleted file mode 100644 index 247333b3fff4c80feb5d94d94f592eead756992e..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/pwd_stats.tpl +++ /dev/null @@ -1,33 +0,0 @@ -<div id="{$sectionId}" class="plugin-section"> - <span class="legend"> - {if !empty($sectionIcon)}<img src="{$sectionIcon|escape}" alt=""/>{/if}{$section|escape} - </span> - <div> - <img src="{$attributes.pwds_stats.img|escape}" alt="user icon"/> - {t count=$attributes.pwds_stats.nb 1=$attributes.pwds_stats.nb plural="There are %1 users:"}There is 1 user:{/t} - <ul> - {foreach from=$attributes.pwds_stats.methods item=method} - {if $method.nb > 0} - {if $method.style == "default"} - <li style="color:green;"> - {elseif $method.style == "clear"} - <li style="color:red;"> - {elseif $method.style == "forbidden"} - <li style="color:red;"> - {else} - <li> - {/if} - {t count=$method.nb 1=$method.name 2=$method.nb plural="%2 of them use the %1 method"}One of them uses %1 method{/t} - </li> - {/if} - {/foreach} - <li style="list-style-image:url({$attributes.pwds_stats.locked_accounts.img|escape})"> - {if $attributes.pwds_stats.locked_accounts.nb > 0} - {t count=$attributes.pwds_stats.locked_accounts.nb 1=$attributes.pwds_stats.locked_accounts.nb plural="%1 of them are locked"}One of them is locked{/t} - {else} - {t}None of them are locked{/t} - {/if} - </li> - </ul> - </div> -</div> diff --git a/plugins/addons/dashboard/users_accounts.tpl b/plugins/addons/dashboard/users_accounts.tpl deleted file mode 100644 index e1cb316e5a9c2c0b3dcc21322a49048b5c45964e..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/users_accounts.tpl +++ /dev/null @@ -1,102 +0,0 @@ -<div id="{$sectionId}" class="plugin-section fullwidth"> - <span class="legend"> - {if !empty($sectionIcon)}<img src="{$sectionIcon|escape}" alt=""/>{/if}{$section|escape} - </span> - <div> - <h1> - {if $attributes.expired.accounts|@count > 0} - {t count=$attributes.expired.accounts|@count 1=$attributes.expired.accounts|@count plural="There are %1 expired accounts"}There is one expired account{/t} - {else} - {t}There are no expired accounts{/t} - {/if} - </h1> - {if $attributes.expired.accounts|@count > 0} - <table style="width: 100%;" class="listingTable"> - <thead> - <tr style="background-color: white; text-align:center;"> - <th colspan="{$attributes.expired.columns.user|@count}" style="background-color: white; padding:5px;"> - {t}Expired accounts{/t} - </th> - <th colspan="{$attributes.expired.columns.manager|@count}" style="background-color: white; padding:5px;"> - {t}Manager concerned{/t} - </th> - </tr> - - - <tr> - {foreach from=$attributes.expired.columns.user item=colname} - <th>{$colname|escape}</th> - {/foreach} - {foreach from=$attributes.expired.columns.manager item=colname} - <th>{$colname|escape}</th> - {/foreach} - </tr> - </thead> - <tbody> - {foreach from=$attributes.expired.accounts item=account} - <tr> - {foreach from=$attributes.expired.columns.user key=colkey item=colname} - <td>{$account.$colkey|escape} </td> - {/foreach} - {foreach from=$attributes.expired.columns.manager key=colkey item=colname} - {if $colkey==manager_mail} - <td><a href="mailto:{$account.$colkey|escape}">{$account.$colkey|escape}</a></td> - {else} - <td>{$account.$colkey|escape} </td> - {/if} - {/foreach} - </tr> - {/foreach} - </tbody> - </table> - {/if} - - <h1> - {if $attributes.expired.accounts_next_days|@count > 0} - {t count=$attributes.expired.accounts_next_days|@count 1=$attributes.expired.next_days 2=$attributes.expired.accounts_next_days|@count plural="There are %2 accounts expiring in the next %1 days"}There is one account expiring in the next %1 days{/t} - {else} - {t 1=$attributes.expired.next_days}There is no account expiring in the next %1 days{/t} - {/if} - </h1> - {if $attributes.expired.accounts_next_days|@count > 0} - <table style="width: 100%;" class="listingTable"> - <thead> - <tr style="background-color: white; text-align:center;"> - <th colspan="{$attributes.expired.columns.user|@count}" style="background-color: white; padding:5px;"> - {t}Next expired accounts{/t} - </th> - <th colspan="{$attributes.expired.columns.manager|@count}" style="background-color: white; padding:5px;"> - {t}Manager concerned{/t} - </th> - </tr> - - - <tr> - {foreach from=$attributes.expired.columns.user item=colname} - <th>{$colname|escape}</th> - {/foreach} - {foreach from=$attributes.expired.columns.manager item=colname} - <th>{$colname|escape}</th> - {/foreach} - </tr> - </thead> - <tbody> - {foreach from=$attributes.expired.accounts_next_days item=account} - <tr> - {foreach from=$attributes.expired.columns.user key=colkey item=colname} - <td> {$account.$colkey|escape}</td> - {/foreach} - {foreach from=$attributes.expired.columns.manager key=colkey item=colname} - {if $colkey==manager_mail} - <td><a href="mailto:{$account.$colkey|escape}">{$account.$colkey|escape}</a></td> - {else} - <td> {$account.$colkey|escape}</td> - {/if} - {/foreach} - </tr> - {/foreach} - </tbody> - </table> - {/if} - </div> -</div> diff --git a/plugins/addons/dashboard/users_stats.tpl b/plugins/addons/dashboard/users_stats.tpl deleted file mode 100644 index 570414e058ba63b4aaf05136ecd8470a3d55280f..0000000000000000000000000000000000000000 --- a/plugins/addons/dashboard/users_stats.tpl +++ /dev/null @@ -1,24 +0,0 @@ -<div id="{$sectionId}" class="plugin-section"> - <span class="legend"> - {if !empty($sectionIcon)}<img src="{$sectionIcon|escape}" alt=""/>{/if}{$section|escape} - </span> - <div> - <img src="{$attributes.users_stats.img|escape}" alt="user icon"/> - {if $attributes.users_stats.nb > 0} - {t count=$attributes.users_stats.nb 1=$attributes.users_stats.nb plural="There are %1 users:"}There is 1 user:{/t} - {else} - {t}There are no users{/t} - {/if} - <ul> - {foreach from=$attributes.users_stats.accounts item=acc} - <li style="list-style-image:url({$acc.img|escape})"> - {if $acc.nb > 0} - {t count=$acc.nb 1=$acc.name 2=$acc.nb plural="%2 of them have a %1 account"}One of them has a %1 account{/t} - {else} - {t 1=$acc.name}None of them have a %1 account{/t} - {/if} - </li> - {/foreach} - </ul> - </div> -</div> diff --git a/plugins/addons/dashboard/class_pluginsManager.inc b/plugins/addons/pluginsManager/class_pluginsManager.inc similarity index 86% rename from plugins/addons/dashboard/class_pluginsManager.inc rename to plugins/addons/pluginsManager/class_pluginsManager.inc index fdc8aa1599970fab9fb43630973c981e541b9d9d..47f529ed07f898f7cda1f706b22649ac6ee0d14a 100644 --- a/plugins/addons/dashboard/class_pluginsManager.inc +++ b/plugins/addons/pluginsManager/class_pluginsManager.inc @@ -24,9 +24,12 @@ class pluginsManager extends simplePlugin { return [ 'plShortName' => _('Plugins'), - 'plDescription' => _('Plugins List'), - 'plObjectType' => ['dashboard'], - + 'plObjectType' => ['tasks'], + 'plTitle' => _('Plugins Manager'), + 'plIcon' => 'geticon.php?context=applications&icon=tasks-dashboard&size=48', + 'plSection' => ['reporting' => ['name' => _('Reporting'), 'priority' => 30]], + 'plPriority' => 10, + 'plDescription' => _('Provide a reporting mechanism of installed plugins'), 'plProvidedAcls' => [] ]; } @@ -35,7 +38,8 @@ class pluginsManager extends simplePlugin { return [ 'plugins' => [ - 'name' => _('Plugins'), + 'name' => _('Plugins Manager'), + 'plShortName' => _('Plugins Manager'), 'attrs' => [new FakeAttribute('pluginsList')], 'template' => get_template_path('plugins_list.tpl', TRUE, dirname(__FILE__)), ], diff --git a/plugins/addons/dashboard/plugins_list.tpl b/plugins/addons/pluginsManager/plugins_list.tpl similarity index 100% rename from plugins/addons/dashboard/plugins_list.tpl rename to plugins/addons/pluginsManager/plugins_list.tpl