Updated OSB to work with KH 3.1
This commit is contained in:
@@ -35,19 +35,19 @@ class Auth_OSB extends Auth_ORM {
|
||||
|
||||
if (! empty($role)) {
|
||||
// Get the module details
|
||||
$module = ORM::factory('module',array('name'=>Request::instance()->controller));
|
||||
$module = ORM::factory('module',array('name'=>Request::current()->controller()));
|
||||
if (! $module->loaded() OR ! $module->status) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>'Module is not defined or active in the Database',
|
||||
'type'=>'warning',
|
||||
'body'=>sprintf('Module not defined: %s',Request::instance()->controller),
|
||||
'body'=>sprintf('Module not defined: %s',Request::current()->controller()),
|
||||
));
|
||||
|
||||
} else {
|
||||
if (Request::instance()->directory)
|
||||
$method_name = sprintf('%s_%s',Request::instance()->directory,Request::instance()->action);
|
||||
if (Request::current()->directory())
|
||||
$method_name = sprintf('%s_%s',Request::current()->directory(),Request::current()->action());
|
||||
else
|
||||
$method_name = Request::instance()->action;
|
||||
$method_name = Request::current()->action();
|
||||
|
||||
// Get the method number
|
||||
$method = ORM::factory('module_method',array('module_id'=>$module->id,'name'=>$method_name));
|
||||
@@ -55,7 +55,7 @@ class Auth_OSB extends Auth_ORM {
|
||||
SystemMessage::add(array(
|
||||
'title'=>'Method is not defined or active in the Database',
|
||||
'type'=>'warning',
|
||||
'body'=>sprintf('Method not defined: %s for %s',Request::instance()->action,$module->name),
|
||||
'body'=>sprintf('Method not defined: %s for %s',Request::current()->action(),$module->name),
|
||||
));
|
||||
|
||||
} else {
|
||||
@@ -93,7 +93,7 @@ class Auth_OSB extends Auth_ORM {
|
||||
'title'=>'Debug',
|
||||
'type'=>'debug',
|
||||
'body'=>sprintf('A-User: <b>%s</b>, Module: <b>%s</b>, Method: <b>%s</b>, Role: <b>%s</b>, Status: <b>%s</b>, Data: <b>%s</b>',
|
||||
$user->username,Request::instance()->controller,Request::instance()->action,$role,$status,$debug)));
|
||||
$user->username,Request::current()->controller(),Request::current()->action(),$role,$status,$debug)));
|
||||
|
||||
// There is no role, so the method should be allowed to run as anonymous
|
||||
} else {
|
||||
@@ -102,7 +102,7 @@ class Auth_OSB extends Auth_ORM {
|
||||
'title'=>'Debug',
|
||||
'type'=>'debug',
|
||||
'body'=>sprintf('B-User: <b>%s</b>, Module: <b>%s</b>, Method: <b>%s</b>, Status: <b>%s</b>, Data: <b>%s</b>',
|
||||
$user->username,Request::instance()->controller,Request::instance()->action,'No Role Default Access',$debug)));
|
||||
$user->username,Request::current()->controller(),Request::current()->action(),'No Role Default Access',$debug)));
|
||||
|
||||
$status = TRUE;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class Auth_OSB extends Auth_ORM {
|
||||
*/
|
||||
private function _get_token_user($token) {
|
||||
$mmto = ORM::factory('module_method_token',array('token'=>$token));
|
||||
$request = Request::instance();
|
||||
$request = Request::current();
|
||||
$user = FALSE;
|
||||
|
||||
if ($mmto->loaded()) {
|
||||
@@ -196,7 +196,7 @@ class Auth_OSB extends Auth_ORM {
|
||||
$username = $user;
|
||||
|
||||
// Load the user
|
||||
$user = ORM::factory('user');
|
||||
$user = ORM::factory('account');
|
||||
$user->where($user->unique_key($username), '=', $username)->find();
|
||||
}
|
||||
|
||||
@@ -232,8 +232,10 @@ class Auth_OSB extends Auth_ORM {
|
||||
$orm = ORM::factory($t)
|
||||
->where($c,'=',$oldsess);
|
||||
|
||||
$orm->session_id = session_id();
|
||||
$orm->save_all();
|
||||
// @todo There must be a way that ORM can update multiple records with 1 SQL
|
||||
foreach ($orm->find_all() as $o)
|
||||
$o->set('session_id',session_id())
|
||||
->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,21 +39,21 @@ class Controller_User_Account extends Controller_TemplateDefault {
|
||||
));
|
||||
|
||||
$ao->save();
|
||||
Request::instance()->redirect('login');
|
||||
Request::current()->redirect('login');
|
||||
|
||||
} else {
|
||||
$output = '';
|
||||
foreach ($ao->validation()->errors('forms/login') as $field => $error)
|
||||
$output .= sprintf('<li><b>%s</b> %s</li>',$field,$error);
|
||||
|
||||
if ($output)
|
||||
$output = sprintf('<ul>%s</ul>',$output);
|
||||
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Record NOT updated'),
|
||||
'type'=>'error',
|
||||
'body'=>_('Your updates didnt pass validation.')
|
||||
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
|
||||
));
|
||||
|
||||
foreach ($ao->validate()->errors('form_errors') as $field => $error)
|
||||
SystemMessage::add(array(
|
||||
'title'=>$field,
|
||||
'type'=>'error',
|
||||
'body'=>$error,
|
||||
));
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
@@ -61,8 +61,6 @@ class Controller_User_Account extends Controller_TemplateDefault {
|
||||
'body'=>View::factory('account/password_reset')
|
||||
->set('record',$ao),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,18 +87,18 @@ class Controller_User_Account extends Controller_TemplateDefault {
|
||||
$ao->save();
|
||||
|
||||
} else {
|
||||
$output = '';
|
||||
foreach ($ao->validation()->errors('forms/login') as $field => $error)
|
||||
$output .= sprintf('<li><b>%s</b> %s</li>',$field,$error);
|
||||
|
||||
if ($output)
|
||||
$output = sprintf('<ul>%s</ul>',$output);
|
||||
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Record NOT updated'),
|
||||
'type'=>'error',
|
||||
'body'=>_('Your updates didnt pass validation.')
|
||||
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
|
||||
));
|
||||
|
||||
foreach ($ao->validate()->errors('form_errors') as $field => $error)
|
||||
SystemMessage::add(array(
|
||||
'title'=>$field,
|
||||
'type'=>'error',
|
||||
'body'=>$error,
|
||||
));
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
@@ -108,8 +106,6 @@ class Controller_User_Account extends Controller_TemplateDefault {
|
||||
'body'=>View::factory('account/edit')
|
||||
->set('record',$ao),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -18,9 +18,6 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
'service' => array(),
|
||||
);
|
||||
|
||||
// Complete our login
|
||||
public function complete_login() {}
|
||||
|
||||
/**
|
||||
* Return an account name
|
||||
*/
|
||||
|
@@ -9,46 +9,5 @@
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Auth_RoleDefault extends Model_Auth_Role {
|
||||
protected $_table_names_plural = false;
|
||||
|
||||
protected $_object_formated = array();
|
||||
protected $_formated = FALSE;
|
||||
protected $_formats = array();
|
||||
|
||||
/**
|
||||
* Format fields for display purposes
|
||||
*
|
||||
* @param string column name
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _format() {
|
||||
$format = Validate::factory($this->_object);
|
||||
|
||||
foreach ($this->_formats as $column => $formats)
|
||||
$format->filters($column,$formats);
|
||||
|
||||
if ($format->check())
|
||||
foreach ($format as $column => $value)
|
||||
$this->_object_formated[$column] = $value;
|
||||
|
||||
$this->_formated = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a formated columns, as per the model definition
|
||||
*/
|
||||
public function display($column) {
|
||||
// Trigger a load of the record.
|
||||
$value = $this->__get($column);
|
||||
|
||||
// If some of our fields need to be formated for display purposes.
|
||||
if ($this->_loaded AND ! $this->_formated AND $this->_formats)
|
||||
$this->_format();
|
||||
|
||||
if (isset($this->_object_formated[$column]))
|
||||
return $this->_object_formated[$column];
|
||||
else
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -9,32 +9,34 @@
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Auth_UserDefault extends Model_Auth_User {
|
||||
protected $_table_names_plural = false;
|
||||
|
||||
// Validation rules
|
||||
protected $_rules = array(
|
||||
'username' => array(
|
||||
'not_empty' => NULL,
|
||||
'min_length' => array(4),
|
||||
'max_length' => array(32),
|
||||
),
|
||||
'password' => array(
|
||||
'not_empty' => NULL,
|
||||
'min_length' => array(5),
|
||||
'max_length' => array(42),
|
||||
),
|
||||
'password_confirm' => array(
|
||||
'matches_ifset' => array('password'),
|
||||
),
|
||||
'email' => array(
|
||||
'not_empty' => NULL,
|
||||
'min_length' => array(4),
|
||||
'max_length' => array(127),
|
||||
'email' => NULL,
|
||||
),
|
||||
);
|
||||
public function rules() {
|
||||
return array(
|
||||
'username' => array(
|
||||
array('not_empty'),
|
||||
array('min_length', array(':value', 4)),
|
||||
array('max_length', array(':value', 32)),
|
||||
),
|
||||
'password' => array(
|
||||
array('not_empty'),
|
||||
array('min_length', array(':value', 5)),
|
||||
array('max_length', array(':value', 32)),
|
||||
),
|
||||
'email' => array(
|
||||
array('not_empty'),
|
||||
array('min_length', array(':value', 4)),
|
||||
array('max_length', array(':value', 127)),
|
||||
array('email'),
|
||||
),
|
||||
// @todo To test
|
||||
'password_confirm' => array(
|
||||
array('matches_ifset', array(':validation', 'password', 'password_confirm')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Validation callbacks
|
||||
// @todo _callbacks no longer used
|
||||
protected $_callbacks = array(
|
||||
'username' => array('username_available'),
|
||||
'email' => array('email_available'),
|
||||
@@ -51,6 +53,7 @@ class Model_Auth_UserDefault extends Model_Auth_User {
|
||||
* here.
|
||||
*
|
||||
* We can also do some other post-login actions here.
|
||||
* @todo Maybe we can do our session update here.
|
||||
*/
|
||||
public function complete_login() {}
|
||||
|
||||
|
@@ -25,11 +25,9 @@ class Controller_Cart extends Controller_TemplateDefault {
|
||||
// @todo - this should be a global config item
|
||||
$mediapath = Route::get('default/media');
|
||||
|
||||
$block = new block;
|
||||
|
||||
// If the cart is empty, we'll return here.
|
||||
if (! Cart::instance()->contents()->count_all())
|
||||
$block->add(array(
|
||||
Block::add(array(
|
||||
'title'=>_('Empty Cart'),
|
||||
'body'=>_('The cart is empty')
|
||||
));
|
||||
@@ -61,7 +59,8 @@ class Controller_Cart extends Controller_TemplateDefault {
|
||||
->set('mediapath',$mediapath);
|
||||
|
||||
// If we are a plugin product, we might need more information
|
||||
if ($item->product->prod_plugin AND method_exists($item->product->prod_plugin_file,'product_cart')) {
|
||||
// @todo If an admin, show a system message if cart_info doesnt exist.
|
||||
if ($item->product->prod_plugin AND method_exists($item->product->prod_plugin_file,'product_cart') AND Kohana::find_file('views',sprintf('%s/cart_info',strtolower($item->product->prod_plugin_file)))) {
|
||||
$output .= View::factory(sprintf('%s/cart_info',strtolower($item->product->prod_plugin_file)));
|
||||
|
||||
// @todo JS validation will need to verify data before submission
|
||||
@@ -70,14 +69,12 @@ class Controller_Cart extends Controller_TemplateDefault {
|
||||
$output .= '<div>'.Form::submit('submit',_('Checkout')).'</div>';
|
||||
$output .= Form::close();
|
||||
|
||||
$block->add(array(
|
||||
Block::add(array(
|
||||
'title'=>_('Your Items'),
|
||||
'body'=>$output,
|
||||
));
|
||||
}
|
||||
|
||||
$this->template->content = $block;
|
||||
|
||||
// Suppress our right hand tab
|
||||
$this->template->right = ' ';
|
||||
}
|
||||
@@ -99,7 +96,7 @@ class Controller_Cart extends Controller_TemplateDefault {
|
||||
echo Kohana::debug($cart->validate()->errors());
|
||||
|
||||
if ($cart->saved())
|
||||
Request::instance()->redirect('cart/index');
|
||||
Request::current()->redirect('cart/index');
|
||||
else
|
||||
throw new Kohana_Exception(_('There was a problem adding the item to the cart.'));
|
||||
}
|
||||
|
@@ -15,11 +15,16 @@ class Model_Cart extends ORMOSB {
|
||||
'product'=>array(),
|
||||
);
|
||||
|
||||
protected $_formats = array(
|
||||
'recurr_schedule'=>array('StaticList_RecurSchedule::display'=>array()),
|
||||
);
|
||||
|
||||
// Cart doesnt use the update column
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
/**
|
||||
* Filters used to format the display of values into friendlier values
|
||||
*/
|
||||
protected $_display_filters = array(
|
||||
'recurr_schedule'=>array(
|
||||
array('StaticList_RecurSchedule::display',array(':value')),
|
||||
),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@@ -24,13 +24,12 @@ class Controller_Checkout extends Controller_TemplateDefault {
|
||||
|
||||
// @todo - this should be a global config item
|
||||
$mediapath = Route::get('default/media');
|
||||
$block = new block;
|
||||
|
||||
// @todo Items in the cart dont have account_id if they were put in the cart when the user was not logged in
|
||||
|
||||
// If the cart is empty, we'll return here.
|
||||
if (! Cart::instance()->contents()->count_all())
|
||||
$block->add(array(
|
||||
Block::add(array(
|
||||
'title'=>_('Empty Cart'),
|
||||
'body'=>_('The cart is empty')
|
||||
));
|
||||
@@ -58,7 +57,7 @@ class Controller_Checkout extends Controller_TemplateDefault {
|
||||
}
|
||||
$output .= '</table>';
|
||||
|
||||
$block->add(array(
|
||||
Block::add(array(
|
||||
'title'=>_('Your Items'),
|
||||
'body'=>$output,
|
||||
));
|
||||
@@ -67,7 +66,7 @@ class Controller_Checkout extends Controller_TemplateDefault {
|
||||
->payment_options_cart();
|
||||
|
||||
// @todo Country value should come from somewhere?
|
||||
$block->add(array(
|
||||
Block::add(array(
|
||||
'title'=>_('Order Total'),
|
||||
'body'=>View::factory('cart/checkout_total')
|
||||
->set('cart',Cart::instance())
|
||||
@@ -91,14 +90,12 @@ class Controller_Checkout extends Controller_TemplateDefault {
|
||||
$output .= '</table>';
|
||||
$output .= Form::close();
|
||||
|
||||
$block->add(array(
|
||||
Block::add(array(
|
||||
'title'=>_('Available Payment Methods'),
|
||||
'body'=>$output,
|
||||
));
|
||||
}
|
||||
|
||||
$this->template->content = $block;
|
||||
|
||||
// Suppress our right hand tab
|
||||
$this->template->right = ' ';
|
||||
}
|
||||
|
@@ -35,8 +35,6 @@ class Controller_Admin_EmailTemplate extends Controller_TemplateDefault {
|
||||
'title'=>_('Available Email Templates'),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,8 +69,6 @@ class Controller_Admin_EmailTemplate extends Controller_TemplateDefault {
|
||||
'title'=>_('Available Email Templates'),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +78,7 @@ class Controller_Admin_EmailTemplate extends Controller_TemplateDefault {
|
||||
$eto = ORM::factory('emailtemplate',$id);
|
||||
|
||||
if (! $eto->loaded())
|
||||
Request::instance()->redirect('admin/emailtemplate/list');
|
||||
Request::current()->redirect('admin/emailtemplate/list');
|
||||
|
||||
$output = '';
|
||||
|
||||
@@ -124,8 +120,6 @@ class Controller_Admin_EmailTemplate extends Controller_TemplateDefault {
|
||||
'title'=>sprintf(_('Edit Template '),$eto->name),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -45,7 +45,7 @@ class Controller_Admin_Export extends Controller_TemplateDefault {
|
||||
->export($daysago);
|
||||
|
||||
if (count($payments)) {
|
||||
$output = Form::open(Request::instance()->uri(array('action'=>'export')));
|
||||
$output = Form::open(Request::current()->uri(array('action'=>'export')));
|
||||
$output .= '<table class="box-left">';
|
||||
|
||||
$output .= View::factory('export/payment/header')
|
||||
@@ -72,8 +72,6 @@ class Controller_Admin_Export extends Controller_TemplateDefault {
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
|
||||
# Nothing to export
|
||||
} else {
|
||||
SystemMessage::add(array(
|
||||
|
@@ -16,7 +16,7 @@ class Export {
|
||||
|
||||
public function __construct() {
|
||||
$this->plugin = preg_replace('/^'.get_parent_class($this).'_/','',get_class($this));
|
||||
$this->request = Request::instance();
|
||||
$this->request = Request::current();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -31,8 +31,6 @@ class Controller_User_Invoice extends Controller_TemplateDefault {
|
||||
'body'=>View::factory('invoice/list')
|
||||
->set('invoices',$ao->invoice->find_all()),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -261,9 +261,9 @@ class Model_Invoice extends ORMOSB {
|
||||
return $this->invoice_items[$c];
|
||||
}
|
||||
|
||||
public function save() {
|
||||
public function save(Validation $validation = NULL) {
|
||||
// Save the invoice
|
||||
parent::save();
|
||||
parent::save($validation);
|
||||
|
||||
// Need to save the associated items and their taxes
|
||||
if ($this->saved()) {
|
||||
|
@@ -39,8 +39,6 @@ class Controller_Admin_Module extends Controller_Module {
|
||||
'title'=>_('Currently installed modules'),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,8 +92,6 @@ class Controller_Admin_Module extends Controller_Module {
|
||||
'title'=>sprintf(_('%s Methods'),strtoupper($mo->name)),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -37,7 +37,7 @@ class Controller_Admin_Module_Method extends Controller_Module {
|
||||
'body'=>sprintf(_('Method %s defined to database'),$mmo->name),
|
||||
));
|
||||
|
||||
Request::instance()->redirect(sprintf('admin/module/edit/%s',$mo->id));
|
||||
Request::current()->redirect(sprintf('admin/module/edit/%s',$mo->id));
|
||||
|
||||
} else {
|
||||
SystemMessage::add(array(
|
||||
@@ -56,8 +56,6 @@ class Controller_Admin_Module_Method extends Controller_Module {
|
||||
'title'=>sprintf(_('Add Method (%s) to Database for (%s)'),strtoupper($mmo->name),strtoupper($mo->name)),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,8 +129,6 @@ class Controller_Admin_Module_Method extends Controller_Module {
|
||||
'title'=>sprintf(_('%s->%s Method'),strtoupper($mmo->module->name),strtoupper($mmo->name)),
|
||||
'body'=>$output,
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -19,7 +19,7 @@ class Controller_Module extends Controller_TemplateDefault {
|
||||
|
||||
public function action_menu() {
|
||||
// Redirect us to the admin menu, no user facilities here!
|
||||
Request::instance()->redirect('/admin/module/menu');
|
||||
Request::current()->redirect('/admin/module/menu');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,7 +20,7 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
$cat = ORM::factory('product_category',$id);
|
||||
|
||||
if (! $cat->loaded())
|
||||
Request::instance()->redirect('welcome/index');
|
||||
Request::current()->redirect('welcome/index');
|
||||
|
||||
Breadcrumb::name($this->request->uri(),$cat->name);
|
||||
|
||||
@@ -30,8 +30,6 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
->set('results',$this->_get_category($cat->id))
|
||||
->set('cat',$cat->id),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +46,7 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
$po = ORM::factory('product',$id);
|
||||
|
||||
if (! $po->loaded())
|
||||
Request::instance()->redirect('product_category/index');
|
||||
Request::current()->redirect('product_category/index');
|
||||
|
||||
Breadcrumb::name($this->request->uri(),$po->product_translate->find()->name);
|
||||
|
||||
@@ -58,7 +56,7 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
|
||||
// If the product category doesnt exist, or doesnt match the product
|
||||
if (! $co->loaded() OR ! in_array($co->id,unserialize($po->avail_category_id)))
|
||||
Request::instance()->redirect('product_category/index');
|
||||
Request::current()->redirect('product_category/index');
|
||||
|
||||
Breadcrumb::name('product/view',$co->name);
|
||||
}
|
||||
@@ -68,8 +66,6 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
'body'=>View::factory('product/view')
|
||||
->set('record',$po),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -20,14 +20,13 @@ class Controller_Product_Category extends Controller_TemplateDefault {
|
||||
'body'=>View::factory('product/category/list')
|
||||
->set('results',$this->_get_categories()),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a list of our categories
|
||||
* @todo Only show categories according to the users group memeberhsip
|
||||
* @todo Obey sort order
|
||||
* @todo Move this to the model
|
||||
*/
|
||||
private function _get_categories() {
|
||||
return ORM::factory('product_category')
|
||||
|
@@ -89,8 +89,6 @@ ORDER BY c.id,s.recur_schedule,c.name,a.company,a.last_name,a.first_name
|
||||
'type'=>'file',
|
||||
'data'=>'css/list.css',
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
//@todo this should really be in a different class, since adsl wont be part of the main app
|
||||
@@ -186,8 +184,6 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
|
||||
'type'=>'file',
|
||||
'data'=>'css/list.css',
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
public function action_listhspaservices() {
|
||||
@@ -268,8 +264,6 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
|
||||
'type'=>'file',
|
||||
'data'=>'css/list.css',
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -375,8 +369,6 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
|
||||
'type'=>'file',
|
||||
'data'=>'css/list.css',
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
private function process(array $file) {
|
||||
|
@@ -35,8 +35,6 @@ class Controller_User_Service extends Controller_TemplateDefault {
|
||||
'body'=>View::factory('service/list')
|
||||
->set('services',$this->ao->service->find_all()),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
public function action_view($id) {
|
||||
@@ -103,8 +101,6 @@ class Controller_User_Service extends Controller_TemplateDefault {
|
||||
->set('product_info',$product_info)
|
||||
->set('product_detail',$product_detail),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -24,13 +24,22 @@ class Model_Service extends ORMOSB {
|
||||
'account'=>array(),
|
||||
);
|
||||
|
||||
protected $_formats = array(
|
||||
'active'=>array('StaticList_YesNo::display'=>array()),
|
||||
'date_next_invoice'=>array('Config::date'=>array()),
|
||||
'recur_schedule'=>array('StaticList_RecurSchedule::display'=>array()),
|
||||
/**
|
||||
* Filters used to format the display of values into friendlier values
|
||||
*/
|
||||
protected $_display_filters = array(
|
||||
'active'=>array(
|
||||
array('StaticList_YesNo::display',array(':value')),
|
||||
),
|
||||
'date_next_invoice'=>array(
|
||||
array('Config::date',array(':value')),
|
||||
),
|
||||
'recur_schedule'=>array(
|
||||
array('StaticList_RecurSchedule::display',array(':value')),
|
||||
),
|
||||
'price'=>array(
|
||||
'Tax::add'=>array(),
|
||||
'Currency::display'=>array(),
|
||||
array('Tax::add',array(':value')),
|
||||
array('Currency::display',array(':value')),
|
||||
),
|
||||
);
|
||||
|
||||
|
@@ -19,18 +19,15 @@ class Controller_StaticPage extends Controller_TemplateDefault {
|
||||
$sp = ORM::factory('staticpage',$id);
|
||||
|
||||
if (! $sp->loaded())
|
||||
Request::instance()->redirect('staticpage_category/index');
|
||||
Request::current()->redirect('staticpage_category/index');
|
||||
|
||||
array_push($this->_control,
|
||||
array($sp->staticpage_category->name=>sprintf('staticpage_category/view/'.$sp->static_page_category_id)));
|
||||
array_push($this->_control,array($sp->staticpage_translate->title=>$this->request->uri()));
|
||||
Breadcrumb::name($this->request->uri(),$sp->staticpage_translate->find()->title);
|
||||
|
||||
Block::add(array(
|
||||
'title'=>$sp->staticpage_translate->title,
|
||||
'title'=>$sp->staticpage_translate->find()->title,
|
||||
'body'=>View::factory('staticpage/view')
|
||||
->set('record',$sp),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -11,22 +11,15 @@
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Controller_StaticPage_Category extends Controller_TemplateDefault {
|
||||
protected $_control = array(
|
||||
array('Site Index'=>'staticpage_category'),
|
||||
);
|
||||
|
||||
/**
|
||||
* By default show a menu of available categories
|
||||
*/
|
||||
public function action_index() {
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Site Index Categories'),
|
||||
'body'=>View::factory('staticpage/category/list')
|
||||
->set('results',$this->_get_categories()),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,17 +31,15 @@ class Controller_StaticPage_Category extends Controller_TemplateDefault {
|
||||
$spc = ORM::factory('staticpage_category',$id);
|
||||
|
||||
if (! $spc->loaded())
|
||||
Request::instance()->redirect('welcome/index');
|
||||
Request::current()->redirect('welcome/index');
|
||||
|
||||
array_push($this->_control,array($spc->name=>$this->request->uri()));
|
||||
Breadcrumb::name($this->request->uri(),$spc->name);
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',_('Category'),$spc->name),
|
||||
'body'=>View::factory('staticpage/category/view')
|
||||
->set('results',$this->_get_category($spc->id)),
|
||||
));
|
||||
|
||||
$this->template->content = Block::factory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,8 @@
|
||||
<!-- @todo Move this back into the controller, so that we only have HTML views -->
|
||||
<table width="100%" border="0">
|
||||
<?php foreach ($results as $value) {?>
|
||||
<tr>
|
||||
<td class="menu"><a href="<?echo URL::site(Request::instance()->uri(array('action'=>'view','id'=>$value->id)));?>"><?php echo $value->name?></a></td>
|
||||
<td class="menu"><a href="<?echo URL::site(Request::current()->uri(array('action'=>'view','id'=>$value->id)));?>"><?php echo $value->name?></a></td>
|
||||
</tr>
|
||||
<?}?>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user