*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2016
- * $Id$
- *
*/
class CRM_Logging_ReportDetail extends CRM_Report_Form {
protected $cid;
protected $summary;
/**
+ * Don't display the Add these contacts to Group button.
+ *
+ * @var bool
+ */
+ protected $_add2groupSupported = FALSE;
+
+ /**
+ * Class constructor.
*/
public function __construct() {
- // don’t display the ‘Add these Contacts to Group’ button
- $this->_add2groupSupported = FALSE;
- $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
- $this->db = $dsn['database'];
+ $this->storeDB();
$this->log_conn_id = CRM_Utils_Request::retrieve('log_conn_id', 'Integer', CRM_Core_DAO::$_nullObject);
$this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
);
CRM_Utils_System::appendBreadCrumb($breadcrumb);
- if (CRM_Utils_Request::retrieve('revert', 'Boolean', CRM_Core_DAO::$_nullObject)) {
- $reverter = new CRM_Logging_Reverter($this->log_conn_id, $this->log_date);
- $reverter->revert($this->tables);
- CRM_Core_Session::setStatus(ts('The changes have been reverted.'), ts('Reverted'), 'success');
- if ($this->cid) {
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
- }
- else {
- CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary, 'reset=1', FALSE, TRUE));
- }
+ if (CRM_Utils_Request::retrieve('revert', 'Boolean')) {
+ $this->revert();
}
// make sure the report works even without the params
public function buildQuickForm() {
parent::buildQuickForm();
- $params = array(
- 1 => array($this->log_conn_id, 'Integer'),
- 2 => array($this->log_date, 'String'),
- );
-
$this->assign('whom_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}"));
$this->assign('who_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->altered_by_id}"));
$this->assign('whom_name', $this->altered_name);
$this->assign('revertConfirm', ts('Are you sure you want to revert all changes?'));
}
+ /**
+ * Store the dsn for the logging database in $this->db.
+ */
+ protected function storeDB() {
+ $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
+ $this->db = $dsn['database'];
+ }
+
+ /**
+ * Revert the changes defined by the parameters.
+ */
+ protected function revert() {
+ $reverter = new CRM_Logging_Reverter($this->log_conn_id, $this->log_date);
+ $reverter->revert($this->tables);
+ CRM_Core_Session::setStatus(ts('The changes have been reverted.'), ts('Reverted'), 'success');
+ if ($this->cid) {
+ CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
+ }
+ else {
+ CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary, 'reset=1', FALSE, TRUE));
+ }
+ }
+
}