Actions

Direct (command)

From LimeSurvey Manual

Revision as of 12:44, 22 September 2017 by DenisChenu (talk | contribs) (Add example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 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