Merge branch 'extended_classes' into sql_criteria
This commit is contained in:
@ -39,9 +39,13 @@ abstract class Action
|
|||||||
* Redirect
|
* Redirect
|
||||||
*
|
*
|
||||||
* @param mixed $url
|
* @param mixed $url
|
||||||
|
* @param bool $permanently
|
||||||
*/
|
*/
|
||||||
protected function redirect($url = null)
|
protected function redirect($url = null, $permanently = false)
|
||||||
{
|
{
|
||||||
|
if ($permanently) {
|
||||||
|
header('HTTP/1.1 301 Moved Permanently');
|
||||||
|
}
|
||||||
header('Location: ' . (($url) ? $url : Env::getRequestUri()));
|
header('Location: ' . (($url) ? $url : Env::getRequestUri()));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,13 @@ class CliLogger extends Logger
|
|||||||
{
|
{
|
||||||
// Заменяем окончания строк на их символы
|
// Заменяем окончания строк на их символы
|
||||||
$message = str_replace(array("\r", "\n"), array('\r', '\n'), $message);
|
$message = str_replace(array("\r", "\n"), array('\r', '\n'), $message);
|
||||||
$out = microtime(true) . " \t: " . $this->pid . trim($message) . PHP_EOL;
|
$out = $this->generateOutString($message);
|
||||||
print($out);
|
print($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function generateOutString($message)
|
||||||
|
{
|
||||||
|
return microtime(true) . " \t: " . $this->pid . trim($message) . PHP_EOL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,13 @@ class MsgViewHelper extends ViewHelper
|
|||||||
|
|
||||||
const WARNING = 'warning';
|
const WARNING = 'warning';
|
||||||
|
|
||||||
|
private static $type_to_class = array(
|
||||||
|
self::SUCCESS => 'success',
|
||||||
|
self::ERROR => 'error',
|
||||||
|
self::INFO => 'info',
|
||||||
|
self::WARNING => 'warning',
|
||||||
|
);
|
||||||
|
|
||||||
protected $css_prefix = '';
|
protected $css_prefix = '';
|
||||||
|
|
||||||
public function msg($msg = null, $type = null)
|
public function msg($msg = null, $type = null)
|
||||||
@ -67,8 +74,14 @@ class MsgViewHelper extends ViewHelper
|
|||||||
$msg = Session::get(__CLASS__, false);
|
$msg = Session::get(__CLASS__, false);
|
||||||
if ($msg) {
|
if ($msg) {
|
||||||
Session::del(__CLASS__);
|
Session::del(__CLASS__);
|
||||||
return '<div class="' . $this->css_prefix . $msg['type'] . '">' . $this->view->escape($msg['message']) . '</div>';
|
$type_to_class = static::getTypeToClass();
|
||||||
|
return '<div class="' . $this->css_prefix . $type_to_class[$msg['type']] . '">' . $this->view->escape($msg['message']) . '</div>';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function getTypeToClass()
|
||||||
|
{
|
||||||
|
return self::$type_to_class;
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user