Consistency updates for use of viewpath()

This commit is contained in:
Deon George
2011-12-21 12:39:21 +11:00
parent a40ce27a16
commit a893527d77
42 changed files with 125 additions and 125 deletions

View File

@@ -262,6 +262,29 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
return sprintf('© %s',Config::SiteName());
}
/**
* Generate a view path to help View::factory() calls
*
* The purpose of this method is to ensure that we have a consistant
* layout for our view files, including those that are needed by
* plugins
*
* @param string Plugin Name (optional)
*/
public function viewpath($plugin='') {
$request = Request::current();
$path = '';
$path .= $request->controller();
if ($request->directory())
$path .= ($path ? '/' : '').$request->directory();
if ($plugin)
$path .= ($path ? '/' : '').$plugin;
$path .= ($path ? '/' : '').$request->action();;
return $path;
}
/**
* This action will render all the media related files for a page
* @return void

View File

@@ -57,7 +57,7 @@ class Controller_User_Account extends Controller_TemplateDefault_User {
Block::add(array(
'title'=>_('Password Reset'),
'body'=>View::factory('account/password_reset')
'body'=>View::factory($this->viewpath())
->set('record',$this->ao),
));
}
@@ -97,7 +97,7 @@ class Controller_User_Account extends Controller_TemplateDefault_User {
Block::add(array(
'title'=>sprintf('%s: %s - %s',_('Account Edit'),$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>View::factory('account/user/edit')
'body'=>View::factory($this->viewpath())
->set('record',$this->ao),
));
}