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_DateCriterion extends Horde_Form
 6: {
 7:     public function __construct(&$vars)
 8:     {
 9:         parent::__construct(
10:             $vars,
11:             $vars->get('edit') ? _("Edit Date Criterion") : _("Add Date Criterion"),
12:             'Whups_Form_Query_DateCriterion');
13: 
14:         $this->addHidden('', 'edit', 'boolean', false);
15: 
16:         $this->addVariable(
17:             _("Created from"), 'ticket_timestamp[from]', 'monthdayyear', false,
18:             false, null, array(date('Y') - 10));
19:         $this->addVariable(
20:             _("Created to"), 'ticket_timestamp[to]', 'monthdayyear', false,
21:             false, null, array(date('Y') - 10));
22: 
23:         $this->addVariable(
24:             _("Updated from"), 'date_updated[from]', 'monthdayyear', false,
25:             false, null, array(date('Y') - 10));
26:         $this->addVariable(
27:             _("Updated to"), 'date_updated[to]', 'monthdayyear', false, false,
28:             null, array(date('Y') - 10));
29: 
30:         $this->addVariable(
31:             _("Resolved from"), 'date_resolved[from]', 'monthdayyear', false,
32:             false, null, array(date('Y') - 10));
33:         $this->addVariable(
34:             _("Resolved to"), 'date_resolved[to]', 'monthdayyear', false, false,
35:             null, array(date('Y') - 10));
36: 
37:         $this->addVariable(
38:             _("Assigned from"), 'date_assigned[from]', 'monthdayyear', false,
39:             false, null, array(date('Y') - 10));
40:         $this->addVariable(
41:             _("Assigned to"), 'date_assigned[to]', 'monthdayyear', false,
42:             false, null, array(date('Y') - 10));
43: 
44:         $this->addVariable(
45:             _("Due from"), 'ticket_due[from]', 'monthdayyear', false, false,
46:             null, array(date('Y') - 10));
47:         $this->addVariable(
48:             _("Due to"), 'ticket_due[to]', 'monthdayyear', false, false, null,
49:             array(date('Y') - 10));
50:     }
51: 
52:     public function execute(&$vars)
53:     {
54:         $path = $vars->get('path');
55:         $parent = false;
56: 
57:         $keys = array(
58:             Whups_Query::CRITERION_TIMESTAMP => 'ticket_timestamp',
59:             Whups_Query::CRITERION_UPDATED => 'date_updated',
60:             Whups_Query::CRITERION_RESOLVED => 'date_resolved',
61:             Whups_Query::CRITERION_ASSIGNED => 'date_assigned',
62:             Whups_Query::CRITERION_DUE => 'ticket_due');
63: 
64:         foreach ($keys as $key_id => $key_name) {
65:             $date = $vars->get($key_name . '[from]');
66:             if (!empty($date['month'])) {
67:                 if (!$parent) {
68:                     $path = $GLOBALS['whups_query']->insertBranch(
69:                         $path, Whups_Query::TYPE_AND);
70:                     $parent = true;
71:                 }
72:                 $date = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']);
73:                 $GLOBALS['whups_query']->insertCriterion(
74:                     $path, $key_id, null, Whups_Query::OPERATOR_GREATER, $date);
75:             }
76:             $date = $vars->get($key_name . '[to]');
77:             if (!empty($date['month'])) {
78:                 if (!$parent) {
79:                     $path = $GLOBALS['whups_query']->insertBranch(
80:                         $path, Whups_Query::TYPE_AND);
81:                     $parent = true;
82:                 }
83:                 $date = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']);
84:                 $GLOBALS['whups_query']->insertCriterion(
85:                     $path, $key_id, null, Whups_Query::OPERATOR_LESS, $date);
86:             }
87:         }
88: 
89:         $this->unsetVars($vars);
90:     }
91: 
92: }
API documentation generated by ApiGen