see http://phpdocu.sourceforge.net/ // +----------------------------------------------------------------------+ // | Author (TikiWiki): Luis Argerich // | Reworked for Bitweaver (& Undoubtedly Screwed-Up) // | by: StarRider // +----------------------------------------------------------------------+ // $Id: data.gauge.php,v 1.11 2007/06/09 18:09:39 squareing Exp $ /** * definitions */ define( 'PLUGIN_GUID_DATAGAUGE', 'datagauge' ); global $gLibertySystem; $pluginParams = array ( 'tag' => 'GAUGE', 'auto_activate' => FALSE, 'requires_pair' => TRUE, 'load_function' => 'data_gauge', 'title' => 'Gauge', 'help_page' => 'DataPluginGauge', 'description' => tra("This plugin displays a graphical GAUGE."), 'help_function' => 'data_gauge_help', 'syntax' => "{GAUGE color= bgcolor= max= value= size= perc= height= }" . tra("Description") . "{GAUGE}", 'path' => LIBERTY_PKG_PATH.'plugins/data.gauge.php', 'security' => 'registered', 'plugin_type' => DATA_PLUGIN ); $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAGAUGE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAGAUGE ); // Help Function function data_gauge_help() { $help = '' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
' . tra( "Key" ) . '' . tra( "Type" ) . '' . tra( "Comments" ) . '
color' . tra( "colorname or hex color") . '
' . tra("(optional)") . '
' . tra( "Specifies the color of the of the Bar in the Gauge. Colornames or HTML colors can be used. To specify HTML color the # character MUST be included like this: ( #RRGGBB ). If not specified - the Current Text Color will be used. See Note below for Colornames & HTML Colors Sources.") . '
bgcolor' . tra( "colorname or hex color") . '
' . tra("(optional)") . '
' . tra( "Specifies the color of the Gauges Background. Colornames or HTML colors can be used. To specify HTML color the # character MUST be included like this: ( #RRGGBB ). If not specified - the Current Background Color will be used. See Note below for Colornames & HTML Colors Sources.") . '
max' . tra( "numeric") . '
' . tra("(optional)") . '
' . tra( "The maximum possible value to be displayed. The Gauge was designed to be used with percentages - so the Default = ") . '100
value' . tra( "numeric") . '
' . tra("(Required)") . '
' . tra( "The current value that the Gauge will display. There is") . ' NO ' . tra("Default value.") . '
size' . tra( "numeric") . '
' . tra("(optional)") . '
' . tra( "The width of the Bar in pixels. The Default = ") . '150
height' . tra( "numeric") . '
' . tra("(optional)") . '
' . tra( "The height of the Bar in pixels. The Default = ") . '14
perc' . tra( "boolean") . '
' . tra("(optional)") . '
' . tra( "Determines if the % character is displayed after the value. Passing any value in this parameter will make it TRUE. The Default = FALSE so the % character will not be displayed") . '
Description' . tra( "boolean") . '
' . tra("(optional)") . '
' . tra("This is NOT a Parameter. Text can be place between the 2 code blocks ( in this case:") . ' {GAUGE} ' . tra(" ). If present the text will be displayed below the Gauge.") . '
' . tra("Example: ") . "{GAUGE color='red' bgcolor='blue' value='25' perc='True' }A Simple Gauge{GAUGE}" . '
' . tra("Note: Browser Safe Colornames are available on the ") . '' . tra( "BitWeaver Web Site" ) . '' . tra(" Another useful site for obtaining HTML colors is ") . '' . tra( "The Color Picker II" ) . ''; return $help; } // Load Function function data_gauge($data, $params) { extract ($params, EXTR_SKIP); if (!isset($max)) { $max = 100; } if (!isset($value)) { return tra("ERROR - Missing parameter. The ") . "__Gauge__" . tra(" plugin requires a value in the parameter ") . "__value__."; } if (!isset($size)) { $size = 150; } if (!isset($bgcolor)) { $bgcolor = '#0000FF'; } if (!isset($color)) { $color = '#FF0000'; } if (!isset($perc)) { $perc = false; } if ($perc) { $perc = number_format($value / $max * 100, 2); $perc = '  ' . $perc . '%'; } else { $perc = ''; } $h_size = floor($value / $max * $size); if (!isset($height)) { $height = 14; } $html = ""; if (!empty($data)) { $html .= ""; } $html .= "
  
$perc
$data
"; return $html; } ?>