dev-master
9999999-devA set of useful extra widgets, validators, modules and other handy stuff for your symfony 1 projects
MIT
The Requires
by Desarrollo CeSPI
A set of useful extra widgets, validators, modules and other handy stuff for your symfony 1 projects
The dcReloadedFormExtraPlugin
adds some useful extra widgets, validators, modules,
etc., (*1)
{ "require": { "desarrollo-cespi/dc-reloaded-form-extra-plugin": "dev-master" } }
Or using git, from source., (*2)
Enable the plugin in your proyect configuration, (*3)
// in config/ProjectConfiguration.class.php add: $this->enablePlugin("dcReloadedFormExtraPlugin");
The pmWidgetFormPropelChoiceOrCreate
extends the functionality provided by
the sfWidgetFormPropelChoice
, adding a link that opens a new window, allowing
the user to create an object of the widget's model. Then, that object is
available for being selected., (*4)
Use it as you use the sfWidgetFormPropelChoice
, except for the following new
parameters:, (*5)
Enable the dc_ajax
module., (*6)
Note: jQuery is required., (*7)
The pmWidgetFormDoctrineChoiceOrCreate
is the doctrine version of the
pmWidgetFormPropelChoiceOrCreate
. So, use it as you use the
pmWidgetFormPropelChoiceOrCreate
., (*8)
The mtWidgetFormPlain
provides a way for showing plain values in the forms., (*9)
$this->widgetSchema["some_field"] = new mtWidgetFormPlain(array("add_hidden_input" => true));
For more options, take a look at the widget's doc comments., (*10)
This widget is used with select widgets filtering values depending on the selection made in observed widget. Supose widget A11 observing A1 widget changes, that observes A widget changes. In this case, you can have the following scenarios: * The form will save A, A1 and A11 values * The form will only sava A11 values (A and A1 will be used only for filtering purpose), (*11)
For the first case, just use the widget as it is. But for the second case, you will need to do some trick inside the form implementation:, (*12)
if (!$this->getObject()->isNew()) { $a11Object=$this->getObject()->getA11(); $this->setDefault('a1_id',$a11Object->getA1Id()); $this->setDefault('a_id',$b111->getB11()->getA1()->getAId()); }
$w = new sfWidgetFormInput(); $this->widgetSchema["some_field"] = new dcWidgetFormAjaxDependence(array( "dependant_widget" => $w, "observe_widget_id" => "some_form_some_field", "get_observed_value_callback" => array(get_class($this), "getValueForUpdate") ));
And then you must implement the getValueForUpdate method., (*13)
Same as dcWidgetFormAjaxDependence, except that retrieves objects from Propel classes., (*14)
Based on dcWidgetFormJQueryDependence. It enables or disables the widget when another changes and a given condition evaluates to true., (*15)
The mtWidgetFormPlain
displays a plain value., (*16)
$this->setWidget("some_field", new mtWidgetFormPlain());
The dcWidgetFormChangeForCredentials
displays one of two widgets depending on
user's credentials., (*17)
$this->setWidget("some_field", new dcWidgetFormChangeForCredentials(new array( "credentials" => array(array("admin", "some_credential")), "widget_without_credentials" => new mtWidgetFormPlain(), "widget_with_credentials" => new sfWidgetFormInput() )));
The mtWidgetFormPartial
displays a partial., (*18)
$this->setWidget("partial", new mtWidgetFormPartial(array( "module" => "some_module", "partial" => "some_partial", "form" => $this ));
The pmWidgetFormSelectJQueryAutocomplete
displays an autocomplete based on a
select tag. This widget is basically a renderer, so it can be used as the
renderer of a sfWidgetFormChoice, sfWidgetFormPropelChoice, etc., (*19)
jquery ui is required., (*20)
$this->getWidget("city_id")->setOption("renderer_class", "pmWidgetFormSelectJQueryAutocomplete");
The pmWidgetFormJQuerySearch
displays an input text with search capabilities., (*21)
$this->setWidget("some_field") = new pmWidgetFormJQuerySearch(array( "url" => "@url_that_performs_the_search" ));
The jquery_search.js provides a javascript class with functions for displaying the results. See the example of a pmWidgetFormPropelJQuerySearch., (*22)
The pmWidgetFormJQuerySearch
displays an input text with search capabilities
over propel objects., (*23)
$this->setWidget("some_field_id", new pmWidgetFormPropelJQuerySearch(array( "model" => "SomeField", "column" => "some_column" )));
The mtWidgetFormInputDate
displays an input text for selecting dates.
Must be validated with mtValidatorDateString and jquery and jqueryui are
REQUIRED., (*24)
$this->setWidget("date", new mtWidgetFormInputDate());
Widgets that embeds a dinamic number of forms. This widget only does the 'view' part. The saving and deleting of new and previous object has to be done manually., (*25)
Represents an Argetine CUIL/CUIT, (*26)
Represents an Hour or also an Hour range., (*27)
This widget is a wrapper for a jQueryUITimepicker (http://fgelinas.com/code/timepicker/)., (*28)
The javascript widget can be configured in many ways, so you could define an associative array of key -> value (available options defined on author page or on this widget implementantion) to give values to it. Also, it allows to create ingle or range time values., (*29)
For a single time value all you need is:, (*30)
$this->setWidget("single_hour", new alWidgetFormTimepicker(array('config' => array('jquery_widget_option_key' => 'jquery_widget_option_value'))));
For a range time value:, (*31)
$this->setWidget("range_hour", new alWidgetFormTimepicker(array('config' => array('jquery_widget_option_key' => 'jquery_widget_option_value'), 'enable_timerange' => true)));
Note: remember than this widget uses the alValidatorTimepicker validator, and it should be configured wheter the value is single or range., (*32)
Check for in the validator section for further explanation on this matters., (*33)
Validates dates represented as strings., (*34)
Validates single or range hour as strings., (*35)
It accepts an option called enable_timerange (by default set to false), that when its set to true, will be expecting a string that looks like this: "HH:MM-HH:MM". Otherwise, it will validate a single value like "HH:MM"., (*36)
Range value, (*37)
$this->setValidator("range_hour", new alValidatorTimepicker(array('enable_timerange' => true)));
Single value, (*38)
$this->setValidator("single_hour", new alValidatorTimepicker(array('enable_timerange' => false)));
or, (*39)
$this->setValidator("single_hour", new alValidatorTimepicker());
Validates a CUIL/CUIT from a String, (*40)
Validates a CUIL/CUIT from a string made by mtWidgetFormCuil, (*41)
$this->setValidator("date", new mtValidatorDateString());
This plugin provides form classes (which extends sfFormPropel and sfFormFilterPropel) that auto-initializes forms., (*42)
You just have to change the super class of the BaseFormPropel (and BaseFormFilterPropel) in order to use this functionality., (*43)
abstract class BaseFormPropel extends pmFormPropel { }
and, (*44)
abstract class BaseFormPropel extends pmFormFilterPropel { }
These clases uses the plugin's widgets and validators to initialize widgets and validators automatically: * unsets created_at and updated_at fields * uses mtWidgetFormInputDate for date widgets * replaces fields named "attachment" with sfWidgetFormInputFile * hides created_by and updated_by fields, (*45)
dc_ajax
module.A set of useful extra widgets, validators, modules and other handy stuff for your symfony 1 projects
MIT