<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
*
* @var int
*/
- private $_friendId;
+ public $_friendId;
public function preProcess() {
parent::preProcess();
*
* @access public
*
- * @return None
+ * @return void
*/
public function setDefaultValues() {
$defaults = array();
$defaults['entity_table'] = 'civicrm_event';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
- if (CRM_Utils_Array::value('id', $defaults)) {
+ if (!empty($defaults['id'])) {
$defaults['tf_id'] = CRM_Utils_Array::value('id', $defaults);
$this->_friendId = $defaults['tf_id'];
// lets unset the 'id' since it conflicts with eventID (or contribID)
/**
* Function to build the form
*
- * @return None
+ * @return void
* @access public
*/
public function buildQuickForm() {
+ if (isset($this->_id)) {
+ $defaults['entity_table'] = 'civicrm_event';
+ $defaults['entity_id'] = $this->_id;
+ CRM_Friend_BAO_Friend::getValues($defaults);
+ $this->_friendId = CRM_Utils_Array::value('id', $defaults);
+ }
+
CRM_Friend_BAO_Friend::buildFriendForm($this);
parent::buildQuickForm();
}
*
* @access public
*
- * @return None
+ * @return void
*/
public function postProcess() {
// get the submitted form values.
CRM_Friend_BAO_Friend::addTellAFriend($formValues);
+ // Update tab "disabled" css class
+ $this->ajaxResponse['tabValid'] = !empty($formValues['tf_is_active']);
+
parent::endPostProcess();
}