* * This management module shows the survey statistics for all surveys the current user can access. * The user may select any set of statistics to reset. The look and feel is controlled within the * view_survey_statistics CSS div. * * @_TODO_@ * - Sort by table headers (always leaving summary at the bottom) * - Filter by table values * - Export values to CSV/Excel * - Support automatic, periodic refresh via javascript * */ // get the survey data (name, status, etc) esp_require_once('/lib/espsurvey'); survey_get_for_current_user($surveys); // handle any button press events // NOTE: we handle these after getting survey data to ensure that actions happen only on allowed surveys $doReset = (isset($_REQUEST['doReset']) && isset($_REQUEST['reset']) && 0 < count($_REQUEST['reset']) ? true : false); if ($doReset) { esp_require_once('/lib/espsurveystat'); foreach ($_REQUEST['reset'] as $sid) { if (array_key_exists($sid, $surveys)) { survey_stat_reset($sid); } else { // bad access $GLOBALS['errmsg'] = mkerror(_('Request to reset survey that is outside allowed access')); } } } // get the statistics esp_require_once('/lib/espsurveystat'); $stats = stat_fetch_with_summary(); // show them echo '
| ' . _('Survey') . ' | ' . _('Login Failures') . ' | ' . _('Attempted') . ' | ' . _('Abandoned') . ' | ' . _('Suspended') . ' | ' . _('Completed') . ' | ' . _('Reset?') . ' |
|---|---|---|---|---|---|---|
| ' . (empty($sid) ? _('Statistics Total') : $surveys[$sid]['name']) . ' | ' . $stat['loginfail'] . ' | ' . $stat['attempted'] . ' | ' . $stat['abandoned'] . ' | ' . $stat['suspended'] . ' | ' . $stat['completed'] . ' | ' . (empty($sid) ? '' : mkcheckbox('reset', $sid)) . ' |