/** * Run the page. * * This method is called after the page is created. * * @return void * @access public * */ function run() { // get the callback, module and activity id $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $dao = new CRM_Core_DAO_ActivityHistory(); $dao->activity_id = $id; $dao->activity_type = ts('SMS Sent'); if ($dao->find(TRUE)) { $cid = $dao->entity_id; } $dao = new CRM_SMS_DAO_History(); $dao->id = $id; if ($dao->find(TRUE)) { $this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name')); $this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name')); $this->assign('sentDate', $dao->sent_date); $this->assign('message', $dao->message); // get the display name and images for the contact list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id); CRM_Utils_System::setTitle($contactImage . ' ' . $displayName); // also add the cid params to the Menu array CRM_Core_Menu::addParam('cid', $cid); } return parent::run(); }
/** * returns the list of fields that can be exported * * @access public * return array */ function &export($prefix = false) { if (!$GLOBALS['_CRM_SMS_DAO_HISTORY']['_export']) { $GLOBALS['_CRM_SMS_DAO_HISTORY']['_export'] = array(); $fields =& CRM_SMS_DAO_History::fields(); foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { $GLOBALS['_CRM_SMS_DAO_HISTORY']['_export']['sms_history'] =& $fields[$name]; } else { $GLOBALS['_CRM_SMS_DAO_HISTORY']['_export'][$name] =& $fields[$name]; } } } } return $GLOBALS['_CRM_SMS_DAO_HISTORY']['_export']; }
/** * delete all records for this contact id * * @param int $id */ public static function deleteContact($id) { $dao = new CRM_SMS_DAO_History(); $dao->contact_id = $id; $dao->delete(); }