/** * showOptionsPage * Displays the print option page. * * @return Void Does not return anything. */ function showOptionsPage() { $statstype = $this->_getGETRequest('statstype', null); if ($statstype == null) { return false; exit; } $path = $this->_getGETRequest('path', ''); SendStudio_Functions::LoadLanguageFile('stats'); $stats_api = $this->GetApi('Splittest_Stats'); $bg_color = 'white'; $print_options = '<input type="hidden" name="statstype" value="' . htmlentities($statstype, ENT_QUOTES, SENDSTUDIO_CHARSET) . '" />'; switch ($statstype) { case 'splittest': $splitStatIds = $this->_getGETRequest('statids', null); $jobIds = $this->_getGETRequest('jobids', null); $splitStatIds = SplitTest_API::FilterIntSet($splitStatIds); $jobIds = SplitTest_API::FilterIntSet($jobIds); $print_options .= '<input type="hidden" name="split_statids" value="' . implode(',', $splitStatIds) . '" />'; $print_options .= '<input type="hidden" name="jobids" value="' . implode(',', $jobIds) . '" />'; $options = array('snapshot' => GetLang('Addon_splittest_Menu_ViewStats'), 'open' => GetLang('Addon_splittest_open_summary'), 'click' => GetLang('Addon_splittest_linkclick_summary'), 'bounce' => GetLang('Addon_splittest_bounce_summary'), 'unsubscribe' => GetLang('Addon_splittest_unsubscribe_summary')); foreach ($options as $key => $val) { $bg_color = $bg_color == 'white' ? '#EDECEC' : 'white'; $print_options .= '<div style="background-color: ' . $bg_color . '; padding: 5px; margin-bottom: 5px;">'; $print_options .= '<input id="print_' . $key . '" type="checkbox" name="options[]" value="' . $key . '" checked="checked" style="margin:0;"/> <label for="print_' . $key . '">' . $val . '</label>' . "\n"; $print_options .= '</div>' . "\n"; } break; } $this->template_system->assign('path', $path); $this->template_system->Assign('title', GetLang('Addon_splittest_PrintSplitTestStatistics')); $this->template_system->Assign('print_options', $print_options); $this->template_system->ParseTemplate('print_stats_options'); }
/** * Admin_Action_Delete * This function handles what happens when you delete a split test. * It checks you are doing a form post. * Then it grabs the api and passes the id(s) across to the api to delete. * * It checks what the api returns and creates a flash message based on the result. * Eg you can't delete a split test campaign while it's sending. * * After that, it returns you to the 'Manage' page. * * @uses SplitTest_API::Delete * @see Admin_Action_Default * @uses GetApi */ public function Admin_Action_Delete() { $user = GetUser(); $api = $this->GetApi(); $split_ids = $this->_getPOSTRequest('splitids', null); if (is_null($split_ids)) { $split_ids = $this->_getPOSTRequest('splitid', null); } if (is_null($split_ids)) { FlashMessage(GetLang('Addon_splittest_ChooseSplittestsToDelete'), SS_FLASH_MSG_ERROR, $this->admin_url); return; } $split_ids = SplitTest_API::FilterIntSet($split_ids); if (!SplitTest_API::OwnsSplitTests($user->Get('userid'), $split_ids) && !$user->Admin()) { FlashMessage(GetLang('NoAccess'), SS_FLASH_MSG_ERROR, $this->admin_url); return; } $deleted = 0; $not_deleted = 0; foreach ($split_ids as $split_id) { $delete_success = $api->Delete($split_id); if ($delete_success) { $deleted++; continue; } $not_deleted++; } /** * If there are only "delete ok" messages, then just work out the number to show * and then create a flash message. */ $url = $this->admin_url; if ($not_deleted > 0) { $url = null; } if ($deleted == 1) { FlashMessage(GetLang('Addon_splittest_SplittestDeleted_One'), SS_FLASH_MSG_SUCCESS, $url); if ($not_deleted == 0) { return; } } if ($deleted > 1) { FlashMessage(sprintf(GetLang('Addon_splittest_SplittestDeleted_Many'), self::PrintNumber($deleted)), SS_FLASH_MSG_SUCCESS, $url); if ($not_deleted == 0) { return; } } if ($not_deleted == 1) { $msg = GetLang('Addon_splittest_SplittestNotDeleted_One'); } else { $msg = sprintf(GetLang('Addon_splittest_SplittestNotDeleted_Many'), self::PrintNumber($not_deleted)); } FlashMessage($msg, SS_FLASH_MSG_ERROR, $this->admin_url); }