Loading...
 
Tiki and PluginR

Tiki and PluginR


Re: Jyhem coding RR plugin settings variables directly from within RR

posts: 37 France

This is what works for us.

In the params definition
'customoutput' => array(
        'required' => false,
        'safe' => true,
        'name' => tra('Custom output'),
        'description' => tra('Write your custom png creation R command. Use tikiRRfilename for value of output. RR does not produce an output file.'),
        'filter' => 'int',
        'default' => '0',
        'options' => array(
          array('text' => '', 'value' => ''),
          array('text' => tra('No'), 'value' => '0'),
          array('text' => tra('Yes'), 'value' => '1'),
        ),
        'advanced' => true,
      ),

in the function runR()
// Check if the user wants to handle the creation of his custom png
        if ( isset($params["customoutput"]) && $params["customoutput"]=="1" ) {
          $image_number = 1;
          $content .= 'tikiRRfilename < - "' . $rgo . "_$image_number.png" . '"' . "\n";
          // Add the user input code at the end
          $content .= $input . "\n";

        } else {
          // Check if the user requested an svg file or pdf file to be generated instead of the standard png in the wiki page
          if (isset($_REQUEST['gtype']) && $_REQUEST['gtype']=="svg") {
[…]
            $content .= $input . "\n";
          } # enf of choice between svg and png
        }