ATutor

Learning Management Tools







Pages:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Subnav Tabs


  • 2012-02-19 12:25:18

    Subnav Tabs

    Hello. I have 2.0 installed and I'm wanting to add a subnav tab. I can't figure out for the life of me where these are located so I can add a new one.

    I've boxed the area I'm talking about in the attached screenshot.

    Thank you.

  • 2012-02-19 12:39:02

    Re: Subnav Tabs

    Subnav tabs are typically defined in the [children] array of the module.php file for any given module. Here's the on for the tests sub menu.

    [php]
    $this->_pages['mods/_standard/tests/index.php']['children'] = array('mods/_standard/tests/create_test.php', 'mods/_standard/tests/question_db.php', 'mods/_standard/tests/question_cats.php');

    ]

    [/php]

    see:
    https://github.com/atutor/ATutor/blob/master/mods/_standard/tests/module.php

  • 2012-02-19 14:19:17

    Re: Subnav Tabs

    Thanks for the Sun. reply.

    I've been looking for the correct file that would have this info. for the My Start Page and I can't find it because I don't think My Start Page is a module... is it?

    I looked under /_core/users but that was just admin stuff. Basically, I'd like to be able to add a "sub-tab" to the ones that I boxed in the screenshot of my original post.

    Thanks again.

  • 2012-02-19 16:01:42

    Re: Subnav Tabs

    You'd usually add the line to the module.php file for a module you're linking into the UI.

    To add a link to the My Start page, it would look something like:

    [php]

    $this->_pages['users/index.php']['children'] = array_merge(array('path/to/yourscript.php'), isset($_pages['users/index.php']['children']) ? $_pages['users/index.php']['children'] : array());

    [/php]

    It can be added to any module.php file.

    You could also add your link via the include/lib/menu_pages.php to the $_pages array. Look for:
    [php]

    $_pages['users/index.php']['children']

    [/php]

    We generally recommend the former method. With the latter you'll loose your changes when you upgrade.

  • 2012-02-19 17:14:18

    Re: Subnav Tabs

    OK. I've got the link/tab in place now using the 2nd method you mentioned. I'm not too concerned about upgrading because I've got so many other edits to make when that happens, it's no biggie.

    The only issue now is that I can't seem to name the tab (see attached screenshot). I'm guessing something needs to happen with the language editor (BLOB file in MySQL?), but I'm not sure.

    Any guidance there?

  • 2012-02-21 09:34:33

    Re: Subnav Tabs

    Define a title_var in the $_pages array for the page you want language for, then using the translator tool in ATutor, add the title_var you used as a new template language item.

    [php]

    $_pages['path/to/yourscript.php']['title_var'] = 'your_tool_titlename';

    [/php]

    You'll need to turn on the translator tool by enabling it in the ATutor include/vitals.inc.php file near the top. Take a look at the language manager documentation in the ATutor Handbook if you need more details.

    I'd still suggest you build your features into a module. Things like language, and links into the UI will be much easier to manage in the long run.

  • 2012-02-21 17:56:36

    Re: Subnav Tabs

    Thanks for the help Greg. I've worked it out. As an alternative to the translator tool route, I found it easier to just run the following in MySQL.

    [php]
    REPLACE INTO `AT_language_text` VALUES ('en', '_template', 'book_exchange', 'Book Exchange', NOW(), '');
    [/php]

    Even though it's not in a module, and it's probably fairly crude, it seems to be working.

    Feel free to nix this post if it's bad form to do it this way and you're not good with leaving that info. on the forums.

    Thanks again!