Generico Filter

Filters ::: filter_generico
Maintained by Justin Hunt
Generico is a simple filter for creating templates of code snippets and text that can be inserted into Moodle text areas.

Generico Filter 1.2.2(Build 2015081902)

Moodle 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9
Released: Wednesday, 19 August 2015, 8:25 PM
Generico Filter
===============
** bug fix to released earlier today version. **

Generico is a filter that will allow up to ten templates to be registered.
When Moodle encounters a filter string it will use the data in the filter string to fill out the template, and insert it into the page.

Usage
===============
Define templates at
Site Administration / plugins / filters / Generico

A template consists of a "key," a "template," some "defaults," and optionally JS and CSS urls to include.
The key is just a one word name, that tells Generico which template to use.
The template is just passage of text that you want to use, and the parts of the template that you want to mark as variables you surround in @@ marks.
The defaults are a comma delimited list of variablename=value pairs. Here is an example template.

templatekey: wildthings
template: Inside this box are @@thing1@@ and @@thing2@@
template defaults: thing2=Silly

A possible filter string for this "wildthings" template would look like this:
{GENERICO:type=wildthings,thing1=Sally}

Generico would replace the above filter string with:
"Inside this box are Sally and Silly"

The filter string must follow this format,
{GENERICO:type=templatekey,variable1=data1,variable2=data2}

The wildthings example above is trivial of course. Imagine using it to embed YouTube videos by registering the standard iframe code YouTube gives you, as a template. Then it would only be necessary to insert the id of the video in a generico filter string.
{GENERICO:type=youtube,id=ABC12345678}

Pre-Set Variables
===============

It is also possible now to add user profile variables to your templates. Just make the first part of the variable name USER: and the next part the name of the user profile field. It also works with custom profile fields. There are two "special" user profile fields, picurl and pic that respectively output the url of the user's profile pic, and their picture itself.

e.g

User's first name: @@USER:firstname@@
User's ice cream preference (custom profile field): @@USER:icecreampref@@
Users profile pic url: @@USER:picurl@@

User's profile pic: @@USER:pic@@

One more preset variable is AUTOID. This will generate a long random string that you can use as ids to link different parts of the template together. For example you set the id of a div to @@AUTOID@@ and in JS go looking for the @@AUTOID@@ to swap out the div for a player.


Installation
==============
If you are uploading Generico, first expand the zip file and upload the generico folder into:
[PATH TO MOODLE]/filters.

Then visit your Moodle server's Site Administration -> Notifications page. Moodle will guide you through the installation.
On the final page of the installation you will be able to register templates. You should choose to skip that and do it later from each template's settings page. (Seeing all the templates on one page is too confusing.)

After installing you will need to enable the Generico filter. You can enable the Generico filter when you visit:
Site Administration / plugins / filters / manage filters

JQuery Configuration (Important)
==============
Many templates will require JQuery. We used to load this as required. And you still can. (The checkbox for that is still on each template page.) Please do not use it. It will be removed in a subsequent version. Instead you should use a theme that loads JQuery already (Essential, BCU are two), or add a call to load JQuery to the Moodle site header.
To add that, go to: Site Administration -> Appearance -> Additional HTML (within HEAD) ,and add:


Enjoy

Justin Hunt
poodllsupport@gmail.com





Version information

Version build number
2015081902
Version release name
1.2.2(Build 2015081902)
Maturity
Stable version
MD5 Sum
207a9df585083b179e35f3313973c4e8
Supported software
Moodle 2.1, Moodle 2.2, Moodle 2.3, Moodle 2.4, Moodle 2.5, Moodle 2.6, Moodle 2.7, Moodle 2.8, Moodle 2.9

Version control information

Version control system (VCS)
GIT
VCS repository URL

Default installation instructions for plugins of the type Filters

  1. Make sure you have all the required versions.
  2. Download and unpack the filter plugin.
  3. Place the folder (eg "myfilter") in the "filter" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation