Fix PHP warnings

ofaj
jmontoyaa 8 years ago
parent 67c53fcd6c
commit 2077b079c9
  1. 8
      main/course_home/2column.php
  2. 7
      main/inc/lib/course_home.lib.php

@ -25,23 +25,23 @@ if (api_is_allowed_to_edit(null, true)) {
* Display message to confirm that a tool must be hidden from the list of available tools (visibility 0,1->2)
*/
if ($_GET['remove']) {
if (isset($_GET['remove']) && $_GET['remove']) {
$msgDestroy = get_lang('DelLk').'<br />';
$msgDestroy .= '<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;';
$msgDestroy .= '<a href="'.api_get_self().'?destroy=yes&amp;id='.$id.'">'.get_lang('Yes').'</a>';
$show_message .= Display :: return_message($msgDestroy, 'confirmation', false);
} elseif ($_GET['destroy']) {
} elseif (isset($_GET['destroy']) && $_GET['destroy']) {
/*
* Process hiding a tools from available tools.
* visibility=2 are only view by Dokeos Administrator (visibility 0,1->2)
*/
Database::query("UPDATE $tool_table SET visibility='2' WHERE c_id = $course_id AND id='".$id."'");
} elseif ($_GET['hide']) {
} elseif (isset($_GET['hide']) && $_GET['hide']) {
/* HIDE */
// visibility 1 -> 0
Database::query("UPDATE $tool_table SET visibility=0 WHERE c_id = $course_id AND id='".$id."'");
$show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
} elseif ($_GET["restore"]) {
} elseif (isset($_GET['restore']) && $_GET["restore"]) {
// visibility 0,2 -> 1
/* REACTIVATE */
Database::query("UPDATE $tool_table SET visibility=1 WHERE c_id = $course_id AND id='".$id."'");

@ -333,6 +333,7 @@ class CourseHome
) {
$tool['link'] = $web_code_path.$tool['link'];
}
$class = '';
if ($course_tool_category == TOOL_PUBLIC_BUT_HIDDEN) {
$class = 'class="invisible"';
}
@ -344,7 +345,7 @@ class CourseHome
if (strpos($tool['name'], 'visio_') !== false) {
$html .= '<a '.$class.' href="javascript: void(0);" onclick="javascript: window.open(\''.htmlspecialchars($tool['link']).(($tool['image'] == 'external.gif' || $tool['image'] == 'external_na.gif') ? '' : $qm_or_amp.api_get_cidreq()).'\',\'window_visio'.api_get_course_id().'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$tool['target'].'">';
} elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
$html .= '<a href="javascript: void(0);" onclick="javascript: window.open(\''.htmlspecialchars($tool['link']).$qm_or_amp.api_get_cidreq().'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$tool['target'].'"'.$class.'>';
$html .= '<a href="javascript: void(0);" onclick="javascript: window.open(\''.htmlspecialchars($tool['link']).$qm_or_amp.api_get_cidreq().'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$tool['target'].'" '.$class.'>';
} else {
$html .= '<a href="'.htmlspecialchars($tool['link']).(($tool['image'] == 'external.gif' || $tool['image'] == 'external_na.gif') ? '' : $qm_or_amp.api_get_cidreq()).'" target="'.$tool['target'].'" '.$class.'>';
}
@ -384,7 +385,7 @@ class CourseHome
$lnk[] = $link;
}
}
if ($tool['adminlink']) {
if (isset($tool['adminlink'])) {
$html .= '<a href="'.$tool['adminlink'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
}
}
@ -413,7 +414,7 @@ class CourseHome
$html .= '<div class="btn-options">';
$html .= '<div class="btn-group btn-group-sm" role="group">';
foreach ($lnk as & $this_link) {
if (!$tool['adminlink']) {
if (!isset($tool['adminlink'])) {
$html .= '<a class="btn btn-default" title='.$this_link['title'].' href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$tool['id'].'&amp;'.$this_link['cmd'].'">'.$this_link['name'].'</a>';
}
}

Loading…
Cancel
Save