You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1003 B

<?php
/**
* @copyright NetMonsters <team@netmonsters.ru>
* @link http://netmonsters.ru
* @package Majestic
* @subpackage app
* @since 2010-02-25
* @version SVN: $Id$
* @filesource $URL$
*/
abstract class Action
{
public function __construct()
{
$this->extractParams();
$this->execute();
}
protected function extractParams()
{
foreach (Env::getParam() as $name => $value) {
if (is_string($name)) {
$this->$name = $value;
}
}
}
abstract protected function execute();
/**
* Redirect
*
* @param mixed $url
* @param mixed $relative Default to true
*/
protected function redirect($url = null, $relative = true)
{
$url = ($url) ? $url : Env::getRequestUri();
if ($relative) {
$url = FrontController::getInstance()->getBaseUrl() . $url;
}
header('Location: ' . $url);
exit();
}
}