Theme work with focusbusiness and baseadmin

Improvements to NAVBAR, updates to StaticList methods, other minor items
Enable product category rendering and other minor improvements
Added ADSL-large category price plan
This commit is contained in:
Deon George
2013-04-26 11:42:09 +10:00
parent eeb8d61237
commit 04ebda2aaa
114 changed files with 1732 additions and 6797 deletions

View File

@@ -0,0 +1,22 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the rendering of ADSL Product Categories
*
* @package ADSL
* @category Helper
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Product_Category_Template_AdslCompare extends Product_Category_Template {
protected function render() {
Style::factory()
->type('file')
->data('media/pages/plans.css');
return View::factory('product/category/list/adslcompare')
->set('o',$this->pco);
}
}
?>

View File

@@ -0,0 +1,22 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the rendering of ADSL Product Categories, when there are many products
*
* @package ADSL
* @category Helper
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Product_Category_Template_AdslCompareLarge extends Product_Category_Template {
protected function render() {
Style::factory()
->type('file')
->data('media/pages/plans.css');
return View::factory('product/category/list/adslcompare-large')
->set('o',$this->pco);
}
}
?>

View File

@@ -46,8 +46,6 @@ class Service_Traffic_Adsl {
/**
* Return an instance of this class
*
* @return HeadImage
*/
public static function instance($supplier) {
$sc = Kohana::classname(get_called_class().'_'.$supplier);

View File

@@ -0,0 +1,75 @@
<div id="page-title">
<h1><?php echo $o->title(); ?></h1>
<?php echo $o->description(); ?>
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="grid-12">
<div class="tablewrapper">
<table class="plan plain">
<tr class="plan-header">
<th class="plan-title">Plan Name</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td class="plan-title"><?php echo $po->title(); ?></td>
<?php endforeach ?>
</tr>
<tr class="plan-header">
<th class="plan-price" >Price</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<?php $x = (string)Currency::display($po->price(0,1,'price_base',TRUE)); ?>
<td class="plan-price">
<span class="note">$</span><?php echo substr($x,0,strpos($x,'.')); ?><span class="cents"> .<?php echo substr($x,-2,strpos($x,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get(1); ?></span>
</td>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<th>Setup</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><span class="note">$</span><?php echo Currency::display($po->price(0,1,'price_setup',TRUE)); ?></td>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<th>Speed</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->display('speed'); ?></td>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<th>Peak Downloads</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->base_down_peak/1000; ?><span class="normal">GB</span></td>
<?php endforeach ?>
</tr>
<?php if ($po->plugin()->base_down_offpeak) : ?>
<tr class="plan-features">
<th>OffPeak Downloads</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->base_down_offpeak/1000; ?><span class="normal">GB</span></td>
<?php endforeach ?>
<?php endif ?>
<tr class="plan-features">
<th>Extra Traffic</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><span class="note">$</span><?php echo $po->plugin()->display('extra_down_peak'); ?><span class="normal">/GB</span></td>
<?php endforeach ?>
</tr>
<tr class="plan-features">
<th>Contract Term</th>
<?php $c=0; foreach ($o->products() as $po) : ?>
<td><?php echo $po->plugin()->display('contract_term'); ?> <span class="normal">mths</span></td>
<?php endforeach ?>
</tr>
</table>
</div> <!-- /tablewrapper -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container -->

View File

@@ -0,0 +1,61 @@
<div id="page-title">
<h1><?php echo $o->title(); ?></h1>
<?php echo $o->description(); ?>
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="grid-12">
<div class="pricing-plans plans-4">
<div class="row">
<?php $c=0; foreach ($o->products() as $po) : ?>
<?php if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row">
<?php endif ?>
<div class="plan-container">
<div class="plan">
<div class="plan-header">
<div class="plan-title">
<?php echo $po->title(); ?>
</div> <!-- /plan-title -->
<div class="plan-price">
<?php $x = (string)Currency::display($po->price(0,1,'price_base',TRUE)); ?>
<span class="note">$</span><?php echo substr($x,0,strpos($x,'.')); ?><span class="cents"> .<?php echo substr($x,-2,strpos($x,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get(1); ?></span>
</div> <!-- /plan-price -->
</div> <!-- /plan-header -->
<div class="plan-features">
<ul>
<li><span class="note">$</span><strong><?php echo Currency::display($po->price(0,1,'price_setup',TRUE)); ?></strong> setup</li>
<li><strong><?php echo $po->plugin()->display('speed'); ?></strong> Speed</li>
<li><strong><?php echo $po->plugin()->base_down_peak/1000; ?></strong>GB Peak Downloads</li>
<?php if ($po->plugin()->base_down_offpeak) : ?>
<li><strong><?php echo $po->plugin()->base_down_offpeak/1000; ?></strong>GB OffPeak Downloads</li>
<?php endif ?>
<li><span class="note">$</span><strong><?php echo $po->plugin()->display('extra_down_peak'); ?></strong>/GB Extra Traffic</li>
<li><strong><?php echo $po->plugin()->display('contract_term'); ?></strong> Months Contract</li>
</ul>
</div> <!-- /plan-features -->
<div class="plan-actions">
<!--
<a href="javascript:;" class="btn">Purchase Now</a>
-->
</div> <!-- /plan-actions -->
</div> <!-- /plan -->
</div> <!-- /plan-container -->
<?php endforeach ?>
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container -->

View File

@@ -26,7 +26,7 @@ class Model_Cart extends ORM_OSB {
*/
protected $_display_filters = array(
'recurr_schedule'=>array(
array('StaticList_RecurSchedule::display',array(':value')),
array('StaticList_RecurSchedule::get',array(':value')),
),
);

View File

@@ -40,8 +40,6 @@ abstract class Service_Domain {
/**
* Return an instance of this class
*
* @return HeadImage
*/
public static function instance($supplier) {
$sc = sprintf('%s_%s',get_called_class(),$supplier);

View File

@@ -23,7 +23,7 @@ class Model_Email_Template extends ORM_OSB {
protected $_display_filters = array(
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
array('StaticList_YesNo::get',array(':value')),
),
);
}

View File

@@ -97,7 +97,7 @@ class Export_Quicken extends Export {
} else {
throw new Kohana_Exception('Missing product map data for :product (:id)',
array(':product'=>$iio->product->name(),':id'=>$iio->product_id));
array(':product'=>$iio->product->title(),':id'=>$iio->product_id));
$qto->ACCNT = 'Other Income';
$qto->INVITEM = 'Product:Unknown';

View File

@@ -0,0 +1,22 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the rendering of Hosting Product Categories
*
* @package Host
* @category Helper
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Product_Category_Template_HostCompare extends Product_Category_Template {
protected function render() {
Style::factory()
->type('file')
->data('media/pages/plans.css');
return View::factory('product/category/list/hostcompare')
->set('o',$this->pco);
}
}
?>

View File

@@ -0,0 +1,52 @@
<div id="page-title">
<h1><?php echo $o->title(); ?></h1>
<?php echo $o->description(); ?>
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="grid-12">
<div class="pricing-plans plans-4">
<div class="row">
<?php $c=0; foreach ($o->products() as $po) : ?>
<?php if (! ($c++%4) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row">
<?php endif ?>
<div class="plan-container">
<div class="plan">
<div class="plan-header">
<div class="plan-title">
<?php echo $po->title(); ?>
</div> <!-- /plan-title -->
<div class="plan-price">
<?php $x = (string)Currency::display($po->price(0,4,'price_base',TRUE)); ?>
<span class="note">$</span><?php echo substr($x,0,strpos($x,'.')); ?><span class="cents"> .<?php echo substr($x,-2,strpos($x,'.')); ?></span><span class="term"><?php echo StaticList_RecurSchedule::get(4); ?></span>
</div> <!-- /plan-price -->
</div> <!-- /plan-header -->
<div class="plan-features">
<ul>
<li><span class="note">$</span><strong><?php echo Currency::display($po->price(0,4,'price_setup',TRUE)); ?></strong> setup</li>
</ul>
</div> <!-- /plan-features -->
<div class="plan-actions">
<a href="<?php echo URL::site('product/view/'.$po->id); ?>" class="btn">More Information</a>
</div> <!-- /plan-actions -->
</div> <!-- /plan -->
</div> <!-- /plan-container -->
<?php endforeach ?>
</div> <!-- /row -->
</div> <!-- /pricing-plans -->
</div> <!-- /grid -->
</div> <!-- /row -->
</div> <!-- /container -->

View File

@@ -325,11 +325,11 @@ class Controller_Task_Invoice extends Controller_Task {
foreach (ORM::factory('Invoice_Item')->find_all() as $iio) {
if ($iio->product_name AND $iio->product_id) {
if (md5(strtoupper($iio->product_name)) == md5(strtoupper($iio->product->name()))) {
if (md5(strtoupper($iio->product_name)) == md5(strtoupper($iio->product->title()))) {
$iio->product_name = NULL;
$iio->save();
} else {
print_r(array("DIFF",'id'=>$iio->id,'pn'=>serialize($iio->product_name),'ppn'=>serialize($iio->product->name()),'pid'=>$iio->product_id,'test'=>strcasecmp($iio->product_name,$iio->product->name())));
print_r(array("DIFF",'id'=>$iio->id,'pn'=>serialize($iio->product_name),'ppn'=>serialize($iio->product->title()),'pid'=>$iio->product_id,'test'=>strcasecmp($iio->product_name,$iio->product->title())));
}
}
}

View File

@@ -478,7 +478,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
$this->SetFont('helvetica','',8);
$this->SetX($x);
$this->Cell(0,0,sprintf('%s - %s',$ito->product->name(),$ito->service->name()));
$this->Cell(0,0,sprintf('%s - %s',$ito->product->title(),$ito->service->name()));
if ($ito->price_base) {
$this->SetX($x+160);

View File

@@ -33,7 +33,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
array('Config::date',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
array('StaticList_YesNo::get',array(':value')),
),
);
@@ -272,7 +272,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
if (! $ito->item_type == 0)
continue;
$t = $ito->product->name();
$t = $ito->product->title();
if (! isset($result[$t])) {
$result[$t]['quantity'] = 0;

View File

@@ -50,7 +50,7 @@
<tr>
<td>+</td>
<?php if ($rs) { ?>
<td><?php echo StaticList_RecurSchedule::display($rs); ?></td>
<td><?php echo StaticList_RecurSchedule::get($rs); ?></td>
<td colspan="1"><?php printf('%s Service(s)',count($items)); ?></td>
<?php } else { ?>
<td colspan="2">Other Items</td>

View File

@@ -61,7 +61,7 @@
<tr>
<td><div id="toggle_<?php echo $rs; ?>"><?php echo HTML::image($mediapath->uri(array('file'=>'img/toggle-closed.png')),array('alt'=>'+')); ?></div><script type="text/javascript">$("#toggle_<?php echo $rs; ?>").click(function() {$('#detail_toggle_<?php echo $rs; ?>').toggle();});</script></td>
<?php if ($rs) { ?>
<td><?php echo StaticList_RecurSchedule::display($rs); ?></td>
<td><?php echo StaticList_RecurSchedule::get($rs); ?></td>
<td><?php printf('%s Service(s)',count($items)); ?></td>
<td>&nbsp;</td>
<?php } else { ?>
@@ -86,7 +86,7 @@
<!-- Service Information -->
<tr class="head">
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$ito->service_id),$ito->service->id()); ?></td>
<td colspan="5"><?php printf('%s - %s',$ito->product->name(),$ito->service->name()); ?> (<?php echo $ito->product_id; ?>)</td>
<td colspan="5"><?php printf('%s - %s',$ito->product->title(),$ito->service->name()); ?> (<?php echo $ito->product_id; ?>)</td>
<td class="right"><?php echo ($i++==0 ? Currency::display($io->items_service_total($ito->service_id)) : '&nbsp;');?></td>
</tr>
<!-- END Product Information -->

View File

@@ -9,48 +9,165 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
class Controller_Admin_Product extends Controller_Product {
protected $auth_required = TRUE;
protected $secure_actions = array(
'ajaxtranslateform'=>TRUE,
'ajaxtranslatecategory'=>TRUE,
'ajaxtranslate'=>TRUE,
'category'=>TRUE,
'edit'=>TRUE,
'list'=>TRUE,
'update'=>TRUE,
'view'=>TRUE,
);
public function action_ajaxtranslateform() {
$this->auto_render = FALSE;
public function action_ajaxtranslate() {
$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'));
else {
if (! $po->loaded() OR ! isset($_REQUEST['key'])) {
$output = _('Unable to find translate data');
} else {
$pto = $po->product_translate->where('language_id','=',$_REQUEST['key'])->find();
$this->response->body(View::factory($this->viewpath())->set('pto',$pto));
$output = View::factory('product/admin/ajaxtranslate')
->set('o',$pto);
}
$this->response->body($output);
}
/**
* Retrieve the product category translate record
*/
public function action_ajaxtranslatecategory() {
$pco = ORM::factory('Product_Category',$this->request->param('id'));
if (! $pco->loaded() OR ! isset($_REQUEST['key'])) {
$output = _('Unable to find translate data');
} else {
$pcto = $pco->product_category_translate->where('language_id','=',$_REQUEST['key'])->find();
$output = View::factory('product/category/admin/ajaxtranslate')
->set('o',$pcto);
}
$this->response->body($output);
}
/**
* Update the product category
*/
public function action_category() {
$pco = ORM::factory('Product_Category',$this->request->param('id'));
if (! $pco->loaded())
HTTP::redirect('welcome/index');
if ($_POST)
$pco->values($_POST)->save();
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("select[name=language_id]").change(function() {
// If we select a blank, then dont continue
if (this.value == 0)
return false;
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "key="+$(this).val(),
dataType: "html",
cache: false,
url: "'.URL::link('admin','product/ajaxtranslatecategory/'.$pco->id,TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=translate]").replaceWith(data);
}
});
});
});
');
Block::factory()
->type('form-horizontal')
->title('Update Category')
->title_icon('icon-wrench')
->body(View::factory('product/category/admin/edit')
->set('o',$pco));
}
/**
* Edit a product configuration
*/
public function action_edit() {
$po = ORM::factory('Product',$this->request->param('id'));
if (! $po->loaded())
HTTP::redirect('welcome/index');
if ($_POST)
$po->values($_POST)->save();
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("select[name=language_id]").change(function() {
// If we select a blank, then dont continue
if (this.value == 0)
return false;
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "key="+$(this).val(),
dataType: "html",
cache: false,
url: "'.URL::link('admin','product/ajaxtranslate/'.$po->id,TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=translate]").replaceWith(data);
}
});
});
});
');
Block::factory()
->type('form-horizontal')
->title('Update Product')
->title_icon('icon-wrench')
->body(View::factory('product/admin/edit')
->set('plugin_form',$po->admin_update())
->set('o',$po));
}
/**
* Show a list of products
*/
public function action_list() {
if ($this->request->param('id'))
$prods = ORM::factory('Product_Category',$this->request->param('id'))->products();
else
$prods = ORM::factory('Product')->order_by('status DESC,prod_plugin_file')->find_all();
$products = ($x=$this->request->param('id')) ? ORM::factory('Product_Category',$x)->products() : ORM::factory('Product')->order_by('status DESC,prod_plugin_file')->find_all();
Block::add(array(
'title'=>_('Customer Products'),
'body'=>Table::display(
$prods,
Block::factory()
->title(_('Products'))
->title_icon('icon-th')
->body(Table::display(
$products,
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('admin','product/view/')),
'name()'=>array('label'=>'Details'),
'status'=>array('label'=>'Active'),
'title()'=>array('label'=>'Details'),
'status(TRUE)'=>array('label'=>'Active'),
'prod_plugin_file'=>array('label'=>'Plugin Name'),
'prod_plugin_data'=>array('label'=>'Plugin Data'),
'price_type'=>array('label'=>'Price Type'),
@@ -62,81 +179,31 @@ class Controller_Admin_Product extends Controller_TemplateDefault_Admin {
'page'=>TRUE,
'type'=>'select',
'form'=>URL::link('admin','product/view'),
)),
));
}
/**
* Edit a product configuration
*/
public function action_update() {
$po = ORM::factory('Product',$this->request->param('id'));
if (! $po->loaded())
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 (! $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()));
if (! $po->values($_POST)->save())
throw new Kohana_Exception('Failed to save updates to product data for record :record',array(':record'=>$so->id()));
}
Block::add(array(
'title'=>sprintf('%s %s:%s',_('Update Product'),$po->id,$po->name()),
'body'=>View::factory($this->viewpath())
->set('po',$po)
->set('mediapath',Route::get('default/media'))
->set('plugin_form',$po->admin_update()),
));
Script::add(array('type'=>'stdin','data'=>'
$(document).ready(function() {
$("select[name=language_id]").change(function() {
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
data: "key="+$(this).val(),
dataType: "html",
cache: false,
url: "'.URL::link('admin','product/ajaxtranslateform/'.$po->id,TRUE).'",
timeout: 2000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=translate]").replaceWith(data);
}
});
});
});
'));
)));
}
public function action_view() {
$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(),
Block::factory()
->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title()))
->title_icon('icon-th-list')
->body(Table::display(
$po->services()->find_all(),
25,
array(
'id'=>array('label'=>'ID','url'=>URL::link('user','service/view/')),
'account->accnum()'=>array(),
'account->name()'=>array('label'=>'Account'),
'name()'=>array('label'=>'Details'),
'status'=>array('label'=>'Active'),
'status(TRUE)'=>array('label'=>'Active'),
'price(TRUE,TRUE)'=>array('label'=>'Price','align'=>'right'),
),
array(
'page'=>TRUE,
'type'=>'select',
'form'=>URL::link('user','service/view'),
)),
));
)));
}
}
?>

View File

@@ -12,26 +12,6 @@
class Controller_Product extends Controller_TemplateDefault {
protected $auth_required = FALSE;
/**
* Show a list of product categories
*/
public function action_categorys() {
$output = '<div id="category">';
$output .= '<ul>';
foreach (ORM::factory('Product_Category')->list_active() as $pco) {
$a = '<h3>'.$pco->display('name').'</h3>';
$a .= '<p>'.$pco->description().'</p>';
$output .= '<li>'.HTML::anchor('product/category/'.$pco->id,$a).'</li>';
}
$output .= '</ul>';
$output .= '</div>';
$this->template->content = $output;
}
/**
* Show the available topics in a category
*
@@ -43,29 +23,15 @@ class Controller_Product extends Controller_TemplateDefault {
$pco = ORM::factory('Product_Category',$this->request->param('id'));
if (! $pco->loaded())
// Only show categories that are active.
if (! $pco->loaded() OR ((! $pco->status AND ! Kohana::$config->load('debug')->show_inactive)))
HTTP::redirect('welcome/index');
if (! $pco->status AND ! Kohana::$config->load('debug')->show_inactive)
HTTP::redirect('welcome/index');
Style::factory()
->type('file')
->data('media/css/pages/welcome.css');
BreadCrumb::name($this->request->uri(),$pco->name);
BreadCrumb::url('product','product/categorys');
BreadCrumb::url('product/category','product/categorys');
foreach ($pco->products() as $po)
$output .= View::factory($this->viewpath().'/list_item')
->set('co',$pco)
->set('o',$po);
// If our output is blank, then there are no products
if (! $output)
$output = _('Sorry, no pages were found in this category, or your account is not authorized for this category.');
Block::add(array(
'title'=>sprintf('%s: %s',_('Category'),$pco->name),
'body'=>$output,
));
return $this->template->content = (string)$pco->template();
}
/**
@@ -77,28 +43,14 @@ class Controller_Product extends Controller_TemplateDefault {
$po = ORM::factory('Product',$id);
if (! $po->loaded())
HTTP::redirect('Product_Category/index');
HTTP::redirect('welcome/index');
BreadCrumb::name($this->request->uri(),$po->product_translate->find()->name);
BreadCrumb::url('product','product/categorys');
// @todo This breadcrumb may not be working anymore.
#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']);
// If the product category doesnt exist, or doesnt match the product
if (! $co->loaded() OR ! in_array($co->id,$po->avail_category))
HTTP::redirect('Product_Category/index');
BreadCrumb::name('product/view',$co->name);
BreadCrumb::url('product/view','product/category/'.$co->id);
}
Block::add(array(
'title'=>$po->description_short(),
'body'=>View::factory($this->viewpath())
->set('record',$po),
));
$this->template->content = (string)View::factory('product/view')
->set('o',$po);
}
}
?>

View File

@@ -1,39 +0,0 @@
<?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_Category extends Controller_TemplateDefault {
/**
* By default show a menu of available categories
*/
public function action_index() {
HTTP::redirect('product_category/list');
}
public function action_list() {
Block::add(array(
'title'=>_('Product Categories'),
'body'=>View::factory('product/category/list')
->set('results',$this->_get_categories()),
));
}
/**
* 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')
->list_active();
}
}
?>

View File

@@ -26,16 +26,20 @@ class Model_Product extends ORM_OSB {
protected $_display_filters = array(
'price_type'=>array(
array('StaticList_PriceType::display',array(':value')),
array('StaticList_PriceType::get',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
array('StaticList_YesNo::get',array(':value')),
),
'taxable'=>array(
array('StaticList_YesNo::display',array(':value')),
array('StaticList_YesNo::get',array(':value')),
),
);
protected $_nullifempty = array(
'price_group',
);
// Our attributes that are arrays, we'll convert/unconvert them
protected $_serialize_column = array(
'avail_category',
@@ -43,41 +47,12 @@ class Model_Product extends ORM_OSB {
);
/**
* Which categories is this product available in
* Return the translated description for a category.
*/
public function categories() {
return $this->avail_category;
}
public function description($full=FALSE) {
$x = $this->translate();
/**
* Get the product description, after translating
* @todo This needs to be improved to find the right language item.
*/
public function description_long() {
return $this->product_translate->find()->display('description_full');
}
/**
* Get the product description, after translating
* @todo This needs to be improved to find the right language item.
*/
public function description_short() {
return $this->product_translate->find()->display('description_short');
}
/**
* This will render the product feature summary information
*/
public function feature_summary() {
return (is_null($plugin = $this->plugin())) ? HTML::nbsp('') : $plugin->feature_summary();
}
/**
* Get the product name, after translating
* @todo This needs to be improved to find the right language item.
*/
public function name() {
return $this->product_translate->find()->display('name');
return $x->loaded() ? $x->display($full ? 'description_full' : 'description_short') : 'No Description';
}
/**
@@ -93,6 +68,66 @@ class Model_Product extends ORM_OSB {
return ORM::factory(Kohana::classname(sprintf('Product_Plugin_%s',$this->prod_plugin_file)),$this->prod_plugin_data);
}
public function save(Validation $validation=NULL) {
if ($this->changed())
if (parent::save($validation))
SystemMessage::factory()
->title('Record Updated')
->type('success')
->body(sprintf('Record %s Updated',$this->id));
// Save our Translated Message
if ($x = array_diff_key($_POST,$this->_object) AND ! empty($_POST['language_id']) AND ! empty($_POST['product_translate']) AND is_array($_POST['product_translate'])) {
$pto = $this->product_translate->where('language_id','=',$_POST['language_id'])->find();
// For a new entry, we need to set the product_cat_id
if (! $pto->loaded()) {
$pto->product_cat_id = $this->id;
$pto->language_id = $_POST['language_id'];
}
if ($pto->values($x['product_translate'])->save())
SystemMessage::factory()
->title('Record Updated')
->type('success')
->body(sprintf('Translation for Record %s Updated',$this->id));
}
}
/**
* List the services that are linked to this product
*/
public function services($active=FALSE) {
return $active ? $this->service->where_active() : $this->service;
}
private function translate() {
return $this->product_translate->where('language_id','=',Config::language())->find();
}
/**
* Return the translated title for a category
*/
public function title() {
$x = $this->translate();
return $x->loaded() ? $x->display('name') : 'No Title';
}
/**
* Which categories is this product available in
*/
public function categories() {
return $this->avail_category;
}
/**
* This will render the product feature summary information
*/
public function feature_summary() {
return (is_null($plugin = $this->plugin())) ? HTML::nbsp('') : $plugin->feature_summary();
}
/**
* Return the best price to the uesr based on the users group's memberships
* @todo This needs to be tested with more than one price group enabled

View File

@@ -11,27 +11,30 @@
*/
class Model_Product_Category extends ORM_OSB {
protected $_table_name = 'product_cat';
protected $_created_column = FALSE;
protected $_updated_column = FALSE;
protected $_nullifempty = array(
'status',
'template',
);
protected $_has_many = array(
'product_category_translate'=>array('foreign_key'=>'product_cat_id','far_key'=>'id'),
'subcategories'=>array('model'=>'product_category','foreign_key'=>'parent_id','far_key'=>'id'),
);
protected $_sorting = array(
'name'=>'asc',
);
/**
* Return the translated description for a category.
*/
public function description() {
// If the user is not logged in, show the site default language
// @todo This needs to change to the session language.
if (! $ao=Auth::instance()->get_user())
$ao=Company::instance()->so();
$x = $this->translate();
return ($x=$this->product_category_translate->where('language_id','=',$ao->language_id)->find()->description) ? $x : _('No Description');
return $x->loaded() ? $x->display('description') : 'No Description';
}
/**
* List all the products belonging to this cateogry
* @todo Consider if we should cache this
*/
public function products() {
$result = array();
@@ -43,13 +46,68 @@ class Model_Product_Category extends ORM_OSB {
return $result;
}
public function list_bylistgroup($cat) {
$result = array();
public function save(Validation $validation=NULL) {
if ($this->changed())
if (parent::save($validation))
SystemMessage::factory()
->title('Record Updated')
->type('success')
->body(sprintf('Record %s Updated',$this->id));
foreach ($this->where('list_group','=',$cat)->find_all() as $pco)
$result[$pco->id] = $pco;
// Save our Translated Message
if ($x = array_diff_key($_POST,$this->_object) AND ! empty($_POST['language_id']) AND ! empty($_POST['product_category_translate']) AND is_array($_POST['product_category_translate'])) {
$pcto = $this->product_category_translate->where('language_id','=',$_POST['language_id'])->find();
// For a new entry, we need to set the product_cat_id
if (! $pcto->loaded()) {
$pcto->product_cat_id = $this->id;
$pcto->language_id = $_POST['language_id'];
}
if ($pcto->values($x['product_category_translate'])->save())
SystemMessage::factory()
->title('Record Updated')
->type('success')
->body(sprintf('Translation for Record %s Updated',$this->id));
}
}
/**
* Return the template that is used to render the product category
*/
public function template() {
if (! $this->template)
throw new Kohana_Exception('Product category :category doesnt have a template',array(':category'=>$this->id));
$o = Kohana::classname('Product_Category_Template_'.$this->template);
return new $o($this);
}
public function templates() {
$template_path = 'classes/Product/Category/Template';
$result = array('');
foreach (Kohana::list_files($template_path) as $file => $path) {
$file = strtoupper(preg_replace('/.php$/','',str_replace($template_path.'/','',$file)));
$result[$file] = $file;
}
return $result;
}
/**
* Return the translated title for a category
*/
public function title() {
$x = $this->translate();
return $x->loaded() ? $x->display('name') : 'No Title';
}
private function translate() {
return $this->product_category_translate->where('language_id','=',Config::language())->find();
}
}
?>

View File

@@ -11,6 +11,8 @@
*/
class Model_Product_Category_Translate extends ORM_OSB {
protected $_table_name = 'product_cat_translate';
protected $_created_column = FALSE;
protected $_updated_column = FALSE;
protected $_belongs_to = array(
'product_category'=>array(),

View File

@@ -0,0 +1,25 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the rendering of Product Category Templates
*
* @package Product
* @category Helper
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
abstract class Product_Category_Template {
protected $pco = NULL;
abstract protected function render();
public function __construct(Model_Product_Category $pco) {
$this->pco = $pco;
}
public function __toString() {
return (string)$this->render();
}
}
?>

View File

@@ -0,0 +1,20 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides the rendering of Product Category Template Super Category
*
* This Template renders sub categories of the same type.
*
* @package Product
* @category Helper
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Product_Category_Template_Supercat extends Product_Category_Template {
protected function render() {
return View::factory('product/category/list/supercat')
->set('o',$this->pco);
}
}
?>

View File

@@ -0,0 +1,442 @@
/*------------------------------------------------------------------
[Pricing Plans Stylesheet]
Project: Base Admin
Version: 2.0
Last change: 12/29/2012
Assigned to: Rod Howard (rh)
-------------------------------------------------------------------*/
/*-- Plan Container --*/
.plan-container {
position: relative;
float: left;
}
/*-- Plan --*/
.plan {
margin-right: 6px;
margin: 0 10px;
border-radius: 4px;
}
/*-- Plan Header --*/
.plan-header {
text-align: center;
color: #FFF;
background-color: #686868;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
}
.plan-title {
padding: 10px 0;
font-size: 16px;
color: #FFF;
border-bottom: 1px solid #FFF;
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
border-radius: 4px 4px 0 0;
}
.plan-price {
padding: 20px 0 10px;
font-size: 66px;
line-height: 0.8em;
background-color: #797979;
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.plan-price span.term {
display: block;
margin-bottom: 0;
font-size: 13px;
line-height: 0;
padding: 2em 0 1em;
}
.plan-price span.note {
position: relative;
top: -40px;
display: inline;
font-size: 17px;
line-height: 0.8em;
}
.plan-price span.cents {
position: relative;
display: inline;
font-size: 17px;
line-height: 0.8em;
}
/*-- Plan Features --*/
.plan-features {
border: 1px solid #DDD;
border-bottom: none;
}
.plan-features {
padding-bottom: 1em;
}
.plan-features ul {
padding: 0;
margin: 0;
list-style: none;
}
.plan-features li {
padding: 1em 0;
margin: 0 2em;
text-align: center;
border-bottom: 1px dotted #CCC;
}
.plan-features li:last-child {
border-bottom: none;
}
/*-- Plan Actions --*/
.plan-actions {
padding: 1.15em 0;
background: #F2F2F2;
background-color: whiteSmoke;
background-image: -moz-linear-gradient(top, #F8F8F8, #E6E6E6);
background-image: -ms-linear-gradient(top, #F8F8F8, #E6E6E6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#F8F8F8), to(#E6E6E6));
background-image: -webkit-linear-gradient(top, #F8F8F8, #E6E6E6);
background-image: -o-linear-gradient(top, #F8F8F8, #E6E6E6);
background-image: linear-gradient(top, #F8F8F8, #E6E6E6);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
border-color: #E6E6E6 #E6E6E6 #BFBFBF;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
border: 1px solid #DDD;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.plan-actions .btn {
padding: 1em 0;
margin: 0 2em;
display: block;
font-size: 16px;
font-weight: 600;
}
/*-- Columns --*/
.pricing-plans.plans-1 .plan-container {
width: 100%;
}
.pricing-plans.plans-2 .plan-container {
width: 50%;
}
.pricing-plans.plans-3 .plan-container {
width: 33.33%;
}
.pricing-plans.plans-4 .plan-container {
width: 25%;
}
/*-- Best Value Highlight --*/
.plan.best-value .plan-header {
background-color: #677E30;
}
.plan.best-value .plan-price {
background-color: #81994D;
}
.plan.skyblue .plan-header {
background-color: #3D7AB8;
}
.plan.skyblue .plan-price {
background-color: #69C;
}
.plan.lavendar .plan-header {
background-color: #754F75;
}
.plan.lavendar .plan-price {
background-color: #969;
}
.plan.teal .plan-header {
background-color: #257272;
}
.plan.teal .plan-price {
background-color: #399;
}
.plan.pink .plan-header {
background-color: #FF3778;
}
.plan.pink .plan-price {
background-color: #F69;
}
.plan.black .plan-header {
background-color: #222;
}
.plan.black .plan-price {
background-color: #333;
}
.plan.yellow .plan-header {
background-color: #C69E00;
}
.plan.yellow .plan-price {
background-color: #E8B900;
}
.plan.purple .plan-header {
background-color: #4E2675;
}
.plan.purple .plan-price {
background-color: #639;
}
.plan.red .plan-header {
background-color: #A40000;
}
.plan.red .plan-price {
background-color: #C00;
}
.plan.orange .plan-header {
background-color: #D98200;
}
.plan.orange .plan-price {
background-color: #F90;
}
.plan.blue .plan-header {
background-color: #0052A4;
}
.plan.blue .plan-price {
background-color: #06C;
}
/*-- Green Plan --*/
.plan.green .plan-header {
background-color: #677E30;
}
.plan.green .plan-price {
background-color: #81994D;
}
/*------------------------------------------------------------------
[2. Min Width: 767px / Max Width: 979px]
*/
@media (min-width: 767px) and (max-width: 979px) {
.pricing-plans .plan-container {
width: 50% !important;
margin-bottom: 2em;
}
}
@media (max-width: 767px) {
.pricing-plans .plan-container {
width: 100% !important;
margin-bottom: 2em;
}
}
/* Customer Settings */
.row-divider {
margin: 1.5em 0 1.5em;
}
.tablewrapper {
background: #F8F8F8 no-repeat 0px 0;
padding: 5px 5px;
border-radius: 7px;
display: block;
vertical-align: baseline;
}
.plan.plain {
font-weight: 500;
font-size: 11px;
margin: 0 0;
}
.plan.plain td:first-of-type {
border-left: 1px solid #D8D7D7;
}
.plan.plain .plan-header th.plan-title:first-of-type {
font-weight: normal;
border-radius: 4px 0 0 0;
}
.plan.plain .plan-header td.plan-title:last-of-type {
font-weight: normal;
border-radius: 0 4px 0 0;
}
.plan.plain .plan-header .plan-title {
font-size: 110%;
border-radius: 0 0 0 0;
border-bottom: 1px solid #D8D7D7;
padding: 5px;
}
.plan.plain .plan-header th.plan-price {
font-size: 110%;
color: #FFF;
font-weight: normal;
}
.plan.plain .plan-header td.plan-price {
font-size: 40px;
}
.plan.plain .plan-header td.plan-price span.note {
top: -21px;
}
.plan.plain .plan-header td.plan-price span.cents {
font-size: 20%;
}
.plan.plain .plan-header td.plan-price span.term {
font-size: 30%;
}
.plan.plain tr {
border: 0;
}
.plan.plain .plan-features {
border-top: 1px dotted #D8D7D7;
}
.plan.plain .plan-features th {
text-align: center;
padding: 5px;
font-size: 110%;
font-weight: normal;
}
.plan.plain .plan-features td {
font-weight: bold;
text-align: center;
padding: 5px;
font-size: 110%;
}
.plan.plain .plan-features td span.note {
font-weight: normal;
font-size: 100%;
}
.plan.plain .plan-features td span.normal {
font-weight: normal;
font-size: 100%;
}

View File

@@ -0,0 +1,26 @@
<div id="translate">
<div class="span6">
<?php echo Form::input('product_translate[name]',$o->name,array(
'label'=>'Category Title',
'placeholder'=>'Descriptive Title',
'class'=>'span3',
'required',
'help-block'=>'The title is shown when uses search products by category')); ?>
</div>
<div class="span9">
<?php echo Form::textarea('product_translate[description_short]',$o->description_short,array(
'label'=>'Short Product Description',
'placeholder'=>'Short Description',
'class'=>'span6',
'required',
'help-block'=>'Complete description of this category')); ?>
</div>
<div class="span9">
<?php echo Form::textarea('product_translate[description_full]',$o->description_full,array(
'label'=>'Full Product Description',
'placeholder'=>'Full Description',
'class'=>'span6',
'required',
'help-block'=>'Complete description of this category')); ?>
</div>
</div>

View File

@@ -1,15 +0,0 @@
<?php echo Form::hidden('product_translate[id]',$pto->id); ?>
<table>
<tr>
<td style="width: 40%;">Product Name</td>
<td style="width: 60%;" style="data"><?php echo Form::input('product_translate[name]',$pto->name); ?></td>
</tr>
<tr>
<td>Product Short Description</td>
<td style="data"><?php echo Form::input('product_translate[description_short]',$pto->description_short); ?></td>
</tr>
<tr>
<td>Product Long Description</td>
<td style="data"><?php echo Form::textarea('product_translate[description_full]',$pto->description_full); ?></td>
</tr>
</table>

View File

@@ -0,0 +1,76 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Update Product</legend>
<div class="row">
<div class="tabbable span9">
<ul class="nav nav-tabs">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<li class="<?php echo $c++ ? '' : 'active'; ?>"><a href="#tab<?php echo $k; ?>" data-toggle="tab"><?php echo $v; ?></a></li>
<?php endforeach ?>
</ul>
<div class="tab-content">
<?php $c=0;foreach (StaticList_RecurSchedule::table() as $k=>$v) : ?>
<div class="tab-pane <?php echo $c++ ? '' : 'active'; ?>" id="tab<?php echo $k; ?>">
<?php echo Form::checkbox("price_group[$k][show]",1,$o->isPriceShown($k),array('label'=>'Price Active','class'=>'span2')); ?>
<?php foreach ($o->availPriceGroups() as $g) : ?>
<div class="row">
<div class="span2"><?php echo ORM::factory('Group',$g)->name; ?></div>
<?php foreach ($o->availPriceOptions() as $po) : ?>
<div class="span2">
<?php echo Form::input("price_group[$k][$g][$po]",$o->price($g,$k,$po),array('placeholder'=>$po,'nocg'=>TRUE,'class'=>'span2')); ?>
</div>
<?php endforeach ?> <!-- /availPriceOptions() -->
</div>
<?php endforeach ?> <!-- /availPriceGroups() -->
</div> <!-- /tab-pane -->
<?php endforeach ?> <!-- /StaticList_RecurSchedule -->
</div> <!-- /tab-content -->
</div> <!-- /tabbable -->
</div> <!-- /row -->
<br>
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Product Active','class'=>'span1')); ?>
</div>
</div>
<div class="row">
<div class="span3">
<?php echo StaticList_RecurSchedule::form('price_recurr_default',$o,$o->price_recurr_default,array('label'=>'Default Period','class'=>'span2')); ?></td>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span3">
<?php echo Form::input('position',$o->position,array('label'=>'Order','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div id="translate"></div>
</div> <!-- /row -->
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span8 -->
</div> <!-- /row -->

View File

@@ -1,59 +0,0 @@
<!-- @todo NEEDS TO BE TRANSLATED -->
<?php echo Form::open(); ?>
<table width="100%">
<tr>
<td style="width: 50%; vertical-align: top;">
<table width="100%">
<tr>
<td style="width: 40%;">Product Active</td>
<td style="width: 5%;">&nbsp;</td>
<td style="width: 60%;" class="data"><?php echo StaticList_YesNo::form('status',$po->status); ?></td>
</tr>
<tr>
<td colspan="2">Price</td>
<td class="data">
<table>
<tr>
<td colspan="2">&nbsp;</td>
<?php foreach (StaticList_RecurSchedule::keys() as $k) { ?>
<td class="head"><?php echo StaticList_RecurSchedule::display($k); ?></td>
<td><?php echo Form::checkbox("price_group[$k][show]",1,$po->isPriceShown($k)); ?>
<?php } ?>
</tr>
<?php foreach ($po->availPriceGroups() as $g) { ?>
<?php foreach ($po->availPriceOptions() as $o) { ?>
<tr>
<td><?php echo ORM::factory('Group',$g)->name; ?></td>
<td><?php echo $o; ?></td>
<?php foreach (StaticList_RecurSchedule::keys() as $k) { ?>
<td colspan="2"><?php echo Form::input("price_group[$k][$g][$o]",$po->price($g,$k,$o),array('size'=>5)); ?></td>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
</table>
</td>
</tr>
<tr>
<td colspan="2">Default Period</td>
<td class="data"><?php echo StaticList_RecurSchedule::form('price_recurr_default',$po,$po->price_recurr_default); ?></td>
</tr>
<tr>
<td colspan="2">Order</td>
<td class="data"><?php echo Form::input('position',$po->position); ?></td>
</tr>
<tr>
<td>Product Descriptions</td>
<td><?php echo Form::select('language_id',ORM_OSB::form('Language',TRUE)); ?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="data" colspan="2"><div id="translate"></div></td>
</tr>
</table>
<?php if ($plugin_form) { echo '<br/>'.$plugin_form; } ?>
</td>
</tr>
</table>
<?php echo Form::submit('submit',_('Update'),array('class'=>'form_button')); ?>
<?php echo Form::close(); ?>

View File

@@ -0,0 +1,18 @@
<div id="translate">
<div class="span6">
<?php echo Form::input('product_category_translate[name]',$o->name,array(
'label'=>'Category Title',
'placeholder'=>'Descriptive Title',
'class'=>'span3',
'required',
'help-block'=>'The title is shown when uses search products by category')); ?>
</div>
<div class="span9">
<?php echo Form::textarea('product_category_translate[description]',$o->description,array(
'label'=>'Category Description',
'placeholder'=>'Description',
'class'=>'span6',
'required',
'help-block'=>'Complete description of this category')); ?>
</div>
</div>

View File

@@ -0,0 +1,36 @@
<div class="row">
<div class="span9 offset1">
<fieldset>
<legend>Update Category</legend>
<div class="row">
<div class="span3">
<?php echo StaticList_YesNo::form('status',$o->status,FALSE,array('label'=>'Active','class'=>'span1')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<?php echo Form::select('template',$o->templates(),$o->template,array('label'=>'List Template')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div class="span5">
<?php echo Form::select('language_id',ORM::factory('Language')->list_select(TRUE),'',array('label'=>'Language','required')); ?>
</div>
</div> <!-- /row -->
<div class="row">
<div id="translate"></div>
</div> <!-- /row -->
<div class="row">
<div class="offset2">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn">Cancel</button>
</div>
</div>
</fieldset>
</div> <!-- /span8 -->
</div> <!-- /row -->

View File

@@ -1,7 +0,0 @@
<table width="100%" border="0">
<?php foreach ($results as $value) { ?>
<tr>
<td class="menu"><a href="<?php echo URL::site('product/category/'.$value->id); ?>"><?php echo $value->name; ?></a></td>
</tr>
<?php } ?>
</table>

View File

@@ -0,0 +1,27 @@
<div id="container">
<div class="row divider service-container">
<div class="grid-3">
<h2><span class="slash">//</span> <?php echo $o->title(); ?></h2>
</div>
<?php $c=0;foreach ($o->subcategories->find_all() as $pco) : ?>
<?php if (! ($c++%3) AND $c>1) : ?>
</div> <!-- /row -->
<hr class="row-divider" />
<div class="row divider service-container">
<div class="grid-3">
&nbsp;
</div>
<?php endif ?>
<div class="grid-3">
<div class="service-item">
<h3><i class="icon-tint"></i><?php echo $pco->title(); ?></h3>
<?php $x=350;echo strlen($pco->description())<$x ? $pco->description() : substr($pco->description(),0,$x).'...'; ?>
<p><a href="<?php echo URL::site('product/category/'.$pco->id); ?>" class="">More Details »</a></p>
</div> <!-- /service -->
</div>
<?php endforeach ?>
</div> <!-- /row -->
</div> <!-- /container -->

View File

@@ -1,8 +0,0 @@
<table class="product-list-item">
<tr class="head">
<td class="heading"><a href="<?php echo URL::site(sprintf('product/view/%s?cid=%s',$o->id,$co->id));?>"><?php echo $o->name(); ?></a><?php echo $co->recur_price_display ? ' ('.Currency::display($o->price(0,$co->recur_price_display,'price_base',TRUE)).')' : ''; ?></td>
</tr>
<tr class="body">
<td><?php echo $o->description_short(); ?></td>
</tr>
</table>

View File

@@ -1,40 +0,0 @@
<?php
if (! count($results)) {
echo _('Sorry, no pages were found in this category, or your account is not authorized for this category.');
return;
}
foreach ($results as $record) {
// Load the language
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=','fr')->find();
// If there isnt a translated page, show the default language
// @todo - default language should come from configuration
if (! $translate->loaded())
$translate = $record->product_translate->where('product_id','=',$record->id)->and_where('language_id','=',1)->find();
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_background">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr valign="top">
<td class="heading"><a href="<?php echo URL::site(sprintf('product/view/%s?cid=%s',$record->id,$cat));?>"><?php echo $translate->name; ?></a> (<?php echo $record->display('price_base'); ?>/mth)</td>
</tr>
<tr>
<td style="background-color: #FFFFFF;">
<table width="100%" border="0" cellpadding="4">
<tr>
<td class="body"><?php echo $translate->description_short; ?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<?php
}
?>

View File

@@ -1,80 +1,15 @@
<?php
// @todo Need to add in product attributes
// @todo Need to add in product plugins
echo Form::open('cart/add');
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_background">
<tr>
<td>
<?php echo Form::hidden('product_id',$record->id); ?>
<?php echo Form::hidden('quantity',1); ?>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td style="background-color: #FFFFFF;">
<table width="100%" border="0" cellpadding="4">
<tr>
<td class="body" rowspan="4"><?php echo $record->description_long(); ?></td>
<td style="text-align: right;"><?php if ($a=$record->show_thumb()) echo $a; ?></td>
</tr>
<tr>
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'product_view')) {
$pio = new $record->prod_plugin_file;
echo '<td style="vertical-align: bottom;">'.$pio->product_view($record->prod_plugin_data).'</td>';
} ?>
</tr>
<tr>
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'contract_view')) {
$pio = new $record->prod_plugin_file;
// @todo This is a hack, need to work out the correct recur_price_schedule dynamically
echo '<td style="vertical-align: top;">'.$pio->contract_view($record->prod_plugin_data,$record->price(0,1,'price_base'),$record->price(0,1,'price_setup')).'</td>';
} ?>
</tr>
<tr>
<?php if ($record->prod_plugin_file && method_exists($record->plugin(),'feature_summary')) {
echo '<td style="vertical-align: top;">'.$record->plugin()->feature_summary().'</td>';
} ?>
</tr>
<tr>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="body" style="width: 50%;"><b>Recurring Billing Schedule</b></td>
<td class="body" style="width: 50%;"><b>Currency</b></td>
</tr>
<tr>
<td class="body"><?php echo StaticList_RecurSchedule::form('recurr_schedule',$record,$record->price_recurr_default);?> </td>
<!-- @todo The default currency should be system configurable and displayed by default -->
<!-- @todo If CURRENCY's value is not active in the DB, then the wrong flag is shown, as StaticList_Module::form() only returns active values -->
<!-- @todo Currency is not used in the cart? -->
<?php $CURRENCY_ISO='AUD'; $CURRENCY=6; $COUNTRY=61?>
<td class="body"><?php echo StaticList_Module::form('currency','currency',$CURRENCY,'id','name',array('status'=>'=:1'),FALSE,array('class'=>'form_button'));?> <?php echo Country::icon($COUNTRY);?></td>
</tr>
<tr>
<td class="body"><b>Price Type</b></td>
<td class="body"><b>Taxable</b></td>
</tr>
<tr>
<td class="body"><?php echo StaticList_PriceType::display($record->price_type);?></td>
<td class="body"><?php echo StaticList_YesNo::display($record->taxable);?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<?php if ($record->prod_plugin_file && method_exists($record->prod_plugin_file,'product_cart')) {
$pio = new $record->prod_plugin_file;
echo '<td style="vertical-align: top;">'.$pio->product_cart($record->prod_plugin_data).'</td>';
} ?>
</tr>
<tr>
<td style="text-align: center;"><?php echo Form::submit('submit','Add to Cart',array('class'=>'form_button','disabled'=>'disabled')); ?> | <?php echo Form::submit('submit','Add to Cart & Checkout',array('disabled'=>'disabled'),array('class'=>'form_button')); ?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php echo Form::close(); ?>
<br/>
<div id="page-title">
<h1><?php echo $o->title(); ?></h1>
<?php echo $o->description(); ?>
</div> <!-- /page-title -->
<div id="container">
<div class="row">
<div class="span9">
<?php echo $o->description(TRUE); ?>
</div> <!-- /row -->
</div> <!-- /row -->
<!-- <div class="row-divider"></div> -->
</div> <!-- /container -->

View File

@@ -38,10 +38,10 @@ class Model_Service extends ORM_OSB {
array('Config::date',array(':value')),
),
'recur_schedule'=>array(
array('StaticList_RecurSchedule::display',array(':value')),
array('StaticList_RecurSchedule::get',array(':value')),
),
'status'=>array(
array('StaticList_YesNo::display',array(':value')),
array('StaticList_YesNo::get',array(':value')),
),
);
@@ -52,9 +52,6 @@ class Model_Service extends ORM_OSB {
if (! $this->product->prod_plugin_file)
return NULL;
if (! is_numeric($this->product->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
$o = ORM::factory(Kohana::classname(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file)),array('service_id'=>$this->id));
return $type ? $o->$type : $o;
@@ -71,7 +68,7 @@ class Model_Service extends ORM_OSB {
* Display the service product name
*/
public function name() {
return is_null($plugin=$this->plugin()) ? $this->product->name() : $plugin->name();
return is_null($plugin=$this->plugin()) ? $this->product->title() : $plugin->name();
}
public function pending_change() {
@@ -211,12 +208,11 @@ class Model_Service extends ORM_OSB {
public function list_bylistgroup($cat) {
$result = array();
$cats = ORM::factory('Product_Category')->list_bylistgroup($cat);
foreach ($this->list_active() as $so)
if (array_intersect($so->product->avail_category,array_keys($cats)))
if ($so->product->prod_plugin_file == $cat)
array_push($result,$so);
Sort::MASort($result,'service_name()');
return $result;
}

View File

@@ -35,7 +35,7 @@ class Model_Service_Change extends ORM_OSB {
$output = array();
foreach ($this->find_all() as $sco) {
array_push($output,sprintf('%s %s',$sco->product->name(),$sco->display('date_effective')));
array_push($output,sprintf('%s %s',$sco->product->title(),$sco->display('date_effective')));
}
} else {

View File

@@ -32,7 +32,7 @@ abstract class Model_Service_Plugin extends ORM_OSB {
* Show our service name as defined in the DB with product suffix.
*/
public function service_name() {
return sprintf('%s - %s',$this->service->product->name(),$this->name());
return sprintf('%s - %s',$this->service->product->title(),$this->name());
}
/**

View File

@@ -36,7 +36,7 @@
</tr>
<tr>
<td>Type</td>
<td class="data"><?php echo StaticList_RecurType::display($so->recur_type); ?></td>
<td class="data"><?php echo StaticList_RecurType::get($so->recur_type); ?></td>
</tr>
<tr>
<td>User Can Change Schedule</td>

View File

@@ -21,7 +21,7 @@ Pending change to: <?php echo $so->service_change->list_details(); ?>
$lp = $iio->product_id; ?>
<tr class="list-sub-head">
<th class="id"><?php echo $iio->product_id; ?></th>
<th colspan="9"><?php echo $iio->product->name(); ?></th>
<th colspan="9"><?php echo $iio->product->title(); ?></th>
</tr>
<?php } ?>
<tr class="list-data">

View File

@@ -23,7 +23,7 @@
<?php if (is_null($so->price) OR ($so->price<=$so->product->price($so->price_group,$so->recur_schedule,'price_base'))) { ?>
<tr>
<td>Service</td>
<td class="data"><?php echo HTML::anchor('product/view/'.$so->product_id,$so->product->name()); ?></td>
<td class="data"><?php echo HTML::anchor('product/view/'.$so->product_id,$so->product->title()); ?></td>
</tr>
<?php } ?>
<tr>

View File

@@ -22,7 +22,7 @@
</tr>
<tr>
<td>CA</td>
<td class="data"><?php echo StaticList_YesNo::display($o->isCA()); ?></td>
<td class="data"><?php echo StaticList_YesNo::get($o->isCA()); ?></td>
</tr>
<tr>
<td>Valid From</td>