Adding tabs
Page: 1
Just threw this together today.
If you want to add a tab, just do the following:
First, DOWNLOAD A BACKUP COPY OF application/layouts/dashboard.php
You will need this in case something goes wrong, it's always a good idea to do this when modifying an installation.
1) Open application/layouts/dashboard.php (not your backup copy, you want that one to be unchanged in case of emergency)
2)Find this chunk of code:
<!-- /header -->
<div id="tabsWrapper">
<div id="tabs">
<?php if(is_array(tabbed_navigation_items())) { ?>
<ul>
<?php foreach(tabbed_navigation_items() as $tabbed_navigation_item) { ?>
<li id="tabbed_navigation_item_<?php echo $tabbed_navigation_item->getID() ?>" <?php if($tabbed_navigation_item->getSelected()) { ?> class="active" <?php } ?>><a href="<?php echo $tabbed_navigation_item->getUrl() ?>"><?php echo clean($tabbed_navigation_item->getTitle()) ?></a></li>
<?php } // foreach ?>
And add <li id="tabbed_navigation_item_overview"><a href="yourlink">text of link</a></li>
in the line below <?php } // foreach ?>
Should work! I don't know how to make it the active tab though, you have to figure out a way to make the class="active" when you're on the page.
Enjoy!
If you want to add a tab, just do the following:
First, DOWNLOAD A BACKUP COPY OF application/layouts/dashboard.php
You will need this in case something goes wrong, it's always a good idea to do this when modifying an installation.
1) Open application/layouts/dashboard.php (not your backup copy, you want that one to be unchanged in case of emergency)
2)Find this chunk of code:
<!-- /header -->
<div id="tabsWrapper">
<div id="tabs">
<?php if(is_array(tabbed_navigation_items())) { ?>
<ul>
<?php foreach(tabbed_navigation_items() as $tabbed_navigation_item) { ?>
<li id="tabbed_navigation_item_<?php echo $tabbed_navigation_item->getID() ?>" <?php if($tabbed_navigation_item->getSelected()) { ?> class="active" <?php } ?>><a href="<?php echo $tabbed_navigation_item->getUrl() ?>"><?php echo clean($tabbed_navigation_item->getTitle()) ?></a></li>
<?php } // foreach ?>
And add <li id="tabbed_navigation_item_overview"><a href="yourlink">text of link</a></li>
in the line below <?php } // foreach ?>
Should work! I don't know how to make it the active tab though, you have to figure out a way to make the class="active" when you're on the page.
Enjoy!
That's great; I discovered this too when I first started looking at how to do this. However, it doesn't follow the same convention as the other dashboard tabs ... and so its a hack (a decent one), but not necessarily the solution. Some detailed documentation would be nice here, in defining how to correctly setup the dashboard tabs! If I've somehow missed the documentation of aC 0.7.1, please let me know! In the meantime, I have been pouring over the code trying to figure out how to setup these dashboard tabs. I believe I've figure most of it out, and am about 90% there ... I need a little help getting the rest of the way.
Here's what I've done so far:
1) Added menu tab definitions to $acHOME/application/helpers/company_website.php by writing the 'define()' statement for menu tab element and the navigation function definition.
define('DASHBOARD_TAB_MY_CALENDAR', 'my_calendar');
add_tabbed_navigation_item(new TabbedNavigationItem(
DASHBOARD_TAB_MY_CALENDAR,
lang('my calendar'),
get_url('dashboard', 'my_calendar', null, 'my_calendar.php') //get_url(controller, action, params, anchor)
));
2) Added menu tab name in $aCHOME/languages/en_us/site_interface.php by adding a new line containing the referencing phrase, and the resulting string.
'my calendar' => 'My Calendar',
3) Added custom page (my_calendar.php) to $aCHOME/application/view/dashboard. This page actually implements that calendar.
So at this point, I have the tab showing up with the correct name. However, I am missing something in the link. As you can see above, I have been copying the definitions of the previous default tabs. But I must be missing something in the setting up of this link, because instead of linking to the desired page I get the following error:
"We are sorry, but activeCollab is not currently able to execute your request. An Error Report has been sent to the administrator."
?c=error&a=execute_action#my_calendar.php
I am very close ... what am I missing here? One thing I need to know is how 'get_url' works. Seems that is the key. Is there a further definition that get_url is looking for that I need to create? The key idea here is to get my custom calendar page included in the main body area ... just the same as 'my projects' and 'my tasks'. That is something that the hack above doesn't do.
Thanks,
Josh
Here's what I've done so far:
1) Added menu tab definitions to $acHOME/application/helpers/company_website.php by writing the 'define()' statement for menu tab element and the navigation function definition.
define('DASHBOARD_TAB_MY_CALENDAR', 'my_calendar');
add_tabbed_navigation_item(new TabbedNavigationItem(
DASHBOARD_TAB_MY_CALENDAR,
lang('my calendar'),
get_url('dashboard', 'my_calendar', null, 'my_calendar.php') //get_url(controller, action, params, anchor)
));
2) Added menu tab name in $aCHOME/languages/en_us/site_interface.php by adding a new line containing the referencing phrase, and the resulting string.
'my calendar' => 'My Calendar',
3) Added custom page (my_calendar.php) to $aCHOME/application/view/dashboard. This page actually implements that calendar.
So at this point, I have the tab showing up with the correct name. However, I am missing something in the link. As you can see above, I have been copying the definitions of the previous default tabs. But I must be missing something in the setting up of this link, because instead of linking to the desired page I get the following error:
"We are sorry, but activeCollab is not currently able to execute your request. An Error Report has been sent to the administrator."
?c=error&a=execute_action#my_calendar.php
I am very close ... what am I missing here? One thing I need to know is how 'get_url' works. Seems that is the key. Is there a further definition that get_url is looking for that I need to create? The key idea here is to get my custom calendar page included in the main body area ... just the same as 'my projects' and 'my tasks'. That is something that the hack above doesn't do.
Thanks,
Josh



