FIxing static/this errors

skala
Julio Montoya 13 years ago
parent 3fc0d1afd9
commit a311613673
  1. 4
      main/inc/lib/document.lib.php
  2. 26
      main/survey/create_new_survey.php

@ -2187,7 +2187,7 @@ class DocumentManager {
* @param bool print html messages
* @return unknown_type
*/
public function upload_document($files, $path, $title ='', $comment = '', $unzip = 0, $if_exists = '', $index_document = false, $show_output = false) {
public static function upload_document($files, $path, $title ='', $comment = '', $unzip = 0, $if_exists = '', $index_document = false, $show_output = false) {
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
$max_filled_space = self::get_course_quota();
@ -2570,7 +2570,7 @@ class DocumentManager {
return $html;
}
static function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0, $add_move_button = false, $filter_by_folder = null, $overwrite_url = null) {
function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0, $add_move_button = false, $filter_by_folder = null, $overwrite_url = null) {
if (empty($course_info['real_id']) || empty($course_info['code']) || !is_array($course_info)) {
return '';
}

@ -57,9 +57,7 @@ $table_gradebook_link = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
// If user is not teacher or if he's a coach trying to access an element out of his session
if (!api_is_allowed_to_edit()) {
if (!api_is_course_coach() || (!empty($_GET['survey_id']) && !api_is_element_in_the_session(TOOL_SURVEY, intval($_GET['survey_id'])))) {
Display :: display_header();
Display :: display_error_message(get_lang('NotAllowed'), false);
Display :: display_footer();
api_not_allowed(true);
exit;
}
}
@ -260,6 +258,10 @@ $form->addRule(array('start_date', 'end_date'), get_lang('StartDateShouldBeBefor
// Setting the default values
$form->setDefaults($defaults);
// Displaying the header
Display::display_header($tool_name);
// The validation or display
if ($form->validate()) {
// Exporting the values
@ -277,18 +279,12 @@ if ($form->validate()) {
}
*/
if ($return['type'] == 'error') {
// Displaying the header
Display::display_header($tool_name);
// Display the error
Display::display_error_message(get_lang($return['message']), false);
// Display the form
$form->display();
} else {
$gradebook_option = $values['survey_qualify_gradebook'] > 0;
if ($gradebook_option) {
$survey_id = intval($return['id']);
@ -316,16 +312,12 @@ if ($form->validate()) {
Display::display_confirmation_message($return['message'], false);
} else {
// Redirecting to the survey page (whilst showing the return message)
@header('location:survey.php?survey_id='.$return['id'].'&message='.$return['message']);
header('location:survey.php?survey_id='.$return['id'].'&message='.$return['message']);
exit;
}
} else {
// Displaying the header
Display::display_header($tool_name);
// Displaying the tool title
//api_display_tool_title($tool_name);
// Display the form
} else {
$form->display();
}
// Footer
Display :: display_footer();
Display :: display_footer();
Loading…
Cancel
Save