Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/exercice/question_list_admin.inc.php

158 lines
3.8 KiB

<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
/**
* Code library for HotPotatoes integration.
* @package dokeos.exercise
* @author
* @version $Id: question_list_admin.inc.php 10789 2007-01-18 19:18:27Z pcool $
*/
/**
==============================================================================
* QUESTION LIST ADMINISTRATION
*
* This script allows to manage the question list
* It is included from the script admin.php
*
* @author Olivier Brouckaert
* @package dokeos.exercise
==============================================================================
*/
// ALLOWED_TO_INCLUDE is defined in admin.php
if(!defined('ALLOWED_TO_INCLUDE'))
{
exit();
}
// moves a question up in the list
if(isset($_GET['moveUp']))
{
$objExercise->moveUp(intval($_GET['moveUp']));
$objExercise->save();
}
// moves a question down in the list
if(isset($_GET['moveDown']))
{
$objExercise->moveDown(intval($_GET['moveDown']));
$objExercise->save();
}
// deletes a question from the exercise (not from the data base)
if($deleteQuestion)
{
// if the question exists
if($objQuestionTmp = Question::read($deleteQuestion))
{
$objQuestionTmp->delete($exerciseId);
// if the question has been removed from the exercise
if($objExercise->removeFromList($deleteQuestion))
{
$nbrQuestions--;
}
}
// destruction of the Question object
unset($objQuestionTmp);
}
echo '<a href="question_pool.php?fromExercise='.$exerciseId.'">'.get_lang('GetExistingQuestion').'</a>';
Question :: display_type_menu ();
?>
<table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
<tr bgcolor='#e6e6e6'><td width="65%" align="center"><b><?php echo get_lang('Question'); ?></b></td>
<td width="20%" align="center"><b><?php echo get_lang('Type');?></b></td>
<td width="15%" align="center"><b><?php echo get_lang('Modify'); ?></b></td>
</tr>
<?php
if($nbrQuestions)
{
$questionList=$objExercise->selectQuestionList();
$i=1;
foreach($questionList as $id)
{
$objQuestionTmp = Question :: read($id);
//showQuestion($id);
?>
<tr>
<td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td> <td><?php eval('echo get_lang('.get_class($objQuestionTmp).'::$explanationLangVar);'); ?></td>
<td> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?myid=1&editQuestion=<?php echo $id; ?>"><img src="../img/edit.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Modify'); ?>" /></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?deleteQuestion=<?php echo $id; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'))); ?>')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Delete'); ?>" /></a>
<?php
if($i != 1)
{
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?moveUp=<?php echo $id; ?>"><img src="../img/up.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveUp'); ?>"></a>
<?php
}
if($i != $nbrQuestions)
{
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?moveDown=<?php echo $id; ?>"><img src="../img/down.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveDown'); ?>"></a>
<?php
}
?>
</td>
<?php
$i++;
unset($objQuestionTmp);
?>
</tr>
<?php }
}
?>
</table>
<table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
<?php
if(!$i)
{
?>
<tr>
<td><?php echo get_lang('NoQuestion'); ?></td>
</tr>
<?php
}
?>
</table>