*/ class saWidgetFormInputCheckboxAgree extends sfWidgetFormInputCheckbox { /** * Constructor. * * Available options: * * - value_attribute_value: The "value" attribute value to set for the checkbox * * @param array $options An array of options * @param array $attributes An array of default HTML attributes * * @see sfWidgetFormInput */ public function __construct($options = array(), $attributes = array()) { $this->addOption('text', __('Souhlasím s').'%cond%.'); $this->addOption('message_title', __('Podmínky')); $this->addOption('message', '...'); $this->addOption('link_name', ' '.__('podmínkami')); parent::__construct($options, $attributes); } /** * Renders the widget. * * @param string $name The element name * @param string $value The this widget is checked if value is not null * @param array $attributes An array of HTML attributes to be merged with the default HTML attributes * @param array $errors An array of errors for the field * * @return string An HTML tag string * * @see sfWidgetForm */ public function render($name, $value = null, $attributes = array(), $errors = array()) { $result = parent::render($name, $value, $attributes, $errors); $link_id = $this->generateId($name).'_cond_link'; $dialog_id = $this->generateId($name).'_cond_dialog'; $result .= strtr($this->getOption('text'), array('%cond%' =>''.$this->getOption('link_name').'')); $script = << $(function(){ $('#{$link_id}').click(function(){ $('#{$dialog_id}').dialog('open'); return false; }); $('#{$dialog_id}').dialog({ width: 640, height: 480, modal: true, autoOpen: false }); });
{$this->getOption('message')}
EOF; return $result.$script; } }