Example #1
0
 /**
  * adiciona uma mensagem de feedback para ser capturada na view
  * @param string $feedback  mensagem (text|html) de feedback
  * @param string $type      success|info|warning|danger que é respectivamente verde|azul|amarelo|vermelho
  * @param string|boolean    $icon TRUE=usa icone default do $type. FALSE=não usa icone. STRING=usa um icone qualquer do twitter bootstrap
  * @param string $nameSpace namespace para dividir certas partes da aplicação que se encontra na mesma sessão
  */
 public static function addFeedback($feedback, $type = "info", $icon = true, $nameSpace = "defaultNameSpace")
 {
     if ($feedback instanceof Exception) {
         $feedback = $feedback->getMessage();
         $type = "danger";
     }
     $feedback = translateError($feedback);
     $typeToIcon = array("success" => "glyphicon-ok-sign", "info" => "info-sign", "warning" => "warning-sign", "danger" => "exclamation-sign");
     if ($icon === true) {
         $icon = $typeToIcon[$type];
     }
     $_SESSION['USER-FEEDBACK-MESSAGES'][$nameSpace][] = array('message' => $feedback, 'type' => $type, 'icon' => $icon);
     return $this;
 }
Example #2
0
function debugErrorHandler($errno, $errstr, $errfile, $errline)
{
    $errstr = translateError($errstr);
    $backTrace = debug_backtrace();
    $bt = '';
    if (DEBUG) {
        array_shift($backTrace);
        $backTrace = array_reverse($backTrace);
        foreach ($backTrace as $key => $trace) {
            if (!$trace['file']) {
                continue;
            }
            $bt = "[" . ($key + 1) . "]" . $trace['file'] . ":" . $trace['line'] . "<br>" . $bt;
        }
        if ($bt !== '') {
            $bt = '<hr><div style="color:#000;">' . $bt . "</div><br>";
        }
    }
    $message = '<div style="min-width:500px;background:#FFFAFA;padding:10px;min-height:100px;text-align:center;margin-left:auto;margin-right:auto;text-align:center;color:#F00;font-family:verdana;font-size:12px;margin:10px;">' . '<div style="display:block;text-align:left;">' . '<div style="font-family:courier new;overflow:auto;border:2px solid #D00;border-radius:10px;font-size:1.3em;color:#D00;padding:10px;"> <span style="font-size:2em;" class="glyphicon glyphicon-warning-sign"></span> ' . $errstr . $bt . '</div>' . '</div>' . '</div>';
    echo $message;
}