Merge branch 4.5 into 4.6
[civicrm-core.git] / tests / extensions / test.extension.manager.reporttest / main.php
CommitLineData
6a488035
TO
1<?php
2
aba1cd8b
EM
3/**
4 * Class test_extension_manager_reporttest
5 */
6a488035 6class test_extension_manager_reporttest extends CRM_Core_Report {
aba1cd8b 7 /**
fe482240 8 * Class constructor.
aba1cd8b 9 */
28a04ea9 10 public function __construct() {
11 $logging = new CRM_Logging_Schema();
6a488035
TO
12 $this->tables[] = 'civicrm_contact';
13 $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
14 $this->tables[] = 'civicrm_email';
15 $this->tables[] = 'civicrm_phone';
16 $this->tables[] = 'civicrm_im';
17 $this->tables[] = 'civicrm_openid';
18 $this->tables[] = 'civicrm_website';
19 $this->tables[] = 'civicrm_address';
20 $this->tables[] = 'civicrm_note';
21 $this->tables[] = 'civicrm_relationship';
22
23 $this->detail = 'logging/contact/detail';
24 $this->summary = 'logging/contact/summary';
25
26 parent::__construct();
27 }
28
28a04ea9 29 public function buildQuickForm() {
6a488035
TO
30 $layout = CRM_Utils_Request::retrieve('layout', 'String', $this);
31 $this->assign('layout', $layout);
32
33 parent::buildQuickForm();
34
35 if ($this->cid) {
36 // link back to contact summary
37 $this->assign('backURL', CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
38 $this->assign('revertURL', self::$_template->get_template_vars('revertURL') . "&cid={$this->cid}");
39 }
40 else {
41 // link back to summary report
42 $this->assign('backURL', CRM_Report_Utils_Report::getNextUrl('logging/contact/summary', 'reset=1', FALSE, TRUE));
43 }
44 }
45
4cbe18b8
EM
46 /**
47 * @return string
48 */
6a488035
TO
49 protected function whoWhomWhenSql() {
50 return "
51 SELECT who.id who_id, who.display_name who_name, whom.id whom_id, whom.display_name whom_name, l.is_deleted
52 FROM `{$this->db}`.log_civicrm_contact l
53 JOIN civicrm_contact who ON (l.log_user_id = who.id)
54 JOIN civicrm_contact whom ON (l.id = whom.id)
55 WHERE log_action = 'Update' AND log_conn_id = %1 AND log_date = %2 ORDER BY log_date DESC LIMIT 1
56 ";
57 }
96025800 58
6a488035 59}