Overview

Packages

  • Horde
    • Form
    • MIME
      • Viewer
    • Scheduler
  • None
  • Whups
    • UnitTests

Classes

  • Horde_Core_Ui_VarRenderer_whups
  • Whups
  • Whups_Ajax_Imple_ContactAutoCompleter
  • Whups_Api
  • Whups_Driver
  • Whups_Driver_Sql
  • Whups_Form_AddComment
  • Whups_Form_Admin_AddAttribute
  • Whups_Form_Admin_AddPriority
  • Whups_Form_Admin_AddQueue
  • Whups_Form_Admin_AddReply
  • Whups_Form_Admin_AddState
  • Whups_Form_Admin_AddType
  • Whups_Form_Admin_AddUser
  • Whups_Form_Admin_AddVersion
  • Whups_Form_Admin_CloneType
  • Whups_Form_Admin_DefaultPriority
  • Whups_Form_Admin_DefaultState
  • Whups_Form_Admin_DeleteAttribute
  • Whups_Form_Admin_DeletePriority
  • Whups_Form_Admin_DeleteQueue
  • Whups_Form_Admin_DeleteReply
  • Whups_Form_Admin_DeleteState
  • Whups_Form_Admin_DeleteType
  • Whups_Form_Admin_DeleteVersion
  • Whups_Form_Admin_EditAttributeStepOne
  • Whups_Form_Admin_EditAttributeStepTwo
  • Whups_Form_Admin_EditPriorityStepOne
  • Whups_Form_Admin_EditPriorityStepTwo
  • Whups_Form_Admin_EditQueueStepOne
  • Whups_Form_Admin_EditQueueStepTwo
  • Whups_Form_Admin_EditReplyStepOne
  • Whups_Form_Admin_EditReplyStepTwo
  • Whups_Form_Admin_EditStateStepOne
  • Whups_Form_Admin_EditStateStepTwo
  • Whups_Form_Admin_EditTypeStepOne
  • Whups_Form_Admin_EditTypeStepTwo
  • Whups_Form_Admin_EditUser
  • Whups_Form_Admin_EditVersionStepOne
  • Whups_Form_Admin_EditVersionStepTwo
  • Whups_Form_InsertBranch
  • Whups_Form_Query_AttributeCriterion
  • Whups_Form_Query_ChooseNameForLoad
  • Whups_Form_Query_ChooseNameForSave
  • Whups_Form_Query_DateCriterion
  • Whups_Form_Query_Delete
  • Whups_Form_Query_GroupCriterion
  • Whups_Form_Query_Parameter
  • Whups_Form_Query_PropertyCriterion
  • Whups_Form_Query_TextCriterion
  • Whups_Form_Query_UserCriterion
  • Whups_Form_Renderer_Comment
  • Whups_Form_Search
  • Whups_Form_SendReminder
  • Whups_Form_Ticket_CreateStepFour
  • Whups_Form_Ticket_CreateStepOne
  • Whups_Form_Ticket_CreateStepThree
  • Whups_Form_Ticket_CreateStepTwo
  • Whups_Form_Ticket_Edit
  • Whups_Form_TicketDetails
  • Whups_LoginTasks_SystemTask_Upgrade
  • Whups_Mail
  • Whups_Query
  • Whups_Query_Manager
  • Whups_Reports
  • Whups_Ticket
  • Whups_View_Base
  • Whups_View_Results
  • Whups_View_SavedQueries
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Forms for editing queries.
 4:  *
 5:  * Copyright 2001-2002 Robert E. Coyle <robertecoyle@hotmail.com>
 6:  * Copyright 2001-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * See the enclosed file LICENSE for license information (BSD). If you
 9:  * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
10:  *
11:  * @author  Robert E. Coyle <robertecoyle@hotmail.com>
12:  * @author  Jan Schneider <jan@horde.org>
13:  * @package Whups
14:  */
15: 
16: /**
17:  * @package Whups
18:  */
19: class Whups_Form_Query_UserCriterion extends Horde_Form
20: {
21:     public function __construct(&$vars)
22:     {
23:         parent::Horde_Form(
24:             $vars,
25:             $vars->get('edit') ? _("Edit User Criterion") : _("Add User Criterion"),
26:             'Whups_Form_Query_UserCriterion');
27: 
28:         $this->addHidden('', 'edit', 'boolean', false);
29:         $this->addVariable(_("User ID"), 'user', 'text', true);
30:         $this->addVariable
31:             (_("Match Operator"), 'operator', 'enum', true, false, null,
32:              array(Whups_Query::textOperators()));
33:         $this->addVariable(_("Search Owners"), 'owners', 'boolean', false);
34:         $this->addVariable(_("Search Requester"), 'requester', 'boolean', false);
35:         $this->addVariable(_("Search Comments"), 'comments', 'boolean', false);
36:     }
37: 
38:     public function execute(&$vars)
39:     {
40:         $path = $vars->get('path');
41:         $user = $vars->get('user');
42:         $operator = $vars->get('operator');
43:         $owners = $vars->get('owners');
44:         $requester = $vars->get('requester');
45:         $comments = $vars->get('comments');
46: 
47:         // If we're adding more than one criterion, put them all under an OR
48:         // node (which should be what is wanted in the general case).
49:         if ((bool)$owners + (bool)$requester + (bool)$comments > 1) {
50:             $path = $GLOBALS['whups_query']->insertBranch($path, Whups_Query::TYPE_OR);
51:         }
52: 
53:         if ($owners) {
54:             $GLOBALS['whups_query']->insertCriterion(
55:                 $path, Whups_Query::CRITERION_OWNERS, null, $operator, $user);
56:         }
57: 
58:         if ($requester) {
59:             $GLOBALS['whups_query']->insertCriterion(
60:                 $path, Whups_Query::CRITERION_REQUESTER, null, $operator, $user);
61:         }
62: 
63:         if ($comments) {
64:             $GLOBALS['whups_query']->insertCriterion(
65:                 $path, Whups_Query::CRITERION_ADDED_COMMENT, null, $operator, $user);
66:         }
67: 
68:         $this->unsetVars($vars);
69:     }
70: 
71: }
API documentation generated by ApiGen