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:  * @package Whups
  4:  */
  5: class Whups_Form_Query_PropertyCriterion extends Horde_Form
  6: {
  7:     public function __construct(&$vars)
  8:     {
  9:         global $whups_driver;
 10: 
 11:         parent::__construct(
 12:             $vars,
 13:             $vars->get('edit') ? _("Edit Property Criterion") : _("Add Property Criterion"),
 14:             'Whups_Form_Query_PropertyCriterion');
 15: 
 16:         $this->addHidden('', 'edit', 'boolean', false);
 17:         $this->addVariable(_("Id"), 'id', 'intlist', false);
 18: 
 19:         /* Types. */
 20:         $this->addVariable(
 21:             _("Type"), 'ttype', 'enum', false, false, null,
 22:             array($whups_driver->getAllTypes(), _("Any")));
 23: 
 24: 
 25:         /* Queues. */
 26:         $queues = Whups::permissionsFilter(
 27:             $whups_driver->getQueues(), 'queue', Horde_Perms::READ);
 28:         if (count($queues)) {
 29:             $v = &$this->addVariable(
 30:                 _("Queue"), 'queue', 'enum', false, false, null,
 31:                 array($queues, _("Any")));
 32:             $v->setAction(Horde_Form_Action::factory('reload'));
 33:             if ($vars->get('queue')) {
 34:                 $this->addVariable(
 35:                     _("Version"), 'version', 'enum', false, false, null,
 36:                     array($whups_driver->getVersions($vars->get('queue')), _("Any")));
 37:             }
 38:         }
 39: 
 40:         /* States. */
 41:         $states = $whups_driver->getStates();
 42:         $this->addVariable(
 43:             _("State"), 'state', 'enum', false, false, null,
 44:             array($states, _("Any")));
 45: 
 46:         /* Priorities. */
 47:         $priorities = $whups_driver->getPriorities();
 48:         $this->addVariable(
 49:             _("Priority"), 'priority', 'enum', false, false, null,
 50:             array($priorities, _("Any")));
 51:     }
 52: 
 53:     public function execute(&$vars)
 54:     {
 55:         $path = $vars->get('path');
 56: 
 57:         $id = $vars->get('id');
 58:         if (strlen(trim($id))) {
 59:             $newpath = $path;
 60:             $ids = split("[\\t\\n ,]+", $id);
 61: 
 62:             if (count($ids) > 1) {
 63:                 $newpath = $GLOBALS['whups_query']->insertBranch(
 64:                     $path, Whups_Query::TYPE_OR);
 65:             }
 66: 
 67:             foreach ($ids as $id) {
 68:                 $GLOBALS['whups_query']->insertCriterion(
 69:                     $newpath, Whups_Query::CRITERION_ID, null,
 70:                     Whups_Query::OPERATOR_EQUAL, $id);
 71:             }
 72:         }
 73: 
 74:         $queue = $vars->get('queue');
 75:         if ($queue) {
 76:             $version = $vars->get('version');
 77:             if ($version) {
 78:                 $path = $GLOBALS['whups_query']->insertBranch(
 79:                     $path, Whups_Query::TYPE_AND);
 80:             }
 81:             $GLOBALS['whups_query']->insertCriterion(
 82:                 $path, Whups_Query::CRITERION_QUEUE, null,
 83:                 Whups_Query::OPERATOR_EQUAL, $queue);
 84:             if ($version) {
 85:                 $GLOBALS['whups_query']->insertCriterion(
 86:                     $path, Whups_Query::CRITERION_VERSION, null,
 87:                     Whups_Query::OPERATOR_EQUAL, $version);
 88:             }
 89:         }
 90: 
 91:         $type = $vars->get('ttype');
 92:         if ($type) {
 93:             $GLOBALS['whups_query']->insertCriterion(
 94:                 $path, Whups_Query::CRITERION_TYPE, null,
 95:                 Whups_Query::OPERATOR_EQUAL, $type);
 96:         }
 97: 
 98:         $state = $vars->get('state');
 99:         if ($state) {
100:             $GLOBALS['whups_query']->insertCriterion(
101:                 $path, Whups_Query::CRITERION_STATE, null,
102:                 Whups_Query::OPERATOR_EQUAL, $state);
103:         }
104: 
105:         $priority = $vars->get('priority');
106:         if ($priority) {
107:             $GLOBALS['whups_query']->insertCriterion(
108:                 $path, Whups_Query::CRITERION_PRIORITY, null,
109:                  Whups_Query::OPERATOR_EQUAL, $priority);
110:         }
111: 
112:         $this->unsetVars($vars);
113:     }
114: 
115: }
API documentation generated by ApiGen