/**
 * Context menu reference
 *
 * This plugin creates a context menu reference.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formcontextmenureference($params, $view)
{
    $output = $view->registerPlugin('Zikula_Form_Plugin_ContextMenu_Reference', $params);
    if (array_key_exists('assign', $params)) {
        $view->assign($params['assign'], $output);
    } else {
        return $output;
    }
}
Пример #2
0
/**
 * The reviewsFormFrame plugin adds styling <div> elements and a validation summary.
 *
 * Available parameters:
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out.
 *
 * @param array            $params  All attributes passed to this function from the template.
 * @param string           $content The content of the block.
 * @param Zikula_Form_View $view    Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_block_reviewsFormFrame($params, $content, $view)
{
    // As with all Forms plugins, we must remember to register our plugin.
    // In this case we also register a validation summary so we don't have to
    // do that explicitively in the templates.
    // We need to concatenate the output of boths plugins.
    $result = $view->registerPlugin('\\Zikula_Form_Plugin_ValidationSummary', $params);
    $result .= $view->registerBlock('Reviews_Form_Plugin_FormFrame', $params, $content);
    return $result;
}
/**
 * Validation summary.
 *
 * This plugin shows a summary of the validation result.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formvalidationsummary($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_ValidationSummary', $params);
}
/**
 * Dropdown relation list.
 *
 * This plugin creates a drop down list from a relation.
 *
 * This plugin supports doctrine.
 * Example:
 * <code>
 * {formdropdownrelationlist recordClass="MyModule_Model_User" where="active = true"
 *  num=15 oderby="registrationDate DESC"}
 * </code>
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formdropdownrelationlist($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_DropdownRelationlist', $params);
}
/**
 * Context menu item.
 *
 * This plugin represents a menu item.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @see    Zikula_Form_Plugin_ContextMenu
 * @return string The rendered output.
 */
function smarty_function_formcontextmenuitem($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_ContextMenu_Item', $params);
}
Пример #6
0
/**
 * File upload field.
 *
 * This plugin creates a field for file uploads.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formuploadinput($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_UploadInput', $params);
}
Пример #7
0
/**
 * Float input.
 *
 * This plugin creates a float input field
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formfloatinput($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_FloatInput', $params);
}
/**
 * The muvideoItemSelector plugin provides items for a dropdown selector.
 *
 * @param  array            $params All attributes passed to this function from the template.
 * @param  Zikula_Form_View $view   Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_function_muvideoItemSelector($params, $view)
{
    return $view->registerPlugin('MUVideo_Form_Plugin_ItemSelector', $params);
}
Пример #9
0
/**
 * Date input for Zikula_Form_View.
 *
 * The date input plugin is a text input plugin that only allows dates to be posted. The value
 * returned from {@link Zikula_Form_View::getValues()} is although a string of the format 'YYYY-MM-DD'
 * since this is the standard internal Zikula format for dates.
 *
 * You can also use all of the features from the Zikula_Form_Plugin_TextInput plugin since the date input
 * inherits from it.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formdateinput($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_DateInput', $params);
}
/**
 * Context menu seperator
 *
 * This plugin creates a seperator in a context menu.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formcontextmenuseparator($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_ContextMenu_Separator', $params);
}
Пример #11
0
/**
 * TextInput plugin for Zikula_Form_View
 *
 * The Zikula_Form_Plugin_TextInput plugin is a general purpose input plugin that allows the user to enter any kind of character based data,
 * including text, numbers, dates and more.
 *
 * Typical use in template file:
 * <code>
 * {formtextinput id='title' maxLength='100' width='30em'}
 * </code>
 *
 * The Zikula_Form_Plugin_TextInput plugin supports basic CSS styling through attributes like "width", "color" and "font_weight". See
 * {@link Zikula_Form_StyledPlugin} for more info.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formtextinput($params, $view)
{
    // Let the Zikula_Form_Plugin class do all the hard work
    return $view->registerPlugin('Zikula_Form_Plugin_TextInput', $params);
}
Пример #12
0
/**
 * Radiobutton plugin
 *
 * Plugin to generate a radiobutton for selecting one-of-X.
 * Usage with fixed number of radiobuttons:
 *
 * <code>
 * {formradiobutton id='yesButton' dataField='ok'} {formlabel __text='Yes' for='yesButton'}<br/>
 * {formradiobutton id='noButton' dataField='ok'} {formlabel __text='No' for='noButton'}
 * </code>
 *
 * The above case sets 'ok' to either 'yesButton' or 'noButton' in the hashtable returned
 * by {@link Zikula_Form_View::getValues()}. As you can see the radiobutton defaults to using the ID for the returned value
 * in the hashtable. You can override this by setting 'value' to something different.
 *
 * You can also enforce a selection:
 *
 * <code>
 * {formradiobutton id='yesButton' dataField='ok' mandatory=true} {formlabel __text='Yes' for='yesButton'}<br/>
 * {formradiobutton id='noButton' dataField='ok' mandatory=true} {formlabel __text='No' for='noButton']-->
 * </code>
 *
 * If you have a list of radiobuttons inside a for/each loop then you can set the ID to something from the data loop
 * like here:
 * <code>
 * {foreach from=$items item=item}
 *   {formradiobutton id=$item.name dataField='item' mandatory=true} {formlabel text=$item.title for=$item.name}
 * {/foreach}
 * </code>
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formradiobutton($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_RadioButton', $params);
}
/**
 * The reviewsItemSelector plugin provides items for a dropdown selector.
 *
 * @param  array            $params All attributes passed to this function from the template.
 * @param  Zikula_Form_View $view   Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_function_reviewsItemSelector($params, $view)
{
    return $view->registerPlugin('Reviews_Form_Plugin_ItemSelector', $params);
}
/**
 * The muboardColourInput plugin handles fields carrying a html colour code.
 * It provides a colour picker for convenient editing.
 *
 * @param  array            $params  All attributes passed to this function from the template.
 * @param  Zikula_Form_View $view    Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_function_muboardColourInput($params, $view)
{
    return $view->registerPlugin('MUBoard_Form_Plugin_ColourInput', $params);
}
Пример #15
0
/**
 * LinkButton
 *
 * Link buttons can be used instead of normal buttons to fire command events in
 * your form event handler. A link button is simply a link (anchor tag with
 * some JavaScript) that can be used exactly like a normal button - but with
 * a different visualization.
 *
 * When the user activates a link button the command name and command argument
 * will be sent to the form event handlers handleCommand function.
 * Example:
 * <code>
 *  function handleCommand($render, &$args)
 *  {
 *    if ($args['commandName'] == 'update')
 *    {
 *      if (!$render->isValid())
 *        return false;
 *
 *      $data = $render->getValues();
 *
 *      DBUtil::updateObject($data, 'demo_data');
 *    }
 *
 *    return true;
 *  }
 * </code>
 *
 * The command arguments ($args) passed to the handler contains 'commandName' and
 * 'commandArgument' with the values you passed to the button in the template.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formlinkbutton($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_LinkButton', $params);
}
/**
 * The zikularoutesmoduleItemSelector plugin provides items for a dropdown selector.
 *
 * @param  array            $params All attributes passed to this function from the template.
 * @param  Zikula_Form_View $view   Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_function_zikularoutesmoduleItemSelector($params, $view)
{
    return $view->registerPlugin('\\Zikula\\RoutesModule\\Form\\Plugin\\ItemSelector', $params);
}
/**
 * The muvideoRelationSelectorList plugin provides a dropdown selector for related items.
 *
 * @param  array            $params All attributes passed to this function from the template.
 * @param  Zikula_Form_View $view   Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_function_muvideoRelationSelectorList($params, $view)
{
    return $view->registerPlugin('MUVideo_Form_Plugin_RelationSelectorList', $params);
}
Пример #18
0
/**
 * Email input.
 *
 * This plugin creates an email input field.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formemailinput($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_EMailInput', $params);
}
/**
 * The reviewsColourInput plugin handles fields carrying a html colour code.
 * It provides a colour picker for convenient editing.
 *
 * @param array            $params  All attributes passed to this function from the template.
 * @param Zikula_Form_View $view    Reference to the view object.
 *
 * @return string The output of the plugin.
 */
function smarty_function_reviewsColourInput($params, $view)
{
    return $view->registerPlugin('Reviews_Form_Plugin_ColourInput', $params);
}
/**
 * PostBack JavaScript function plugin
 *
 * Use this plugin to create a postback generating JavaScript function to be called from your
 * JavaScript code.
 *
 * Example:
 * <code>
 * {formpostbackfunction function='startMyPostBack' commandName='abc'}
 * </code>
 * This generates a JavaScript function named startMyPostBack() that you can call from your own JavaScript.
 * When called it will generate a postback and fire an event to be handled by the $onCommand
 * method in the form event handler.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formpostbackfunction($params, $view)
{
    // Let the Zikula_Form_Plugin class do all the hard work
    return $view->registerPlugin('Zikula_Form_Plugin_PostBackFunction', $params);
}
Пример #21
0
/**
 * Error message placeholder
 *
 * Use this plugin to display error messages. It should be added in your template in the exact location where
 * you want the error message to be displayed. Then, on postback, you can do as shown here to set the
 * error message:
 * <code>
 *  function handleCommand($render, &$args)
 *  {
 *    if ($args['commandName'] == 'update')
 *    {
 *      if (!$render->isValid())
 *        return false;
 *
 *      $data = $render->getValues();
 *      if (... something is wrong ...)
 *      {
 *        $errorPlugin = $render->getPluginById('MyPluginId');
 *        $errorPlugin->message = 'Something happend';
 *        return false;
 *      }
 *
 *      ... handle data ...
 *    }
 *
 *    return true;
 *  }
 * </code>
 * Beware that {@link Zikula_Form_View::getPluginById()} only works on postback.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formerrormessage($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_ErrorMessage', $params);
}
/**
 * Language selector.
 *
 * This plugin creates a language selector using a dropdown list.
 * The selected value of the base dropdown list will be set to the 3-letter language code of
 * the selected language.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formlanguageselector($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_LanguageSelector', $params);
}
Пример #23
0
/**
 * Checkbox list
 *
 * Renders a list of checkboxes with the supplied items.
 * Usefull for selecting multiple items.
 *
 * You can set the items directly like this:
 * <code>
 * {formcheckboxlist id='mylist' items=$items}
 * </code>
 * with the form event handler code like this:
 * <code>
 * class mymodule_user_testHandler extends Zikula_Form_Handler
 * {
 *   function initialize($view)
 *   {
 *       $items = array( array('text' => 'A', 'value' => '1'),
 *                       array('text' => 'B', 'value' => '2'),
 *                       array('text' => 'C', 'value' => '3') );
 *
 *       $view->assign('items', $items); // Supply items
 *       $view->assign('mylist', 2);     // Supply selected value
 *   }
 * }
 * </code>
 * Or you can set them indirectly using the plugin's databased features:
 * <code>
 * {formcheckboxlist id='mylist'}
 * </code>
 * with the form event handler code like this:
 * <code>
 * class mymodule_user_testHandler extends Zikula_Form_Handler
 * {
 *   function initialize($view)
 *   {
 *       $items = array( array('text' => 'A', 'value' => '1'),
 *                       array('text' => 'B', 'value' => '2'),
 *                       array('text' => 'C', 'value' => '3') );
 *
 *       $view->assign('mylistItems', $items);  // Supply items
 *       $view->assign('mylist', 2);            // Supply selected value
 *   }
 * }
 * </code>
 *
 * The resulting dataset is a list of strings representing the selected
 * values. So when you do a $data = $view->getValues(); you will
 * get a dataset like this:
 *
 * <code>
 *   array('xxx' => 'valueXX',
 *         'checkboxes' => array('15','17','22','34'),
 *         'yyy' => 'valueYYY')
 * </code>
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formcheckboxlist($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_CheckboxList', $params);
}
/**
 * Category selector
 *
 * This plugin creates a category selector using a dropdown list.
 * The selected value of the base dropdown list will be set to ID of the selected category.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Form render object.
 *
 * @return string The rendered output.
 */
function smarty_function_formcategoryselector($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_CategorySelector', $params);
}
Пример #25
0
/**
 * Image button.
 *
 * This button works like a normal {@link Zikula_Form_Plugin_Button} with the exception
 * that it displays a clickable image instead of a text button. It further
 * more returns the X and Y coordinate of the click position in the image.
 *
 * The command event arguments contains four elements:
 * - commandName: command name
 * - commandArgument: command argument
 * - posX: X position of click
 * - posY: Y position of click.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formimagebutton($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_ImageButton', $params);
}
Пример #26
0
/**
 * Web form label.
 *
 * Use this to create labels for your input fields in a web form. Example:
 * <code>
 *   {formlabel __text='Title' for='title'}
 *   {formtextinput id='title'}
 * </code>
 * The rendered output is an HTML label element with the "for" value
 * set to the supplied id. In addition to this, the Zikula_Form_Plugin_Label plugin also sets
 * "myLabel" on the "pointed-to" plugin to the supplied label text. This enables
 * the validation summary to display the label text.
 *
 * @param array            $params Parameters passed in the block tag.
 * @param Zikula_Form_View $view   Reference to Zikula_Form_View object.
 *
 * @return string The rendered output.
 */
function smarty_function_formlabel($params, $view)
{
    return $view->registerPlugin('Zikula_Form_Plugin_Label', $params);
}