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:  * This file contains all Horde_Form classes to create a new ticket.
  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:  * @package Whups
 13:  */
 14: 
 15: /**
 16:  * @package Whups
 17:  */
 18: class Whups_Form_Ticket_CreateStepThree extends Horde_Form
 19: {
 20:     public function __construct(&$vars)
 21:     {
 22:         global $whups_driver, $conf;
 23: 
 24:         parent::__construct($vars, _("Create Ticket - Step 3"));
 25: 
 26:         $states = $whups_driver->getStates($vars->get('type'), 'unconfirmed');
 27:         $attributes = $whups_driver->getAttributesForType($vars->get('type'));
 28: 
 29:         $queue = $vars->get('queue');
 30:         $info = $whups_driver->getQueue($queue);
 31: 
 32:         if ($GLOBALS['registry']->getAuth()) {
 33:             $states2 = $whups_driver->getStates(
 34:                 $vars->get('type'), array('new', 'assigned'));
 35:             if (is_array($states2)) {
 36:                 $states = $states + $states2;
 37:             }
 38:         }
 39: 
 40:         if (Whups::hasPermission($queue, 'queue', 'requester')) {
 41:             $test = $this->addVariable(
 42:                 _("The Requester's Email Address"), 'user_email',
 43:                 'whups:whupsemail', false);
 44:         } elseif (!$GLOBALS['registry']->getAuth()) {
 45:             $this->addVariable(
 46:                 _("Your Email Address"), 'user_email', 'email', true);
 47:             if (!empty($conf['guests']['captcha'])) {
 48:                 $this->addVariable(
 49:                     _("Spam protection"), 'captcha', 'figlet', true, null, null,
 50:                     array(
 51:                         Whups::getCAPTCHA(!$this->isSubmitted()),
 52:                         $conf['guests']['figlet_font']));
 53:             }
 54:         }
 55: 
 56:         // Silently default the state if there is only one choice
 57:         if (count($states) == 1) {
 58:             $vars->set('state', reset(array_keys($states)));
 59:             $f_state = &$this->addHidden(
 60:                 _("Ticket State"), 'state', 'enum', true, false, null, array($states));
 61:         } else {
 62:             $f_state = &$this->addVariable(
 63:                 _("Ticket State"), 'state', 'enum', true, false, null, array($states));
 64:             $f_state->setDefault(
 65:                 $whups_driver->getDefaultState($vars->get('type')));
 66:         }
 67: 
 68:         $f_priority = &$this->addVariable(
 69:             _("Priority"), 'priority', 'enum', true, false, null,
 70:             array($whups_driver->getPriorities($vars->get('type'))));
 71:         $f_priority->setDefault(
 72:             $whups_driver->getDefaultPriority($vars->get('type')));
 73:         $this->addVariable(_("Due Date"), 'due', 'datetime', false, false);
 74:         $this->addVariable(_("Summary"), 'summary', 'text', true, false);
 75:         $this->addVariable(_("Attachment"), 'newattachment', 'file', false);
 76:         $this->addVariable(_("Description"), 'comment', 'longtext', true);
 77:         foreach ($attributes as $attribute_id => $attribute_value) {
 78:             $this->addVariable(
 79:                 $attribute_value['human_name'],
 80:                 'attributes[' . $attribute_id . ']',
 81:                 $attribute_value['type'],
 82:                 $attribute_value['required'],
 83:                 $attribute_value['readonly'],
 84:                 $attribute_value['desc'],
 85:                 $attribute_value['params']);
 86:         }
 87: 
 88:         /* Comment permissions. */
 89:         $groups = $GLOBALS['injector']->getInstance('Horde_Group');
 90:         $mygroups = $groups->listGroups($GLOBALS['registry']->getAuth());
 91:         if ($mygroups) {
 92:             $mygroups = array(0 => _("This comment is visible to everyone")) + $mygroups;
 93:             $v = $this->addVariable(
 94:                 _("Make this comment visible only to members of a group?"), 'group',
 95:                 'enum', false, false, null, array($mygroups));
 96:             $v->setDefault(0);
 97:         }
 98:     }
 99: 
100:     public function validate(&$vars, $canAutoFill = false)
101:     {
102:         global $conf;
103: 
104:         if (!parent::validate($vars, $canAutoFill)) {
105:             if (!$GLOBALS['registry']->getAuth() && !empty($conf['guests']['captcha'])) {
106:                 $vars->remove('captcha');
107:                 $this->removeVariable($varname = 'captcha');
108:                 $this->insertVariableBefore(
109:                     'state', _("Spam protection"), 'captcha', 'figlet', true,
110:                     null, null,
111:                     array(Whups::getCAPTCHA(true),
112:                           $conf['guests']['figlet_font']));
113:             }
114:             return false;
115:         }
116: 
117:         return true;
118:     }
119: 
120: }
API documentation generated by ApiGen