本文整理汇总了PHP中IEM::logUserActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP IEM::logUserActivity方法的具体用法?PHP IEM::logUserActivity怎么用?PHP IEM::logUserActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEM
的用法示例。
在下文中一共展示了IEM::logUserActivity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EditNewsletter
/**
* EditNewsletter
* Loads up stage 1 of editing a newsletter (choosing format, templates etc).
*
* @param Int $newsletterid Newsletter to load up.
*
* @see GetApi
* @see GetTemplateList
* @see Newsletter_API::Load
* @see Newsletter_API::GetAllFormats
*
* @return Void Prints out the form, doesn't return anything.
*/
function EditNewsletter($newsletterid=0) {
$newsletter = $this->GetApi();
if ($newsletterid <= 0 || !$newsletter->Load($newsletterid)) {
$GLOBALS['Error'] = GetLang('UnableToLoadNewsletter');
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
$this->ManageNewsletters();
return;
}
// Log this to "User Activity Log"
IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/newsletters_view.gif', $newsletter->name);
$GLOBALS['Action'] = 'Edit&SubAction=Step2&id=' . $newsletterid;
$GLOBALS['CancelButton'] = GetLang('EditNewsletterCancelButton');
$GLOBALS['Heading'] = GetLang('EditNewsletter');
$GLOBALS['Intro'] = GetLang('EditNewsletterIntro');
$GLOBALS['NewsletterDetails'] = GetLang('EditNewsletterHeading');
$GLOBALS['FormatList'] = '';
$allformats = $newsletter->GetAllFormats();
foreach ($allformats as $id => $name) {
$selected = '';
if ($id == $newsletter->format) {
$selected = ' SELECTED';
}
if ($name == 'TextAndHTML') {
$recommended = ' ' . GetLang('Recommended');
} else {
$recommended = '';
}
$GLOBALS['FormatList'] .= '<option value="' . $id . '"' . $selected . '>' . GetLang('Format_' . $name) . $recommended . '</option>';
}
$GLOBALS['Name'] = htmlspecialchars($newsletter->name, ENT_QUOTES, SENDSTUDIO_CHARSET);
$GLOBALS['DisplayTemplateList'] = 'none';
$this->ParseTemplate('Newsletter_Form_Step1');
}
示例2: Process
//.........这里部分代码省略.........
$this->DeleteAutoresponders($autolist);
} else {
$this->DenyAccess();
}
break;
case 'step2':
$listid = 0;
if (isset($_GET['list'])) {
$listid = (int)$_GET['list'];
}
$this->ManageAutoresponders($listid);
break;
case 'sendpreviewdisplay':
$this->SendPreviewDisplay();
break;
case 'sendpreview':
$this->SendPreview();
break;
case 'view':
$id = (isset($_GET['id'])) ? (int)$_GET['id'] : 0;
$type = strtolower(get_class($this));
$autoresponderapi = $this->GetApi();
if (!$autoresponderapi->Load($id)) {
break;
}
// Log this to "User Activity Log"
$logURL = SENDSTUDIO_APPLICATION_URL . '/admin/index.php?Page=' . __CLASS__ . '&Action=Edit&id=' . $_GET['id'];
IEM::logUserActivity($logURL, 'images/autoresponders_view.gif', $autoresponderapi->name);
$details = array();
$details['htmlcontent'] = $autoresponderapi->GetBody('HTML');
$details['textcontent'] = $autoresponderapi->GetBody('Text');
$details['format'] = $autoresponderapi->format;
$this->PreviewWindow($details);
break;
case 'edit':
$subaction = (isset($_GET['SubAction'])) ? strtolower($_GET['SubAction']) : false;
switch ($subaction) {
case 'save':
case 'complete':
$user = IEM::getCurrentUser();
$session_autoresponder = IEM::sessionGet('Autoresponders');
$listid = $session_autoresponder['list'];
if (!$session_autoresponder || !isset($session_autoresponder['autoresponderid'])) {
$this->ManageAutoresponders($listid);
break;
}
$text_unsubscribelink_found = true;
$html_unsubscribelink_found = true;
$id = $session_autoresponder['autoresponderid'];
$autoapi = $this->GetApi();
$autoapi->Load($id);
示例3: ViewSubscriber
/**
* ViewSubscriber
* Prints the 'view subscriber' page and all appropriate options including custom fields.
*
* @param Int $listid The list the subscriber is on. This is checked to make sure the user has 'manage' access to the list before anything else.
* @param Int $subscriberid The subscriberid to view.
* @param Int $segmentid The ID of the segment that the subscriber is going to be fetched from
* @param String $msgtype The heading to show when viewing a subscriber. This can be either error or success. Used with $msg to display something.
* @param String $msg The message to display in the heading. If this is not present, no message is displayed.
*
* @see GetApi
* @see Subscribers_API::GetCustomFieldSettings
* @see Lists_API::GetCustomFields
* @see Lists_API::Load
* @see Lists_API::GetListFormat
*
* @return Void Doesn't return anything. Prints out the view form and that's it.
*/
function ViewSubscriber($listid = 0, $subscriberid = 0, $segmentid = 0, $msgtype = 'Error', $msg = false)
{
$user = GetUser();
$access = $user->HasAccess('Subscribers', 'Manage');
if (!$access) {
$this->DenyAccess();
return;
}
$this->SetupGoogleCalendar();
$search_info = IEM::sessionGet('Search_Subscribers');
$GLOBALS['list'] = $listid;
if ($msg && $msgtype) {
switch (strtolower($msgtype)) {
case 'success':
$GLOBALS['Success'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('SuccessMsg', true, false);
break;
default:
$GLOBALS['Error'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
}
}
$SubscriberApi = $this->GetApi('Subscribers');
$subscriberinfo = false;
/**
* Get Subscriber record from the database
*/
$adminAccess = false;
// If this user is an admin/list admin/list admintype == a then give permission
if ($user->Admin() || $user->ListAdminType() == 'a' || $user->ListAdmin()) {
$adminAccess = true;
}
// Get subscribers from list
if ($segmentid == 0) {
if (!$adminAccess && !$SubscriberApi->CheckPermission($user->userid, $subscriberid)) {
$this->DenyAccess();
return;
}
$subscriberinfo = $SubscriberApi->LoadSubscriberList($subscriberid, $listid);
// Get subscribers from segment
} else {
if (!$adminAccess) {
$segmentapi = $this->GetApi('Segment', true);
$segmentapi->Load($segmentid);
if ($segmentapi->ownerid != $user->userid && !$user->HasAccess('Segments', 'View', $segmentid)) {
$this->DenyAccess();
return;
}
}
$subscriberinfo = $SubscriberApi->LoadSubscriberSegment($subscriberid, $segmentid);
}
/**
* -----
*/
// hmm, the subscriber doesn't exist or can't be loaded? show an error.
if (empty($subscriberinfo)) {
$GLOBALS['ErrorMessage'] = GetLang('SubscriberDoesntExist_View');
$this->DenyAccess();
return;
}
// Log this to "User Activity Log"
$logURL = SENDSTUDIO_APPLICATION_URL . '/admin/index.php?Page=Subscribers&Action=Edit&List=' . $_GET['List'] . '&id=' . $_GET['id'];
IEM::logUserActivity($logURL, 'images/contacts_view.gif', $subscriberinfo['emailaddress']);
$list_api = $this->GetApi('Lists');
$list_api->Load($listid);
//.........这里部分代码省略.........
示例4: EditCustomField
/**
* EditCustomField
* Allows editing of a custom field. This also handles whether to show more options (if it's a checkbox/dropdown) and so on.
*
* @param Int $fieldid Fieldid to load and edit.
*
* @see GetApi
* @see CustomFields_API::Load
* @see CustomFields_API::Settings
* @see MoreOptions
* @see MoreOptionsToShow
*
* @return Void Doesn't return anything, just prints out the results.
*/
function EditCustomField($fieldid=0)
{
if ($fieldid <= 0) {
return false;
}
$api = $this->GetApi();
if (!$api->Load($fieldid)) {
$GLOBALS['ErrorMessage'] = GetLang('CustomFieldDoesntExist');
$this->DenyAccess();
return;
}
$fieldapi = $this->GetApi('CustomFields_' . $api->fieldtype);
$fieldapi->Load($fieldid);
// Log this to "User Activity Log"
IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/customfields.gif', $api->Settings['FieldName']);
$GLOBALS['CustomFieldDetails'] = GetLang('EditCustomField');
$GLOBALS['Action'] = 'Edit&SubAction=Update&id=' . $fieldid;
$GLOBALS['CancelButton'] = GetLang('EditCustomField_CancelPrompt');
$GLOBALS['Heading'] = GetLang('EditCustomField');
$GLOBALS['Intro'] = GetLang('EditCustomFieldIntro');
$type = $fieldapi->fieldtype;
$GLOBALS['FieldType'] = GetLang('CustomFieldType_' . strtolower($type));
$GLOBALS['FieldName'] = htmlspecialchars($fieldapi->Settings['FieldName'], ENT_QUOTES, SENDSTUDIO_CHARSET);
$fieldoptions = $fieldapi->GetOptions();
foreach ($fieldoptions as $name => $val) {
if (!is_array($fieldapi->Settings[$name])) {
$GLOBALS[$name] = htmlspecialchars($fieldapi->Settings[$name], ENT_QUOTES, SENDSTUDIO_CHARSET);
continue;
}
foreach ($fieldapi->Settings[$name] as $p => $pname) {
$GLOBALS['Display'.$p] = htmlspecialchars($pname, ENT_QUOTES, SENDSTUDIO_CHARSET);
}
}
$required = '';
if ($fieldapi->Settings['FieldRequired']) {
$required = ' CHECKED';
}
$GLOBALS['FieldRequired'] = $required;
if (isset($fieldapi->Settings['ApplyDefault'])) {
$required = ' CHECKED';
}
$GLOBALS['ApplyDefault'] = $required;
$GLOBALS['CancelButton'] = GetLang('EditCustomField_CancelPrompt');
$currentlist = '';
$extralist = '';
$extralistdisplay = 'none';
$addmorelinkdisplay = '';
if (in_array($fieldapi->fieldtype, $this->MoreOptions)) {
$extralist_template = 'CustomField_Form_Step2_' . $fieldapi->fieldtype . '_list_edit';
$keysize = sizeof($fieldapi->Settings['Key']);
for ($i = 1; $i <= $keysize; $i++) {
$GLOBALS['KeyNumber'] = $i;
$GLOBALS['Key'] = htmlspecialchars($fieldapi->Settings['Key'][$i-1], ENT_QUOTES, SENDSTUDIO_CHARSET);
$GLOBALS['Value'] = htmlspecialchars($fieldapi->Settings['Value'][$i-1], ENT_QUOTES, SENDSTUDIO_CHARSET);
$currentlist .= $this->ParseTemplate($extralist_template, true, false);
}
$end = $i;
$GLOBALS['Key'] = '';
$GLOBALS['Value'] = '';
$GLOBALS['KeyNumber'] = $i;
$extralist .= $this->ParseTemplate($extralist_template, true, false);
$GLOBALS['CurrentSize'] = $i;
}
//.........这里部分代码省略.........
示例5: PrintEditForm
//.........这里部分代码省略.........
$GLOBALS['AdminNotifications_Import_Email'] = $user->Get('adminnotify_import_emailtext');
if (empty($GLOBALS['AdminNotifications_Import_Email'])) {
$GLOBALS['AdminNotifications_Import_Email'] = GetLang('AdminNotifications_Import_Email');
}
$GLOBALS['SendLimit'] = $user->Get('adminnotify_send_threshold');
$GLOBALS['ImportLimit'] = $user->Get('adminnotify_import_threshold');
if (empty($GLOBALS['SendLimit'])) {
$GLOBALS['SendLimit'] = 1000;
}
if (empty($GLOBALS['ImportLimit'])) {
$GLOBALS['ImportLimit'] = 1000;
}
$admin_flag = $user->Get('adminnotify_send_flag');
if ($user->Get('adminnotify_send_flag') == 1) {
$GLOBALS['AdminNotificationsSend'] = 'CHECKED';
$GLOBALS['UseNotifySend'] = '';
} else {
$GLOBALS['UseNotifySend'] = "style=display:none;";
}
if ($user->Get('adminnotify_import_flag') == 1) {
$GLOBALS['AdminNotificationsImport'] = 'CHECKED';
$GLOBALS['UseNotifyImport'] = '';
} else {
$GLOBALS['UseNotifyImport'] = "style=display:none;";
}
$GLOBALS['SmtpPort'] = $user->Get('smtpport');
// Log this to "User Activity Log"
IEM::logUserActivity(IEM::urlFor('users', array('Action' => 'Edit', 'UserID' => $userid)), 'images/user.gif', $user->username);
} else {
$timezone = (isset($details['timezone'])) ? $details['timezone'] : SENDSTUDIO_SERVERTIMEZONE;
$GLOBALS['TimeZoneList'] = $this->TimeZoneList($timezone);
$activity = $thisuser->defaultEventActivityType;
if (!is_array($activity)) {
$activity = array();
}
$GLOBALS['EventActivityType'] = implode("\n", $activity);
$GLOBALS['FormAction'] = 'Action=Create';
if (!empty($details)) {
foreach ($details as $area => $val) {
$GLOBALS[$area] = $val;
}
}
$GLOBALS['Heading'] = GetLang('CreateUser');
$GLOBALS['Help_Heading'] = GetLang('Help_CreateUser');
$listadmintype = 'c';
$segmentadmintype = 'c';
$admintype = 'c';
$templateadmintype = 'c';
$GLOBALS['DisplayMaxLists'] = 'none';
$GLOBALS['DisplayEmailsPerHour'] = 'none';
$GLOBALS['DisplayEmailsPerMonth'] = 'none';
$GLOBALS['DisplayEmailsMaxEmails'] = 'none';
$GLOBALS['MaxLists'] = '0';
示例6: Process
//.........这里部分代码省略.........
$usecaptcha = true;
}
$formapi->Set('customfields', $field_order);
$formapi->Set('design', $design);
$formapi->Set('formtype', $formtype);
$formapi->Set('chooseformat', $chooseformat);
$formapi->Set('changeformat', $changeformat);
$formapi->Set('usecaptcha', $usecaptcha);
$html = $formapi->GetHTML(true);
echo $html;
exit();
break;
case 'gethtml':
$this->GetFormHTML();
break;
case 'view':
$this->PrintHeader(true);
$id = (isset($_GET['id'])) ? (int)$_GET['id'] : false;
$formapi = $this->GetApi();
$loaded = $formapi->Load($id);
if (!$id || !$loaded) {
$GLOBALS['Error'] = GetLang('NoSuchForm');
$html = $this->ParseTemplate('ErrorMsg', true, false);
} else {
// Log this to "User Activity Log"
$logURL = SENDSTUDIO_APPLICATION_URL . '/admin/index.php?Page=' . __CLASS__ . '&Action=Edit&id=' . $_GET['id'];
IEM::logUserActivity($logURL, 'images/forms_view.gif', $formapi->name);
$formtype = $formapi->Get('formtype');
// if it's a 'm'odify-details form or 'f'riend form,
// get the user modified html instead of the built in html.
if (in_array($formtype, array('m', 'f'))) {
$html = $formapi->Get('formhtml');
} else {
$html = $formapi->GetHTML(true);
}
}
header('Content-type: text/html; charset="' . SENDSTUDIO_CHARSET . '"');
print '<html><head><meta http-equiv="Content-Type" content="text/html; charset='.SENDSTUDIO_CHARSET.'"></head><body>';
echo $html;
print '</body></html>';
exit();
break;
case 'copy':
$id = (isset($_GET['id'])) ? (int)$_GET['id'] : 0;
$api = $this->GetApi();
$result = $api->Copy($id);
if (!$result) {
$GLOBALS['Error'] = GetLang('FormCopyFail');
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
} else {
$GLOBALS['Message'] = $this->PrintSuccess('FormCopySuccess');
}
$this->ManageForms();
break;
示例7: ManageSubscribers_Step3
//.........这里部分代码省略.........
$GLOBALS['AddButtonURL'] = 'index.php?Page=Subscribers&Action=Add&SubAction=Step2&list=' . $search_info['List'];
} else {
/**
* If we're viewing more than one list, use those id's.
*/
if (is_array($search_info['List'])) {
$listids = $search_info['List'];
$title = GetLang('SubscribersManageMultipleList');
} else {
/**
* The default is all of the users lists.
*/
$listids = array_keys($user_lists);
$title = GetLang('SubscribersManageAnyList');
}
/**
* Override the title if we're coming from a search result.
*/
if ($search_info['Source'] == 'search') {
$title = GetLang('SubscribersManageSearchResult');
}
$GLOBALS['AddButtonURL'] = 'index.php?Page=Subscribers&Action=Add';
$GLOBALS['ColumnCount'] = 4;
}
}
$GLOBALS['SubscribersManage'] = $title;
// Log this to "User Activity Log" except when is deleting.
if (!(isset($_GET['SubAction']) && strtolower($_GET['SubAction']) != "delete")) {
IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/lists_view.gif', $title);
}
if ($totalsubscribers < 1) {
IEM::sessionRemove('Search_Subscribers');
if ($subscriber_edited) {
$GLOBALS['Message'] .= $this->PrintSuccess('SubscriberEditSuccess');
} else {
$GLOBALS['Message'] .= $this->PrintSuccess('NoSubscribersMatch', true);
}
$this->ParseTemplate('Subscribers_Manage_Empty');
return;
}
if ($totalsubscribers == 1) {
$GLOBALS['Message'] .= $this->PrintSuccess('Subscribers_' . $tempMessageStringSubfix . 'FoundOne');
} else {
$GLOBALS['Message'] .= $this->PrintSuccess('Subscribers_' . $tempMessageStringSubfix . 'FoundMany', $GLOBALS['TotalSubscriberCount']);
}
$CustomFieldsApi = $this->GetApi('CustomFields');
$customfields_for_all_lists = $CustomFieldsApi->GetCustomFieldsForLists($listids, $visiblefields_set);
$listNames = array();
foreach ($listids as $listid) {
array_push($listNames, $user_lists[$listid]['name']);
foreach ($this->BuiltinFields as $key => $name) {
if (in_array($key,$visiblefields_set) && !in_array($key,$visiblefields)) {
if (!isset($visiblefields_lists[$key])) {
$visiblefields_lists[$key] = array();
}
$visiblefields_lists[$key][] = (int)$listid;
示例8: EditSubscriber
/**
* EditSubscriber
* Prints the 'edit subscriber' form and all appropriate options including custom fields.
*
* @param Int $listid The list the subscriber is on. This is checked to make sure the user has 'edit' access to the list before anything else.
* @param Int $subscriberid The subscriberid to edit.
* @param Int $segmentid The segment the subscriber is on.
* @param String $msgtype The heading to show when editing a subscriber. This can be either error or success. Used with $msg to display something.
* @param String $msg The message to display in the heading. If this is not present, no message is displayed.
*
* @see GetApi
* @see Subscribers_API::GetCustomFieldSettings
* @see Lists_API::GetCustomFields
* @see Lists_API::Load
* @see Lists_API::GetListFormat
*
* @return Void Doesn't return anything. Prints out the edit form and that's it.
*/
function EditSubscriber($listid = 0, $subscriberid = 0, $segmentid = 0, $msgtype = 'Error', $msg = false)
{
$user = GetUser();
$access = $user->HasAccess('Subscribers', 'Edit');
if (!$access) {
$this->DenyAccess();
return;
}
$this->SetupGoogleCalendar();
$search_info = IEM::sessionGet('Search_Subscribers');
$GLOBALS['list'] = $listid;
if ($msg && $msgtype) {
switch (strtolower($msgtype)) {
case 'success':
$GLOBALS['Success'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('SuccessMsg', true, false);
break;
default:
$GLOBALS['Error'] = $msg;
$GLOBALS['Message'] = $this->ParseTemplate('ErrorMsg', true, false);
}
}
$SubscriberApi = $this->GetApi('Subscribers');
/**
* Get Subscriber record from the database
*/
$adminAccess = false;
// If this user is an admin/list admin/list admintype == a then give permission
if ($user->Admin() || $user->ListAdminType() == 'a' || $user->ListAdmin()) {
$adminAccess = true;
}
// Get subscribers from list
if ($segmentid == 0) {
if (!$adminAccess && !$SubscriberApi->CheckPermission($user->userid, $subscriberid)) {
$this->DenyAccess();
return;
}
$subscriberinfo = $SubscriberApi->LoadSubscriberList($subscriberid, $listid);
// Get subscribers from segment
} else {
if (!$adminAccess) {
$segmentapi = $this->GetApi('Segment', true);
$segmentapi->Load($segmentid);
if ($segmentapi->ownerid != $user->userid && !$user->HasAccess('Segments', 'View', $segmentid)) {
$this->DenyAccess();
return;
}
}
$subscriberinfo = $SubscriberApi->LoadSubscriberSegment($subscriberid, $segmentid);
$GLOBALS['SegmentID'] = $segmentid;
}
/**
* -----
*/
// hmm, the subscriber doesn't exist or can't be loaded? show an error.
if (empty($subscriberinfo)) {
$GLOBALS['ErrorMessage'] = GetLang('SubscriberDoesntExist_Edit');
$this->DenyAccess();
return;
}
$list_api = $this->GetApi('Lists');
$list_api->Load($listid);
// Log this to "User Activity Log"
if (IEM::requestGetGET('Action', '', 'strtolower') != 'save') {
IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/contacts_view.gif', $subscriberinfo['emailaddress']);
}
//.........这里部分代码省略.........
示例9: _edit
/**
* _edit
* Display the editor page foe editing existing record
*
* @param Array $parameters Any parameters that need to be parsed to this function (OPTIONAL)
* @return String Returns response string that can be outputted to the browser
*
* @uses SendStudio_Functions::_getGETRequest()
* @uses SendStudio_Functions::GetApi()
* @uses TriggerEmails_API::GetRecordByID()
* @uses TriggerEmails::_manage()
* @uses TriggerEmails::_getEditor()
* @uses FlashMessage()
*
* @test permission
*/
private function _edit($parameters = array())
{
if (!$parameters['user']->HasAccess('triggeremails', 'edit')) {
$this->DenyAccess();
exit();
}
$id = intval($this->_getGETRequest('id', 0));
if ($id == 0) {
return $this->_manage($parameters);
}
$api = $this->GetApi();
if (!$parameters['user']->Admin() && !$api->IsOwner($id, $parameters['user']->userid)) {
$this->DenyAccess();
exit();
}
$record = $api->GetRecordByID($id);
if ($record === false || empty($record)) {
FlashMessage(GetLang('TriggerEmails_Cannot_Load_Record'), SS_FLASH_MSG_ERROR, 'index.php?Page=TriggerEmails');
}
// ----- Fetch trigger data
$tempData = $api->GetData($id);
if ($tempData === false) {
FlashMessage(GetLang('TriggerEmails_Cannot_Load_Record'), SS_FLASH_MSG_ERROR, 'index.php?Page=TriggerEmails');
}
if (array_key_exists($id, $tempData)) {
$record['data'] = $tempData[$id];
}
unset($tempData);
// -----
// ----- Fetch trigger actions
$tempActions = $api->GetActions($id);
if ($tempActions === false) {
FlashMessage(GetLang('TriggerEmails_Cannot_Load_Record'), SS_FLASH_MSG_ERROR, 'index.php?Page=TriggerEmails');
}
if (array_key_exists($id, $tempActions)) {
$record['triggeractions'] = $tempActions[$id];
}
unset($tempActions);
// -----
// Log this to "User Activity Log"
IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/triggeremails_view.gif', $record['name']);
return $this->_getEditor($parameters, $record);
}
示例10: TriggerEmailsStats_View
/**
* TriggerEmailsStats_View
* Handle listing of the trigger emails statistics
*
* @return Void Prints output directly to stdout without returning anything.
*
* @uses Stats_API::GetTriggerEmailsStats()
*/
function TriggerEmailsStats_View()
{
// ----- Sanitize and declare variables that is going to be used in this function
$user = IEM::userGetCurrent();
$id = intval($this->_getGETRequest('id', ''));
$record = array();
$triggerrecord = array();
$api = $this->GetApi();
$triggerapi = $this->GetApi('TriggerEmails');
$page = array(
'messages' => GetFlashMessages(),
'whichtab' => intval($this->_getGETRequest('tab', 1)),
'unique_open' => ($this->_getGETRequest('Unique', false) ? true : false),
'session_token' => md5(uniqid(rand()))
);
$tabs = array(
'snapshot' => array(),
'open' => array(),
'links' => array(),
'bounces' => array(),
'unsubscribe' => array(),
'forward' => array(),
'recipients' => array()
);
// ----
if ($id == 0) {
return $this->TriggerEmailsStats_List();
}
// Make sure that user can access this particular trigger email statistics
if (!$this->_TriggerEmailsStats_Access($id)) {
return $this->TriggerEmailsStats_List();
}
// ----- Load trigger emails statistics record
$record = $api->GetTriggerEmailsStatsRecord($id);
$triggerrecord = $triggerapi->GetRecordByID($id, true, true);
if (!isset($triggerrecord['triggeractions']) || !is_array($triggerrecord['triggeractions'])) {
$triggerrecord['triggeractions'] = array();
}
if (!isset($triggerrecord['triggeractions']['send']) || !is_array($triggerrecord['triggeractions']['send'])) {
$triggerrecord['triggeractions']['send'] = array();
}
$temp = array('trackopens', 'tracklinks');
foreach ($temp as $each) {
if (!isset($triggerrecord['triggeractions']['send'][$each])) {
$triggerrecord['triggeractions']['send'][$each] = 0;
}
}
if (empty($record)) {
return $this->TriggerEmailsStats_List();
}
// -----
// Log this to "User Activity Log"
IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/chart_bar.gif', $record['triggeremailsname']);
// ----- Calculate some common variables for the record
$record['processed_totalsent'] = intval($record['htmlrecipients']) + intval($record['textrecipients']) + intval($record['multipartrecipients']);
$record['processed_unopened'] = abs($record['processed_totalsent'] - $record['emailopens_unique']);
$record['processed_totalbounced'] = intval($record['bouncecount_soft']) + intval($record['bouncecount_hard']) + intval($record['bouncecount_unknown']);
if ($record['processed_totalsent'] != 0) {
if ($triggerrecord['triggeractions']['send']['trackopens'] != 0) {
$record['processed_timeframe_emailopens_total'] = intval($api->GetOpens($record['statid'], 1, 'all', $page['unique_open'], $this->CalendarRestrictions['opens'], true));
$record['processed_timeframe_emailopens_unique'] = intval($api->GetOpens($record['statid'], 1, 'all', $page['unique_open'], $this->CalendarRestrictions['opens'], true));
}
if ($triggerrecord['triggeractions']['send']['tracklinks'] != 0) {
$record['processed_timeframe_linkclicks_total'] = intval($api->GetClicks($record['statid'], 1, 'all', 'a', $this->CalendarRestrictions['clicks'], true));
$record['processed_timeframe_linkclicks_unique'] = intval($api->GetUniqueClicks($record['statid'], 'a', $this->CalendarRestrictions['clicks']));
$record['processed_timeframe_linkclicks_individuals'] = intval($api->GetUniqueClickRecipients($record['statid'], $this->CalendarRestrictions['clicks'], 'a'));
}
$record['processed_timeframe_bounces'] = intval($api->GetBounces($record['statid'], 1, 'all', 'any', $this->CalendarRestrictions['bounces'], true));
$record['processed_timeframe_unsubscribes'] = intval($api->GetUnsubscribes($record['statid'], 1, 'all', $this->CalendarRestrictions['unsubscribes'], true));
if (array_key_exists('forwards', $this->CalendarRestrictions) && !empty($this->CalendarRestrictions['forwards'])) {
$record['processed_timeframe_forwards'] = intval($api->GetForwards($record['statid'], 1, 'all', $this->CalendarRestrictions['forwards'], true));
//.........这里部分代码省略.........