Minor - Flint fixes

pull/2990/head
Angel Fernando Quiroz Campos 6 years ago
parent 49a99aa1b5
commit 9e6c750e6f
  1. 2
      main/cron/import_csv.php
  2. 12
      main/exercise/exercise.class.php
  3. 61
      main/mySpace/access_details_session.php

@ -1440,7 +1440,7 @@ class ImportCsv
$externalCareerIds = []; $externalCareerIds = [];
if (substr($externalCareerIdList, 0, 1) === '[') { if (substr($externalCareerIdList, 0, 1) === '[') {
$externalCareerIdList = substr($externalCareerIdList, 1, -1); $externalCareerIdList = substr($externalCareerIdList, 1, -1);
$externalCareerIds = preg_split('/,/',$externalCareerIdList); $externalCareerIds = preg_split('/,/', $externalCareerIdList);
} else { } else {
$externalCareerIds = [$externalCareerIdList]; $externalCareerIds = [$externalCareerIdList];
} }

@ -7939,6 +7939,7 @@ class Exercise
if (empty($this->exerciseCategoryId)) { if (empty($this->exerciseCategoryId)) {
return null; return null;
} }
return (int) $this->exerciseCategoryId; return (int) $this->exerciseCategoryId;
} }
@ -7948,7 +7949,7 @@ class Exercise
public function setExerciseCategoryId($value) public function setExerciseCategoryId($value)
{ {
if (!empty($value)) { if (!empty($value)) {
$this->exerciseCategoryId = (int)$value; $this->exerciseCategoryId = (int) $value;
} }
} }
@ -8372,6 +8373,7 @@ class Exercise
* Return an HTML table of exercises for on-screen printing, including * Return an HTML table of exercises for on-screen printing, including
* action icons. If no exercise is present and the user can edit the * action icons. If no exercise is present and the user can edit the
* course, show a "create test" button. * course, show a "create test" button.
*
* @param int $categoryId * @param int $categoryId
* @param string $keyword * @param string $keyword
* *
@ -8459,7 +8461,7 @@ class Exercise
$categoryCondition $categoryCondition
$keywordCondition $keywordCondition
ORDER BY title"; ORDER BY title";
// LIMIT $from , $limit"; // LIMIT $from , $limit";
} else { } else {
// Only for students // Only for students
$total_sql = "SELECT count(iid) as count $total_sql = "SELECT count(iid) as count
@ -8477,7 +8479,7 @@ class Exercise
$condition_session $condition_session
$categoryCondition $categoryCondition
$keywordCondition "; $keywordCondition ";
// ORDER BY title LIMIT $from , $limit"; // ORDER BY title LIMIT $from , $limit";
} }
$result = Database::query($sql); $result = Database::query($sql);
$result_total = Database::query($total_sql); $result_total = Database::query($total_sql);
@ -9179,7 +9181,7 @@ class Exercise
d.c_id = $courseId AND d.c_id = $courseId AND
(d.path LIKE '%htm%') AND (d.path LIKE '%htm%') AND
d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' "; d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' ";
// LIMIT $from , $limit"; // only .htm or .html files listed // LIMIT $from , $limit"; // only .htm or .html files listed
} else { } else {
$sql = "SELECT d.iid, d.path as path, d.comment as comment $sql = "SELECT d.iid, d.path as path, d.comment as comment
FROM $TBL_DOCUMENT d FROM $TBL_DOCUMENT d
@ -9187,7 +9189,7 @@ class Exercise
d.c_id = $courseId AND d.c_id = $courseId AND
(d.path LIKE '%htm%') AND (d.path LIKE '%htm%') AND
d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' "; d.path LIKE '".Database :: escape_string($uploadPath.'/%/%')."' ";
// LIMIT $from , $limit"; // LIMIT $from , $limit";
} }
$result = Database::query($sql); $result = Database::query($sql);

@ -155,17 +155,17 @@ if ($form->validate()) {
// Partials // Partials
$partialDuration += $item['duration']; $partialDuration += $item['duration'];
/* /*
if (empty($partialMinLogin)) { if (empty($partialMinLogin)) {
$partialMinLogin = api_strtotime($item['login'], 'UTC'); $partialMinLogin = api_strtotime($item['login'], 'UTC');
} }
if ($partialMinLogin > api_strtotime($item['login'], 'UTC')) { if ($partialMinLogin > api_strtotime($item['login'], 'UTC')) {
$partialMinLogin = api_strtotime($item['login'], 'UTC'); $partialMinLogin = api_strtotime($item['login'], 'UTC');
} }
if (api_strtotime($item['logout'], 'UTC') > $partialMaxLogin) { if (api_strtotime($item['logout'], 'UTC') > $partialMaxLogin) {
$partialMaxLogin = api_strtotime($item['logout'], 'UTC'); $partialMaxLogin = api_strtotime($item['logout'], 'UTC');
} }
*/ */
$report[$sessionId]['courses'][$course['real_id']][] = $record; $report[$sessionId]['courses'][$course['real_id']][] = $record;
$report[$sessionId]['name'][$course['real_id']] = $courseInfo['title'].'  ('.$session['session_name'].')'; $report[$sessionId]['name'][$course['real_id']] = $courseInfo['title'].'  ('.$session['session_name'].')';
} }
@ -222,34 +222,33 @@ if ($form->validate()) {
// Partials // Partials
$partialDuration += $item['duration']; $partialDuration += $item['duration'];
/* /*
if (empty($partialMinLogin)) { if (empty($partialMinLogin)) {
$partialMinLogin = api_strtotime($item['login'], 'UTC'); $partialMinLogin = api_strtotime($item['login'], 'UTC');
} }
if ($partialMinLogin > api_strtotime($item['login'], 'UTC')) { if ($partialMinLogin > api_strtotime($item['login'], 'UTC')) {
$partialMinLogin = api_strtotime($item['login'], 'UTC'); $partialMinLogin = api_strtotime($item['login'], 'UTC');
} }
if (api_strtotime($item['logout'], 'UTC') > $partialMaxLogin) { if (api_strtotime($item['logout'], 'UTC') > $partialMaxLogin) {
$partialMaxLogin = api_strtotime($item['logout'], 'UTC'); $partialMaxLogin = api_strtotime($item['logout'], 'UTC');
} }
*/ */
} }
if (!empty($result)) { if (!empty($result)) {
/* /*
$record = [
customDate($partialMinLogin, true),
customDate($partialMaxLogin, true),
api_format_time($partialDuration, 'js'),
];
*/
$record = [ $record = [
customDate($partialMinLogin, true),
customDate($partialMaxLogin, true),
api_format_time($partialDuration, 'js'),
];
*/
$record = [
"", "",
"", "",
api_format_time($partialDuration, 'js'), api_format_time($partialDuration, 'js'),
]; ];
$report[0]['courses'][$course['course_id']][] = $record; $report[0]['courses'][$course['course_id']][] = $record;
$report[0]['name'][$course['course_id']] = $course['title']; $report[0]['name'][$course['course_id']] = $course['title'];
} }

Loading…
Cancel
Save