skala
Juan Carlos Raña 15 years ago
commit cda500342c
  1. 5
      main/css/chamilo/default.css
  2. 8
      main/exercice/admin.php
  3. 60
      main/exercice/exercice.php
  4. 2
      main/exercice/exercice_submit.php
  5. 19
      main/exercice/exercise.class.php
  6. 6
      main/exercice/exercise_admin.php
  7. 5
      main/exercice/question_pool.php
  8. 20
      main/inc/lib/document.lib.php
  9. 45
      main/newscorm/lp_add_item.php
  10. 21
      main/newscorm/lp_list.php

@ -2106,15 +2106,12 @@ padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;}
border:1px solid #E1E1E0;
}
.small {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px
}
.xsmall {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px
font-size: 10px
}
.xxsmall {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px
}
#glossary_menu li {

@ -257,8 +257,12 @@ if (!empty($gradebook) && $gradebook=='view') {
);
}
$interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
$interbreadcrumb[]=array("url" => "admin.php?exerciseId=".$objExercise->id,"name" => $objExercise->exercise);
$interbreadcrumb[] = array("url" => "exercice.php","name" => get_lang('Exercices'));
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => cut($objExercise->exercise, EXERCISE_MAX_NAME_BREADCRUMB));
} else {
$interbreadcrumb[] = array("url" => "#", "name" => cut($objExercise->exercise, EXERCISE_MAX_NAME_BREADCRUMB));
}
// shows a link to go back to the question pool
if(!$exerciseId && $nameTools != get_lang('ExerciseManagement')){

@ -294,7 +294,11 @@ if ($show != 'result') {
} else {
if ($is_allowedToEdit || $is_tutor) {
$nameTools = get_lang('StudentScore');
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$objExerciseTmp = new Exercise();
if ($objExerciseTmp->read($exerciseId)) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exerciseId, "name" => cut($objExerciseTmp->exercise, EXERCISE_MAX_NAME_BREADCRUMB));
}
} else {
$nameTools = get_lang('YourScore');
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
@ -302,7 +306,7 @@ if ($show != 'result') {
}
// need functions of statsutils lib to display previous exercices scores
require_once (api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php');
require_once api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php';
if ($is_allowedToEdit && !empty ($choice) && $choice == 'exportqti2') {
require_once 'export/qti2/qti2_export.php';
@ -347,7 +351,7 @@ if (!empty ($_POST['export_report']) && $_POST['export_report'] == 'export_repor
if (!$is_allowedToEdit and !$is_tutor) {
$user_id = api_get_user_id();
}
require_once ('exercise_result.class.php');
require_once 'exercise_result.class.php';
switch ($_POST['export_format']) {
case 'xls' :
$export = new ExerciseResult();
@ -388,7 +392,7 @@ HotPotGCt($documentPath, 1, api_get_user_id() );
// only for administrator
if ($is_allowedToEdit) {
if (!empty ($choice)) {
if (!empty($choice)) {
// construction of Exercise
$objExerciseTmp = new Exercise();
@ -443,8 +447,8 @@ if ($is_allowedToEdit) {
Security::clear_token();
}
if (!empty ($hpchoice)) {
switch ($hpchoice) {
if (!empty($hpchoice)) {
switch($hpchoice) {
case 'delete' : // deletes an exercise
$imgparams = array ();
$imgcount = 0;
@ -712,15 +716,20 @@ if ($show == 'test') {
$i=1;
if ($is_allowedToEdit) {
$headers = array(get_lang('ExerciseName'), get_lang('QuantityQuestions'), get_lang('Actions'));
$headers = array(array('name' => get_lang('ExerciseName')),
array('name' => get_lang('QuantityQuestions'), 'params' => array('width'=>'80px')),
array('name' => get_lang('Actions'), 'params' => array('width'=>'180px')));
} else {
$headers = array(get_lang('ExerciseName'), get_lang('Status'), get_lang('Results'));
$headers = array(array('name' => get_lang('ExerciseName')),
array('name' => get_lang('Status')),
array('name' => get_lang('Results')));
}
$header_list = '';
foreach($headers as $header) {
$header_list .= Display::tag('th',$header);
$header_list .= Display::tag('th', $header['name'], $header['params']);
}
echo Display::tag('tr',$header_list);
echo Display::tag('tr', $header_list);
$count = 0;
if (!empty($exercise_list))
@ -784,7 +793,7 @@ if ($show == 'test') {
}
//Showing exercise title
$row['title']= text_filter($row['title']);
$row['title'] = text_filter($row['title']);
//echo Display::tag('h1',$row['title']);
if ($session_id == $row['session_id']) {
@ -883,7 +892,13 @@ if ($show == 'test') {
//This query might be improved later on by ordering by the new "tms" field rather than by exe_id
//Don't remove this marker: note-query-exe-results
$qry = "SELECT * FROM $TBL_TRACK_EXERCICES
WHERE exe_exo_id = ".$row['id']." AND exe_user_id = " . api_get_user_id() . " AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
WHERE exe_exo_id = ".$row['id']." AND
exe_user_id = ".api_get_user_id()." AND
exe_cours_id = '".api_get_course_id()."' AND
status <> 'incomplete' AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
session_id = '" . api_get_session_id() . "'
ORDER BY exe_id DESC";
$qryres = Database::query($qry);
$num = Database :: num_rows($qryres);
@ -895,28 +910,22 @@ if ($show == 'test') {
if ($time_limits) {
// Examn is ready to be taken
if ($is_actived_time) {
if ($my_result_disabled == 0) {
//Show results
if ($my_result_disabled == 0 || $my_result_disabled == 2) {
//More than one attempt
if ($num > 0) {
$row_track = Database :: fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt') . ' : ';
$attempt_text .= show_score($row_track['exe_result'], $row_track['exe_weighting']);
} else {
if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time']));
} else {
if ($row['start_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($row['start_time']));
}
if ($row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time']));
}
}
//No attempts
$attempt_text = get_lang('NotAttempted');
}
} else {
$attempt_text = get_lang('CantShowResults');
}
} else {
//Quiz not ready
//Quiz not ready due to time limits
if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time']));
} else {
@ -927,13 +936,12 @@ if ($show == 'test') {
if ($row['end_time'] != '0000-00-00 00:00:00') {
$attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time']));
}
}
}
} else {
//Normal behaviour
//Show results
if ($my_result_disabled == 0) {
if ($my_result_disabled == 0 || $my_result_disabled == 2) {
if ($num > 0) {
$row_track = Database :: fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt') . ' : ';

@ -444,7 +444,7 @@ if (!empty ($gradebook) && $gradebook == 'view') {
}
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices'));
$interbreadcrumb[] = array ("url" => "#","name" => $objExercise->selectTitle());
$interbreadcrumb[] = array ("url" => "#","name" => cut($objExercise->selectTitle(), EXERCISE_MAX_NAME_BREADCRUMB));
if ($origin != 'learnpath') { //so we are not in learnpath tool
//$htmlHeadXtra[] = $objExercise->show_lp_javascript();

@ -16,6 +16,8 @@ define('EXERCISE_FEEDBACK_TYPE_END', 0);
define('EXERCISE_FEEDBACK_TYPE_DIRECT', 1);
define('EXERCISE_FEEDBACK_TYPE_EXAM', 2);
define('EXERCISE_MAX_NAME_BREADCRUMB', 60);
$debug = 0; //All exercise scripts should depend in this debug variable
require_once dirname(__FILE__).'/../inc/lib/exercise_show_functions.lib.php';
@ -855,7 +857,7 @@ class Exercise {
}
$form->addElement('header', '', $form_title);
// title
$form->addElement('text', 'exerciseTitle', get_lang('ExerciseName'),'class="input_titles" id="exercise_title"');
$form->addElement('text', 'exerciseTitle', get_lang('ExerciseName'), ' size="60" id="exercise_title"');
//$form->applyFilter('exerciseTitle','html_filter');
$form->addElement('html','<div class="row">
@ -1821,7 +1823,7 @@ class Exercise {
$user_answer = '';
// Get answer list for matching
$sql_answer = 'SELECT id, answer FROM '.$table_ans.' WHERE question_id="'.$questionId.'" ';
$sql_answer = 'SELECT id, answer FROM '.$table_ans.' WHERE question_id = "'.$questionId.'" ';
$res_answer = Database::query($sql_answer);
$answer_matching =array();
while ($real_answer = Database::fetch_array($res_answer)) {
@ -2057,9 +2059,7 @@ class Exercise {
$answer = '';
$j = 0;
//initialise answer tags
$user_tags = array ();
$correct_tags = array ();
$real_text = array ();
$user_tags = $correct_tags = $real_text = array ();
// the loop will stop at the end of the text
while (1) {
// quits the loop if there are no more blanks (detect '[')
@ -2087,7 +2087,7 @@ class Exercise {
break;
}
if ($from_database) {
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($exeId)."' AND question_id= '".Database::escape_string($questionId)."'";
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".$exeId."' AND question_id= '".Database::escape_string($questionId)."'";
$resfill = Database::query($queryfill);
$str = Database::result($resfill,0,'answer');
@ -2095,9 +2095,9 @@ class Exercise {
$str = str_replace('\r\n', '', $str);
$choice = $arr[1];
$tmp=strrpos($choice[$j],' / ');
$choice[$j]=api_substr($choice[$j],0,$tmp);
$choice[$j]=trim($choice[$j]);
$tmp = api_strrpos($choice[$j],' / ');
$choice[$j] = api_substr($choice[$j],0,$tmp);
$choice[$j] = trim($choice[$j]);
//Needed to let characters ' and " to work as part of an answer
$choice[$j] = stripslashes($choice[$j]);
@ -2110,7 +2110,6 @@ class Exercise {
$correct_tags[] = api_strtolower(api_substr($temp, 0, $pos));
$j++;
$temp = api_substr($temp, $pos +1);
//$answer .= ']';
}
$answer = '';
$real_correct_tags = $correct_tags;

@ -178,8 +178,10 @@ if ($form->validate()) {
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
}
$nameTools=get_lang('ExerciseManagement');
$interbreadcrumb[] = array ("url"=>'exercice.php', 'name'=> get_lang('Exercices'));
$nameTools = get_lang('ExerciseManagement');
$interbreadcrumb[] = array("url"=>'exercice.php', 'name'=> get_lang('Exercices'));
$interbreadcrumb[] = array("url"=>"admin.php?exerciseId=".$objExercise->id, "name" => cut($objExercise->exercise, EXERCISE_MAX_NAME_BREADCRUMB));
Display::display_header($nameTools,get_lang('Exercise'));
echo '<div class="actions">';

@ -75,9 +75,8 @@ if(!($objExcercise instanceOf Exercise) && !empty($fromExercise)) {
}
$nameTools = get_lang('QuestionPool');
$interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
$interbreadcrumb[]=array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->exercise);
$interbreadcrumb[] = array("url" => "exercice.php","name" => get_lang('Exercices'));
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => cut($objExercise->exercise, EXERCISE_MAX_NAME_BREADCRUMB));
if ($is_allowedToEdit) {

@ -16,8 +16,14 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
/* CONSTANTS */
define('DISK_QUOTA_FIELD', 'disk_quota'); //name of the database field
/** default quota for the course documents folder */
define('DEFAULT_DOCUMENT_QUOTA', api_get_setting('default_document_quotum'));
//Default quota for the course documents folder
$default_quota = api_get_setting('default_document_quotum');
//Just in case the setting is not correctly set
if (empty($default_quota)) {
$default_quota = 100000000;
}
define('DEFAULT_DOCUMENT_QUOTA', $default_quota);
class DocumentManager {
@ -30,9 +36,11 @@ class DocumentManager {
* @todo eliminate globals
*/
public static function get_course_quota() {
global $_course;
if (empty($_course['sysCode'])) { return DEFAULT_DOCUMENT_QUOTA; }
$course_code = Database::escape_string($_course['sysCode']);
$course_info = api_get_course_info();
if (empty($course_info)) {
return DEFAULT_DOCUMENT_QUOTA;
}
$course_code = Database::escape_string($course_info['code']);
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$sql_query = "SELECT ".DISK_QUOTA_FIELD." FROM $course_table WHERE code = '$course_code'";
@ -43,7 +51,7 @@ class DocumentManager {
$course_quota = $result[DISK_QUOTA_FIELD];
}
if (is_null($course_quota)) {
if (is_null($course_quota) || empty($course_quota)) {
// Course table entry for quota was null, then use default value
$course_quota = DEFAULT_DOCUMENT_QUOTA;
}

@ -85,8 +85,7 @@ function check_for_title() {
// Compose title if there is none
contentTextArray = contentText.split(\' \') ;
var x=0;
for(x=0; (x<5 && x<contentTextArray.length); x++)
{
for(x=0; (x<5 && x<contentTextArray.length); x++) {
if(x < 4)
{
bestandsnaamNieuw += contentTextArray[x] + \' \';
@ -96,8 +95,6 @@ function check_for_title() {
bestandsnaamNieuw += contentTextArray[x];
}
}
}
temp=true;
}
@ -129,14 +126,23 @@ $_SESSION['oLP']->get_js_dropdown_array() .
//'if( typeof cbo != "undefined" ) {'."\n" .
'cbo.options[k].selected = true;'."\n" .
//'}'."\n" .
'}'."\n" .
'$().ready(function() {'."\n" .
'if ($(\'#previous\')) {'."\n" .
'if(\'parent is\'+$(\'#idParent\').val()) {'.
'load_cbo($(\'#idParent\').val());'."\n" .
'}}'."\n" .
'});'."\n" .
'</script>';
'}
$(function() {
if ($(\'#previous\')) {
if(\'parent is\'+$(\'#idParent\').val()) {
load_cbo($(\'#idParent\').val());
}
}
//Loads LP item tabs
$("#resource_tab").tabs();
$(\'.lp_resource_element\').click(function() {
window.location.href = $(\'a\', this).attr(\'href\');
});
});
</script>';
$htmlHeadXtra[] = api_get_jquery_ui_js(); //jQuery
@ -221,17 +227,15 @@ Display::display_header(null, 'Path');
//api_display_tool_title($therow['name']);
$suredel = trim(get_lang('AreYouSureToDelete'));
//$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
//@todo move this somewhere else css/fix.css
?>
<style>
<style>
#feedback { font-size: 1.4em; }
#resExercise .ui-selecting { background: #FECA40; }
#resExercise .ui-selected { background: #F39814; color: white; }
#resExercise { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#resExercise li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
</style>
<script type='text/javascript'>
function stripslashes(str) {
@ -249,13 +253,6 @@ function confirmation(name) {
return false;
}
}
$(function() {
$("#resource_tab").tabs();
$('.lp_resource_element').click(function() {
window.location.href = $('a', this).attr('href');
});
});
</script>
<?php

@ -126,16 +126,16 @@ if (!empty($curDirPath)) {
/* CURRENT DIRECTORY */
echo '<tr>';
echo '<th width="50%">'.get_lang('Title').'</th>';
if ($is_allowed_to_edit) {
echo '<th width="30%">'.get_lang('Title').'</th>';
echo '<th>'.get_lang('PublicationDate').'</th>';
echo '<th>'.get_lang('ExpirationDate').'</th>';
}
echo '<th>'.get_lang('Progress')."</th>";
if ($is_allowed_to_edit) {
echo '<th>'.get_lang('AuthoringOptions')."</th>";
echo '<th>'.get_lang('Progress')."</th>";
echo '<th width="240px">'.get_lang('AuthoringOptions')."</th>";
} else {
echo '<th width="50%">'.get_lang('Title').'</th>';
echo '<th>'.get_lang('Progress')."</th>";
}
echo '</tr>';
@ -205,7 +205,6 @@ if (is_array($flat_list)) {
}
}
$counter++;
if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; }
@ -255,7 +254,11 @@ if (is_array($flat_list)) {
$lp_theme_css = $mystyle;
if ($display_progress_bar) {
if ($is_allowed_to_edit) {
$dsp_progress = '<td>'.learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id()).'</td>';
} else {
$dsp_progress = '<td><div style="width:125px">'.learnpath::get_progress_bar('%',learnpath::get_db_progress($id, api_get_user_id(), '%', '', false, api_get_session_id())).'</div></td>';
}
} else {
$dsp_progress = '<td style="padding-top:1em;"><div style="width:125px">'.learnpath::get_db_progress($id, api_get_user_id(), 'both','',false, api_get_session_id()).'</div></td>';
}
@ -483,8 +486,8 @@ if (is_array($flat_list)) {
}
}
if ($is_allowed_to_edit) {
$start_time = Display::tag('td', $start_time);
$end_time = Display::tag('td', $end_time);
$start_time = Display::tag('td', Display::div($start_time, array('class'=>'small')));
$end_time = Display::tag('td', Display::div($end_time, array('class'=>'small')));
} else {
$start_time = $end_time= '';
}

Loading…
Cancel
Save