Consistency updates for use of viewpath()
This commit is contained in:
@@ -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
|
||||
|
@@ -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),
|
||||
));
|
||||
}
|
||||
|
@@ -253,17 +253,25 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
public static function page($key) {
|
||||
if ($ids = Session::instance()->get('page_table_view'.$key)) {
|
||||
$pag = new Pagination(array(
|
||||
'total_items'=>count($ids),
|
||||
'items_per_page'=>1,
|
||||
));
|
||||
// We have preference for parameters passed to the action.
|
||||
if (is_null($id = Request::current()->param('id'))) {
|
||||
|
||||
return array($ids[$pag->current_first_item()-1],(string)$pag);
|
||||
if (isset($_POST['id']) AND is_array($_POST['id']))
|
||||
Table::post($key,'id');
|
||||
|
||||
if ($ids = Session::instance()->get('page_table_view'.$key)) {
|
||||
$pag = new Pagination(array(
|
||||
'total_items'=>count($ids),
|
||||
'items_per_page'=>1,
|
||||
));
|
||||
|
||||
return array($ids[$pag->current_first_item()-1],(string)$pag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If we get here, then there is no previous data to retrieve.
|
||||
} else
|
||||
return array(NULL,'');
|
||||
return array($id,'');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -53,11 +53,11 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
}
|
||||
|
||||
public function currency($name) {
|
||||
return StaticListModule::form($name,'currency',$this->currency_id,'id','name',array());
|
||||
return StaticList_Module::form($name,'currency',$this->currency_id,'id','name',array('status'=>'=:1'),FALSE,array('class'=>'form_button'));
|
||||
}
|
||||
|
||||
public function country($name) {
|
||||
return StaticListModule::form($name,'country',$this->country_id,'id','name',array());
|
||||
return StaticList_Module::form($name,'country',$this->country_id,'id','name',array('active'=>'=:1'),FALSE,array('class'=>'form_button'));
|
||||
}
|
||||
|
||||
public function language($name) {
|
||||
|
@@ -104,21 +104,6 @@ abstract class ORMOSB extends ORM {
|
||||
$model->$field = serialize($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
return $plugin ? sprintf('%s/%s/%s/%s',$request->controller(),$request->directory(),$plugin,$request->action()) : sprintf('%s/%s/%s',$request->controller(),$request->directory(),$request->action());
|
||||
}
|
||||
|
||||
public function changed() {
|
||||
return $this->_changed;
|
||||
}
|
||||
|
Reference in New Issue
Block a user