1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11: class Folks_Search_Form extends Horde_Form {
12:
13: function __construct($vars, $title = '', $name = null)
14: {
15: parent::__construct($vars, $title, $name);
16:
17: $this->addVariable(_("Word"), 'word', 'text', false);
18: $this->addVariable(_("Search by"), 'by', 'set', false, false, null, array(array('uid' => _("Name"), 'city' => _("City"), 'description' => _("Description")), true));
19: $this->addVariable(_("Gender"), 'user_gender', 'radio', false, false, null, array(array(1 => _("Male"), 2 => _("Female")), true));
20: $this->addVariable(_("City"), 'user_city', 'text', false);
21: $this->addVariable(_("Age from"), 'age_from', 'number', false);
22: $this->addVariable(_("Age to"), 'age_to', 'number', false);
23: $this->addVariable(_("Mast have"), 'has', 'set', false , false, null, array(array('picture' => _("Picture"), 'videos' => _("Video"))));
24: $this->addVariable(_("Is online"), 'online', 'boolean', false);
25: $this->setButtons(array(_("Search")));
26: }
27:
28: 29: 30: 31: 32: 33: 34:
35: function getInfo($vars, &$info)
36: {
37: $this->_getInfoFromVariables($this->getVariables(), $this->_vars, $info);
38: }
39:
40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50:
51: function _getInfoFromVariables($variables, &$vars, &$info)
52: {
53: foreach ($variables as $var) {
54: $value = $var->getValue($vars);
55: if (empty($value)) {
56: continue;
57: }
58:
59: require_once 'Horde/Array.php';
60: if (Horde_Array::getArrayParts($var->getVarName(), $base, $keys)) {
61: if (!isset($info[$base])) {
62: $info[$base] = array();
63: }
64: $pointer = &$info[$base];
65: while (count($keys)) {
66: $key = array_shift($keys);
67: if (!isset($pointer[$key])) {
68: $pointer[$key] = array();
69: }
70: $pointer = &$pointer[$key];
71: }
72: $var->getInfo($vars, $pointer);
73: } else {
74: $var->getInfo($vars, $info[$var->getVarName()]);
75: }
76:
77: }
78: }
79: }
80: