Minor - fixing PHP warnings.

1.9.x
Julio Montoya 11 years ago
parent 1e19156781
commit 127850a42d
  1. 12
      main/survey/reporting.php
  2. 19
      main/survey/survey_invite.php

@ -18,6 +18,7 @@ require_once '../inc/global.inc.php';
require_once 'survey.lib.php';
$this_section = SECTION_COURSES;
$survey_id = intval($_GET['survey_id']);
$survey_data = survey_manager::get_survey($survey_id);
// Export
/**
@ -26,17 +27,13 @@ $survey_id = intval($_GET['survey_id']);
if (isset($_POST['export_report']) && $_POST['export_report']) {
switch ($_POST['export_format']) {
case 'xls':
$survey_data = survey_manager::get_survey($survey_id);
$filename = 'survey_results_'.$survey_id.'.xls';
$data = SurveyUtil::export_complete_report_xls($survey_data, $filename, $_GET['user_id']);
exit;
break;
case 'csv':
default:
$survey_data = survey_manager::get_survey($survey_id);
$data = SurveyUtil::export_complete_report($survey_data, $_GET['user_id']);
//$filename = 'fileexport.csv';
$filename = 'survey_results_'.$survey_id.'.csv';
header('Content-type: application/octet-stream');
@ -73,7 +70,6 @@ $people_filled = survey_manager::get_people_who_filled_survey(
// Checking the parameters
SurveyUtil::check_parameters($people_filled);
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit(false, true)) {
Display :: display_header(get_lang('ToolSurvey'));
@ -104,7 +100,7 @@ if (api_strlen(strip_tags($survey_data['title'])) > 40) {
// Breadcrumbs
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php', 'name' => get_lang('SurveyList'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id, 'name' => $urlname);
if (!$_GET['action'] OR $_GET['action'] == 'overview') {
if (!isset($_GET['action']) || isset($_GET['action']) && $_GET['action'] == 'overview') {
$tool_name = get_lang('Reporting');
} else {
$interbreadcrumb[] = array(
@ -131,7 +127,7 @@ if (!$_GET['action'] OR $_GET['action'] == 'overview') {
Display::display_header($tool_name, 'Survey');
// Action handling
SurveyUtil::handle_reporting_actions($people_filled);
SurveyUtil::handle_reporting_actions($survey_data, $people_filled);
// Actions bar
echo '<div class="actions">';
@ -140,7 +136,7 @@ echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$sur
echo '</div>';
// Content
if (!$_GET['action'] || $_GET['action'] == 'overview') {
if (!isset($_GET['action']) || isset($_GET['action']) && $_GET['action'] == 'overview') {
$myweb_survey_id = $survey_id;
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_question.gif',get_lang('DetailedReportByQuestion')).' '.get_lang('DetailedReportByQuestion').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByQuestionDetail').' </div>';
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_user.gif',get_lang('DetailedReportByUser')).' '.get_lang('DetailedReportByUser').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByUserDetail').'.</div>';

@ -153,7 +153,7 @@ $form->addElement('style_submit_button', 'submit', get_lang('PublishSurvey'), 'c
$form->addRule('mail_text', get_lang('ThisFieldIsRequired'), 'required');
}*/
$portal_url = api_get_path(WEB_PATH);
if ($_configuration['multiple_access_urls']) {
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$url = api_get_access_url($access_url_id);
@ -200,14 +200,23 @@ if ($form->validate()) {
for ($i = 0; $i < count($additional_users); $i++) {
$additional_users[$i] = trim($additional_users[$i]);
}
$counter_additional_users = SurveyUtil::save_invitations($additional_users, $values['mail_title'],
$values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']);
$counter_additional_users = SurveyUtil::save_invitations(
$additional_users,
$values['mail_title'],
$values['mail_text'],
$values['resend_to_all'],
$values['send_mail'],
$values['remindUnAnswered']
);
// Updating the invited field in the survey table
SurveyUtil::update_count_invited($survey_data['code']);
$total_count = $count_course_users + $counter_additional_users;
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_survey = Database :: get_course_table(TABLE_SURVEY);
// Counting the number of people that are invited
$sql = "SELECT * FROM $table_survey WHERE c_id = $course_id AND code = '".Database::escape_string($survey_data['code'])."'";
$sql = "SELECT * FROM $table_survey
WHERE c_id = $course_id AND code = '".Database::escape_string($survey_data['code'])."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$total_invited = $row['invited'];

Loading…
Cancel
Save