Minor - Replace deprecated function calls #scrutinizer

pull/2487/head
Yannick Warnier 8 years ago
parent 5f631cb562
commit 7c3b4cb42d
  1. 16
      main/exercise/exercise.php
  2. 16
      main/forum/forumfunction.inc.php
  3. 18
      main/gradebook/gradebook_view_result.php
  4. 16
      main/lp/lp_add_item.php
  5. 18
      main/notebook/index.php
  6. 12
      main/webservices/cm_webservice_forum.php

@ -142,7 +142,7 @@ if ($origin != 'learnpath') {
Display :: display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
if (in_array($_GET['message'], array('ExerciseEdited'))) {
Display :: display_confirmation_message(get_lang($_GET['message']));
echo Display::return_message(get_lang($_GET['message']), 'confirmation');
}
}
} else {
@ -220,7 +220,7 @@ if ($is_allowedToEdit) {
if ($link_info !== false) {
GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
}
Display :: display_confirmation_message(get_lang('ExerciseDeleted'));
echo Display::return_message(get_lang('ExerciseDeleted'), 'confirmation');
}
break;
case 'enable':
@ -243,7 +243,7 @@ if ($is_allowedToEdit) {
$userId
);
// "WHAT'S NEW" notification: update table item_property (previously last_tooledit)
Display :: display_confirmation_message(get_lang('VisibilityChanged'));
echo Display::return_message(get_lang('VisibilityChanged'), 'confirmation');
break;
case 'disable':
// disables an exercise
@ -265,31 +265,31 @@ if ($is_allowedToEdit) {
'invisible',
$userId
);
Display :: display_confirmation_message(get_lang('VisibilityChanged'));
echo Display::return_message(get_lang('VisibilityChanged'), 'confirmation');
break;
case 'disable_results':
//disable the results for the learners
$objExerciseTmp->disable_results();
$objExerciseTmp->save();
Display :: display_confirmation_message(get_lang('ResultsDisabled'));
echo Display::return_message(get_lang('ResultsDisabled'), 'confirmation');
break;
case 'enable_results':
//disable the results for the learners
$objExerciseTmp->enable_results();
$objExerciseTmp->save();
Display :: display_confirmation_message(get_lang('ResultsEnabled'));
echo Display::return_message(get_lang('ResultsEnabled'), 'confirmation');
break;
case 'clean_results':
//clean student results
if ($exercise_action_locked == false) {
$quantity_results_deleted = $objExerciseTmp->clean_results(true);
$title = $objExerciseTmp->selectTitle();
Display :: display_confirmation_message($title.': '.sprintf(get_lang('XResultsCleaned'), $quantity_results_deleted));
echo Display::return_message($title.': '.sprintf(get_lang('XResultsCleaned'), $quantity_results_deleted), 'confirmation');
}
break;
case 'copy_exercise': //copy an exercise
$objExerciseTmp->copy_exercise();
Display :: display_confirmation_message(get_lang('ExerciseCopied'));
echo Display::return_message(get_lang('ExerciseCopied'), 'confirmation');
break;
}
}

@ -149,23 +149,23 @@ function handle_forum_and_forumcategories($lp_id = null)
}
}
$return_message = deleteForumCategoryThread($get_content, $get_id);
Display::display_confirmation_message($return_message, false);
echo Display::return_message($return_message, 'confirmation', false);
}
// Change visibility of a forum or a forum category.
if ($action_forum_cat == 'invisible' || $action_forum_cat == 'visible') {
$return_message = change_visibility($get_content, $get_id, $action_forum_cat);
Display::display_confirmation_message($return_message, false);
echo Display::return_message($return_message, 'confirmation', false);
}
// Change lock status of a forum or a forum category.
if ($action_forum_cat == 'lock' || $action_forum_cat == 'unlock') {
$return_message = change_lock_status($get_content, $get_id, $action_forum_cat);
Display::display_confirmation_message($return_message, false);
echo Display::return_message($return_message, 'confirmation', false);
}
// Move a forum or a forum category.
if ($action_forum_cat == 'move' && isset($_GET['direction'])) {
$return_message = move_up_down($get_content, $_GET['direction'], $get_id);
Display::display_confirmation_message($return_message, false);
echo Display::return_message($return_message, 'confirmation', false);
}
}
@ -413,7 +413,7 @@ function show_add_forum_form($inputvalues = array(), $lp_id)
if ($check) {
$values = $form->getSubmitValues();
$return_message = store_forum($values);
Display :: display_confirmation_message($return_message);
echo Display::return_message($return_message, 'confirmation');
}
Security::clear_token();
} else {
@ -600,7 +600,7 @@ function store_forumcategory($values, $courseInfo = array(), $showMessage = true
}
if ($showMessage) {
Display::display_confirmation_message($return_message, 'success');
echo Display::return_message($return_message, 'confirmation');
}
return $last_id;
@ -3750,7 +3750,7 @@ function store_edit_post($forumInfo, $values)
Session::erase('addedresource');
Session::erase('addedresourceid');
Display :: display_confirmation_message($message, false);
echo Display::return_message($message, 'confirmation', false);
}
/**
@ -4916,7 +4916,7 @@ function delete_attachment($post_id, $id_attach = 0, $display = true)
if (!empty($result) && !empty($id_attach) && $display) {
$message = get_lang('AttachmentFileDeleteSuccess');
Display::display_confirmation_message($message);
echo Display::return_message($message, 'confirmation');
}
return $affectedRows;

@ -386,7 +386,7 @@ if (isset($_GET['resultdelete'])) {
if (isset($_POST['action'])) {
$number_of_selected_items = count($_POST['id']);
if ($number_of_selected_items == '0') {
Display :: display_warning_message(get_lang('NoItemsSelected'), false);
Display::addFlash(Display::return_message(get_lang('NoItemsSelected'), 'warning', false));
} else {
switch ($_POST['action']) {
case 'delete':
@ -470,29 +470,29 @@ if (!isset($_GET['export']) && (!isset($_GET['import']))) {
Display :: display_header('');
}
if (isset($_GET['addresultnostudents'])) {
Display :: display_warning_message(get_lang('AddResultNoStudents'), false);
Display::addFlash(Display::return_message(get_lang('AddResultNoStudents'), 'warning', false));
}
if (isset($_GET['addresult'])) {
Display :: display_confirmation_message(get_lang('ResultAdded'), false);
Display::addFlash(Display::return_message(get_lang('ResultAdded'), 'confirmation', false));
}
if (isset($_GET['adduser'])) {
Display :: display_confirmation_message(get_lang('UserAdded'), false);
Display::addFlash(Display::return_message(get_lang('UserAdded'), 'confirmation', false));
}
if (isset($_GET['incorrectdata'])) {
Display :: display_warning_message(get_lang('IncorrectData'), false);
Display::addFlash(Display::return_message(get_lang('IncorrectData'), 'warning', false));
}
if (isset($_GET['massdelete'])) {
Display :: display_confirmation_message(get_lang('ResultsDeleted'), false);
Display::addFlash(Display::return_message(get_lang('ResultsDeleted'), 'confirmation', false));
}
if (isset($_GET['nouser'])) {
Display :: display_warning_message(get_lang('NoUser'), false);
Display::addFlash(Display::return_message(get_lang('NoUser'), 'warning', false));
}
if (isset($_GET['overwritemax'])) {
Display :: display_warning_message(get_lang('OverWriteMax'), false);
Display::addFlash(Display::return_message(get_lang('OverWriteMax'), 'warning', false));
}
if (isset($_GET['import_user_error'])) {
@ -503,7 +503,7 @@ if (isset($_GET['import_user_error'])) {
}
if (isset($_GET['import_score_error'])) {
$userinfo = api_get_user_info($_GET['import_score_error']);
Display :: display_warning_message(get_lang('ScoreDoesNotMatch') . ' ' . api_get_person_name($userinfo['firstname'], $userinfo['lastname']));
Display::addFlash(Display::return_message(get_lang('ScoreDoesNotMatch'). ' ' . api_get_person_name($userinfo['firstname'], $userinfo['lastname']), 'warning'));
}
if ($file_type == null) {
//show the result header

@ -239,31 +239,31 @@ if (isset($new_item_id) && is_numeric($new_item_id)) {
switch ($type) {
case 'dir':
echo $learnPath->display_manipulate($new_item_id, $_POST['type']);
Display::display_confirmation_message(get_lang('NewChapterCreated'));
echo Display::return_message(get_lang('NewChapterCreated'), 'confirmation');
break;
case TOOL_LINK:
echo $learnPath->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewLinksCreated'));
echo Display::return_message(get_lang('NewLinksCreated'), 'confirmation');
break;
case TOOL_STUDENTPUBLICATION:
echo $learnPath->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewStudentPublicationCreated'));
echo Display::return_message(get_lang('NewStudentPublicationCreated'), 'confirmation');
break;
case TOOL_QUIZ:
echo $learnPath->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewExerciseCreated'));
echo Display::return_message(get_lang('NewExerciseCreated'), 'confirmation');
break;
case TOOL_DOCUMENT:
Display::display_confirmation_message(get_lang('NewDocumentCreated'));
echo Display::return_message(get_lang('NewDocumentCreated'), 'confirmation');
echo $learnPath->display_item($new_item_id);
break;
case TOOL_FORUM:
echo $learnPath->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewForumCreated'));
echo Display::return_message(get_lang('NewForumCreated'), 'confirmation');
break;
case 'thread':
echo $learnPath->display_manipulate($new_item_id, $type);
Display::display_confirmation_message(get_lang('NewThreadCreated'));
echo Display::return_message(get_lang('NewThreadCreated'), 'confirmation');
break;
}
} else {
@ -282,7 +282,7 @@ if (isset($new_item_id) && is_numeric($new_item_id)) {
echo $learnPath->display_hotpotatoes_form('add', 0, $_GET['file']);
break;
case TOOL_QUIZ:
echo Display::display_warning_message(get_lang('ExerciseCantBeEditedAfterAddingToTheLP'));
echo Display::return_message(get_lang('ExerciseCantBeEditedAfterAddingToTheLP'), 'warning');
echo $learnPath->display_quiz_form('add', 0, $_GET['file']);
break;
case TOOL_FORUM:

@ -92,7 +92,7 @@ if ($action === 'addnote') {
$values = $form->exportValues();
$res = NotebookManager::save_note($values);
if ($res) {
Display::display_confirmation_message(get_lang('NoteAdded'));
echo Display::return_message(get_lang('NoteAdded'), 'confirmation');
}
}
Security::clear_token();
@ -144,7 +144,7 @@ if ($action === 'addnote') {
$values = $form->exportValues();
$res = NotebookManager::update_note($values);
if ($res) {
Display::display_confirmation_message(get_lang('NoteUpdated'));
echo Display::return_message(get_lang('NoteUpdated'), 'confirmation');
}
}
@ -164,7 +164,7 @@ if ($action === 'addnote') {
// Action handling: deleting a note
$res = NotebookManager::delete_note($_GET['notebook_id']);
if ($res) {
Display::display_confirmation_message(get_lang('NoteDeleted'));
echo Display::return_message(get_lang('NoteDeleted'), 'confirmation');
}
NotebookManager::display_notes();
@ -175,23 +175,23 @@ if ($action === 'addnote') {
switch ($_GET['view']) {
case 'creation_date':
if (!$_GET['direction'] || $_GET['direction'] == 'ASC') {
Display::display_confirmation_message(get_lang('NotesSortedByCreationDateAsc'));
echo Display::return_message(get_lang('NotesSortedByCreationDateAsc'), 'confirmation');
} else {
Display::display_confirmation_message(get_lang('NotesSortedByCreationDateDESC'));
echo Display::return_message(get_lang('NotesSortedByCreationDateDESC'), 'confirmation');
}
break;
case 'update_date':
if (!$_GET['direction'] || $_GET['direction'] == 'ASC') {
Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateAsc'));
echo Display::return_message(get_lang('NotesSortedByUpdateDateAsc'), 'confirmation');
} else {
Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateDESC'));
echo Display::return_message(get_lang('NotesSortedByUpdateDateDESC'), 'confirmation');
}
break;
case 'title':
if (!$_GET['direction'] || $_GET['direction'] == 'ASC') {
Display::display_confirmation_message(get_lang('NotesSortedByTitleAsc'));
echo Display::return_message(get_lang('NotesSortedByTitleAsc'), 'confirmation');
} else {
Display::display_confirmation_message(get_lang('NotesSortedByTitleDESC'));
echo Display::return_message(get_lang('NotesSortedByTitleDESC'), 'confirmation');
}
break;
}

@ -22,7 +22,7 @@ class WSCMForum extends WSCM
public function get_foruns_id($username, $password, $course_code)
{
if ($this->verifyUserPass($username, $password) == "valid") {
$course_db = CourseManager::get_course_information($course_code);
$course_db = api_get_course_info($course_code);
$foruns_info = get_forums($id='', $course_db['code']);
$foruns_id = '#';
foreach ($foruns_info as $forum) {
@ -44,7 +44,7 @@ class WSCMForum extends WSCM
$forum_id
) {
if ($this->verifyUserPass($username, $password) == "valid") {
$course_db = CourseManager::get_course_information($course_code);
$course_db = api_get_course_info($course_code);
$table_forums = Database::get_course_table(TABLE_FORUM, $course_db['db_name']);
$table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']);
@ -95,7 +95,7 @@ class WSCMForum extends WSCM
$field
) {
if ($this->verifyUserPass($username, $password) == "valid") {
$course_db = CourseManager::get_course_information($course_code);
$course_db = api_get_course_info($course_code);
$table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']);
$table_threads = Database::get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
@ -141,7 +141,7 @@ class WSCMForum extends WSCM
$thread_id
) {
if ($this->verifyUserPass($username, $password) == "valid") {
$course_db = CourseManager::get_course_information($course_code);
$course_db = api_get_course_info($course_code);
$table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db['db_name']);
$table_threads = Database::get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
@ -166,7 +166,7 @@ class WSCMForum extends WSCM
public function get_posts_id($username, $password, $course_code, $thread_id)
{
if ($this->verifyUserPass($username, $password) == "valid") {
$course_db = CourseManager::get_course_information($course_code);
$course_db = api_get_course_info($course_code);
$table_users = Database::get_main_table(TABLE_MAIN_USER);
$table_posts = Database::get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
@ -214,7 +214,7 @@ class WSCMForum extends WSCM
$field
) {
if ($this->verifyUserPass($username, $password) == "valid") {
$course_db = CourseManager::get_course_information($course_code);
$course_db = api_get_course_info($course_code);
$table_posts = Database::get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
$table_users = Database::get_main_table(TABLE_MAIN_USER);

Loading…
Cancel
Save