ViewAction functional merged to Action, Model::inset now returns last insert id if returned or affected rows count, #16

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@125 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2010-03-14 12:12:17 +00:00
parent 8fc917dca2
commit d0630c4240
9 changed files with 32 additions and 52 deletions

View File

@ -12,8 +12,16 @@
abstract class Action
{
protected $template;
/**
* @var PHPView
*/
protected $view;
public function __construct()
{
$this->view = FrontController::getInstance()->getView();
$this->extractParams();
$this->execute();
}
@ -45,4 +53,18 @@ abstract class Action
header('Location: ' . $url);
exit();
}
protected function getTemplate()
{
$class = get_class($this);
$template = ($this->template) ? $this->template : substr($class, 0, -6/*strlen('Action')*/);
$dir = array_slice(explode('/', Load::getFilePath($class)), -2, 1);
return '/actions/' . array_pop($dir) . '/' . $template;
}
public function fetch()
{
$this->view->assignObject($this);
return $this->view->fetch($this->getTemplate());
}
}