Minor - format code

pull/2487/head
jmontoyaa 8 years ago
parent 9df170dbc2
commit ad9e92ee69
  1. 6
      main/exercise/TestCategory.php
  2. 4
      main/exercise/UniqueAnswerImage.php
  3. 7
      main/exercise/hotpotatoes.lib.php
  4. 13
      main/exercise/hotpotatoes_exercise_report.php
  5. 113
      main/exercise/hotpotatoes_exercise_result.class.php
  6. 19
      main/exercise/hotspot_lang_conversion.php
  7. 3
      main/exercise/question_create.php
  8. 21
      main/exercise/recalculate.php
  9. 1
      main/exercise/tests_category.php

@ -745,8 +745,10 @@ class TestCategory
*
* @return string
*/
public static function get_stats_table_by_attempt($exerciseId, $category_list = array())
{
public static function get_stats_table_by_attempt(
$exerciseId,
$category_list = array()
) {
if (empty($category_list)) {
return null;
}

@ -220,7 +220,8 @@ class UniqueAnswerImage extends UniqueAnswer
$selectQuestion
);
$group['url'.$i] = $form->createElement(
'text', 'url'.$i,
'text',
'url'.$i,
get_lang('Other').': ',
array(
'class' => 'col-md-2',
@ -317,7 +318,6 @@ class UniqueAnswerImage extends UniqueAnswer
{
$destinationStr.=$destination_id.';';
} */
$goodAnswer = $correct == $i ? true : false;
if ($goodAnswer) {
$nbrGoodAnswers++;

@ -14,7 +14,8 @@ $dbTable = Database::get_course_table(TABLE_DOCUMENT);
/**
* Creates a hotpotato directory.
*
* If a directory of that name already exists, don't create any. If a file of that name exists, remove it and create a directory.
* If a directory of that name already exists, don't create any.
* If a file of that name exists, remove it and create a directory.
* @param string $base_work_dir Wanted path
* @return boolean Always true so far
*/
@ -95,7 +96,9 @@ function GetComment($path, $courseCode = '')
* Sets the comment in the database for a particular path.
* @param string $path File path
* @param string $comment Comment to set
* @return Doctrine\DBAL\Driver\Statement|null Result of the database operation (Database::query will output some message directly on error anyway)
* @return Doctrine\DBAL\Driver\Statement|null
* Result of the database operation
* (Database::query will output some message directly on error anyway)
*/
function SetComment($path, $comment)
{

@ -290,10 +290,17 @@ function exportExcel() {
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
echo Display::grid_js(
'results',
$url,
$columns,
$column_model,
$extra_params,
array(),
$action_links,
true
);
if ($is_allowedToEdit || $is_tutor) { ?>
//setSearchSelect("status");
//
//view:true, del:false, add:false, edit:false, excel:true}

@ -19,6 +19,7 @@ class HotpotatoesExerciseResult
* @param string The document path (for HotPotatoes retrieval)
* @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
* @param string $document_path
* @return bool
*/
public function getExercisesReporting($document_path, $hotpotato_name)
{
@ -226,17 +227,37 @@ class HotpotatoesExerciseResult
}
if ($with_column_user) {
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Email'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('Email')
);
$column++;
if (api_is_western_name_order()) {
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('FirstName')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('LastName')
);
$column++;
} else {
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('LastName'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('LastName')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('FirstName'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('FirstName')
);
$column++;
}
}
@ -267,19 +288,47 @@ class HotpotatoesExerciseResult
}
}
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Title'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('Title')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('StartDate'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('StartDate')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('EndDate'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('EndDate')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Duration').' ('.get_lang('MinMinutes').')');
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('Duration').' ('.get_lang('MinMinutes').')'
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Score'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('Score')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Total'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('Total')
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, get_lang('Status'));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
get_lang('Status')
);
$line++;
foreach ($this->results as $row) {
@ -298,14 +347,46 @@ class HotpotatoesExerciseResult
$column++;
if (api_is_western_name_order()) {
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['first_name']),
ENT_QUOTES,
$charset
)
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['last_name']),
ENT_QUOTES,
$charset
)
);
$column++;
} else {
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['last_name']),
ENT_QUOTES,
$charset
)
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['first_name']),
ENT_QUOTES,
$charset
)
);
$column++;
}
}

@ -7,9 +7,6 @@
* @deprecated ?
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
*/
/**
* Code
*/
require_once __DIR__.'/../inc/global.inc.php';
$hotspot_lang_file = api_get_path(SYS_LANG_PATH);
@ -19,10 +16,11 @@ if (isset($_GET['lang'])) {
$lang = urldecode($_GET['lang']);
if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php'))
if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php')) {
$hotspot_lang_file .= $lang.'/hotspot.inc.php';
else
} else {
$hotspot_lang_file .= 'english/hotspot.inc.php';
}
} else {
$hotspot_lang_file .= 'english/hotspot.inc.php';
}
@ -31,15 +29,12 @@ if (isset($_GET['lang'])) {
}
$file = file($hotspot_lang_file);
$temp = array();
foreach ($file as $value)
{
foreach ($file as $value) {
$explode = explode('=', $value);
if (count($explode) > 1)
{
if (count($explode) > 1) {
$explode[0] = trim($explode[0]);
$explode[0] = '&'.substr($explode[0], 1, strlen($explode[0]));
@ -51,8 +46,6 @@ foreach ($file as $value)
}
}
foreach ($temp as $value)
{
foreach ($temp as $value) {
echo $value.' ';
}
?>

@ -108,7 +108,8 @@ if ($form->validate()) {
Display::display_footer();
}
function check_question_type($parameter) {
function check_question_type($parameter)
{
$question_list = Question::get_question_type_list();
foreach ($question_list as $key => $value) {
$valid_question_types[] = $key;

@ -21,24 +21,23 @@ $trackedExercise = $em
->getRepository('ChamiloCoreBundle:TrackEExercises')
->find(intval($_REQUEST['id']));
if (
$trackedExercise->getExeUserId() != intval($_REQUEST['user']) ||
if ($trackedExercise->getExeUserId() != intval($_REQUEST['user']) ||
$trackedExercise->getExeExoId() != intval($_REQUEST['exercise'])
) {
api_not_allowed(true);
exit;
}
$attemps = $em->getRepository('ChamiloCoreBundle:TrackEAttempt')
$attempts = $em->getRepository('ChamiloCoreBundle:TrackEAttempt')
->findBy([
'exeId' => $trackedExercise->getExeId(),
'userId' => $trackedExercise->getExeUserId()
]);
$newResult = 0;
foreach ($attemps as $attemp) {
$questionId = $attemp->getQuestionId();
/** @var \Chamilo\CoreBundle\Entity\TrackEAttempt $attempt */
foreach ($attempts as $attempt) {
$questionId = $attempt->getQuestionId();
$question = $em->find('ChamiloCourseBundle:CQuizQuestion', $questionId);
@ -52,20 +51,16 @@ foreach ($attemps as $attemp) {
]);
$newMarks = 0;
foreach ($answers as $answer) {
if ($answer->getId() != $attemp->getAnswer()) {
if ($answer->getId() != $attempt->getAnswer()) {
continue;
}
$newMarks += $answer->getPonderation();
}
$newResult += $newMarks;
$attemp->setMarks($newMarks);
$em->merge($attemp);
$attempt->setMarks($newMarks);
$em->merge($attempt);
}
$trackedExercise->setExeResult($newResult);

@ -5,6 +5,7 @@
hubert.borderiou
Manage tests category page
*/
$htmlHeadXtra[] = '
<script>
function confirmDelete(in_txt, in_id) {

Loading…
Cancel
Save