Example #1
0
    /**
     * Display a message, for example an error or success message.
     * @param string $message The message to display.
     * @param string $image An optional image to display with the message.
     */
    public static function message($message, $image = '')
    {
        if (strlen($image) == 0) {
            echo '<h2>', piaCore::toHtml($message), '</h2>';
        } else {
            echo '<h2><img src="images/', $image, '" alt="message" height="22"
			  style="vertical-align:middle;" />&nbsp;', piaApp::toHtml($message), '</h2>';
        }
    }
Example #2
0
 /**
  * Get a number formatted for a SQL insert or NULL if the value is not a valid number.
  * @param string or numeric $value The value to format.
  * @param integer $decimals The number of decimals, default is 2.
  * @param numeric $nan Comparison numeric if the value has not been set, -99 by default.
  * @return SQL string formatted version of the number if it's a valid number, NULL otherwise.
  */
 public static function getNumericOrNull($value, $decimals = 2, $nan = -99)
 {
     $str = piaCore::getFormattedNumber($value, $decimals, $nan, '');
     if (!isset($str) || strlen($str) == 0) {
         $str = 'NULL';
     }
     return $str;
 }