PHP warning/notices avoided

skala
Julio Montoya 13 years ago
parent 1152da417d
commit 12bf5b6410
  1. 1
      main/admin/group_add.php
  2. 11
      main/admin/user_edit.php
  3. 3
      main/exercice/admin.php
  4. 3
      main/exercice/adminhp.php
  5. 8
      main/exercice/answer_admin.inc.php
  6. 2
      main/exercice/exercise.class.php
  7. 189
      main/exercice/hotspot_admin.inc.php

@ -71,6 +71,7 @@ $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allow
$groups = array();
$groups[0] = get_lang('NoParentship');
$groups = $groups + GroupPortalManager::get_groups_list($group_id);
$group_data['parent_group'] = GroupPortalManager::get_parent_group($group_id);
$form->addElement('select', 'parent_group', get_lang('GroupParentship'), $groups, array());

@ -27,7 +27,7 @@ $htmlHeadXtra[] = '
<script>
var is_platform_id = "'.$is_platform_admin.'";
<!--
function enable_expiration_date() {
document.user_edit.radio_expiration_date[0].checked=false;
@ -54,7 +54,7 @@ function display_drh_list(){
$radios.filter("[value=0]").attr("checked", true);
} else {
if (is_platform_id == 1)
document.getElementById("id_platform_admin").style.display="none";
document.getElementById("id_platform_admin").style.display="none";
$radios.filter("[value=0]").attr("checked", true);
}
}
@ -209,7 +209,7 @@ $status[SESSIONADMIN] = get_lang('SessionsAdmin');
$form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();','class'=>'chzn-select'));
$display = $user_data['status'] == STUDENT || $_POST['status'] == STUDENT ? 'block' : 'none';
$display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (isset($_POST['status']) && $_POST['status'] == STUDENT)) ? 'block' : 'none';
/*
$form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
@ -363,7 +363,7 @@ if ( $form->validate()) {
UserManager::remove_user_admin($user_id);
}
}
foreach ($user as $key => $value) {
if (substr($key, 0, 6) == 'extra_') { //an extra field
UserManager::update_extra_field_value($user_id, substr($key, 6), $value);
@ -375,6 +375,7 @@ if ( $form->validate()) {
}
}
$message = null;
if ($error_drh) {
$err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager');
$message = Display::return_message($err_msg, 'error');
@ -402,6 +403,7 @@ $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time();
$content = null;
if ($image == '') {
$content .= '<img '.$img_attributes.' />';
} else {
@ -412,7 +414,6 @@ if ($image == '') {
$content .= $form->return_form();
$tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -71,9 +71,6 @@ if (!$is_allowedToEdit) {
api_not_allowed(true);
}
// Allows script inclusions
define(ALLOWED_TO_INCLUDE,1);
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
/* stripslashes POST data */

@ -30,9 +30,6 @@ if (isset($_REQUEST["cancel"])) {
$newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
$hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_REQUEST['hotpotatoesName']:'');
// allows script inclusions
define(ALLOWED_TO_INCLUDE,1);
$is_allowedToEdit=api_is_allowed_to_edit(null,true);
// document path

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
// YW: 20110209: Script depredated?
// YW: 20110209: Script depredated?
/**
* This script allows to manage answers. It is included from the script admin.php
* @package chamilo.exercise
@ -13,10 +13,6 @@
*/
use \ChamiloSession as Session;
// ALLOWED_TO_INCLUDE is defined in admin.php
if (!defined('ALLOWED_TO_INCLUDE')) {
exit();
}
if (!is_object($objQuestion)) {
$objQuestion = Question :: read($_GET['modifyAnswers']);
}
@ -545,7 +541,7 @@ if ($modifyAnswers) {
$weighting = array();
// initializing + Modification de la ligne suivante
// initializing + Modification de la ligne suivante
if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
$correct = array();
} else {

@ -152,7 +152,7 @@ class Exercise {
$this->exercise_was_added_in_lp = true;
}
$this->force_edit_exercise_in_lp = isset($_configuration['force_edit_exercise_in_lp']) ? $_configuration['force_edit_exercise_in_lp'] : false;
$this->force_edit_exercise_in_lp = isset($_configuration['force_edit_exercise_in_lp']) ? $_configuration['force_edit_exercise_in_lp'] : true;
if ($this->exercise_was_added_in_lp) {
$this->edit_exercise_in_lp = $this->force_edit_exercise_in_lp == true;

@ -1,21 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script allows to manage answers. It is included from the
* This script allows to manage answers. It is included from the
* script admin.php
* @package chamilo.exercise
* @author Toon Keppens
*/
/**
* Code
* ALLOWED_TO_INCLUDE is defined in admin.php
*/
use \ChamiloSession as Session;
if (!defined('ALLOWED_TO_INCLUDE')) {
exit();
}
$modifyAnswers = intval($_GET['hotspotadmin']);
if (!is_object($objQuestion)) {
@ -234,8 +227,8 @@ if ($submitAnswers || $buttonBack) {
break;
}
} // end for()
//now the noerror section
//now the noerror section
$select_question_noerror = $_POST['select_question_noerror'];
$lp_noerror = $_POST['lp_noerror'];
$try_noerror = $_POST['try_noerror'];
@ -281,7 +274,7 @@ if ($submitAnswers || $buttonBack) {
if ($weighting[$i]) {
$questionWeighting+=$weighting[$i];
}
// creates answer
// creates answer
$objAnswer->createAnswer($reponse[$i], '', $comment[$i], $weighting[$i], $i, $hotspot_coordinates[$i], $hotspot_type[$i], $destination[$i]);
} // end for()
// saves the answers into the data base
@ -377,7 +370,7 @@ if ($modifyAnswers) {
}
if ($answerType == HOT_SPOT_DELINEATION) {
//added the noerror answer
//added the noerror answer
$reponse_noerror = 'noerror';
$comment_noerror = $objAnswer->selectComment($nbrAnswers + 1);
$destination_noerror_list = $objAnswer->selectDestination($nbrAnswers + 1);
@ -458,7 +451,7 @@ if ($modifyAnswers) {
if ($moreOARAnswers) {
if ($nbrAnswers < 12) {
// Add a new answer
// Add a new answer
$nbrAnswers++;
$_SESSION['tmp_answers']['answer'][] = '';
@ -514,24 +507,24 @@ if ($modifyAnswers) {
//ie6 fix
if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
?>
<?php if ($answerType == HOT_SPOT_DELINEATION) { ?>
<?php if ($answerType == HOT_SPOT_DELINEATION) { ?>
<input type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessOAR'); ?>" >
<input type="submit" class="btn plus" name="moreOARAnswers" value="<?php echo get_lang('MoreOAR'); ?>" />
<?php } else { ?>
<input type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessHotspots'); ?>" >
<input type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" />
<?php } ?>
<input type="submit" class="btn save" name="submitAnswers" value="<?php echo get_lang('Ok'); ?>" />
<input type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" />
<?php } ?>
<input type="submit" class="btn save" name="submitAnswers" value="<?php echo get_lang('Ok'); ?>" />
<?php
} else {
if ($answerType == HOT_SPOT_DELINEATION) {
?>
?>
<button type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessOAR'); ?>" ><?php echo get_lang('LessOAR'); ?></button>
<button type="submit" class="btn plus" name="moreOARAnswers" value="<?php echo get_lang('MoreOAR'); ?>" /><?php echo get_lang('MoreOAR'); ?></button>
<?php } else { ?>
<button type="submit" class="btn minus" name="lessAnswers" value="<?php echo get_lang('LessHotspots'); ?>" ><?php echo get_lang('LessHotspots'); ?></button>
<button type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" /><?php echo get_lang('MoreHotspots'); ?></button>
<button type="submit" class="btn plus" name="moreAnswers" value="<?php echo get_lang('MoreHotspots'); ?>" /><?php echo get_lang('MoreHotspots'); ?></button>
<?php } ?>
<button type="submit" class="btn save" name="submitAnswers" value="<?php echo get_lang('Ok'); ?>" /><?php echo get_lang('AddQuestionToExercise'); ?></button>
<?php
@ -540,7 +533,7 @@ if ($modifyAnswers) {
</td>
</tr>
<tr>
<td valign="top">
<td valign="top">
<input type="hidden" name="formSent" value="1" />
<input type="hidden" name="nbrAnswers" value="<?php echo $nbrAnswers; ?>" />
<table class="data_table">
@ -551,18 +544,18 @@ if ($modifyAnswers) {
-->
<tr>
<th width="5">&nbsp;<?php /* echo get_lang('Hotspot'); */ ?></th>
<th><?php echo get_lang('HotspotDescription'); ?> *</th>
<th><?php echo get_lang('HotspotDescription'); ?> *</th>
<?php if ($answerType == HOT_SPOT_DELINEATION) echo '<th >' . get_lang('Thresholds') . '</th>'; ?>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<th><?php echo get_lang('Comment'); ?></th>
<?php if ($answerType == HOT_SPOT_DELINEATION) echo '<th >' . get_lang('Scenario') . '</th>'; ?>
<th><?php echo get_lang('Comment'); ?></th>
<?php if ($answerType == HOT_SPOT_DELINEATION) echo '<th >' . get_lang('Scenario') . '</th>'; ?>
<?php } else { ?>
<th colspan="2"><?php echo get_lang('Comment'); ?></th>
<?php } ?>
<th colspan="2"><?php echo get_lang('Comment'); ?></th>
<?php } ?>
<th><?php echo get_lang('QuestionWeighting'); ?> *</th>
<th><?php echo get_lang('QuestionWeighting'); ?> *</th>
</tr>
</tr>
<?php
require_once '../newscorm/learnpathList.class.php';
$list = new LearnpathList(api_get_user_id());
@ -575,7 +568,7 @@ if ($modifyAnswers) {
$select_lp_id = array();
$option_lp = '';
// setting the LP
// setting the LP
$is_selected = false;
foreach ($flat_list as $id => $details) {
$select_lp_id[$id] = $details['lp_name'];
@ -592,7 +585,7 @@ if ($modifyAnswers) {
$option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
}
//Feedback SELECT
//Feedback SELECT
$question_list = $objExercise->selectQuestionList();
$option_feed = '';
$option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
@ -612,7 +605,7 @@ if ($modifyAnswers) {
else
$option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
//-------- IF it is a delineation
//-------- IF it is a delineation
if ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'delineation') {
for ($k = 1; $k <= 100; $k++) {
@ -628,7 +621,7 @@ if ($modifyAnswers) {
$option3.='<option ' . $selected3 . '>' . $k . '</option>';
}
?>
<tr>
<tr>
<td valign="top">
<div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div>
<input type="hidden" name="reponse[<?php echo $i; ?>]" value="delineation" />
@ -638,7 +631,7 @@ if ($modifyAnswers) {
<?php echo get_lang('MinOverlap'); ?><br/><br/>
<?php echo get_lang('MaxExcess'); ?><br/><br/>
<?php echo get_lang('MaxMissing'); ?><br/><br/>
</td>
</td>
<td>
<br/><br/>
<select name="threadhold1[<?php echo $i; ?>]" >
@ -648,12 +641,12 @@ if ($modifyAnswers) {
<select name="threadhold2[<?php echo $i; ?>]" >
<?php echo $option2; ?>
</select>%
<br/><br/>
<select name="threadhold3[<?php echo $i; ?>]" >
<br/><br/>
<select name="threadhold3[<?php echo $i; ?>]" >
<?php echo $option3; ?>
</select>%
<br/>
</td>
</td>
<td align="left">
<br />
@ -664,13 +657,13 @@ if ($modifyAnswers) {
<input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
<br/>
<?php echo get_lang('LearnerIsInformed'); ?>
</td>
</td>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<td>
<table>
<tr>
<td>
<td>
<input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?>
<br /><br />
@ -681,43 +674,43 @@ if ($modifyAnswers) {
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
<br /> <br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<select name="select_question[<?php echo $i; ?>]" >
<?php echo $option_feed; ?>
</select>
</select>
</td>
</tr>
</tr>
</table>
</td>
<?php } else { ?>
<td> &nbsp;</td>
<td> &nbsp;</td>
<?php
}
}
//elseif ($_SESSION['tmp_answers']['hotspot_type'][$i]=='noerror' || $_SESSION['tmp_answers']['answer'][$i]=='noerror')
elseif (false) {
?>
<tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
?>
<tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
<th colspan="3" ><?php echo get_lang('Feedback'); ?></th>
<!-- th colspan="1" ><?php echo get_lang('Scenario'); ?></th -->
<th></th>
</tr>
<tr>
<tr>
<td colspan="2" valign="top" align="left">
<?php echo get_lang('LearnerHasNoMistake'); ?>
<input type="hidden" name="reponse[<?php echo $i; ?>]" value="noerror" />
<input type="hidden" name="weighting[<?php echo $i; ?>]" value="0" />
<input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="noerror" />
<input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="0;0|0|0" />
</td>
</td>
<td colspan="2" align="left">
<textarea wrap="virtual" rows="3" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"><?php echo Security::remove_XSS($comment[$i]); ?></textarea>
</td>
@ -731,42 +724,42 @@ if ($modifyAnswers) {
<?php echo get_lang('TryAgain'); ?>
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
<br /> <br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<br /> <br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<select name="select_question[<?php echo $i; ?>]">
<?php echo $option_feed; ?>
</select>
</td>
</tr>
</select>
</td>
</tr>
</table>
</td>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
// if it's an OAR
// if it's an OAR
elseif ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'oar') {
if ($i == 2) {
?>
?>
<tr>
<th width="5">&nbsp;<?php /* echo get_lang('Hotspot'); */ ?></th>
<th ><?php echo get_lang('OAR'); ?>*</th>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<th ><?php echo get_lang('OAR'); ?>*</th>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<th colspan="2" ><?php echo get_lang('Comment'); ?></th>
<th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th>
<?php } else { ?>
<th colspan="3" ><?php echo get_lang('Comment'); ?></th>
<th colspan="3" ><?php echo get_lang('Comment'); ?></th>
<?php } ?>
<th>&nbsp;</th>
@ -780,7 +773,7 @@ if ($modifyAnswers) {
</td>
<td valign="top" align="left">
<input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="20" />
<input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="20" />
</td>
<td colspan="2" align="left">
@ -798,34 +791,34 @@ if ($modifyAnswers) {
<?php echo get_lang('TryAgain'); ?>
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp[<?php echo $i; ?>]" >
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<input name="url[<?php echo $i; ?>]" value="<?php echo $url[$i]; ?>">
<br /><br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<br /><br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<select name="select_question[<?php echo $i; ?>]">
<?php echo $option_feed; ?>
</select>
</select>
</td>
</tr>
</tr>
</table>
</td>
</td>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
<td>&nbsp;</td>
<?php } ?>
<?php
}
} else { //end if is delineation
?>
?>
<td valign="top">
<div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div>
</td>
</td>
<td valign="top" align="left">
<input type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($reponse[$i]); ?>" size="45" />
</td>
@ -843,10 +836,10 @@ if ($modifyAnswers) {
/* <td align="left"><textarea wrap="virtual" rows="1" cols="25" name="comment[<?php echo $i; ?>]" style="width: 100%"><?php echo api_htmlentities($comment[$i], ENT_QUOTES, api_get_system_encoding()); ?></textarea></td> */
?>
<td>&nbsp;</td>
<td align="left" ><?php echo $return; ?></td>
<td align="left" ><?php echo $return; ?></td>
<?php
}
?>
?>
<td valign="top">
<?php
//if ($answerType==HOT_SPOT_DELINEATION && $i!=2)
@ -867,8 +860,8 @@ if ($modifyAnswers) {
<?php
}
?>
</td>
</tr>
</td>
</tr>
<?php
}
require_once '../newscorm/learnpathList.class.php';
@ -876,7 +869,7 @@ if ($modifyAnswers) {
$flat_list = $list->get_flat_list();
$select_lp_id = array();
$option_lp = '';
//$option_lp.='<option value="0">'.get_lang('SelectTargetLP').'</option>';
//$option_lp.='<option value="0">'.get_lang('SelectTargetLP').'</option>';
foreach ($flat_list as $id => $details) {
$selected = '';
$select_lp_id[$id] = $details['lp_name'];
@ -915,20 +908,20 @@ if ($modifyAnswers) {
if ($answerType == HOT_SPOT_DELINEATION) {
?>
<tr>
<tr>
<th colspan="2" ><?php echo get_lang('IfNoError'); ?></th>
<?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
<th colspan="2" ><?php echo get_lang('Feedback'); ?></th>
<th><?php echo get_lang('Scenario'); ?></th>
<?php } else { ?>
<th colspan="3" ><?php echo get_lang('Feedback'); ?></th>
<?php } ?>
<th colspan="3" ><?php echo get_lang('Feedback'); ?></th>
<?php } ?>
<th>&nbsp;</th>
</tr>
<tr>
<tr>
<td colspan="2" valign="top" align="left">
<?php echo get_lang('LearnerHasNoMistake'); ?>
</td>
<?php echo get_lang('LearnerHasNoMistake'); ?>
</td>
<td colspan="2" align="left">
<textarea wrap="virtual" rows="3" cols="25" name="comment_noerror" style="width: 100%"><?php echo Security::remove_XSS($comment_noerror); ?></textarea>
</td>
@ -940,34 +933,34 @@ if ($modifyAnswers) {
<td>
<input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> />
<?php echo get_lang('TryAgain'); ?>
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<br /><br />
<?php echo get_lang('SeeTheory'); ?> <br />
<select name="lp_noerror" >
<?php echo $option_lp; ?>
</select>
<br /><br />
<?php echo get_lang('Other'); ?> <br />
<?php echo get_lang('Other'); ?> <br />
<input name="url_noerror" value="<?php echo $url_noerror; ?>">
<br /><br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<?php echo get_lang('SelectQuestion'); ?> <br />
<select name="select_question_noerror">
<?php echo $option_feed; ?>
</select>
</td>
</tr>
</select>
</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<?php } else { ?>
<td colspan="2">&nbsp;</td>
<?php } ?>
</tr>
</tr>
<?php
}
?>
?>
</table>
</td>
</td>
</tr>
<tr>
<td colspan="2" valign="top" style="border-top:none">

Loading…
Cancel
Save