Themeing work based on bootstrap
This commit is contained in:
@@ -12,8 +12,49 @@
|
||||
abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = ' » ';
|
||||
protected static $_c = 0;
|
||||
protected $_items = array('body');
|
||||
|
||||
protected static $_required_keys = array('body');
|
||||
|
||||
/**
|
||||
* Enable a friendly name to be used for a path
|
||||
*/
|
||||
public static function name($path,$name,$override=TRUE) {
|
||||
if (isset(static::$_data['name'][$path]) AND ! $override)
|
||||
return;
|
||||
|
||||
static::$_data['name'][$path] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this BreadCrumb
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '<article class="breadcrumbs">';
|
||||
$output .= HTML::anchor('/',_('Home'));
|
||||
|
||||
$data = empty(static::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : static::$_data['path'];
|
||||
|
||||
$c = count($data);
|
||||
$i=0;
|
||||
foreach ($data as $k => $v) {
|
||||
$i++;
|
||||
|
||||
$output .= '<div class="breadcrumb_divider"></div>';
|
||||
$p = join('/',array_slice($data,0,$k+1));
|
||||
$output .= $i==$c ? '<span id="active">' : '<span id="inactive">';
|
||||
$output .= HTML::anchor(
|
||||
(empty(static::$_data['url'][$p]) ? $p : static::$_data['url'][$p]),
|
||||
(empty(static::$_data['name'][$p]) ? ucfirst(URL::dir($v)) : static::$_data['name'][$p])
|
||||
);
|
||||
$output .= '</span>';
|
||||
}
|
||||
|
||||
$output .= '</article>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the BreadCrumb path
|
||||
*
|
||||
@@ -30,20 +71,6 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
throw new Kohana_Exception('Path is not a string, nor an array');
|
||||
}
|
||||
|
||||
public static function dump() {
|
||||
echo Debug::vars(static::$_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable a friendly name to be used for a path
|
||||
*/
|
||||
public static function name($path,$name,$override=TRUE) {
|
||||
if (isset(static::$_data['name'][$path]) AND ! $override)
|
||||
return;
|
||||
|
||||
static::$_data['name'][$path] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable specifying the URL for a path
|
||||
*/
|
||||
@@ -56,41 +83,5 @@ abstract class lnApp_BreadCrumb extends HTMLRender {
|
||||
|
||||
static::$_data['url'][$path] = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return BreadCrumb
|
||||
*/
|
||||
public static function factory() {
|
||||
return new BreadCrumb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this BreadCrumb
|
||||
*/
|
||||
protected function render() {
|
||||
$output = '<ul id="breadcrumb">';
|
||||
$output .= '<li>'.HTML::anchor('/',_('Home')).'</li>';
|
||||
|
||||
$data = empty(static::$_data['path']) ? explode('/',preg_replace('/^\//','',Request::detect_uri())) : static::$_data['path'];
|
||||
|
||||
$c = count($data);
|
||||
$i=0;
|
||||
foreach ($data as $k => $v) {
|
||||
$i++;
|
||||
|
||||
$p = join('/',array_slice($data,0,$k+1));
|
||||
$output .= $i==$c ? '<li id="active">' : '<li>';
|
||||
$output .= HTML::anchor(
|
||||
(empty(static::$_data['url'][$p]) ? $p : static::$_data['url'][$p]),
|
||||
(empty(static::$_data['name'][$p]) ? ucfirst(URL::dir($v)) : static::$_data['name'][$p])
|
||||
);
|
||||
$output .= '</li>';
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user