Fixes to OSB to work with KH 3.3
This commit is contained in:
@@ -21,7 +21,7 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
|
||||
public function action_ajaxtranslateform() {
|
||||
$this->auto_render = FALSE;
|
||||
|
||||
$po = ORM::factory('product',$this->request->param('id'));
|
||||
$po = ORM::factory('Product',$this->request->param('id'));
|
||||
|
||||
if (! $this->request->is_ajax() OR ! $po->loaded() OR ! isset($_REQUEST['key']))
|
||||
$this->response->body(_('Unable to find translate data'));
|
||||
@@ -39,9 +39,9 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
|
||||
*/
|
||||
public function action_list() {
|
||||
if ($this->request->param('id'))
|
||||
$prods = ORM::factory('product')->list_category($this->request->param('id'),FALSE);
|
||||
$prods = ORM::factory('Product')->list_category($this->request->param('id'),FALSE);
|
||||
else
|
||||
$prods = ORM::factory('product')->order_by('status DESC,prod_plugin_file')->find_all();
|
||||
$prods = ORM::factory('Product')->order_by('status DESC,prod_plugin_file')->find_all();
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Customer Products'),
|
||||
@@ -72,13 +72,13 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
|
||||
* Edit a product configuration
|
||||
*/
|
||||
public function action_update() {
|
||||
$po = ORM::factory('product',$this->request->param('id'));
|
||||
$po = ORM::factory('Product',$this->request->param('id'));
|
||||
|
||||
if (! $po->loaded())
|
||||
Request::current()->redirect('welcome/index');
|
||||
HTTP::redirect('welcome/index');
|
||||
|
||||
if ($_POST) {
|
||||
if (isset($_POST['product_translate']['id']) AND ($pto=ORM::factory('product_translate',$_POST['product_translate']['id'])) AND $pto->loaded())
|
||||
if (isset($_POST['product_translate']['id']) AND ($pto=ORM::factory('Product_Translate',$_POST['product_translate']['id'])) AND $pto->loaded())
|
||||
if (! $pto->values($_POST['product_translate'])->save())
|
||||
throw new Kohana_Exception('Failed to save updates to product_translate data for record :record',array(':record'=>$po->id()));
|
||||
|
||||
@@ -118,12 +118,12 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
|
||||
}
|
||||
|
||||
public function action_view() {
|
||||
$po = ORM::factory('product',$this->request->param('id'));
|
||||
$po = ORM::factory('Product',$this->request->param('id'));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',_('Current Services Using this Product'),$po->name()),
|
||||
'body'=>Table::display(
|
||||
ORM::factory('service')->where('product_id','=',$po->id)->find_all(),
|
||||
ORM::factory('Service')->where('product_id','=',$po->id)->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/service/view/'),
|
@@ -15,7 +15,7 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
$output = '<div id="category">';
|
||||
$output .= '<ul>';
|
||||
|
||||
foreach (ORM::factory('product_category')->list_active() as $pco) {
|
||||
foreach (ORM::factory('Product_Category')->list_active() as $pco) {
|
||||
$a = '<h3>'.$pco->display('name').'</h3>';
|
||||
$a .= '<p>'.$pco->description().'</p>';
|
||||
|
||||
@@ -35,15 +35,17 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
* @todo Only show categories according to their validity dates
|
||||
* @todo Obey sort order
|
||||
*/
|
||||
public function action_category($id) {
|
||||
$cat = ORM::factory('product_category',$id);
|
||||
public function action_category() {
|
||||
$id = $this->request->param('id');
|
||||
|
||||
$cat = ORM::factory('Product_Category',$id);
|
||||
|
||||
if (! $cat->loaded())
|
||||
Request::current()->redirect('welcome/index');
|
||||
HTTP::redirect('welcome/index');
|
||||
|
||||
Breadcrumb::name($this->request->uri(),$cat->name);
|
||||
Breadcrumb::url('product','product/categorys');
|
||||
Breadcrumb::url('product/category','product/categorys');
|
||||
BreadCrumb::name($this->request->uri(),$cat->name);
|
||||
BreadCrumb::url('product','product/categorys');
|
||||
BreadCrumb::url('product/category','product/categorys');
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',_('Category'),$cat->name),
|
||||
@@ -57,31 +59,33 @@ class Controller_Product extends Controller_TemplateDefault {
|
||||
* Obtain a list of pages in a category
|
||||
*/
|
||||
private function _get_category($id) {
|
||||
return ORM::factory('product')->list_category($id);
|
||||
return ORM::factory('Product')->list_category($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a product
|
||||
*/
|
||||
public function action_view($id) {
|
||||
$po = ORM::factory('product',$id);
|
||||
public function action_view() {
|
||||
$id = $this->request->param('id');
|
||||
|
||||
$po = ORM::factory('Product',$id);
|
||||
|
||||
if (! $po->loaded())
|
||||
Request::current()->redirect('product_category/index');
|
||||
HTTP::redirect('Product_Category/index');
|
||||
|
||||
Breadcrumb::name($this->request->uri(),$po->product_translate->find()->name);
|
||||
Breadcrumb::url('product','product/categorys');
|
||||
BreadCrumb::name($this->request->uri(),$po->product_translate->find()->name);
|
||||
BreadCrumb::url('product','product/categorys');
|
||||
|
||||
// Work out our category id for the control line
|
||||
if (! empty($_GET['cid'])) {
|
||||
$co = ORM::factory('product_category',$_GET['cid']);
|
||||
$co = ORM::factory('Product_Category',$_GET['cid']);
|
||||
|
||||
// If the product category doesnt exist, or doesnt match the product
|
||||
if (! $co->loaded() OR ! in_array($co->id,unserialize($po->avail_category)))
|
||||
Request::current()->redirect('product_category/index');
|
||||
HTTP::redirect('Product_Category/index');
|
||||
|
||||
Breadcrumb::name('product/view',$co->name);
|
||||
Breadcrumb::url('product/view','product/category/'.$co->id);
|
||||
BreadCrumb::name('product/view',$co->name);
|
||||
BreadCrumb::url('product/view','product/category/'.$co->id);
|
||||
}
|
||||
|
||||
Block::add(array(
|
@@ -15,7 +15,7 @@ class Controller_Product_Category extends Controller_TemplateDefault {
|
||||
* By default show a menu of available categories
|
||||
*/
|
||||
public function action_index() {
|
||||
Request::current()->redirect('product_category/list');
|
||||
HTTP::redirect('product_category/list');
|
||||
}
|
||||
|
||||
public function action_list() {
|
||||
@@ -33,7 +33,7 @@ class Controller_Product_Category extends Controller_TemplateDefault {
|
||||
* @todo Move this to the model
|
||||
*/
|
||||
private function _get_categories() {
|
||||
return ORM::factory('product_category')
|
||||
return ORM::factory('Product_Category')
|
||||
->list_active();
|
||||
}
|
||||
}
|
@@ -56,7 +56,7 @@ class Model_Product extends ORM_OSB {
|
||||
if (! is_numeric($this->prod_plugin_data))
|
||||
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->id,':type'=>$this->prod_plugin_file));
|
||||
|
||||
return ORM::factory(sprintf('product_plugin_%s',$this->prod_plugin_file),$this->prod_plugin_data);
|
||||
return ORM::factory(sprintf('Product_Plugin_%s',$this->prod_plugin_file),$this->prod_plugin_data);
|
||||
}
|
||||
|
||||
/**
|
Reference in New Issue
Block a user