Added counter to assetclass and assetclassgroup views

master
Thomas Hooge 2 years ago
parent 42a964c4b8
commit 1c8021c325
  1. 12
      assetclass.php
  2. 12
      assetclassgroup.php
  3. 2
      lang/de.php
  4. 2
      lang/en.php
  5. 3
      login.php
  6. 1
      options.php
  7. 12
      tpl/assetclass.tpl
  8. 6
      tpl/assetclassgroup.tpl
  9. 8
      tpl/options.tpl

@ -10,10 +10,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
include("includes.php");
include("header.php");
$sql = "SELECT a.assetclass_id, a.assetclass_name, g.assetclassgroup_id,
g.assetclassgroup_name, g.assetclassgroup_color
FROM assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
ORDER BY a.assetclass_name";
$sql = "SELECT c.assetclass_id AS id, c.assetclass_name AS name, c.assetclassgroup_id AS group_id,
g.assetclassgroup_name AS group_name, g.assetclassgroup_color AS color,
COUNT(a.asset_id) AS count_asset
FROM assetclass AS c
LEFT JOIN assetclassgroup AS g USING (assetclassgroup_id)
LEFT JOIN asset AS a USING (assetclass_id)
GROUP BY id, name, group_id, group_name, color
ORDER BY c.assetclass_name";
$sth = $dbh->query($sql);
$smarty->assign("assetclasses", $sth->fetchAll(PDO::FETCH_ASSOC));

@ -10,14 +10,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
include("includes.php");
include("header.php");
$sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name,
assetclassgroup_color AS color, assetclassgroup_description AS description
FROM assetclassgroup
ORDER BY assetclassgroup_name";
$sql = "SELECT g.assetclassgroup_id AS id, g.assetclassgroup_name AS name,
g.assetclassgroup_color AS color, g.assetclassgroup_description AS description,
COUNT(c.assetclass_id) AS count_class
FROM assetclassgroup AS g LEFT JOIN assetclass AS c USING (assetclassgroup_id)
GROUP BY id, name, color, description
ORDER BY g.assetclassgroup_name";
$sth = $dbh->query($sql);
$smarty->assign('assetclassgroups', $sth->fetchAll(PDO::FETCH_ASSOC));
$smarty->display("assetclassgroup.tpl");
include("footer.php");
?>
?>

@ -66,12 +66,14 @@ $lang = array(
'lang_assetclass_del' => 'Objektklasse löschen',
'lang_assetclass_edit' => 'Objektklasse ändern',
'lang_assetclass_name' => 'Objektklassenname',
'lang_assetclass_count' => '# Objekte',
'lang_assetclass_none' => 'Es sind keine Objektklassen vorhanden',
'lang_assetclassgroup_add' => 'Objektklassengruppe hinzufügen',
'lang_assetclassgroup_del' => 'Objektklassengruppe löschen',
'lang_assetclassgroup_edit' => 'Objektklassengruppe ändern',
'lang_assetclassgroup_name' => 'Objektklassengruppenname',
'lang_assetclassgroup_count' => '# Klassen',
'lang_assetclassgroup_none' => 'Es sind keine Objektklassengruppen vorhanden',
'lang_assignnodetoasset' => 'Knoten zu Objekt hinzufügen',

@ -66,12 +66,14 @@ $lang = array(
'lang_assetclass_del' => 'Delete assetclass',
'lang_assetclass_edit' => 'Mofidy assetclass',
'lang_assetclass_name' => 'Assetclass name',
'lang_assetclass_count' => '# Assets',
'lang_assetclass_none' => 'There are no assetclasses defined',
'lang_assetclassgroup_add' => 'Add assetclassgroup',
'lang_assetclassgroup_del' => 'Delete assetclassgroup',
'lang_assetclassgroup_edit' => 'Modify assetclassgroup',
'lang_assetclassgroup_name' => 'Assetclassgroup Name',
'lang_assetclassgroup_count' => '# Classes',
'lang_assetclassgroup_none' => 'There are no assetclassegroups defined',
'lang_assignnodetoasset' => 'Assign node to asset',

@ -36,7 +36,7 @@ function user_login ($user_name, $user_pass) {
$sql = "SELECT user_id, user_pass, user_displayname, user_language,
user_imagesize, user_imagecount, user_mac, user_dateformat,
user_dns1suffix, user_dns2suffix, user_tooltips,
user_menu, user_role, user_flags
user_menu, user_role, user_flags, user_realm
FROM user
WHERE user_name=?";
$sth = $dbh->prepare($sql);
@ -63,6 +63,7 @@ function user_login ($user_name, $user_pass) {
// all ok: user is logged in, register session data
$_SESSION['suser_id'] = $user->user_id;
$_SESSION['suser_realm'] = $user->user_realm;
$_SESSION['suser_displayname'] = $user->user_displayname;
$_SESSION['suser_language'] = $user->user_language;
$_SESSION['suser_imagesize'] = $user->user_imagesize;

@ -10,6 +10,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
include("includes.php");
include("header.php");
$smarty->assign('realm', $_SESSION['suser_realm']);
$smarty->assign('role_add', $_SESSION['suser_role_add']);
$smarty->assign('role_edit', $_SESSION['suser_role_edit']);
$smarty->assign('role_delete', $_SESSION['suser_role_delete']);

@ -20,15 +20,21 @@
<td class="header">
{$lang_assetclassgroup_name}
</td>
<td class="header">
{$lang_assetclass_count}
</td>
</tr>
{foreach item=assetclass from=$assetclasses}
<tr>
<td class="label">
<a href="assetclassview.php?assetclass_id={$assetclass.assetclass_id}">{$assetclass.assetclass_name}</a>
<a href="assetclassview.php?assetclass_id={$assetclass.id}">{$assetclass.name}</a>
</td>
<td class="value">
<img src="image.php?color={$assetclass.assetclassgroup_color}" alt="#{$assetclass.assetclassgroup_color}">
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclass.assetclassgroup_id}">{$assetclass.assetclassgroup_name}</a>
<img src="image.php?color={$assetclass.color}" alt="#{$assetclass.color}">
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclass.group_id}">{$assetclass.group_name}</a>
</td>
<td class="label">
{$assetclass.count_asset}
</td>
</tr>
{foreachelse}

@ -20,6 +20,9 @@
<td class="header">
{$lang_description}
</td>
<td class="header">
{$lang_assetclassgroup_count}
</td>
</tr>
{foreach item=acg from=$assetclassgroups}
<tr>
@ -30,6 +33,9 @@
<td>
{$acg.description}
</td>
<td>
{$acg.count_class}
</td>
</tr>
{foreachelse}
<tr>

@ -63,4 +63,12 @@
{/if}
</td>
</tr>
<tr>
<td class="label">
{$lang_user_realm}
</td>
<td class="label">
{$realm}
</td>
</tr>
</table>