Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-08-21-20-13-45
[civicrm-core.git] / CRM / Contact / Page / View / SMS.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26*/
27
28/**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2013
32 * $Id$
33 *
34 */
35
36/**
37 * Dummy page for details of SMS
38 *
39 */
40class CRM_Contact_Page_View_SMS extends CRM_Core_Page {
41
42 /**
43 * Run the page.
44 *
45 * This method is called after the page is created.
46 *
47 * @return void
48 * @access public
49 *
50 */
51 function run() {
52 // get the callback, module and activity id
53 $action = CRM_Utils_Request::retrieve('action', 'String',
54 $this, FALSE, 'browse'
55 );
56 $id = CRM_Utils_Request::retrieve('id', 'Positive',
57 $this
58 );
59
60 $dao = new CRM_Core_DAO_ActivityHistory();
61 $dao->activity_id = $id;
62 $dao->activity_type = ts('SMS Sent');
63 if ($dao->find(TRUE)) {
64 $cid = $dao->entity_id;
65 }
66
67 $dao = new CRM_SMS_DAO_History();
68 $dao->id = $id;
69
70 if ($dao->find(TRUE)) {
71 $this->assign('fromName',
72 CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
73 $dao->contact_id,
74 'display_name'
75 )
76 );
77 $this->assign('toName',
78 CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
79 $cid,
80 'display_name'
81 )
82 );
83 $this->assign('sentDate', $dao->sent_date);
84 $this->assign('message', $dao->message);
85
86 // get the display name and images for the contact
87 list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
88
89 CRM_Utils_System::setTitle($contactImage . ' ' . $displayName);
90
91 // also add the cid params to the Menu array
92 CRM_Core_Menu::addParam('cid', $cid);
93 }
94 return parent::run();
95 }
96}
97