Major updates from other projects
This commit is contained in:
parent
7961e60901
commit
b657781a5b
4
classes/Site.php
Normal file
4
classes/Site.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
class Site extends lnApp_Site {}
|
||||
?>
|
@ -39,8 +39,8 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
protected $ao;
|
||||
|
||||
public function __construct(Request $request, Response $response) {
|
||||
if (Config::theme())
|
||||
$this->template = Config::theme().'/page';
|
||||
if (Site::Theme())
|
||||
$this->template = Site::Theme().'/page';
|
||||
|
||||
return parent::__construct($request,$response);
|
||||
}
|
||||
@ -150,7 +150,7 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
|
||||
public function after() {
|
||||
if ($this->auto_render) {
|
||||
$this->template->navbar = $this->template->shownavbar ? View::factory('pages/navbar') : '';
|
||||
$this->template->navbar = $this->template->shownavbar ? View::factory(Site::Theme().'/navbar') : '';
|
||||
|
||||
if (empty($this->template->content))
|
||||
$this->template->content = Block::factory()->render_all();
|
||||
@ -159,12 +159,6 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
if (isset(URL::$method_directory[strtolower($this->request->directory())]))
|
||||
BreadCrumb::name(URL::$method_directory[strtolower($this->request->directory())],$this->request->directory());
|
||||
|
||||
// Application Title
|
||||
if (class_exists('Model_Module') AND $mo=ORM::factory('Module',array('name'=>Request::current()->controller())) AND $mo->loaded())
|
||||
$this->meta->title = sprintf('%s: %s',Kohana::$config->load('config')->appname,$mo->display('name'));
|
||||
else
|
||||
$this->meta->title = Kohana::$config->load('config')->appname;
|
||||
|
||||
// Description
|
||||
$this->meta->description = sprintf('%s::%s',$this->request->controller(),$this->request->action());
|
||||
|
||||
|
@ -24,7 +24,7 @@ abstract class lnApp_HTTP_Exception extends Kohana_HTTP_Exception {
|
||||
$output .= '</div>';
|
||||
$output .= '</div></div></div>';
|
||||
|
||||
$view = View::factory(Config::theme().'/page')
|
||||
$view = View::factory(Site::Theme().'/page')
|
||||
->set('meta',new Meta)
|
||||
->set('navbar','')
|
||||
->set('content',$output);
|
||||
|
@ -43,6 +43,10 @@ class lnApp_Menu {
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function mainnav() {
|
||||
return Kohana::$config->load('mainnav');
|
||||
}
|
||||
|
||||
public static function ul($type,array $result,array $append=NULL,$sub=FALSE,$method=NULL) {
|
||||
$output = $sub ? '<ul class="dropdown-menu">' : '<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">';
|
||||
|
||||
|
@ -29,14 +29,5 @@ abstract class lnApp_Meta {
|
||||
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
|
||||
public function secure() {
|
||||
static $secure = NULL;
|
||||
|
||||
if (! $secure AND Request::current())
|
||||
$secure = Request::current()->secure() ? 'https://' : 'http://';
|
||||
|
||||
return $secure;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -6,7 +6,7 @@
|
||||
* This file contains enhancements for Kohana, that should be considered upstream and maybe havent been yet.
|
||||
* It also contains some functionality for OSB, which cannot be covered in ORM_OSB.
|
||||
*
|
||||
* @package WWZ
|
||||
* @package lnApp
|
||||
* @category Modifications
|
||||
* @author Deon George
|
||||
* @copyright (c) 2014 Deon George
|
||||
@ -18,12 +18,95 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
private $_object_formated = array();
|
||||
private $_formated = FALSE;
|
||||
|
||||
protected $_created_column = array('column'=>'date_orig','format'=>TRUE);
|
||||
protected $_updated_column = array('column'=>'date_last','format'=>TRUE);
|
||||
|
||||
// Our filters used to display values in a friendly format
|
||||
protected $_display_filters = array();
|
||||
|
||||
// Our attributes used in forms.
|
||||
protected $_form = array();
|
||||
|
||||
// Our attribute blobs that should be compressed
|
||||
protected $_compress_column = array();
|
||||
|
||||
// Our attributes that should be converted to NULL when empty
|
||||
protected $_nullifempty = array();
|
||||
|
||||
// Our attribute values that need to be stored as serialized
|
||||
protected $_serialize_column = array();
|
||||
|
||||
// If we need to load any sub items on loading this model
|
||||
protected $_sub_items = array();
|
||||
protected $_sub_items_load = array();
|
||||
protected $_sub_items_sorted = FALSE;
|
||||
|
||||
// Whether to show a SystemMessage when a record is saved.
|
||||
protected $_save_message = FALSE;
|
||||
|
||||
/**
|
||||
* Auto process some data as it comes from the database
|
||||
* @see parent::__get()
|
||||
*/
|
||||
public function __get($column) {
|
||||
if (array_key_exists($column,$this->_table_columns)) {
|
||||
// If the column is a blob, we'll decode it automatically
|
||||
if (
|
||||
$this->_table_columns[$column]['data_type'] == 'blob'
|
||||
AND in_array($column,$this->_compress_column)
|
||||
AND ! is_null($this->_object[$column])
|
||||
AND ! isset($this->_changed[$column])
|
||||
AND (! isset($this->_table_columns[$column]['auto_convert']) OR ! $this->_table_columns[$column]['auto_convert'])
|
||||
) {
|
||||
|
||||
// In case our blob hasnt been saved as one.
|
||||
try {
|
||||
$this->_object[$column] = $this->_blob($this->_object[$column]);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
HTTP_Exception::factory(501,Kohana_Exception::text($e));
|
||||
}
|
||||
|
||||
$this->_table_columns[$column]['auto_convert'] = TRUE;
|
||||
}
|
||||
|
||||
// If the column is a serialized object, we'll unserialize it.
|
||||
if (
|
||||
in_array($column,$this->_serialize_column)
|
||||
AND is_string($this->_object[$column])
|
||||
AND ! is_null($this->_object[$column])
|
||||
AND ! isset($this->_changed[$column])
|
||||
AND (! isset($this->_table_columns[$column]['unserialized']) OR ! $this->_table_columns[$column]['unserialized'])
|
||||
) {
|
||||
|
||||
// In case our object hasnt been saved as serialized.
|
||||
try {
|
||||
$this->_object[$column] = unserialize($this->_object[$column]);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
HTTP_Exception::factory(501,Kohana_Exception::text($e));
|
||||
}
|
||||
|
||||
$this->_table_columns[$column]['unserialized'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::__get($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve and Store DB BLOB data in compressed format.
|
||||
*/
|
||||
private function _blob($data,$set=FALSE) {
|
||||
try {
|
||||
return $set ? gzcompress($this->_serialize($data,$set)) : $this->_serialize(gzuncompress($data));
|
||||
|
||||
// Maybe the data isnt compressed?
|
||||
} catch (Exception $e) {
|
||||
return $this->_serialize($data,$set);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format fields for display purposes
|
||||
*
|
||||
@ -37,6 +120,57 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
$this->_formated = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept our object load, so that we can load our subitems
|
||||
*/
|
||||
protected function _load_values(array $values) {
|
||||
parent::_load_values($values);
|
||||
|
||||
$sort = FALSE;
|
||||
if ($this->_loaded AND $this->_sub_items_load AND count($this->_sub_items_load) == 1)
|
||||
foreach ($this->_sub_items_load as $item => $sort)
|
||||
$this->_sub_items = $this->$item->find_all()->as_array();
|
||||
|
||||
if ($sort) {
|
||||
Sort::MAsort($this->_sub_items,$sort);
|
||||
$this->_sub_items_sorted = TRUE;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a column is marked to be nullified if it is empty, this is where it is done.
|
||||
*/
|
||||
private function _nullifempty(array $array) {
|
||||
foreach ($array as $k=>$v) {
|
||||
if (is_array($v)) {
|
||||
if (is_null($x=$this->_nullifempty($v)))
|
||||
unset($array[$k]);
|
||||
else
|
||||
$array[$k] = $x;
|
||||
|
||||
} elseif (! $v AND $v !== 0 AND $v !== '0')
|
||||
unset($array[$k]);
|
||||
|
||||
}
|
||||
|
||||
return count($array) ? $array : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try and (un)serialize our data, and if it fails, just return it.
|
||||
*/
|
||||
private function _serialize($data,$set=FALSE) {
|
||||
try {
|
||||
return $set ? serialize($data) : unserialize($data);
|
||||
|
||||
// Maybe the data serialized?
|
||||
} catch (Exception $e) {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides Kohana cache so that it can be globally disabled.
|
||||
*/
|
||||
@ -164,6 +298,27 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
}
|
||||
|
||||
public function save(Validation $validation=NULL) {
|
||||
// Find any fields that have changed, and process them.
|
||||
if ($this->_changed)
|
||||
foreach ($this->_changed as $c) {
|
||||
// Any fields that are blobs, and encode them.
|
||||
if (! is_null($this->_object[$c]) AND $this->_table_columns[$c]['data_type'] == 'blob' AND in_array($c,$this->_compress_column)) {
|
||||
$this->_object[$c] = $this->_blob($this->_object[$c],TRUE);
|
||||
|
||||
// We need to reset our auto_convert flag
|
||||
if (isset($this->_table_columns[$c]['auto_convert']))
|
||||
$this->_table_columns[$c]['auto_convert'] = FALSE;
|
||||
|
||||
// Any fields that should be seriailzed, we'll do that.
|
||||
} elseif (is_array($this->_object[$c]) AND in_array($c,$this->_serialize_column)) {
|
||||
$this->_object[$c] = serialize($this->_object[$c]);
|
||||
}
|
||||
|
||||
// Test if the value has still changed
|
||||
if ($this->_original_values AND $this->_object[$c] == $this->_original_values[$c])
|
||||
unset($this->_changed[$c]);
|
||||
}
|
||||
|
||||
parent::save();
|
||||
|
||||
if ($this->saved() AND $this->_save_message AND (PHP_SAPI !== 'cli'))
|
||||
@ -175,10 +330,26 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function subitems() {
|
||||
return $this->_sub_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the Kohana processing so we can null values if required.
|
||||
* We override this function, because we do set our own primary key value
|
||||
*/
|
||||
public function values(array $values, array $expected = NULL) {
|
||||
foreach ($values as $k=>$v) {
|
||||
// Convert to NULL
|
||||
if (in_array($k,$this->_nullifempty)) {
|
||||
if (is_array($v))
|
||||
$values[$k] = $this->_nullifempty($v);
|
||||
|
||||
elseif (! $v AND $v !== 0 AND $v !== '0')
|
||||
$values[$k] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
parent::values($values,$expected);
|
||||
|
||||
if (isset($values[$this->_primary_key]))
|
||||
@ -186,5 +357,16 @@ abstract class lnApp_ORM extends Kohana_ORM {
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function what_changed() {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->changed() as $k) {
|
||||
$result[$k]['old'] = ($x=Arr::get($this->_original_values,$k)) ? $x : serialize($x);
|
||||
$result[$k]['new'] = ($x=Arr::get($this->_object,$k)) ? $x : serialize($x);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
70
classes/lnApp/Site.php
Normal file
70
classes/lnApp/Site.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class is for site level configuration
|
||||
*
|
||||
* @package lnApp
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class lnApp_Site {
|
||||
/**
|
||||
* Return our application name
|
||||
*/
|
||||
public static function Appname() {
|
||||
return Kohana::$config->load('config')->appname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a date using a site configured format
|
||||
*/
|
||||
public static function Date($date) {
|
||||
return (is_null($date) OR ! $date) ? '' : date(Kohana::$config->load('config')->date_format,$date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a date using a site configured format
|
||||
* @note We need this function here, since we call self:: methods, which need to resolve to the child class.
|
||||
*/
|
||||
public static function Datetime($date) {
|
||||
return sprintf('%s %s',self::Date($date),self::Time($date));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the site configured language
|
||||
*/
|
||||
public static function Language() {
|
||||
return Kohana::$config->load('config')->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the protocol that the site is using
|
||||
*
|
||||
* @param string URL to be included in the return
|
||||
*/
|
||||
public static function Protocol($url='') {
|
||||
static $secure = NULL;
|
||||
|
||||
if (! $secure AND Request::current())
|
||||
$secure = Request::current()->secure() ? 'https://' : 'http://';
|
||||
|
||||
return $secure.($url ? $url : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the site theme
|
||||
*/
|
||||
public static function Theme() {
|
||||
return 'theme/'.Kohana::$config->load('config')->theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a time using a site configured format
|
||||
*/
|
||||
public static function Time($date) {
|
||||
return date(Kohana::$config->load('config')->date_format,($date ? $date : time()));
|
||||
}
|
||||
}
|
||||
?>
|
@ -13,8 +13,6 @@ abstract class lnApp_URL extends Kohana_URL {
|
||||
// Our method paths for different functions
|
||||
public static $method_directory = array(
|
||||
'admin'=>'a',
|
||||
'reseller'=>'r',
|
||||
'affiliate'=>'f',
|
||||
'user'=>'u',
|
||||
);
|
||||
|
||||
@ -64,11 +62,7 @@ abstract class lnApp_URL extends Kohana_URL {
|
||||
case 'admin': $result[$k] = array('name'=>'Administrator','icon'=>'icon-globe');
|
||||
break;
|
||||
|
||||
case 'affiliate':
|
||||
case 'reseller': $result[$k] = array('name'=>'Reseller','icon'=>'icon-th-list');
|
||||
break;
|
||||
|
||||
case 'user': $result[$k] = array('name'=>Auth::instance()->get_user()->name(),'icon'=>'icon-user');
|
||||
case 'user': $result[$k] = array('name'=>class_exists('Auth') ? Auth::instance()->get_user()->name() : 'Guest','icon'=>'icon-user');
|
||||
break;
|
||||
|
||||
default: $result[$k] = array('name'=>$k,'icon'=>'icon-question-sign');
|
||||
|
@ -11,10 +11,10 @@
|
||||
*/
|
||||
|
||||
return array(
|
||||
'appname' => '',
|
||||
'cache_type' => 'file',
|
||||
'date_format' => 'd-M-Y',
|
||||
'language' => 'auto',
|
||||
'method_security' => FALSE,
|
||||
'theme' => 'bootstrap',
|
||||
'time_format' => 'H:i:s',
|
||||
);
|
||||
?>
|
||||
|
19
config/debug.php
Normal file
19
config/debug.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* WWZ Configuration - Debug Settings
|
||||
*
|
||||
* @package lnApp
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010-2013 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
|
||||
return array
|
||||
(
|
||||
'ajax'=>FALSE, // AJAX actions can only be run by ajax calls if set to FALSE
|
||||
'etag'=>FALSE, // Force generating ETAGS
|
||||
'site'=>FALSE, // Glogal site debug
|
||||
);
|
||||
?>
|
16
config/mainnav.php
Normal file
16
config/mainnav.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* lnApp system default configurable items.
|
||||
*
|
||||
* @package lnApp
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010-2013 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
|
||||
return array(
|
||||
// 'Nav Item' => array('icon'=>'icon-edit','url'=>URL::site('welcome')),
|
||||
);
|
||||
?>
|
@ -1,13 +1,13 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* OSB Configuration - Pagination Driver
|
||||
* lnApp Configuration - Pagination Driver
|
||||
*
|
||||
* @package OSB
|
||||
* @package lnApp
|
||||
* @category Configuration
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
* @copyright (c) 2014 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
|
||||
return array(
|
||||
|
0
media/js/custom.js
Normal file
0
media/js/custom.js
Normal file
10
views/theme/baseadmin/navbar.php
Normal file
10
views/theme/baseadmin/navbar.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php foreach (URL::navbar() as $type => $details) :
|
||||
if ($x = Menu::items($type)) : ?>
|
||||
<ul class="nav pull-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="<?php echo $details['icon']; ?>"></i> <?php echo $details['name']; ?> <b class="caret"></b></a>
|
||||
<?php echo Menu::ul($type,$x,$type == 'user' ? array('logout'=>'Logout') : NULL); ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif;
|
||||
endforeach ?>
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $meta->title; ?></title>
|
||||
<title><?php echo Site::Appname(); ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||
@ -19,12 +19,12 @@
|
||||
echo HTML::style('media/theme/bootstrap/css/bootstrap-responsive.min.css');
|
||||
echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css');
|
||||
} else {
|
||||
echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css');
|
||||
echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css');
|
||||
echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css');
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'));
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'));
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'));
|
||||
}
|
||||
|
||||
echo HTML::style($meta->secure().'fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800');
|
||||
echo HTML::style(Site::Protocol('fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'));
|
||||
echo HTML::style('media/css/ui-lightness/jquery-ui-1.10.0.custom.min.css');
|
||||
echo HTML::style('media/theme/baseadmin/css/base-admin-2.css');
|
||||
echo HTML::style('media/theme/baseadmin/css/base-admin-2-responsive.css');
|
||||
@ -39,13 +39,14 @@
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><i class="icon-cog"></i> </a>
|
||||
<a class="brand" href="<?php echo URL::site(); ?>"><?php echo Config::sitename(); ?><sup></sup></a>
|
||||
<a class="brand" href="<?php echo URL::site(); ?>"><?php echo Site::Appname(); ?><sup></sup></a>
|
||||
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav pull-right">
|
||||
<?php echo $navbar; ?>
|
||||
</ul>
|
||||
|
||||
<?php if (class_exists('Controller_Search')) : ?>
|
||||
<div class="navbar-search pull-right">
|
||||
<div class="navbar-search-addon">
|
||||
<i class="icon-search"></i>
|
||||
@ -53,6 +54,7 @@
|
||||
<input type="text" name="search-query" class="search-query" placeholder="Search" data-provide="typeahead">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div><!--/.nav-collapse -->
|
||||
|
||||
</div> <!-- /container -->
|
||||
@ -69,13 +71,18 @@
|
||||
<div class="subnav-collapse collapse">
|
||||
<ul class="mainnav">
|
||||
<li class="">
|
||||
<a href="<?php echo URL::link('user','welcome',TRUE); ?>"><i class="icon-home"></i> <span>Home</span></a>
|
||||
<a href="<?php echo URL::site('welcome'); ?>"><i class="icon-home"></i><span>Home</span></a>
|
||||
</li>
|
||||
<?php if (($ao = Auth::instance()->get_user()) AND $ao->isAdmin()) : ?>
|
||||
<?php if (class_exists('Auth') AND ($ao = Auth::instance()->get_user()) AND $ao->isAdmin()) : ?>
|
||||
<li class="">
|
||||
<a href="<?php echo URL::link('admin','welcome',TRUE); ?>"><i class="icon-tasks"></i> <span>Admin</span></a>
|
||||
<a href="<?php echo URL::link('admin','welcome',TRUE); ?>"><i class="icon-tasks"></i><span>Admin</span></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php foreach (Menu::mainnav() as $name => $attributes) : ?>
|
||||
<li class="">
|
||||
<a href="<?php echo Arr::get($attributes,'url'); ?>"><i class="<?php echo Arr::get($attributes,'icon','icon-asterisk'); ?>"></i><span><?php echo $name; ?></span></a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div> <!-- /.subnav-collapse -->
|
||||
</div> <!-- /container -->
|
||||
@ -107,9 +114,9 @@
|
||||
echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js');
|
||||
echo HTML::script('media/js/lodash/lodash-1.2.1.min.js');
|
||||
} else {
|
||||
echo HTML::script($meta->secure().'code.jquery.com/jquery-1.9.1.min.js');
|
||||
echo HTML::script($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js');
|
||||
echo HTML::script($meta->secure().'cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js');
|
||||
echo HTML::script(Site::Protocol('code.jquery.com/jquery-1.9.1.min.js'));
|
||||
echo HTML::script(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'));
|
||||
echo HTML::script(Site::Protocol('cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js'));
|
||||
}
|
||||
|
||||
echo HTML::script('media/theme/baseadmin/js/backtotop.js');
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?php foreach (URL::navbar() as $type => $details) : ?>
|
||||
<?php if ($x = Menu::items($type)) : ?>
|
||||
<ul class="nav pull-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="<?php echo $details['icon']; ?>"></i> <?php echo $details['name']; ?> <b class="caret"></b></a>
|
||||
<?php echo Menu::ul($type,$x,$type == 'user' ? array('logout'=>'Logout') : NULL); ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
10
views/theme/bootstrap/navbar.php
Normal file
10
views/theme/bootstrap/navbar.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php foreach (URL::navbar() as $type => $details) :
|
||||
if ($x = Menu::items($type)) : ?>
|
||||
<ul class="nav pull-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="<?php echo $details['icon']; ?>"></i> <?php echo $details['name']; ?> <b class="caret"></b></a>
|
||||
<?php echo Menu::ul($type,$x,$type == 'user' ? array('logout'=>'Logout') : NULL); ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endif;
|
||||
endforeach ?>
|
@ -1,53 +1,128 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $meta->title; ?></title>
|
||||
<title><?php echo Site::Appname(); ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||
|
||||
<meta name="keywords" content="<?php echo $meta->keywords; ?>" />
|
||||
<meta name="description" content="<?php echo $meta->description; ?>" />
|
||||
<meta name="copyright" content="<?php echo Config::copywrite(); ?>" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Bootstrap -->
|
||||
<?php echo HTML::style('media/theme/bootstrap/css/bootstrap.min.css',array('media'=>'screen')); ?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
|
||||
<?php
|
||||
if (Kohana::$environment >= Kohana::TESTING OR Request::current()->secure()) {
|
||||
echo HTML::style('media/theme/bootstrap/css/bootstrap.min.css');
|
||||
echo HTML::style('media/theme/bootstrap/css/bootstrap-responsive.min.css');
|
||||
echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css');
|
||||
} else {
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'));
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'));
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'));
|
||||
}
|
||||
|
||||
echo HTML::style(Site::Protocol('fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'));
|
||||
echo HTML::style('media/css/ui-lightness/jquery-ui-1.10.0.custom.min.css');
|
||||
echo Style::factory()->render_all();
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
body { padding-top: 50px; padding-bottom: 10px; }
|
||||
</style>
|
||||
|
||||
<?php #echo Style::factory(); ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php if (! empty($shownavbar)) : ?>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><i class="icon-cog"></i> </a>
|
||||
<a class="brand" href="<?php echo URL::site(); ?>"><?php echo Site::Appname(); ?><sup></sup></a>
|
||||
|
||||
<a class="brand" href="#"><?php echo $meta->title; ?></a>
|
||||
</div><!-- container -->
|
||||
</div><!-- navbar-inner -->
|
||||
</div><!-- navbar -->
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav pull-right">
|
||||
<?php echo $navbar; ?>
|
||||
</ul>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span9 offset3">
|
||||
<p><?php echo $content; ?></p>
|
||||
</div><!-- span12 -->
|
||||
</div><!-- row -->
|
||||
<?php if (class_exists('Controller_Search')) : ?>
|
||||
<div class="navbar-search pull-right">
|
||||
<div class="navbar-search-addon">
|
||||
<i class="icon-search"></i>
|
||||
<?php echo HTML::image('media/img/spinner.gif',array('class'=>'right','name'=>'searching')); ?>
|
||||
<input type="text" name="search-query" class="search-query" placeholder="Search" data-provide="typeahead">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div><!--/.nav-collapse -->
|
||||
|
||||
<hr>
|
||||
</div> <!-- /container -->
|
||||
</div> <!-- /navbar-inner -->
|
||||
</div> <!-- /nvarbar -->
|
||||
|
||||
<footer>
|
||||
<p><?php echo $footer; ?></p>
|
||||
</footer>
|
||||
</div><!-- container -->
|
||||
<script src="http://code.jquery.com/jquery.min.js"></script>
|
||||
<?php echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js'); ?>
|
||||
<?php echo Script::factory(); ?>
|
||||
<div class="subnavbar">
|
||||
<div class="subnavbar-inner">
|
||||
<div class="container">
|
||||
<a class="btn-subnavbar collapsed" data-toggle="collapse" data-target=".subnav-collapse">
|
||||
<i class="icon-reorder"></i>
|
||||
</a>
|
||||
|
||||
<div class="subnav-collapse collapse">
|
||||
<ul class="mainnav">
|
||||
<li class="">
|
||||
<a href="<?php echo URL::site('welcome'); ?>"><i class="icon-home"></i><span>Home</span></a>
|
||||
</li>
|
||||
<?php if (class_exists('Auth') AND ($ao = Auth::instance()->get_user()) AND $ao->isAdmin()) : ?>
|
||||
<li class="">
|
||||
<a href="<?php echo URL::link('admin','welcome',TRUE); ?>"><i class="icon-tasks"></i><span>Admin</span></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php foreach (Menu::mainnav() as $name => $attributes) : ?>
|
||||
<li class="">
|
||||
<a href="<?php echo Arr::get($attributes,'url'); ?>"><i class="<?php echo Arr::get($attributes,'icon','icon-asterisk'); ?>"></i><span><?php echo $name; ?></span></a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div> <!-- /.subnav-collapse -->
|
||||
</div> <!-- /container -->
|
||||
</div> <!-- /subnavbar-inner -->
|
||||
</div> <!-- /subnavbar -->
|
||||
<?php endif ?>
|
||||
|
||||
<div class="error_container">
|
||||
<div class="error_details">
|
||||
<div class="row">
|
||||
<div class="span10 offset2">
|
||||
<?php echo SystemMessage::factory()->render_all(); ?>
|
||||
</div>
|
||||
</div> <!-- /row -->
|
||||
</div> <!-- /error_details -->
|
||||
</div> <!-- /error_container -->
|
||||
|
||||
<div class="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php echo $content; ?>
|
||||
</div> <!-- /row -->
|
||||
</div> <!-- /container -->
|
||||
</div> <!-- /main -->
|
||||
|
||||
<?php
|
||||
if (Kohana::$environment >= Kohana::TESTING OR Request::current()->secure()) {
|
||||
echo HTML::script('media/js/jquery/jquery-1.9.1.min.js');
|
||||
echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js');
|
||||
echo HTML::script('media/js/lodash/lodash-1.2.1.min.js');
|
||||
} else {
|
||||
echo HTML::script(Site::Protocol('code.jquery.com/jquery-1.9.1.min.js'));
|
||||
echo HTML::script(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'));
|
||||
echo HTML::script(Site::Protocol('cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js'));
|
||||
}
|
||||
|
||||
echo HTML::script('media/theme/baseadmin/js/backtotop.js');
|
||||
echo HTML::script('media/js/search.js');
|
||||
echo HTML::script('media/js/custom.js');
|
||||
echo Script::factory()->render_all();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<ul id="main-nav">
|
||||
<li class="active"><a href="<?php echo URL::site(''); ?>">Home</a></li>
|
||||
<?php if ($x = Company::instance()->faq()) : ?>
|
||||
<?php if (class_exists('Company') AND $x=Company::instance()->faq()) : ?>
|
||||
<li><a href="<?php echo $x; ?>">Faq</a></li>
|
||||
<?php endif ?>
|
||||
<?php if (Auth::instance()->logged_in()) : ?>
|
||||
<?php if (class_exists('Auth') AND Auth::instance()->logged_in()) : ?>
|
||||
<li><a href="<?php echo URL::site('login'); ?>">Customer Login</a></li>
|
||||
<?php else : ?>
|
||||
<li><a href="<?php echo URL::site('login'); ?>" data-toggle="modal" data-target="#modal-login">Customer Login</a></li>
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $meta->title; ?></title>
|
||||
<title><?php echo Site::Appname(); ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $meta->shortcut_icon ? $meta->shortcut_icon : '/favicon.ico' ?>" type="image/vnd.microsoft.icon" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="Content-Language" content="<?php echo $meta->language; ?>" />
|
||||
@ -14,17 +14,17 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<?php
|
||||
if (Kohana::$environment >= Kohana::TESTING) {
|
||||
if (Kohana::$environment >= Kohana::TESTING OR Request::current()->secure()) {
|
||||
echo HTML::style('media/theme/bootstrap/css/bootstrap.min.css');
|
||||
echo HTML::style('media/theme/bootstrap/css/bootstrap-responsive.min.css');
|
||||
echo HTML::style('media/vendor/font-awesome/css/font-awesome.min.css');
|
||||
} else {
|
||||
echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css');
|
||||
echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css');
|
||||
echo HTML::style($meta->secure().'netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css');
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css'));
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css'));
|
||||
echo HTML::style(Site::Protocol('netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css'));
|
||||
}
|
||||
|
||||
echo HTML::style($meta->secure().'fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800');
|
||||
echo HTML::style(Site::Protocol('fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,800italic,400,600,800'));
|
||||
echo HTML::style('media/theme/focusbusiness/css/focus-1.1.css');
|
||||
echo HTML::style('media/theme/focusbusiness/css/focus-1.1-responsive.css');
|
||||
echo HTML::style('media/theme/focusbusiness/css/custom.css');
|
||||
@ -35,14 +35,16 @@
|
||||
<body>
|
||||
<div id="wrapper" class="clearfix">
|
||||
<div id="header">
|
||||
<h1 id="title"><a href="<?php echo URL::site('/'); ?>"><?php echo Config::sitename(); ?><sup>+</sup></a></h1>
|
||||
<h1 id="title"><a href="<?php echo URL::site('/'); ?>"><?php echo Site::Appname(); ?><sup>+</sup></a></h1>
|
||||
</div> <!-- /header -->
|
||||
|
||||
<?php if (! empty($shownavbar)) : ?>
|
||||
<div id="nav" class="clearfix">
|
||||
<div class="container">
|
||||
<?php echo $navbar; ?>
|
||||
</div> <!-- /container -->
|
||||
</div> <!-- /nav -->
|
||||
<?php endif ?>
|
||||
|
||||
<div id="content">
|
||||
<?php echo $content; ?>
|
||||
@ -76,12 +78,14 @@
|
||||
|
||||
<div class="grid-4">
|
||||
<h3><span class="slash">//</span> Contact Us</h3>
|
||||
<?php if (class_exists('Company')) : ?>
|
||||
<address>
|
||||
<strong><?php echo Company::instance()->name(); ?></strong><br/>
|
||||
<i class="icon-map-marker"></i> <?php echo Company::instance()->address(); ?><br/>
|
||||
<i class="icon-phone"></i> <?php echo Company::instance()->phone(); ?><br/>
|
||||
<i class="icon-envelope"></i> <?php echo Company::instance()->email(); ?>
|
||||
</address>
|
||||
<?php endif ?>
|
||||
</div> <!-- /grid-4 -->
|
||||
|
||||
</div> <!-- /row -->
|
||||
@ -89,12 +93,12 @@
|
||||
</div> <!-- /footer -->
|
||||
</div> <!-- /wrapper -->
|
||||
<?php
|
||||
if (Kohana::$environment >= Kohana::TESTING) {
|
||||
if (Kohana::$environment >= Kohana::TESTING OR Request::current()->secure()) {
|
||||
echo HTML::script('media/js/jquery/jquery-1.9.1.min.js');
|
||||
echo HTML::script('media/theme/bootstrap/js/bootstrap.min.js');
|
||||
} else {
|
||||
echo HTML::script($meta->secure().'code.jquery.com/jquery-1.9.1.min.js');
|
||||
echo HTML::script($meta->secure().'netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js');
|
||||
echo HTML::script(Site::Protocol('code.jquery.com/jquery-1.9.1.min.js'));
|
||||
echo HTML::script(Site::Protocol('netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'));
|
||||
}
|
||||
|
||||
echo HTML::script('media/theme/focusbusiness/js/focus.js');
|
||||
|
Reference in New Issue
Block a user