Minor - format code

pull/2487/head
jmontoyaa 8 years ago
parent 4735112fef
commit 407faaab43
  1. 27
      main/exercise/Annotation.php
  2. 2
      main/exercise/Draggable.php
  3. 3
      main/exercise/adminhp.php
  4. 2
      main/exercise/annotation_user.php
  5. 29
      main/exercise/answer.class.php
  6. 10
      main/exercise/calculated_answer.class.php
  7. 18
      main/exercise/exercise_admin.php
  8. 16
      main/exercise/exercise_history.php
  9. 20
      main/exercise/exercise_reminder.php
  10. 21
      main/exercise/exercise_report.php
  11. 2
      main/exercise/exercise_result.php
  12. 4
      main/exercise/exercise_show.php

@ -34,7 +34,12 @@ class Annotation extends Question
{
parent::createForm($form, $fck_config);
$form->addElement('number', 'weighting', get_lang('Weighting'), ['step' => '0.1']);
$form->addElement(
'number',
'weighting',
get_lang('Weighting'),
['step' => '0.1']
);
if (!empty($this->id)) {
$form->setDefaults(array('weighting' => float_format($this->weighting, 1)));
@ -55,14 +60,26 @@ class Annotation extends Question
'imageUpload',
array(
Display::img(
Display::return_icon('annotation.png', null, null, ICON_SIZE_BIG, false, true)
Display::return_icon(
'annotation.png',
null,
null,
ICON_SIZE_BIG,
false,
true
)
),
get_lang('UploadJpgPicture'),
)
);
$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif'));
$form->addRule(
'imageUpload',
get_lang('OnlyImagesAllowed'),
'filetype',
array('jpg', 'jpeg', 'png', 'gif')
);
$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
}
@ -92,7 +109,7 @@ class Annotation extends Question
/**
* @param FormValidator $form
*/
function createAnswersForm($form)
public function createAnswersForm($form)
{
// nothing
}
@ -100,7 +117,7 @@ class Annotation extends Question
/**
* @param FormValidator $form
*/
function processAnswersCreation($form)
public function processAnswersCreation($form)
{
$this->weighting = $form->getSubmitValue('weighting');
$this->save();

@ -57,7 +57,6 @@ class Draggable extends Question
if (count($answer->nbrAnswers) > 0) {
$nb_matches = $nb_options = 0;
for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
if ($answer->isCorrect($i)) {
$nb_matches++;
@ -107,7 +106,6 @@ class Draggable extends Question
for ($i = 1; $i <= $nb_matches; ++$i) {
$renderer = &$form->defaultRenderer();
$renderer->setElementTemplate(
'<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>',
"answer[$i]"

@ -56,13 +56,10 @@ Display::display_header($nameTools,"Exercise");
/** @todo probably wrong !!!! */
require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
?>
<h4>
<?php echo $nameTools; ?>
</h4>
<?php
if (isset($newName)) {
if ($newName!="") {

@ -50,14 +50,12 @@ if (!empty($attemptList) && isset($attemptList[$questionId])) {
foreach ($parts as $partPoint) {
$points[] = Geometry::decodePoint($partPoint);
}
$data['answers']['paths'][] = $points;
break;
case 'T':
$text = [
'text' => array_shift($parts)
];
$data['answers']['texts'][] = $text + Geometry::decodePoint($parts[0]);
break;
}

@ -190,9 +190,9 @@ class Answer
/**
* Reads answer information from the data base ordered by parameter
* @param string Field we want to order by
* @param string DESC or ASC
* @param string $field
* @param string $field Field we want to order by
* @param string $order DESC or ASC
*
* @author Frederic Vauthier
*/
public function readOrderedBy($field, $order = 'ASC')
@ -387,11 +387,18 @@ class Answer
$list = array();
for ($i = 1; $i <= $this->nbrAnswers; $i++) {
if (!empty($this->answer[$i])) {
//Avoid problems when parsing elements with accents
if ($decode) {
$this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding());
$this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding());
$this->answer[$i] = api_html_entity_decode(
$this->answer[$i],
ENT_QUOTES,
api_get_system_encoding()
);
$this->comment[$i] = api_html_entity_decode(
$this->comment[$i],
ENT_QUOTES,
api_get_system_encoding()
);
}
$list[] = array(
@ -402,7 +409,7 @@ class Answer
'hotspot_coord' => $this->hotspot_coordinates[$i],
'hotspot_type' => $this->hotspot_type[$i],
'correct' => $this->correct[$i],
'destination' => $this->destination[$i]
'destination' => $this->destination[$i],
);
}
}
@ -423,6 +430,7 @@ class Answer
$list[$i] = $this->weighting[$i];
}
}
return $list;
}
@ -499,8 +507,7 @@ class Answer
* returns answer hotspot coordinates
*
* @author Olivier Brouckaert
* @param integer Answer ID
* @param integer $id
* @param integer $id Answer ID
* @return integer Answer position
*/
public function selectHotspotCoordinates($id)
@ -512,8 +519,7 @@ class Answer
* returns answer hotspot type
*
* @author Toon Keppens
* @param integer Answer ID
* @param integer $id
* @param integer $id Answer ID
* @return integer Answer position
*/
public function selectHotspotType($id)
@ -971,7 +977,6 @@ class Answer
public function isCorrectByAutoId($needle)
{
$key = 0;
foreach ($this->autoId as $autoIdKey => $autoId) {
if ($autoId == $needle) {
$key = $autoIdKey;

@ -31,7 +31,6 @@ class CalculatedAnswer extends Question
public function createAnswersForm($form)
{
$defaults = array();
if (!empty($this->id)) {
$objAnswer = new Answer($this->id);
$preArray = explode('@@', $objAnswer->selectAnswer(1));
@ -125,9 +124,14 @@ class CalculatedAnswer extends Question
Display::return_icon('fill_field.png'),
array(
'id' => 'answer',
'onkeyup' => 'javascript: updateBlanks(this);'
'onkeyup' => 'javascript: updateBlanks(this);',
),
array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '350'));
array(
'ToolbarSet' => 'TestQuestionDescription',
'Width' => '100%',
'Height' => '350',
)
);
$form->addRule('answer', get_lang('GiveText'), 'required');
$form->addRule('answer', get_lang('DefineBlanks'), 'regex', '/\[.*\]/');

@ -109,11 +109,8 @@ $htmlHeadXtra[] = '<script>
disabledHideRandom();
$("#hidden_matrix").show();
break;
}
}
</script>';
// to correct #4029 Random and number of attempt menu empty added window.onload=advanced_parameters;
@ -153,9 +150,13 @@ $objExercise->createForm($form);
if ($form->validate()) {
$objExercise->processCreation($form);
if ($form->getSubmitValue('edit') == 'true') {
Display::addFlash(Display::return_message(get_lang('ExerciseEdited')));
Display::addFlash(
Display::return_message(get_lang('ExerciseEdited'), 'success')
);
} else {
Display::addFlash(Display::return_message(get_lang('ExerciseAdded')));
Display::addFlash(
Display::return_message(get_lang('ExerciseAdded'), 'success')
);
}
$exercise_id = $objExercise->id;
Session::erase('objExercise');
@ -207,12 +208,15 @@ if ($form->validate()) {
}
echo '</div>';
if ($objExercise->feedback_type == 1)
if ($objExercise->feedback_type == 1) {
Display::display_normal_message(
get_lang('DirectFeedbackCantModifyTypeQuestion')
);
}
if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) {
if (api_get_setting('search_enabled')=='true' &&
!extension_loaded('xapian')
) {
Display::display_error_message(get_lang('SearchXapianModuleNotInstalled'));
}

@ -8,7 +8,6 @@
* @author Denes Nagy, HotPotatoes integration
* @author Wolfgang Schneider, code/html cleanup
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
api_protect_course_script(true);
@ -25,9 +24,18 @@ if (!$is_allowedToEdit) {
exit;
}
$interbreadcrumb[] = array('url' => 'exercise_report.php?'.api_get_cidreq(), 'name' => get_lang('Exercises'));
$interbreadcrumb[] = array('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(), 'name' => get_lang('StudentScore'));
$interbreadcrumb[] = array('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
$interbreadcrumb[] = array(
'url' => 'exercise_report.php?'.api_get_cidreq(),
'name' => get_lang('Exercises'),
);
$interbreadcrumb[] = array(
'url' => 'exercise_report.php?filter=2&'.api_get_cidreq(),
'name' => get_lang('StudentScore'),
);
$interbreadcrumb[] = array(
'url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(),
'name' => get_lang('Details'),
);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
use \ChamiloSession as Session;
use ChamiloSession as Session;
/**
* Exercise reminder overview
@ -71,19 +71,23 @@ if (empty($objExercise)) {
if (!$objExercise) {
//Redirect to the exercise overview
//Check if the exe_id exists
header("Location: overview.php?exerciseId=".$exerciseId);
header("Location: overview.php?exerciseId=".$exerciseId.'&'.api_get_cidreq());
exit;
}
$time_control = false;
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
$clock_expired_time = ExerciseLib::get_session_time_control_key(
$objExercise->id,
$learnpath_id,
$learnpath_item_id
);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
$time_control = true;
}
if ($time_control) {
// Get time left for exipiring time
// Get time left for expiring time
$time_left = api_strtotime($clock_expired_time, 'UTC') - time();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css');
@ -93,7 +97,6 @@ if ($time_control) {
$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
}
if (isset($_SESSION['exe_id'])) {
$exe_id = intval($_SESSION['exe_id']);
}
@ -132,7 +135,6 @@ if ($time_control) {
}
echo Display::div('', array('id'=>'message'));
echo '<script>
lp_data = $.param({"learnpath_id": '.$learnpath_id.', "learnpath_item_id" : '.$learnpath_item_id.', "learnpath_item_view_id": '.$learnpath_item_view_id.'});
@ -176,7 +178,6 @@ echo '<script>
$attempt_list = Event::getAllExerciseEventByExeId($exe_id);
$remind_list = $exercise_stat_info['questions_to_check'];
$remind_list = explode(',', $remind_list);
$exercise_result = array();
foreach ($attempt_list as $question_id => $options) {
@ -225,7 +226,10 @@ foreach ($question_list as $questionId) {
$counter++;
if ($objExercise->type == ONE_PER_PAGE) {
$question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url);
$question_title = Display::url(
$counter.'. '.cut($objQuestionTmp->selectTitle(), 40),
$url
);
$question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40);
} else {
$question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40);

@ -126,7 +126,7 @@ if (isset($_REQUEST['comments']) &&
$_REQUEST['comments'] == 'update' &&
($is_allowedToEdit || $is_tutor || $allowCoachFeedbackExercises)
) {
//filtered by post-condition
// Filtered by post-condition
$id = intval($_GET['exeid']);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
@ -140,7 +140,6 @@ if (isset($_REQUEST['comments']) &&
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$exerciseId = $track_exercise_info['exe_exo_id'];
$course_info = api_get_course_info();
$url = api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq().'&show_headers=1&id_session='.$session_id;
$my_post_info = array();
@ -281,7 +280,9 @@ if ($is_allowedToEdit && $origin != 'learnpath') {
);
}
} 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>';
}
//Deleting an attempt
@ -326,11 +327,12 @@ if (($is_allowedToEdit || $is_tutor || api_is_coach()) &&
Database::query($sql);
}
Display :: display_header($nameTools);
// Clean all results for this test before the selected date
if (($is_allowedToEdit || $is_tutor || api_is_coach()) && isset($_GET['delete_before_date']) && $locked == false) {
if (($is_allowedToEdit || $is_tutor || api_is_coach()) &&
isset($_GET['delete_before_date']) && $locked == false
) {
// ask for the date
$check = Security::check_token('get');
if ($check) {
@ -399,15 +401,14 @@ if ($is_allowedToEdit) {
}
echo $actions;
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_results&exerciseId='.$exercise_id.'&filter_by_user='.$filter_user.'&'.api_get_cidreq();
$action_links = '';
// Generating group list
$group_list = GroupManager::get_group_list();
$group_parameters = array('group_all:'.get_lang('All'), 'group_none:'.get_lang('None'));
$group_parameters = array(
'group_all:'.get_lang('All'),
'group_none:'.get_lang('None'),
);
foreach ($group_list as $group) {
$group_parameters[] = $group['id'].':'.$group['name'];

@ -1,7 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
use \ChamiloSession as Session;
use ChamiloSession as Session;
/**
* Exercise result

@ -136,8 +136,6 @@ if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
$fromlink = '';
$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name);
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result'));
@ -895,7 +893,6 @@ if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress
'details' => 'true',
'course' => Security::remove_XSS($_GET['cidReq'])
]);
$formUrl .= $fromlink;
$emailForm = new FormValidator('myform', 'post', $formUrl, '', ['id' => 'myform']);
$emailForm->addHidden('lp_item_id', $learnpath_id);
@ -950,7 +947,6 @@ if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress
);
echo $emailForm->returnForm();
}
//Came from lpstats in a lp

Loading…
Cancel
Save