Format code

1.10.x
jmontoyaa 9 years ago
parent 0df4479ece
commit 3d62bc8afc
  1. 6
      main/exercice/addlimits.php
  2. 43
      main/exercice/adminhp.php
  3. 6
      main/exercice/aiken.php
  4. 20
      main/exercice/hotspot.class.php
  5. 18
      main/exercice/hotspot_admin.inc.php
  6. 25
      main/upload/upload.document.php

@ -59,9 +59,9 @@ if (isset($_SESSION['gradebook'])){
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('ToolGradebook')
);
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('ToolGradebook')
);
}
$nameTools=get_lang('Exercises');
$interbreadcrumb[] = array(

@ -4,26 +4,28 @@
* 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;
$this_section = SECTION_COURSES;
$_course = api_get_course_info();
if (isset($_REQUEST["cancel"])) {
if ($_REQUEST["cancel"]==get_lang('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']) ? $_REQUEST['hotpotatoesName'] : '';
$is_allowedToEdit=api_is_allowed_to_edit(null,true);
// document path
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
// picture path
$picturePath=$documentPath.'/images';
@ -40,33 +42,31 @@ if (isset($_SESSION['gradebook'])) {
$gradebook= $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
'name' => get_lang('ToolGradebook'),
);
}
$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
$nameTools = get_lang('adminHP');
Display::display_header($nameTools,"Exercise");
/** @todo probably wrong !!!! */
require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php');
require_once api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php';
?>
<h4>
<?php echo $nameTools; ?>
<?php echo $nameTools; ?>
</h4>
<?php
if (isset($newName)) {
if ($newName!="") {
//alter database record for that test
SetComment($hotpotatoesName,$newName);
SetComment($hotpotatoesName, $newName);
echo "<script language='Javascript' type='text/javascript'> window.location='exercise.php'; </script>";
}
}
@ -75,14 +75,13 @@ 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=="") {
$lstrComment = GetQuizName($hotpotatoesName,$documentPath);
if ($lstrComment == '') {
$lstrComment = GetQuizName($hotpotatoesName, $documentPath);
}
if ($lstrComment=="") {
$lstrComment = basename($hotpotatoesName,$documentPath);
if ($lstrComment == '') {
$lstrComment = basename($hotpotatoesName, $documentPath);
}
echo $lstrComment;

@ -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);

@ -12,9 +12,12 @@
**/
class HotSpot extends Question
{
static $typePicture = 'hotspot.png';
static $explanationLangVar = 'HotSpot';
public static $typePicture = 'hotspot.png';
public static $explanationLangVar = 'HotSpot';
/**
* HotSpot constructor.
*/
public function __construct()
{
parent::__construct();
@ -34,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
@ -75,12 +85,12 @@ class HotSpot extends Question
}
}
function createAnswersForm ($form)
function createAnswersForm($form)
{
// nothing
}
function processAnswersCreation ($form)
function processAnswersCreation($form)
{
// nothing
}

@ -366,8 +366,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 +606,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 +674,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])

@ -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.
@ -31,12 +32,9 @@ if (!DocumentManager::get_document_id($_course, $path)) {
/**
* Header
*/
$nameTools = get_lang('UplUploadDocument');
$interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=" . urlencode(
$path
) . $req_gid,
"url" => "./document.php?curdirpath=" . urlencode($path) . '&'.api_get_cidreq(),
"name" => $langDocuments
);
Display::display_header($nameTools, "Doc");
@ -69,13 +67,17 @@ if (isset($_FILES['user_upload'])) {
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,7 +96,7 @@ 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'],
@ -116,6 +118,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,12 +126,12 @@ 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,
@ -144,7 +147,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')));
}
}

Loading…
Cancel
Save