Minor - fixing PHP warnings.

1.9.x
Julio Montoya 11 years ago
parent d555a949a4
commit 2c7e7ff431
  1. 32
      main/exercice/admin.php
  2. 31
      main/exercice/fill_blanks.class.php
  3. 2
      main/exercice/question_admin.inc.php

@ -87,35 +87,39 @@ if($_SERVER['REQUEST_METHOD'] == 'POST') {
}
}
// get vars from GET
if (empty($exerciseId)) {
$exerciseId = intval($_GET['exerciseId']);
$exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0';
}
if (empty($newQuestion)) {
$newQuestion = $_GET['newQuestion'];
$newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0;
}
if (empty($modifyAnswers)) {
$modifyAnswers = $_GET['modifyAnswers'];
$modifyAnswers = isset($_GET['modifyAnswers']) ? $_GET['modifyAnswers'] : 0;
}
if (empty($editQuestion)) {
$editQuestion = $_GET['editQuestion'];
$editQuestion = isset($_GET['editQuestion']) ? $_GET['editQuestion'] : 0;
}
if (empty($modifyQuestion)) {
$modifyQuestion = $_GET['modifyQuestion'];
$modifyQuestion = isset($_GET['modifyQuestion']) ? $_GET['modifyQuestion'] : 0;
}
if (empty($deleteQuestion)) {
$deleteQuestion = $_GET['deleteQuestion'];
}
if ( empty ($clone_question) ) {
$clone_question = $_GET['clone_question'];
$deleteQuestion = isset($_GET['deleteQuestion']) ? $_GET['deleteQuestion'] : 0;
}
$clone_question = isset($_REQUEST['clone_question']) ? $_REQUEST['clone_question'] : 0;
if (empty($questionId)) {
$questionId = $_SESSION['questionId'];
$questionId = isset($_SESSION['questionId']) ? $_SESSION['questionId'] : 0;
}
if (empty($modifyExercise)) {
$modifyExercise = $_GET['modifyExercise'];
$modifyExercise = isset($_GET['modifyExercise']) ? $_GET['modifyExercise'] : null;
}
$fromExercise = isset($fromExercise) ? $fromExercise : null;
$cancelExercise = isset($cancelExercise) ? $cancelExercise : null;
$cancelAnswers = isset($cancelAnswers) ? $cancelAnswers : null;
$modifyIn = isset($modifyIn) ? $modifyIn : null;
$cancelQuestion = isset($cancelQuestion) ? $cancelQuestion : null;
// Cleaning all incomplete attempts of the admin/teacher to avoid weird problems when changing the exercise settings, number of questions, etc
delete_all_incomplete_attempts(api_get_user_id(), $exerciseId, api_get_course_id(), api_get_session_id());
@ -139,7 +143,7 @@ $aType = array(get_lang('UniqueSelect'),get_lang('MultipleSelect'),get_lang('Fil
// tables used in the exercise tool
if ($_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
require_once 'export/qti2/qti2_export.php';
$export = export_question($_GET['questionId'],true);
$qid = (int)$_GET['questionId'];
@ -234,7 +238,7 @@ if ($cancelQuestion) {
}
}
if (isset($clone_question) && !empty($objExercise->id)) {
if (!empty($clone_question) && !empty($objExercise->id)) {
$old_question_obj = Question::read($clone_question);
$old_question_obj->question = $old_question_obj->question.' - '.get_lang('Copy');

@ -12,16 +12,15 @@
*/
/**
CLASS FillBlanks
*
* This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER),
* This class allows to instantiate an object of type MULTIPLE_ANSWER
* (MULTIPLE CHOICE, MULTIPLE ANSWER),
* extending the class question
*
* @author Eric Marguin
* @author Julio Montoya multiple fill in blank option added
* @package chamilo.exercise
**/
class FillBlanks extends Question
{
static $typePicture = 'fill_in_blanks.gif';
@ -30,7 +29,7 @@ class FillBlanks extends Question
/**
* Constructor
*/
function FillBlanks()
public function FillBlanks()
{
parent::question();
$this -> type = FILL_IN_BLANKS;
@ -41,7 +40,8 @@ class FillBlanks extends Question
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
*/
function createAnswersForm ($form) {
function createAnswersForm($form)
{
$defaults = array();
if (!empty($this->id)) {
@ -76,8 +76,17 @@ class FillBlanks extends Question
$defaults['answer'] = get_lang('DefaultTextInBlanks');
}
$setValues = null;
if (isset($a_weightings) && count($a_weightings) > 0) {
foreach ($a_weightings as $i => $weighting) {
$setValues .= 'document.getElementById("weighting['.$i.']").value = "'.$weighting.'";';
}
}
// javascript
echo '<script>
function FCKeditor_OnComplete(editorInstance) {
if (window.attachEvent) {
editorInstance.EditorDocument.attachEvent("onkeyup", updateBlanks) ;
@ -113,15 +122,10 @@ class FillBlanks extends Question
document.getElementById("blanks_weighting").innerHTML = fields + "</table></div></div>";
if (firstTime) {
firstTime = false;
';
if (count($a_weightings) > 0) {
foreach($a_weightings as $i => $weighting) {
echo 'document.getElementById("weighting['.$i.']").value = "'.$weighting.'";';
}
'.$setValues.'
}
echo '}
}
window.onload = updateBlanks;
</script>';
@ -150,10 +154,9 @@ class FillBlanks extends Question
}
}
/**
* abstract function which creates the form to create / edit the answers of the question
* @param the formvalidator instance
* @param FormValidator $form
*/
function processAnswersCreation($form)
{

@ -75,7 +75,9 @@ if (is_object($objQuestion)) {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&hotspotadmin='.$objQuestion->id.'"</script>';
}
} else {
if (isset($questionName)) {
echo '<h3>'.$questionName.'</h3>';
}
if (!empty($pictureName)) {
echo '<img src="../document/download.php?doc_url=%2Fimages%2F'.$pictureName.'" border="0">';
}

Loading…
Cancel
Save