<?php

require_once LAB_PATH_KERNEL.'/classes/HTML/QuickForm2/Renderer/Default.php';

class HTML_LabData_Renderer_Bootstrap extends HTML_QuickForm2_Renderer_Default
{
	public function __construct()
	{
		$this->templatesForClass = array(
			'html_quickform2_element_inputhidden' => '<div style="display: none;">{element}</div>',
			'html_quickform2_element_inputcheckbox' =>
			'<div class="form-group<qf:error> has-error</qf:error>">
				<label class="col-lg-3 control-label" for="{id}">{label}</label>
				<div class="col-lg-9">
					<div class="checkbox">
						<label>
							{element} <qf:label_2>{label_2}</qf:label_2>
						</label>
					</div>
				</div>
			</div>',
			'html_quickform2' => '<div class="quickform">{errors}<form{attributes}><div>{hidden}{content}</div></form><qf:reqnote><div class="reqnote">{reqnote}</div></qf:reqnote></div>',
			'html_quickform2_container_fieldset' => '<fieldset{attributes}><qf:label><legend id="{id}-legend">{label}</legend></qf:label>{content}</fieldset>',
			'special:error' => array(
				'prefix'    => '<div class="errors"><qf:message><p>{message}</p></qf:message><ul><li>',
				'separator' => '</li><li>',
				'suffix'    => '</li></ul><qf:message><p>{message}</p></qf:message></div>'
			),
			'html_quickform2_element' =>
			'<div class="form-group<qf:error> has-error</qf:error>">
				<qf:required><span class="required">*</span></qf:required>
				<qf:label><label class="col-lg-3 control-label" for="{id}">{label}</label></qf:label>
				<div class="col-lg-9">
					{element}
					<qf:error><span class="help-block">{error}</span></qf:error>
				</div>
			</div>',
			'html_quickform2_container_group' => '<div class="row {class}"><p class="label"><qf:required><span class="required">*</span></qf:required><qf:label><label>{label}</label></qf:label></p><div class="element group<qf:error> error</qf:error>" id="{id}"><qf:error><span class="error">{error}<br /></span></qf:error>{content}</div></div>',
			'html_quickform2_container_repeat' => '<div class="row repeat" id="{id}"><qf:label><p>{label}</p></qf:label>{content}</div>'
		);
		
		$this->setOption(
			array(
				'required_note'=>'<em>*</em> '._m('поля обязательные для заполнения.'),
				'errors_prefix'=>_m('Введена неверная информация:'),
				'errors_suffix'=>_m('Пожалуста исправьте эти поля.')
			)
		);
	}
}