x

Main chapters

  1. LimeSurvey Cloud vs LimeSurvey CE
  2. LimeSurvey Cloud - Quick start guide
  3. LimeSurvey CE - Installation
  4. How to design a good survey (Guide)
  5. Getting started
  6. LimeSurvey configuration
  7. Introduction - Surveys
  8. View survey settings
  9. View survey menu
  10. View survey structure
  11. Introduction - Questions
  12. Introduction - Question Groups
  13. Introduction - Surveys - Management
  14. Survey toolbar options
  15. Multilingual survey
  16. Quick start guide - ExpressionScript
  17. Advanced features
  18. General FAQ
  19. Troubleshooting
  20. Workarounds
  21. License
  22. Version change log
  23. Plugins - Advanced
 Actions

Talk

Talk:Add new menu and view by a plugin

From LimeSurvey Manual

Why isn't newDirectRequest implemented in the base class? Seems like a generic class that mostly is not needed to override.

Olle (talk) 23:59, 29 April 2016 (CEST)


Draft:

Add new content in side-body in LimeSurvey 2.5

A plugin can add content into the side-body div in the LimeSurvey 2.5 admin interface by calling the PluginHelper controller. As in the section above, you will need to add a new menu with an acnhor to the controller, which will in turn call your plugin action. The return value of the plugin action will be rendered in the side-body. Below is an example of a plugin that will add a menu item into the tools menu:

    public function beforeToolsMenuRender()
    {
        $event = $this->getEvent();
        $surveyId = $event->get('surveyId');
        $href = Yii::app()->createUrl(
            'admin/pluginhelper',  // Call the plugin helper controller
            array(
                'sa' => 'sidebody',  // subaction is "sidebody"
                'plugin' => 'MyPlugin',  // Name of this plugin
                'method' => 'actionIndex',  // Plugin action that PluginHelper will call
                'surveyId' => $surveyId
            )
        );
        // TODO: Class ExtraMenuItem is not part of core yet
        $menuItem = new ExtraMenuItem(array(
            'label' => 'Label of the menu',
            'iconClass' => 'fa fa-table',
            'href' => $href
        ));
        $event->set('menuItems', array($menuItem));
    }
    public function actionIndex()
    {
        // TODO: Add view and layout
        return "This is the content of the side-body";
    }

Olle (talk) 17:17, 30 April 2016 (CEST)