3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
36 require_once 'CRM/Core/Form.php';
37 require_once 'CRM/Core/OptionGroup.php';
40 * Class CRM_Auction_Form_SearchItem
42 class CRM_Auction_Form_SearchItem
extends CRM_Core_Form
{
44 * This virtual function is used to set the default values of
45 * various form elements
47 * @return array reference to the array of default values
49 function setDefaultValues() {
51 $defaults['auctionsByDates'] = 0;
57 * Build the form object
60 public function buildQuickForm() {
61 $this->add('text', 'title', ts('Find'),
62 array(CRM_Core_DAO
::getAttribute('CRM_Auction_DAO_Auction', 'title'))
65 $this->add('date', 'start_date', ts('From'), CRM_Core_SelectValues
::date('relative'));
66 $this->addRule('start_date', ts('Select a valid Auction FROM date.'), 'qfDate');
68 $this->add('date', 'end_date', ts('To'), CRM_Core_SelectValues
::date('relative'));
69 $this->addRule('end_date', ts('Select a valid Auction TO date.'), 'qfDate');
71 $this->addButtons(array(
72 array('type' => 'refresh',
73 'name' => ts('Search'),
82 function postProcess() {
83 $params = $this->controller
->exportValues($this->_name
);
84 $parent = $this->controller
->getParent();
85 $parent->set('searchResult', 1);
86 if (!empty($params)) {
87 $fields = array('title', 'item_type_id');
88 foreach ($fields as $field) {
89 if (isset($params[$field]) &&
90 !CRM_Utils_System
::isNull($params[$field])
92 $parent->set($field, $params[$field]);
95 $parent->set($field, NULL);