Fixes to OSB to work with KH 3.3
This commit is contained in:
47
application/classes/Controller/TemplateDefault/Admin.php
Normal file
47
application/classes/Controller/TemplateDefault/Admin.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* lnApp User Main home page controller
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page/Admin
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault_Admin extends Controller_TemplateDefault_User {
|
||||
protected function setup(array $config_items=array()) {
|
||||
$module = Request::current()->controller();
|
||||
|
||||
if ($_POST AND isset($_POST['module_config'][$module]))
|
||||
Config::instance()->so->module_config($module,$_POST['module_config'][$module])->save();
|
||||
|
||||
if ($config_items) {
|
||||
$output = '';
|
||||
$mc = Config::instance()->so->module_config($module);
|
||||
|
||||
$output .= Form::open();
|
||||
$output .= View::factory('setup/admin/module/head');
|
||||
|
||||
foreach ($config_items as $k=>$v)
|
||||
$output .= View::factory('setup/admin/module/body')
|
||||
->set('module',$module)
|
||||
->set('mc',$mc)
|
||||
->set('key',$k)
|
||||
->set('info',$v)
|
||||
->set('val',isset($mc[$k]) ? $mc[$k] : '');
|
||||
|
||||
$output .= View::factory('setup/admin/module/foot');
|
||||
|
||||
$output .= Form::submit('submit',_('Submit'),array('class'=>'form_button'));
|
||||
$output .= Form::close();
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',strtoupper($module),_('Configuration')),
|
||||
'body'=>$output,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
38
application/classes/Controller/TemplateDefault/Affiliate.php
Normal file
38
application/classes/Controller/TemplateDefault/Affiliate.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB User Main home page controller
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Page/Affiliate
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault_Affiliate extends Controller_TemplateDefault_User {
|
||||
/**
|
||||
* This will filter a search query to only return the affiliates
|
||||
*/
|
||||
protected function filter($o,$af,$sort='account->name()',$afid='affiliate_id') {
|
||||
$result = array();
|
||||
|
||||
foreach ($o as $x) {
|
||||
if (isset($x->$afid)) {
|
||||
if ($x->$afid == $af)
|
||||
array_push($result,$x);
|
||||
|
||||
} elseif (method_exists($x,'list_affiliates')) {
|
||||
if (in_array($af,$x->list_affiliates()))
|
||||
array_push($result,$x);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($sort)
|
||||
Sort::MAsort($result,$sort);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
44
application/classes/Controller/TemplateDefault/User.php
Normal file
44
application/classes/Controller/TemplateDefault/User.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* lnApp User Main home page controller
|
||||
*
|
||||
* @package lnApp
|
||||
* @subpackage Page/User
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Controller_TemplateDefault_User extends Controller_TemplateDefault {
|
||||
protected $auth_required = TRUE;
|
||||
|
||||
// Our acccount object
|
||||
protected $ao;
|
||||
|
||||
public function before() {
|
||||
// If our action doesnt exist, no point processing any further.
|
||||
if (! method_exists($this,'action_'.Request::current()->action()))
|
||||
return;
|
||||
|
||||
if (! count($this->secure_actions) OR (! isset($this->secure_actions[Request::current()->action()])))
|
||||
throw new Kohana_Exception('Class has no security defined :class, or no security configured for :method',array(':class'=>get_class($this),':method'=>Request::current()->action()));
|
||||
|
||||
parent::before();
|
||||
|
||||
$this->ao = Auth::instance()->get_user();
|
||||
if (is_string($this->ao) OR ! $this->ao->loaded())
|
||||
throw new Kohana_Exception('Account doesnt exist :account ?',array(':account'=>is_string($this->ao) ? $this->ao : Auth::instance()->get_user()->id));
|
||||
}
|
||||
|
||||
public function after() {
|
||||
$dc = 'welcome/index';
|
||||
$m = sprintf('%s/%s',Request::current()->directory(),Request::current()->controller());
|
||||
|
||||
BreadCrumb::URL(Request::current()->directory(),sprintf('%s/%s',Request::current()->directory(),$dc),FALSE);
|
||||
BreadCrumb::URL($m,method_exists($this,'action_menu') ? $m.'/menu' : sprintf('%s/%s',Request::current()->directory(),$dc),FALSE);
|
||||
|
||||
parent::after();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user