Merge 1.10.x

remotes/angel/1.11.x
jmontoyaa 8 years ago
commit e3bbb08d9c
  1. 21
      main/exercise/adminhp.php
  2. 6
      main/exercise/aiken.php
  3. 17
      main/exercise/hotpotatoes_exercise_report.php
  4. 2
      main/exercise/hotpotatoes_exercise_result.class.php
  5. 13
      main/exercise/hotspot.class.php
  6. 33
      main/exercise/hotspot_admin.inc.php
  7. 4
      main/forum/forumqualify.php
  8. 19
      main/inc/lib/fileUpload.lib.php
  9. 14
      main/template/default/layout/footer.tpl
  10. 39
      main/upload/upload.document.php

@ -4,22 +4,22 @@
* HotPotatoes administration.
* @package chamilo.exercise
* @author Istvan Mandak
* @version $Id: adminhp.php 20089 2009-04-24 21:12:54Z cvargas1 $
*/
require_once '../inc/global.inc.php';
$this_section=SECTION_COURSES;
$_course = api_get_course_info();
if (isset($_REQUEST["cancel"])) {
if ($_REQUEST["cancel"]==get_lang('Cancel')) {
header("Location: exercise.php");
exit;
}
}
//$is_courseAdmin = $_SESSION['is_courseAdmin'];
$newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
$hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_REQUEST['hotpotatoesName']:'');
$newName = !empty($_REQUEST['newName']) ? $_REQUEST['newName'] : '';
$hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($_REQUEST['hotpotatoesName']) : '';
$is_allowedToEdit=api_is_allowed_to_edit(null,true);
// document path
@ -43,7 +43,7 @@ if (isset($_SESSION['gradebook'])) {
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
'name' => get_lang('ToolGradebook'),
);
}
@ -54,7 +54,7 @@ $nameTools = get_lang('adminHP');
Display::display_header($nameTools,"Exercise");
/** @todo probably wrong !!!! */
require_once(api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php');
require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
?>
@ -75,13 +75,12 @@ echo "<form action=\"".api_get_self()."\" method='post' name='form1'>";
echo "<input type=\"hidden\" name=\"hotpotatoesName\" value=\"$hotpotatoesName\">";
echo "<input type=\"text\" name=\"newName\" value=\"";
$lstrComment = "";
$lstrComment = '';
$lstrComment = GetComment($hotpotatoesName);
if ($lstrComment=="") {
if ($lstrComment == '') {
$lstrComment = GetQuizName($hotpotatoesName,$documentPath);
}
if ($lstrComment=="") {
if ($lstrComment == '') {
$lstrComment = basename($hotpotatoesName,$documentPath);
}

@ -1,15 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Code for Aiken import integration.
* @package chamilo.exercise
* @author Ronny Velasquez <ronny.velasquez@beeznest.com>
* @author César Perales <cesar.perales@gmail.com> Updated function names and import files for Aiken format support
*/
/**
* Code
*/
// including the global Chamilo file
require_once '../inc/global.inc.php';
$lib_path = api_get_path(LIBRARY_PATH);
$main_path = api_get_path(SYS_CODE_PATH);

@ -1,5 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Exercise list: This script shows the list of exercises for administrators and students.
* @package chamilo.exercise
@ -7,15 +10,12 @@
*
*/
use ChamiloSession as Session;
// including the global library
require_once '../inc/global.inc.php';
// Setting the tabs
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_jqgrid_js();
$_course = api_get_course_info();
// Access control
api_protect_course_script(true, false, true);
@ -23,7 +23,6 @@ api_protect_course_script(true, false, true);
// including additional libraries
require_once 'hotpotatoes.lib.php';
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
@ -37,7 +36,7 @@ $TBL_TRACK_HOTPOTATOES_EXERCISES = Database :: get_main_table(TABLE_STATISTIC_TR
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id();
$hotpotatoes_path = isset($_REQUEST['path']) ? $_REQUEST['path'] : null;
$hotpotatoes_path = isset($_REQUEST['path']) ? Security::remove_XSS($_REQUEST['path']) : null;
$filter_user = isset($_REQUEST['filter_by_user']) ? intval($_REQUEST['filter_by_user']) : null;
if (empty($hotpotatoes_path)) {
@ -73,10 +72,12 @@ $actions = null;
if ($is_allowedToEdit && $origin != 'learnpath') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
$actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.Security::remove_XSS($hotpotatoes_path).' ">'.Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.$hotpotatoes_path.' ">'.
Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>';
}
} else {
$actions .= '<a href="exercise.php">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="exercise.php">' .
Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
}
if ($is_allowedToEdit) {

@ -121,7 +121,7 @@ class HotpotatoesExerciseResult
* @param boolean Whether to include user fields or not
* @return boolean False on error
*/
public function exportCompleteReportCSV($document_path='', $hotpotato_name)
public function exportCompleteReportCSV($document_path = '', $hotpotato_name)
{
global $charset;
$this->getExercisesReporting($document_path, $hotpotato_name);

@ -37,7 +37,14 @@ class HotSpot extends Question
parent::createForm($form, $fck_config);
if (!isset($_GET['editQuestion'])) {
$form->addElement('file','imageUpload',array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture')) );
$form->addElement(
'file',
'imageUpload',
array(
'<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />',
get_lang('UploadJpgPicture'),
)
);
// setting the save button here and not in the question class.php
// Saving a question
@ -78,12 +85,12 @@ class HotSpot extends Question
}
}
function createAnswersForm ($form)
function createAnswersForm($form)
{
// nothing
}
function processAnswersCreation ($form)
function processAnswersCreation($form)
{
// nothing
}

@ -1,13 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
use \ChamiloSession as Session;
/**
* This script allows to manage answers. It is included from the
* script admin.php
* @package chamilo.exercise
* @author Toon Keppens
*/
use \ChamiloSession as Session;
$modifyAnswers = intval($_GET['hotspotadmin']);
@ -246,11 +247,11 @@ if ($submitAnswers || $buttonBack) {
} // end for()
//now the noerror section
$selectQuestionNoError = $_POST['select_question_noerror'];
$lp_noerror = $_POST['lp_noerror'];
$try_noerror = isset($_POST['try_noerror']) ? $_POST['try_noerror'] : null;
$url_noerror = $_POST['url_noerror'];
$comment_noerror = $_POST['comment_noerror'];
$selectQuestionNoError = Security::remove_XSS($_POST['select_question_noerror']);
$lp_noerror = Security::remove_XSS($_POST['lp_noerror']);
$try_noerror = isset($_POST['try_noerror']) ? Security::remove_XSS($_POST['try_noerror']) : null;
$url_noerror = Security::remove_XSS($_POST['url_noerror']);
$comment_noerror = Security::remove_XSS($_POST['comment_noerror']);
$threadhold_total = '0;0;0';
if ($try_noerror == 'on') {
@ -292,6 +293,7 @@ if ($submitAnswers || $buttonBack) {
if ($weighting[$i]) {
$questionWeighting+=$weighting[$i];
}
// creates answer
$objAnswer->createAnswer(
$reponse[$i],
@ -324,7 +326,6 @@ if ($submitAnswers || $buttonBack) {
$editQuestion = $questionId;
unset($modifyAnswers);
echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
}
}
@ -366,8 +367,9 @@ if ($modifyAnswers) {
if ($answerType == HOT_SPOT_DELINEATION) {
// the magic happens here ...
// we do this to not count the if no error section
if ($nbrAnswers >= 2)
if ($nbrAnswers >= 2) {
$nbrAnswers--;
}
}
$reponse = array();
@ -605,19 +607,16 @@ if ($modifyAnswers) {
<tr>
<th width="5">&nbsp;</th>
<th> <?php echo get_lang('HotspotDescription'); ?> *</th>
<?php
if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
?>
<?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>';
}
?>
<?php
} else {
?>
<th colspan="2"><?php echo get_lang('Comment'); ?></th>
} else { ?>
<th colspan="2">
<?php echo get_lang('Comment'); ?>
</th>
<?php } ?>
<th><?php echo get_lang('QuestionWeighting'); ?> *</th>
</tr>
@ -676,10 +675,8 @@ if ($modifyAnswers) {
}
//-------- IF it is a delineation
if ($_SESSION['tmp_answers']['hotspot_type'][$i] == 'delineation') {
$option1 = $option2 = $option3 = '';
for ($k = 1; $k <= 100; $k++) {
$selected1 = $selected2 = $selected3 = '';
if ($k == $threadhold1[$i])

@ -171,7 +171,7 @@ if ($allowToQualify) {
// Show max qualify in my form
$maxQualify = showQualify('2', $userIdToQualify, $threadId);
$score = isset($_POST['idtextqualify']) ? $_POST['idtextqualify'] : '';
$score = isset($_POST['idtextqualify']) ? Security::remove_XSS($_POST['idtextqualify']) : '';
if ($score > $maxQualify) {
Display:: display_error_message(
@ -292,7 +292,7 @@ if ($allowToQualify) {
$realname = $attachment_list['path'];
$user_filename = $attachment_list['filename'];
echo Display::return_icon('attachment.gif',get_lang('Attachment'));
echo Display::return_icon('attachment.gif', get_lang('Attachment'));
echo '<a href="download.php?file=';
echo $realname;
echo ' "> '.$user_filename.' </a>';

@ -1127,12 +1127,8 @@ function unzip_uploaded_document(
*/
function clean_up_files_in_zip($p_event, &$p_header)
{
$originalFilePath = $p_header['filename'];
$originalFileName = basename($p_header['filename']);
$modifiedFileName = clean_up_path($originalFileName);
$p_header['filename'] = str_replace($originalFileName, $modifiedFileName, $originalFilePath);
return 1;
$res = clean_up_path($p_header['filename']);
return $res;
}
/**
@ -1140,11 +1136,11 @@ function clean_up_files_in_zip($p_event, &$p_header)
* by eliminating dangerous file names and cleaning them
*
* @param string $path
* @return string
* @return $path
* @see disable_dangerous_file()
* @see api_replace_dangerous_char()
*/
function clean_up_path($path)
function clean_up_path(&$path)
{
// Split the path in folders and files
$path_array = explode('/', $path);
@ -1158,8 +1154,7 @@ function clean_up_path($path)
// Join the "cleaned" path (modified in-place as passed by reference)
$path = implode('/', $path_array);
$res = filter_extension($path);
return $path;
return $res;
}
/**
@ -1572,13 +1567,12 @@ function create_unexisting_directory(
WHERE
c_id = $course_id AND
(
path = '" . $systemFolderName . "'
path = '" . Database::escape_string($systemFolderName). "'
)
";
$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {
$document_id = add_document(
$_course,
$systemFolderName,
@ -1596,7 +1590,6 @@ function create_unexisting_directory(
if ($document_id) {
// Update document item_property
if (!empty($visibility)) {
$visibilities = array(
0 => 'invisible',
1 => 'visible',

@ -39,11 +39,15 @@
{{ administrator_name }}
</div>
{% endif %}
<div class="software-name">
<a href="{{_p.web}}" target="_blank">
{{ "PoweredByX" |get_lang | format(_s.software_name) }}
</a>&copy; {{ "now"|date("Y") }}
</div>
{% if _s.software_name != '' %}
<div class="software-name">
<a href="{{_p.web}}" target="_blank">
{{ "PoweredByX" |get_lang | format(_s.software_name) }}
</a>&copy; {{ "now"|date("Y") }}
</div>
{% endif %}
{% if plugin_footer_right is not null %}
<div id="plugin_footer_right">
{{ plugin_footer_right }}

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Process part of the document sub-process for upload. This script MUST BE included by upload/index.php
* as it prepares most of the variables needed here.
@ -9,6 +10,7 @@
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
$_course = api_get_course_info();
$courseDir = $_course['path'] . "/document";
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path . $courseDir;
@ -17,7 +19,7 @@ $max_filled_space = DocumentManager::get_course_quota();
//what's the current path?
if (isset($_POST['curdirpath'])) {
$path = $_POST['curdirpath'];
$path = Security::remove_XSS($_POST['curdirpath']);
} else {
$path = '/';
}
@ -31,12 +33,9 @@ if (!DocumentManager::get_document_id($_course, $path)) {
/**
* Header
*/
$nameTools = get_lang('UplUploadDocument');
$interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=" . urlencode(
$path
) . $req_gid,
"url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=" . urlencode($path) . '&'.api_get_cidreq(),
"name" => $langDocuments
);
Display::display_header($nameTools, "Doc");
@ -56,26 +55,30 @@ if (isset($_FILES['user_upload'])) {
$_FILES['user_upload'],
$base_work_dir,
$_POST['curdirpath'],
$_user['user_id'],
api_get_user_id(),
$to_group_id,
$to_user_id,
$_POST['unzip'],
$_POST['if_exists']
);
$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
$new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : '';
$new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : '';
if ($new_path && ($new_comment || $new_title))
if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
$table_document = Database::get_course_table(TABLE_DOCUMENT);
$ct = '';
if ($new_comment) $ct .= ", comment='$new_comment'";
if ($new_title) $ct .= ", title='$new_title'";
if ($new_comment) {
$ct .= ", comment='$new_comment'";
}
if ($new_title) {
$ct .= ", title='$new_title'";
}
Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
}
//check for missing images in html files
$missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
if ($missing_files) {
if ($missing_files) {
//show a form to upload the missing files
Display::display_normal_message(
build_missing_files_form(
@ -94,10 +97,10 @@ if (isset($_POST['submit_image'])) {
if ($number_of_uploaded_images > 0) {
//we could also create a function for this, I'm not sure...
//create a directory for the missing files
$img_directory = str_replace('.','_',$_POST['related_file']."_files");
$img_directory = str_replace('.', '_', $_POST['related_file']."_files");
$folderData = create_unexisting_directory(
$_course,
$_user['user_id'],
api_get_user_id(),
api_get_session_id(),
$to_group_id,
$to_user_id,
@ -116,6 +119,7 @@ if (isset($_POST['submit_image'])) {
$to_user_id,
$max_filled_space
);
//open the html file and replace the paths
replace_img_path_in_html_file(
$_POST['img_file_path'],
@ -123,16 +127,16 @@ if (isset($_POST['submit_image'])) {
$base_work_dir . $_POST['related_file']
);
//update parent folders
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']);
}
}
//they want to create a directory
if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
$added_slash = ($path=='/')?'':'/';
$added_slash = $path == '/' ? '' : '/';
$dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
$created_dir = create_unexisting_directory(
$_course,
$_user['user_id'],
api_get_user_id(),
api_get_session_id(),
$to_group_id,
$to_user_id,
@ -144,7 +148,7 @@ if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
Display::display_normal_message(get_lang('DirCr'));
$path = $created_dir;
} else {
display_error(get_lang('CannotCreateDir'));
Display::addFlash(Display::return_message(get_lang('CannotCreateDir')));
}
}
@ -203,7 +207,6 @@ if (isset($_GET['createdir'])) {
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/> <?php echo (get_lang('UplDoNothing'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?>
</td>
</tr>
</table>

Loading…
Cancel
Save