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

Direct (command): Difference between revisions

From LimeSurvey Manual

DenisChenu (talk | contribs)
Created page with "{{FeatureStarting|2.63.0}} '''Usage''' This event is used for Command Line Interface usage. '''How to use''' This event needs to be called with php cli command. <code>php..."
 
DenisChenu (talk | contribs)
Add example
 
Line 7: Line 7:
'''How to use'''
'''How to use'''


This event needs to be called with php cli command.
This event needs to be called with php cli command (default action).
<code>php yourlimesurveydir/application/commands/console.php plugin index --target=examplePluginName</code>
 
<syntaxhighlight lang="bash">php yourlimesurveydir/application/commands/console.php plugin index --target=examplePluginName</syntaxhighlight>
Or
Or
<code>php yourlimesurveydir/application/commands/console.php plugin --target=examplePluginName</code>
<syntaxhighlight lang="bash">php yourlimesurveydir/application/commands/console.php plugin --target=examplePluginName</syntaxhighlight>
Because default action is index.


'''Input'''
'''Input'''
Line 21: Line 21:
* '''option''' mixed : extra param for plugin if needed, optionnal.
* '''option''' mixed : extra param for plugin if needed, optionnal.


'''Example'''
<syntaxhighlight lang="php">
    /**
    * Event direct happen
    * Usage : index --target=value [--function=] [--option=]
    * @return @void
    */
    public function direct()
    {
        echo "Event direct happen\n";
        if($this->event->get("target") != get_class()) {
            echo "But target is not this plugin, then quit\n";
            return;
        }
        echo "Target is this plugin.\n";
        echo "Function call is ".$this->event->get("function")."\n";
        echo "With option: ".$this->event->get("option")."\n";
    }
</syntaxhighlight>
See [https://gist.github.com/Shnoulle/39bb12a2bf8628dd607250510fe36e47 cliEvent.php] gist
[[Category:Plugins events]]
[[Category:Plugins events]]

Latest revision as of 12:44, 22 September 2017

 Hint: This features is available starting in version 2.63.0


Usage

This event is used for Command Line Interface usage.

How to use

This event needs to be called with php cli command (default action).

php yourlimesurveydir/application/commands/console.php plugin index --target=examplePluginName

Or

php yourlimesurveydir/application/commands/console.php plugin --target=examplePluginName

Input

The event receives the following information:

  • target string : the plugin name, usage is to use it for target of action.
  • function mixed : extra param for plugin if needed, optionnal. Usage use as string.
  • option mixed : extra param for plugin if needed, optionnal.

Example

    /**
     * Event direct happen
     * Usage : index --target=value [--function=] [--option=]
     * @return @void
     */
    public function direct()
    {
        echo "Event direct happen\n";
        if($this->event->get("target") != get_class()) {
            echo "But target is not this plugin, then quit\n";
            return;
        }
        echo "Target is this plugin.\n";
        echo "Function call is ".$this->event->get("function")."\n";
        echo "With option: ".$this->event->get("option")."\n";
    }

See cliEvent.php gist