Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KHIT93 committed Feb 11, 2015
1 parent 407c991 commit ac2bf55
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
25 changes: 21 additions & 4 deletions application/helpers/menu_helper.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?php
function traverse($array, $class = NULL, $toggle = false) {
function traverse($array, $class = 'nav navbar-nav', $toggle = false) {
$active = get_instance()->uri->uri_string;
$str = '<ul class="'.$class.'">';
foreach($array as $item) {
if($active == $item['link']) {
$str .= '<li class="active"><a href="'.$item['link'].'"'.(isset($item['children'])&&$toggle==true?' class="dropdown-toggle" data-toggle="dropdown"':'').'>'.$item['title'].'</a>'.(isset($item['children'])&&$item['children']?traverse($item['children'], 'dropdown-menu'):'').'</li>';
$str .= '<li class="active'.((isset($item['children'])) ? ' dropdown' : '').'"><a href="'.$item['link'].'"'.(isset($item['children'])&&$toggle==true?' class="dropdown-toggle" data-toggle="dropdown" role="button"':'').'>'.$item['title'].'</a>'.(isset($item['children'])&&$item['children']?traverse($item['children'], 'dropdown-menu'):'').'</li>';
}
else {
$str .= '<li><a href="'.$item['link'].'"'.(isset($item['children'])&&$toggle==true?' class="dropdown-toggle" data-toggle="dropdown"':'').'>'.$item['title'].'</a>'.(isset($item['children'])&&$item['children']?traverse($item['children'], 'dropdown-menu'):'').'</li>';
$str .= '<li class="'.((isset($item['children'])) ? 'dropdown' : '').'"><a href="'.$item['link'].'"'.(isset($item['children'])&&$toggle==true?' class="dropdown-toggle" data-toggle="dropdown" role="button"':'').'>'.$item['title'].'</span></a>'.(isset($item['children'])&&$item['children']?traverse($item['children'], 'dropdown-menu'):'').'</li>';
}
}
$str .= '</ul>';
return $str;
}
function sidebar_traverse($array, $class = NULL, $toggle = false) {
$active = get_instance()->uri->uri_string;
$CI =& get_instance();
$active = base_url().$CI->uri->uri_string;
$str = '<ul class="'.$class.'">';
foreach($array as $item) {
if($active == $item['link']) {
Expand Down Expand Up @@ -68,4 +69,20 @@ function menu_structure_as_strng_array($mid) {
}
return $output;
}
}
if(!function_exists('array_to_menu')) {
function array_to_menu($array, $class = 'nav navbar-nav', $toggle = true) {
$menuitems = array();
foreach($array as $link) {
$menuitems[] = array('id' => $link['mlid'], 'title' => $link['title'], 'parent' => $link['parent'], 'link' => $link['link']);
}
$tmp = array(0 => array('title' => 'root', 'children'=>array()));
foreach($menuitems as $item) {
$tmp[$item['id']] = isset($tmp[$item['id']]) ? array_merge($tmp[$item['id']],$item) : $item;
$tmp[$item['parent']]['children'][] =& $tmp[$item['id']];
}
$db = NULL;
$root = $tmp[0]['children'];
return traverse($root, $class, $toggle);
}
}
5 changes: 4 additions & 1 deletion application/models/mdl_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function prepare($static_data = NULL) {
$this->_return['page_top'] = '';
$this->_return['page'] = $this->_prepare_page();
$this->_return['page_bottom'] = '';
$this->_return['scripts'] = (isset($this->_theme_data['scripts'])) ? $this->_prepare_scripts(): '';
$this->_return['scripts'] = (isset($this->_theme_data['scripts'])) ? $this->_prepare_scripts(): $this->_mandatory_scripts();
return $this->_return;
}
private function _prepare_data() {
Expand Down Expand Up @@ -100,6 +100,9 @@ protected function _prepare_page_section_widget($widget) {
if(isset($widget_data['module'])) {
$widget_contents = Modules::run($widget_data['module'].'/_widget');
}
if(isset($widget_data['menu'])) {
$widget_contents = array_to_menu($this->db->order_by('position asc, title asc')->get_where('menu_links', array('mid' => $widget_data['menu']))->result_array());
}
}
//load normal widget tpl file
return $this->load->view($this->theme->tpl_path('widget').'/widget.tpl.php', array('content' => $widget_contents), true);
Expand Down
2 changes: 1 addition & 1 deletion application/modules/cookies/controllers/cookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function _scripts_alter() {

function _widget() {
//contains information about the widget generated by this module
return 'Cookie compliance goes here';
return '<p>Cookie compliance goes here</p>';
}

function _install() {
Expand Down
23 changes: 11 additions & 12 deletions frontend/themes/admin/page.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@
</script>
<div class="sidebar-shortcuts" id="sidebar-shortcuts">
<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
<button class="btn btn-success">
<i class="ace-icon fa fa-signal"></i>
</button>
<button class="btn btn-info">
<a class="btn btn-success" href="<?php print base_url(); ?>">
<i class="ace-icon fa fa-home"></i>
</a>
<a class="btn btn-info">
<i class="ace-icon fa fa-pencil"></i>
</button>
<button class="btn btn-warning">
</a>
<a class="btn btn-warning">
<i class="ace-icon fa fa-users"></i>
</button>
<button class="btn btn-danger">
</a>
<a class="btn btn-danger" href="<?php print base_url().'admin/settings'; ?>">
<i class="ace-icon fa fa-cogs"></i>
</button>
</a>
</div>
</div>
<?php print $page['sidebar_first']; ?>
Expand All @@ -90,11 +90,10 @@
<?php print $page['content']; ?>
</div>
</div><!-- /.main-content -->
<hr>
<div class="footer">
<div class="footer-inner">
<div class="footer-content">
<?php print $page['footer']; ?>
</div>
<?php print $page['footer']; ?>
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion frontend/themes/bootstrap/base.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<?php
print $page_top;
print $page;
//krumo($page);
print $page_bottom;
print $scripts;
?>
Expand Down
6 changes: 1 addition & 5 deletions frontend/themes/bootstrap/page.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
<a class="navbar-brand" href="#"><?php print $site_name; ?></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<?php print $page['navigation']; ?>
</div>
</div>
</nav>
Expand Down

0 comments on commit ac2bf55

Please sign in to comment.