AppGini Helper Indicators Library

Our brand new PHP library allows you to append various, self-refreshing indicators to your navbar and to control the output by using PHP hooks.

User Interface (UI)

Customizable indicators in top navbar

Automatically wraps on smaller screens

Use cases

Here are some use cases which can give benefit to your application and to your users

  • Show number of tasks assigned to current user
  • Show number of incoming messages
  • Show number of open orders
  • Show sales totals per day
  • Show number of open issues
  • Show working time of current user
  • and so much more

Configuration

Initial configuration of indicators with just a few lines of PHP code

  • Easy to understand code for appending one or more indicators
  • Configurable interval (in seconds) per indicator
  • Each indicator will be displayed when page loads
  • If configured, each indicator will be periodically reloaded automatically
  • Four different modes
    • Reoad every n seconds (always)
    • Reload every n seconds if browser (-tab) is active
    • Reload every n seconds if browser (-tab) is inactive
    • Load once (on page-load)
  • No Javascript required

Customization

The browser will periodically reload information from the server per indicator and update the navbar-indicators automatically.

  • Change text / value
  • Change icon (Glyphicon)
  • Change coloured bullet
    red, yellow, green, orange, black, white, blue, purple, pink
  • Conditionally hide/show indicators
  • Tooltip on mouseover
  • Indicators can act as a link
    for example for loading the tasks-page showing tasks of current user
  • No Javascript required

Styling

You can use CSS to modify the style, for example change background-color or border of indicators. You can even change the style during auto-reload and for active/inactive indicators separately.

Example

Initialize library

Just one command for initialization of our new PHP library

<!-- file: hooks/header-extras.php -->

<?php

AppGiniHelperIndicators::init();

Initialize indicators

Configure various indicators in indicator_loader() hook:

// file: hooks/__global.php
function indicator_loader($context)
{
  return [
    $context->create("num_tasks")->updateEvery(30)->whenActive(),
    $context->create("num_messages")->updateEvery(30)->whenActive(),
    $context->create("date")->updateEvery(60),
    $context->create("time")->updateEvery(5),
  ];
}

Return information

Return values per indicator in indicator_handler() hook:

function indicator_handler($context, &$indicator) 
{
  switch ($indicator->name) {
    case 'date':
      $indicator->value = date("d.m.Y");
      $indicator->tooltip = date("l, d.m.Y");
      $indicator->icon = "calendar";
      break;
    case 'time':
      $indicator->value = date("H:i");
      $indicator->icon = "time";
      break;
    case 'num_tasks':
      $indicator->value = $context->getRecordCount("tasks", true, "id NOT IN (1, 5)");
      $indicator->href = "tasks_view.php";      
      $indicator->icon = "copy";
      $indicator->tooltip = "Number of all open tasks";
      break;
    case 'num_messages':
      $indicator->value =  sqlValue("SELECT count(*) FROM messages");
      $indicator->icon = "envelope";
      $indicator->visible = $indicator->value > 0;
      $indicator->bullet = AppGiniHelperIndicatorBullets::Blue;
      $indicator->tooltip = "Number of messages";
     break;
  }
  return TRUE;
}

Optional CSS-styling

<style>
  .indicator {
    border-bottom: 1px solid gray !important;
  }

  .indicator-loading {
    border-bottom: 1px solid white !important;
    filter: blur(1px);
  }

  .autorefresh-on {
    border-bottom-color: silver;
    background-color: rgba(128,128,128,0.2);
  }

  .autorefresh-off {
    filter: blur(1px);
  }
</style>

Fully integrated with AppGini applications

As this is a serverside PHP library, you can use all known PHP functions, for example return values depending on the currently logged in user or group.

There is more built-in, for example hiding indicators on small devices or automatically calling javascript functions when values have changed. This library can give so much more benefit to you!

Pricing & Purchase

All pricing information for our products along with discounts are available in our shop.

Do you like it?