<?php

/**
 * @package		ARTIO Booking
 * @subpackage  models
 * @copyright	Copyright (C) 2010 ARTIO s.r.o.. All rights reserved.
 * @author 		ARTIO s.r.o., http://www.artio.net
 * @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
 * @link        http://www.artio.net Official website
 */
defined('_JEXEC') or die();

class JFormRuleFields extends JFormRule {

    public function test(\SimpleXMLElement $element, $fields, $group = null, \JRegistry $input = null, \JForm $form = null) {
        $value = (array) JFactory::getApplication()->getUserState('com_booking.fields.value');
        JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_booking/tables');
        return JTable::getInstance('Field', 'Table')->truncate()->store($value);
    }

}
