* @version 1.0 * @since 03 Nov 2013 12:32:30 */ require_once dirname(__FILE__) . '/_config.inc.php'; $auth->requireLogin(); $app->sslOn(); require_once 'codebase/lib/HTML.inc.php'; require_once 'models/Report.inc.php'; /******************************************************************** * CONFIG ********************************************************************/ // Titles and navigation header. $nav->add(_("Reports"), null); if (getFormData('filter_survey_id')) { $s = Survey::get(array('survey_id' => getFormData('filter_survey_id'))); $nav->add(sprintf(_("Responses to %s"), $s['survey_name'])); } else { $nav->add(_("Responses"), null); } $nav->set('id', 'reports'); /******************************************************************** * MAIN ********************************************************************/ // Bounce the user if they don't have permission to list records. Participant::requireAllow('read'); // If the user does not have access to 'any' record, limit by their account_id. $where_clause = ''; if ($acl->check('user_id:' . $auth->get('user_id'), 'report:response', 'any')) { // User has access to view responses from 'any' survey. $questions = Question::get(array('survey_id' => getFormData('filter_survey_id')), Model::INNUMERABLE); } else { // User is limited to view questions only for surveys in his account. $questions = Question::get(array( 'survey_id' => getFormData('filter_survey_id'), 'account_id' => $auth->get('account_id') ), Model::INNUMERABLE); } if (!empty($questions)) { $s_stats = Survey::getStats(getFormData('filter_survey_id')); } /******************************************************************** * OUTPUT ********************************************************************/ include 'header.inc.html'; include 'report-responses.inc.html'; include 'footer.inc.html';