This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/product/classes/Controller/Product.php

55 lines
1.3 KiB
PHP
Raw Normal View History

2013-10-10 02:44:53 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides product categories
*
* @package Product
* @category Controllers
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Product extends Controller_TemplateDefault {
protected $auth_required = FALSE;
/**
* Show the available topics in a category
*
* @todo Only show categories according to their validity dates
* @todo Obey sort order
*/
public function action_category() {
$output = '';
$pco = ORM::factory('Product_Category',$this->request->param('id'));
// Only show categories that are active.
2016-08-31 05:03:09 +00:00
if (! $pco->loaded() OR ((! $pco->active AND ! Kohana::$config->load('debug')->show_inactive)))
2013-10-10 02:44:53 +00:00
HTTP::redirect('welcome/index');
2016-07-29 01:19:30 +00:00
$this->meta->title = $pco->name();
Style::factory()
->type('file')
->data('media/css/pages/welcome.css');
2013-10-10 02:44:53 +00:00
return $this->template->content = (string)$pco->template();
2013-10-10 02:44:53 +00:00
}
/**
* Show a product
*/
public function action_view() {
$id = $this->request->param('id');
$po = ORM::factory('Product',$id);
if (! $po->loaded())
HTTP::redirect('welcome/index');
2013-10-10 02:44:53 +00:00
$this->template->content = (string)View::factory('product/view')
->set('o',$po);
2013-10-10 02:44:53 +00:00
}
}
?>