Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Admin my site - extending SS main menu?

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1125 Views
  • carlossg
    Avatar
    Community Member
    13 Posts

    Admin my site - extending SS main menu? Link to this post

    Hi all, first post.

    I'm developing a website for a secondary school, managing subjects, teachers, departments, students and all their relations.

    I've created some DataObjects to manage subjects, teachers, etc.
    My doubt comes at time of adding new subjects (i.e). I've created a subject page with a TableField control to enter new subjects, and created this page-type in Site Content (in the tree).
    Works fine, but I don't find the place to put it (Site Content) suitable. Would not be more reasonable put all the admin pages (add subjects, teachers, ...) in a new tab in SS main menu?, i mean right beside "Site Content","Files & Images", "Newsletters", etc. and manage this pages with a tree?. the answer is yes!! (i guess). but how?
    How do I add a new tab y main menu?, how do I create a tree with all the admin pages?, Is too hard to do what i am asking for? Does it differ too much from creating pages for every admin task and add them in site tree?.

    Hope don't confuse you...

    Thanks a lot and any ideas will be gladed.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Admin my site - extending SS main menu? Link to this post

    Not a straight forward thing to do well but First Add the panel to the cms by adding this to you _config file.

    // Add Polls to the CMS
    Object::addStaticVars('LeftAndMain', array(
    'extra_menu_items' => array(
          'Custom Panel' => 'admin/custompanel/',
       )
    ));

    Director::addRules(100, array(
       'admin/custompanel/$Action/$ID/$OtherID' => 'CustomPanel',
    ));

    This will add a Custom Panel link and point to the CustomPanel.php which you will need to create, which needs to look something like -

    mysite/code/CustomPanel.php

    <?php
    class CustomPanel extends GenericDataAdmin {
       
       static $data_type = 'DataObjectName';
       static $result_columns = array(' Fields you want to show ');
       
       function init() {

       }
       
       public function getLink($action = null, $id = 0) {
          
       }
       
       public function performSearch(){
       
       }
       
       function getEditForm($id){
          // fields on your dataobject you need to edit
          
       return new Form($this, 'EditForm', $fields, $actions);
       }
       
       function save($data, $form){ }

    }

    ?>

    1125 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.