skala
Juan Carlos Raña 15 years ago
commit cda500342c
  1. 5
      main/css/chamilo/default.css
  2. 8
      main/exercice/admin.php
  3. 70
      main/exercice/exercice.php
  4. 2
      main/exercice/exercice_submit.php
  5. 23
      main/exercice/exercise.class.php
  6. 6
      main/exercice/exercise_admin.php
  7. 7
      main/exercice/question_pool.php
  8. 24
      main/inc/lib/document.lib.php
  9. 45
      main/newscorm/lp_add_item.php
  10. 45
      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')){

@ -293,8 +293,12 @@ if ($show != 'result') {
$nameTools = get_lang('Exercices');
} else {
if ($is_allowedToEdit || $is_tutor) {
$nameTools = get_lang('StudentScore');
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$nameTools = get_lang('StudentScore');
$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);
foreach($headers as $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);
@ -894,29 +909,23 @@ if ($show == 'test') {
//Time limits are on
if ($time_limits) {
// Examn is ready to be taken
if ($is_actived_time) {
if ($my_result_disabled == 0) {
if ($is_actived_time) {
//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 {
@ -926,14 +935,13 @@ 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') . ' : ';
@ -957,7 +965,7 @@ if ($show == 'test') {
}*/
if (empty($num)) {
$num = '';
$num = '';
}
$item .= Display::tag('td', $attempt_text);

@ -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]);
@ -2105,12 +2105,11 @@ class Exercise {
$choice[$j] = trim($choice[$j]);
}
$user_tags[] = api_strtolower($choice[$j]);
$user_tags[] = api_strtolower($choice[$j]);
//put the contents of the [] answer tag into correct_tags[]
$correct_tags[] = api_strtolower(api_substr($temp, 0, $pos));
$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,10 +75,9 @@ 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) {
//Duplicating a Question

@ -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,22 +36,24 @@ 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'";
$sql_result = Database::query($sql_query);
$course_quota = null;
$course_quota = null;
if (Database::num_rows($sql_result)) {
$result = Database::fetch_array($sql_result);
$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;
$course_quota = DEFAULT_DOCUMENT_QUOTA;
}
return $course_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

@ -125,17 +125,17 @@ if (!empty($curDirPath)) {
/* CURRENT DIRECTORY */
echo '<tr>';
echo '<th width="50%">'.get_lang('Title').'</th>';
if ($is_allowed_to_edit) {
echo '<th>'.get_lang('PublicationDate').'</th>';
echo '<th>'.get_lang('ExpirationDate').'</th>';
}
echo '<th>'.get_lang('Progress')."</th>";
echo '<tr>';
if ($is_allowed_to_edit) {
echo '<th>'.get_lang('AuthoringOptions')."</th>";
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>";
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>';
@ -203,8 +203,7 @@ if (is_array($flat_list)) {
if (!empty($details['expired_on'])) {
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_LONG);
}
}
}
$counter++;
if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; }
@ -254,8 +253,12 @@ if (is_array($flat_list)) {
$lp_theme_css = $mystyle;
if ($display_progress_bar) {
$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>';
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>';
}
@ -324,11 +327,11 @@ if (is_array($flat_list)) {
// Session test not necessary if we want to show base course learning paths inside the session (see http://support.chamilo.org/projects/chamilo-18/wiki/Tools_and_sessions).
//if ($current_session == $details['lp_session']) {
if ($details['lp_visibility'] == 0) {
$dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">".Display::return_icon('invisible.png', get_lang('Show'),'','22')."</a>";
} else {
$dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>" .Display::return_icon('visible.png', get_lang('Hide'),'','22')."</a>";
}
if ($details['lp_visibility'] == 0) {
$dsp_visible = "<a href=\"".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=1\">".Display::return_icon('invisible.png', get_lang('Show'),'','22')."</a>";
} else {
$dsp_visible = "<a href='".api_get_self()."?".api_get_cidreq()."&lp_id=$id&action=toggle_visible&new_status=0'>" .Display::return_icon('visible.png', get_lang('Hide'),'','22')."</a>";
}
//} else {
// $dsp_visible = '<img src="../img/invisible.gif" border="0" title="'.get_lang('Show').'" />';
//}
@ -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