';
$info .= get_lang('Name').' : '.$user['complete_name_with_message_link'].'
';
- if (api_get_setting('show_email_addresses') == 'true') {
+ if (api_get_setting('show_email_addresses') === 'true') {
$info .= get_lang('Email').' :
';
}
diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php
index 645e7a8b1f..cf13e4a86a 100755
--- a/main/gradebook/lib/fe/gradebooktable.class.php
+++ b/main/gradebook/lib/fe/gradebooktable.class.php
@@ -1239,10 +1239,10 @@ class GradebookTable extends SortableTable
$extra .= $item->getSkillsFromItem();
$text .= " ".$extra.$show_message;
- if ($item instanceof ExerciseLink) {
+ /*if ($item instanceof ExerciseLink) {
$spaces = str_repeat(' ', $spaces);
$text .= '
'.$spaces.$item->getLpListToString();
- }
+ }*/
$cc = $this->currentcat->get_course_code();
if (empty($cc)) {
diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php
index d18ce82346..fd670b9741 100755
--- a/main/gradebook/lib/flatview_data_generator.class.php
+++ b/main/gradebook/lib/flatview_data_generator.class.php
@@ -202,9 +202,9 @@ class FlatViewDataGenerator
$label = $item->get_name();
}
- if ($item instanceof ExerciseLink) {
+ /*if ($item instanceof ExerciseLink) {
$label .= '
'.$item->getLpListToString();
- }
+ }*/
$headers[] = $label;
$evaluationsAdded[] = $item->get_id();
@@ -225,9 +225,9 @@ class FlatViewDataGenerator
$label = $item->get_name();
}
- if ($item instanceof ExerciseLink) {
+ /*if ($item instanceof ExerciseLink) {
$label .= '
'.$item->getLpListToString();
- }
+ }*/
$headers[] = $label;
}
diff --git a/main/gradebook/user_stats.php b/main/gradebook/user_stats.php
index 2b042db816..012323bc59 100755
--- a/main/gradebook/user_stats.php
+++ b/main/gradebook/user_stats.php
@@ -1,4 +1,5 @@
content_to_pdf($html);
exit;
}
-$actions = '
';
+$actions = '
';
if (!empty($categoryId)) {
$interbreadcrumb[] = [
'url' => 'gradebook_flatview.php?selectcat='.$categoryId.'&'.api_get_cidreq(),
@@ -130,5 +131,5 @@ $actions .= '
';
Display::display_header(get_lang('ResultsPerUser'));
echo $actions;
DisplayGradebook::display_header_user($_GET['userid'], $category[0]->get_id());
-$user_table->display();
+$userTable->display();
Display::display_footer();
diff --git a/main/mySpace/work_stats.php b/main/mySpace/work_stats.php
new file mode 100644
index 0000000000..f7081b0925
--- /dev/null
+++ b/main/mySpace/work_stats.php
@@ -0,0 +1,205 @@
+ api_is_student_boss() ? '#' : 'index.php',
+ 'name' => get_lang('MySpace'),
+];
+
+function get_count_users()
+{
+ $courseCode = api_get_course_id();
+ $sessionId = api_get_session_id();
+
+ return CourseManager::get_user_list_from_course_code(
+ $courseCode,
+ $sessionId,
+ null,
+ null,
+ null,
+ true
+ );
+}
+
+function get_users($from, $number_of_items, $column, $direction)
+{
+ $consideredWorkingTime = api_get_configuration_value('considered_working_time');
+
+ $courseId = api_get_course_int_id();
+ $courseCode = api_get_course_id();
+ $sessionId = api_get_session_id();
+ $webCodePath = api_get_path(WEB_CODE_PATH);
+
+ $lastConnectionDate = null;
+ $is_western_name_order = api_is_western_name_order();
+ $limit = null;
+ $from = (int) $from;
+ $number_of_items = (int) $number_of_items;
+ $limit = 'LIMIT '.$from.','.$number_of_items;
+
+ $students = CourseManager::get_user_list_from_course_code(
+ $courseCode,
+ $sessionId,
+ $limit,
+ null,
+ null,
+ false
+ );
+ $url = $webCodePath.'mySpace/myStudents.php';
+
+ $workList = getWorkListTeacher(0, 100, null, null, null);
+
+ $workTimeList = [];
+ foreach ($workList as $work) {
+ $fieldValue = new ExtraFieldValue('work');
+ $resultExtra = $fieldValue->getAllValuesForAnItem(
+ $work['id'],
+ true
+ );
+
+ foreach ($resultExtra as $field) {
+ $field = $field['value'];
+ if ($consideredWorkingTime == $field->getField()->getVariable()) {
+ $time = $field->getValue();
+ $parsed = date_parse($time);
+ $workTimeList[$work['id']] = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];
+
+ break;
+ }
+ }
+ }
+
+ $all_datas = [];
+ foreach ($students as $studentData) {
+ $studentId = $studentData['user_id'];
+ $studentData = api_get_user_info($studentId);
+ $urlDetails = $url."?student=$studentId&details=true&course=$courseCode&id_session=$sessionId";
+ $row = [];
+ if ($is_western_name_order) {
+ $first = Display::url($studentData['firstname'], $urlDetails);
+ $last = Display::url($studentData['lastname'], $urlDetails);
+ } else {
+ $first = Display::url($studentData['lastname'], $urlDetails);
+ $last = Display::url($studentData['firstname'], $urlDetails);
+ }
+
+ $row[] = $first;
+ $row[] = $last;
+
+ $timeInSeconds = Tracking::get_time_spent_on_the_course(
+ $studentId,
+ $courseId,
+ $sessionId
+ );
+
+ $row[] = api_time_to_hms($timeInSeconds);
+
+ $userWorkTime = 0;
+ foreach ($workList as $work) {
+ $userWorks = get_work_user_list(
+ 0,
+ 100,
+ null,
+ null,
+ $work['id'],
+ null,
+ $studentId,
+ false,
+ $courseId,
+ $sessionId
+ );
+
+ if ($userWorks) {
+ foreach ($userWorks as $work) {
+ $userWorkTime += $workTimeList[$work['parent_id']];
+ }
+ }
+ }
+
+ $row[] = api_time_to_hms($userWorkTime);
+ $status = '';
+ if ($userWorkTime && $timeInSeconds) {
+ if ($userWorkTime > $timeInSeconds) {
+ $status = Display::label('TimeToFix', 'warning');
+ } else {
+ $status = Display::label('Ok', 'success');
+ }
+ }
+
+ $row[] = $status;
+ /*$detailsLink = Display::url(
+ Display::return_icon('2rightarrow.png', get_lang('Details').' '.$studentData['username']),
+ $urlDetails,
+ ['id' => 'details_'.$studentData['username']]
+ );
+ $row[] = $detailsLink;*/
+ $all_datas[] = $row;
+ }
+
+ return $all_datas;
+}
+
+$is_western_name_order = api_is_western_name_order();
+$sort_by_first_name = api_sort_by_first_name();
+$actionsLeft = '';
+$toolbar = Display::toolbarAction('toolbar-student', [$actionsLeft]);
+
+$itemPerPage = 10;
+$perPage = api_get_configuration_value('my_space_users_items_per_page');
+if ($perPage) {
+ $itemPerPage = (int) $perPage;
+}
+
+$table = new SortableTable(
+ 'tracking_work_student',
+ 'get_count_users',
+ 'get_users',
+ ($is_western_name_order xor $sort_by_first_name) ? 1 : 0,
+ $itemPerPage
+);
+
+$parameters = ['cidReq' => $courseCode, 'id_session' => $sessionId];
+$table->set_additional_parameters($parameters);
+
+if ($is_western_name_order) {
+ $table->set_header(0, get_lang('FirstName'), false);
+ $table->set_header(1, get_lang('LastName'), false);
+} else {
+ $table->set_header(0, get_lang('LastName'), false);
+ $table->set_header(1, get_lang('FirstName'), false);
+}
+
+$table->set_header(2, get_lang('TimeSpentInTheCourse'), false);
+$table->set_header(3, get_lang('TimeSpentInWork'), false);
+$table->set_header(4, get_lang('Status'), false);
+
+Display::display_header($nameTools);
+echo $toolbar;
+echo Display::page_subheader($nameTools);
+$table->display();
+
+Display::display_footer();
diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php
index f8cdbe36a1..14b70575a5 100755
--- a/main/survey/fillsurvey.php
+++ b/main/survey/fillsurvey.php
@@ -305,7 +305,7 @@ if (count($_POST) > 0) {
} else {
// All the other question types (open question, multiple choice, percentage, ...)
if (isset($types[$survey_question_id]) &&
- 'percentage' == $types[$survey_question_id]) {
+ 'percentage' === $types[$survey_question_id]) {
$sql = "SELECT * FROM $table_survey_question_option
WHERE
c_id = $course_id AND
@@ -378,7 +378,6 @@ if (count($_POST) > 0) {
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
$option_value = $row['value'];
- //$option_value = 0;
$survey_question_answer = $value;
// We save the answer after making sure that a possible previous attempt is deleted
@@ -406,7 +405,6 @@ if (count($_POST) > 0) {
}
$user_id = api_get_user_id();
-
if ($user_id == 0) {
$user_id = $survey_invitation['user'];
}
@@ -1079,7 +1077,7 @@ if ((isset($_GET['show']) && $_GET['show'] != '') ||
$questions = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
// If the type is not a pagebreak we store it in the $questions array
- if ('pagebreak' != $row['type']) {
+ if ('pagebreak' !== $row['type']) {
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
@@ -1193,7 +1191,7 @@ if ((isset($_GET['show']) && $_GET['show'] != '') ||
$questions = [];
while ($row = Database :: fetch_array($result, 'ASSOC')) {
// If the type is not a pagebreak we store it in the $questions array
- if ('pagebreak' != $row['type']) {
+ if ('pagebreak' !== $row['type']) {
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
@@ -1270,6 +1268,11 @@ $form = new FormValidator(
);
$form->addHidden('language', $p_l);
+$showNumber = true;
+if (SurveyManager::hasDependency($survey_data)) {
+ $showNumber = false;
+}
+
if (isset($questions) && is_array($questions)) {
$originalShow = isset($_GET['show']) ? (int) $_GET['show'] : 0;
$questionCounter = 1;
@@ -1306,7 +1309,9 @@ if (isset($questions) && is_array($questions)) {
// @todo move this in a function.
$form->addHtml('
');
- $form->addHtml('
'.$questionNumber.'.
');
+ if ($showNumber) {
+ $form->addHtml('
'.$questionNumber.'.
');
+ }
$form->addHtml('
'.Security::remove_XSS($question['survey_question']).'
');
$userAnswerData = SurveyUtil::get_answers_of_question_by_user($question['survey_id'], $question['question_id']);
diff --git a/main/survey/preview.php b/main/survey/preview.php
index 77b45acced..bbe2c43a1b 100755
--- a/main/survey/preview.php
+++ b/main/survey/preview.php
@@ -93,13 +93,13 @@ if (isset($_GET['show'])) {
if (Database::num_rows($result)) {
while ($row = Database::fetch_array($result)) {
if (1 == $survey_data['one_question_per_page']) {
- if ('pagebreak' != $row['type']) {
+ if ('pagebreak' !== $row['type']) {
$paged_questions[$counter][] = $row['question_id'];
$counter++;
continue;
}
} else {
- if ('pagebreak' == $row['type']) {
+ if ('pagebreak' === $row['type']) {
$counter++;
} else {
$paged_questions[$counter][] = $row['question_id'];
@@ -143,7 +143,7 @@ if (isset($_GET['show'])) {
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
// If the type is not a pagebreak we store it in the $questions array
- if ('pagebreak' != $row['type']) {
+ if ('pagebreak' !== $row['type']) {
$sort = $row['sort'];
$questions[$sort]['question_id'] = $row['question_id'];
$questions[$sort]['survey_id'] = $row['survey_id'];
@@ -191,6 +191,11 @@ if (is_array($questions) && count($questions) > 0) {
$counter = $before + 1;
}
+ $showNumber = true;
+ if (SurveyManager::hasDependency($survey_data)) {
+ $showNumber = false;
+ }
+
$js = '';
foreach ($questions as $key => &$question) {
$ch_type = 'ch_'.$question['type'];
@@ -211,7 +216,9 @@ if (is_array($questions) && count($questions) > 0) {
$js .= survey_question::getQuestionJs($question);
$form->addHtml('
');
- $form->addHtml('
'.$counter.'.
');
+ if ($showNumber) {
+ $form->addHtml('
'.$counter.'.
');
+ }
$form->addHtml('
'.Security::remove_XSS($question['survey_question']).'
');
$display->render($form, $question);
$form->addHtml('
');
diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php
index 970d9a7e54..e384344a48 100755
--- a/main/survey/survey.lib.php
+++ b/main/survey/survey.lib.php
@@ -2515,6 +2515,42 @@ class SurveyManager
return true;
}
+ public static function hasDependency($survey)
+ {
+ if (false === api_get_configuration_value('survey_question_dependency')) {
+ return false;
+ }
+
+ if (empty($survey)) {
+ return false;
+ }
+
+ if (!isset($survey['survey_id'])) {
+ return false;
+ }
+
+ $courseId = (int) $survey['c_id'];
+ $surveyId = (int) $survey['survey_id'];
+
+ $table = Database::get_course_table(TABLE_SURVEY_QUESTION);
+
+ $sql = "SELECT COUNT(iid) count FROM $table
+ WHERE
+ c_id = $courseId AND
+ survey_id = $surveyId AND
+ parent_option_id <> 0
+ LIMIT 1
+ ";
+ $result = Database::query($sql);
+ $row = Database::fetch_array($result);
+
+ if ($row) {
+ return $row['count'] > 0;
+ }
+
+ return false;
+ }
+
/**
* @param array $survey
*
@@ -2526,8 +2562,8 @@ class SurveyManager
return 0;
}
- $courseId = $survey['c_id'];
- $surveyId = $survey['survey_id'];
+ $courseId = (int) $survey['c_id'];
+ $surveyId = (int) $survey['survey_id'];
$table = Database::get_course_table(TABLE_SURVEY_QUESTION);
@@ -2625,7 +2661,8 @@ class SurveyManager
$groupId = 0
) {
$invitationRepo = Database::getManager()->getRepository('ChamiloCourseBundle:CSurveyInvitation');
- $invitations = $invitationRepo->findBy(
+
+ return $invitationRepo->findBy(
[
'user' => $userId,
'cId' => $courseId,
@@ -2635,8 +2672,6 @@ class SurveyManager
],
['invitationDate' => 'DESC']
);
-
- return $invitations;
}
/**
@@ -2694,7 +2729,12 @@ class SurveyManager
if (empty($sessionId)) {
$subscribe = CourseManager::is_user_subscribed_in_course($userId, $courseCode);
} else {
- $subscribe = CourseManager::is_user_subscribed_in_course($userId, $courseCode, true, $sessionId);
+ $subscribe = CourseManager::is_user_subscribed_in_course(
+ $userId,
+ $courseCode,
+ true,
+ $sessionId
+ );
}
// User is not subscribe skip!
diff --git a/plugin/whispeakauth/ajax/authentify_password.php b/plugin/whispeakauth/ajax/authentify_password.php
index 8c633f53e7..ef75d7b675 100644
--- a/plugin/whispeakauth/ajax/authentify_password.php
+++ b/plugin/whispeakauth/ajax/authentify_password.php
@@ -3,8 +3,6 @@
use Chamilo\PluginBundle\Entity\WhispeakAuth\LogEvent;
-$cidReset = true;
-
require_once __DIR__.'/../../../main/inc/global.inc.php';
api_block_anonymous_users(false);
diff --git a/plugin/whispeakauth/ajax/record_audio.php b/plugin/whispeakauth/ajax/record_audio.php
index c3418be4a7..f0d8bf9458 100644
--- a/plugin/whispeakauth/ajax/record_audio.php
+++ b/plugin/whispeakauth/ajax/record_audio.php
@@ -4,8 +4,6 @@
use Chamilo\PluginBundle\WhispeakAuth\Controller\AuthenticationController;
use Chamilo\PluginBundle\WhispeakAuth\Controller\EnrollmentController;
-$cidReset = true;
-
require_once __DIR__.'/../../../main/inc/global.inc.php';
$action = isset($_POST['action']) ? $_POST['action'] : 'enrollment';