1<?php 2/** 3 * Class helper_plugin_bureaucracy_fieldusemailtemplate 4 * 5 * Adds a template only for use with the mail action 6 */ 7class helper_plugin_bureaucracy_fieldusemailtemplate extends helper_plugin_bureaucracy_field { 8 9 /** 10 * Arguments: 11 * - cmd 12 * - template 13 * 14 * @param array $args The tokenized definition, only split at spaces 15 */ 16 function initialize($args) { 17 if(count($args) < 2){ 18 msg(sprintf($this->getLang('e_missingargs'), hsc($args[0]), 19 hsc($args[1])), -1); 20 return; 21 } 22 23 // get standard arguments 24 $this->opt = array_combine(array('cmd', 'template'), $args); 25 } 26 27 /** 28 * Nothing displayed 29 * 30 * @params array $params Additional HTML specific parameters 31 * @params Doku_Form $form The target Doku_Form object 32 * @params int $formid unique identifier of the form which contains this field 33 */ 34 function renderfield($params, Doku_Form $form, $formid) { 35 } 36 37 /** 38 * Handle a post to the field 39 * 40 * @param string $value null 41 * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) 42 * @param int $index index number of field in form 43 * @param int $formid unique identifier of the form which contains this field 44 * @return bool Whether the passed value is valid 45 */ 46 function handle_post($value, &$fields, $index, $formid) { 47 return true; 48 } 49 50 /** 51 * Get an arbitrary parameter 52 * 53 * @param string $name 54 * @return mixed|null 55 */ 56 function getParam($name) { 57 return ($name === 'value' || 58 (in_array($name, array('template')) && $this->hidden)) ? 59 null : 60 parent::getParam($name); 61 } 62} 63