_showHide = new CRM_Core_ShowHideBlocks(); if (empty($defaults['auctionsByDates'])) { $this->_showHide->addHide('id_fromToDates'); } $this->_showHide->addToTemplate(); return $defaults; } /** * Build the form * * @access public * * @return void */ public function buildQuickForm() { $this->add('text', 'title', ts('Find'), array(CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction', 'title')) ); $auctionsByDates = array(); $searchOption = array(ts('Show Current and Upcoming Auctions'), ts('Search All or by Date Range')); $this->addRadio('auctionsByDates', ts('Auctions by Dates'), $searchOption, array('onclick' => "return showHideByValue('auctionsByDates','1','id_fromToDates','block','radio',true);"), "
"); $this->add('date', 'start_date', ts('From'), CRM_Core_SelectValues::date('relative')); $this->addRule('start_date', ts('Select a valid Auction FROM date.'), 'qfDate'); $this->add('date', 'end_date', ts('To'), CRM_Core_SelectValues::date('relative')); $this->addRule('end_date', ts('Select a valid Auction TO date.'), 'qfDate'); $this->addButtons(array( array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE, ), )); } function postProcess() { $params = $this->controller->exportValues($this->_name); $parent = $this->controller->getParent(); $parent->set('searchResult', 1); if (!empty($params)) { $fields = array('title', 'event_type_id', 'start_date', 'end_date', 'auctionsByDates'); foreach ($fields as $field) { if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field]) ) { $parent->set($field, $params[$field]); } else { $parent->set($field, NULL); } } } } }