histogram: Make histograms crash less
[ninja.git] / application / helpers / help.php
blobe8afd12f7000c9e3ed727f43cd7fd9c107267083
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Help class to provide links to render help texts
4 */
5 class help_Core
7 /**
8 * Render the help text calls to fetch
9 * translated help texts vis ajax calls.
11 * Example usage:
12 * Entering <?php help::render('edit'); ?> somewhere on a page (view) will
13 * create a clickable icon that fetches the help text from the current
14 * controller.
16 * By adding a second parameter to the call:
17 * <?php help::render('edit', 'extinfo'); ?> the information is instead
18 * fetched from the extinfo controller.
20 public static function render($key=false, $controller=false)
22 if (empty($key)) {
23 return false;
26 $img_path = url::base(false).'application/views/icons/12x12/help.png';
28 $controller = !empty($controller) ? $controller : Router::$controller;
30 # build the element ID with random nr | controller | help key
31 $id = 'help_'.rand(0, 10000).'|'.$controller.'|'.$key;
33 return '<a class="helptext_target" style="border:0" id="'.$id.'" href="#">'.
34 '<img src="'.$img_path.'" title="'._('Click for help').'" alt="'._('Click for help').'" style="width: 12px; height: 12px; margin-bottom: -1px" /></a>';