Overview

Packages

  • Folks
  • None

Classes

  • Folks
  • Folks_Activity_Form
  • Folks_Api
  • Folks_Application
  • Folks_Block_Activities
  • Folks_Block_Friends
  • Folks_Block_Know
  • Folks_Block_New
  • Folks_Block_Random
  • Folks_Block_Recent
  • Folks_Driver
  • Folks_Driver_sql
  • Folks_Friends
  • Folks_Friends_application
  • Folks_Friends_facebook
  • Folks_Friends_prefs
  • Folks_Friends_shared
  • Folks_Friends_sql
  • Folks_Login_Form
  • Folks_Notification
  • Folks_Notification_facebook
  • Folks_Notification_letter
  • Folks_Notification_mail
  • Folks_Notification_tickets
  • Folks_Search_Form
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 4:  *
 5:  * See the enclosed file COPYING for license information (GPL). If you
 6:  * did not receive this file, see http://www.horde.org/licenses/gpl.
 7:  *
 8:  * @author Duck <duck@obala.net>
 9:  * @package Folks
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:      * Fetch the field values of the submitted form.
30:      *
31:      * @param Variables $vars  A Variables instance, optional since Horde 3.2.
32:      * @param array $info      Array to be filled with the submitted field
33:      *                         values.
34:      */
35:     function getInfo($vars, &$info)
36:     {
37:         $this->_getInfoFromVariables($this->getVariables(), $this->_vars, $info);
38:     }
39: 
40:     /**
41:      * Fetch the field values from a given array of variables.
42:      *
43:      * @access private
44:      *
45:      * @param array  $variables  An array of Horde_Form_Variable objects to
46:      *                           fetch from.
47:      * @param object $vars       The Variables object.
48:      * @param array  $info       The array to be filled with the submitted
49:      *                           field values.
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: 
API documentation generated by ApiGen