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();

This init-command belongs in hooks/header-extras.php

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),
  ];
}

This belongs in hooks/__global.php

Return information

Return values per indicator in indicator_handler() hook:

// file: hooks/__global.php
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':
      // Please note: This is just an example reading from 
      // a table named "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':
      // Please note: This is just an example
      // reading values from a table named "messages"
      $e=null;
      $indicator->value =  sqlValue("SELECT count(*) FROM messages", $e);
      $indicator->icon = "envelope";
      $indicator->visible = $indicator->value > 0;
      $indicator->bullet = AppGiniHelperIndicatorBullets::Blue;
      $indicator->tooltip = "Number of messages";
     break;
  }
  return TRUE;
}

This belongs in hooks/__global.php

Optional CSS-styling

.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);
}

Custom CSS basics:
You can put the CSS statements given above right inside a <style>...</style>-tag and put it in hooks/header-extras.php .
Or you can create a new css-file, put the content given above there, save it and include this file as <link>-tag in hooks/header-extras.php .

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?