1: <?php
2: /**
3: * @package Form
4: */
5: class Horde_Form_Type_tableset extends Horde_Form_Type {
6:
7: var $_values;
8: var $_header;
9:
10: function init($values, $header)
11: {
12: $this->_values = $values;
13: $this->_header = $header;
14: }
15:
16: function isValid(&$var, &$vars, $value, &$message)
17: {
18: if (count($this->_values) == 0 || count($value) == 0) {
19: return true;
20: }
21: foreach ($value as $item) {
22: if (!isset($this->_values[$item])) {
23: $error = true;
24: break;
25: }
26: }
27: if (!isset($error)) {
28: return true;
29: }
30:
31: $message = Horde_Form_Translation::t("Invalid data submitted.");
32: return false;
33: }
34:
35: function getHeader()
36: {
37: return $this->_header;
38: }
39:
40: function getValues()
41: {
42: return $this->_values;
43: }
44:
45: /**
46: * Return info about field type.
47: */
48: function about()
49: {
50: return array(
51: 'name' => Horde_Form_Translation::t("Table Set"),
52: 'params' => array(
53: 'values' => array('label' => Horde_Form_Translation::t("Values"),
54: 'type' => 'stringlist'),
55: 'header' => array('label' => Horde_Form_Translation::t("Headers"),
56: 'type' => 'stringlist')),
57: );
58: }
59:
60: }
61: