Example #1
0
 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     require_once 'CRM/Auction/BAO/Auction.php';
     $defaults = array();
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Auction_BAO_Auction::retrieve($params, $defaults);
     } else {
         $defaults['is_active'] = 1;
     }
     return $defaults;
 }
Example #2
0
 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access public 
  */
 function preProcess()
 {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, true);
     if (($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::UPDATE || $this->_action & CRM_Core_Action::DELETE) && !$this->_id) {
         CRM_Core_Error::fatal("I am not sure which item you looking for.");
     }
     require_once 'CRM/Auction/BAO/Auction.php';
     $params = array('id' => $this->_aid);
     $this->_auctionValues = array();
     CRM_Auction_BAO_Auction::retrieve($params, $this->_auctionValues);
     $this->assign('auctionTitle', $this->_auctionValues['auction_title']);
     // set donor id
     $session =& CRM_Core_Session::singleton();
     $this->_donorID = $this->get('donorID');
     $this->assign('donorName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_donorID, 'display_name'));
     // also set user context
     $session->pushUserContext(CRM_Utils_System::url('civicrm/auction/item', "reset=1&aid={$this->_aid}"));
 }