Minor - flint fixes

pull/3272/head
Julio Montoya 5 years ago
parent a0a31da801
commit c87e63449f
  1. 2
      config/packages/framework.yaml
  2. 2
      config/packages/security.yaml
  3. 1
      config/routes.yaml
  4. 1
      config/services.yaml
  5. 2
      public/main/admin/add_drh_to_user.php
  6. 2
      public/main/admin/course_edit.php
  7. 1
      public/main/admin/index.php
  8. 2
      public/main/admin/user_information.php
  9. 2
      public/main/admin/user_linking_requests.php
  10. 10
      public/main/admin/user_list.php
  11. 2
      public/main/auth/profile.php
  12. 2
      public/main/badge/issued.php
  13. 2
      public/main/badge/issued_all.php
  14. 14
      public/main/calendar/agenda_list.php
  15. 3
      public/main/dropbox/dropbox_download.php
  16. 3
      public/main/exercise/exercise.class.php
  17. 14
      public/main/exercise/exercise_submit_modal.php
  18. 12
      public/main/exercise/question_pool.php
  19. 2
      public/main/inc/global.inc.php
  20. 2
      public/main/inc/lib/CourseChatUtils.php
  21. 2
      public/main/inc/lib/TicketManager.php
  22. 4
      public/main/inc/lib/api.lib.php
  23. 2
      public/main/inc/lib/document.lib.php
  24. 6
      public/main/inc/lib/exercise.lib.php
  25. 152
      public/main/inc/lib/extra_field.lib.php
  26. 13
      public/main/inc/lib/extra_field_value.lib.php
  27. 4
      public/main/inc/lib/groupmanager.lib.php
  28. 2
      public/main/inc/lib/image.lib.php
  29. 167
      public/main/inc/lib/internationalization.lib.php
  30. 8
      public/main/inc/lib/message.lib.php
  31. 320
      public/main/inc/lib/myspace.lib.php
  32. 14
      public/main/inc/lib/sessionmanager.lib.php
  33. 4
      public/main/inc/lib/skill.lib.php
  34. 2
      public/main/inc/lib/template.lib.php
  35. 20
      public/main/inc/lib/tracking.lib.php
  36. 6
      public/main/inc/lib/usergroup.lib.php
  37. 5
      public/main/inc/lib/usermanager.lib.php
  38. 45
      public/main/inc/lib/webservices/Rest.php
  39. 6
      public/main/install/install.lib.php
  40. 3
      public/main/lp/learnpath.class.php
  41. 2
      public/main/lp/lp_subscribe_users.php
  42. 2
      public/main/lp/lp_subscribe_users_to_category.php
  43. 6
      public/main/session/session_list_simple.php
  44. 2
      public/main/webservices/registration.soap.php
  45. 2
      public/plugin/buycourses/src/buycourses.ajax.php
  46. 23
      public/plugin/grading_electronic/generate.php
  47. 10
      src/CoreBundle/Entity/Group.php
  48. 16
      src/CoreBundle/Entity/ResourceFile.php
  49. 2
      src/CoreBundle/Entity/ResourceNode.php
  50. 2
      src/CoreBundle/Entity/User.php

@ -15,4 +15,4 @@ framework:
# annotations:
# cache: file
# file_cache_dir: "%kernel.cache_dir%/annotations"
serializer: { enable_annotations: true }
serializer: {enable_annotations: true}

@ -78,4 +78,4 @@ security:
json_login:
check_path: /login_json
# username_path: security.credentials.login
# password_path: security.credentials.password
# password_path: security.credentials.password

@ -68,4 +68,3 @@ chamilo_graphql:
chamilo_lti:
resource: "@ChamiloLtiBundle/Resources/config/routing.yml"

@ -140,4 +140,3 @@ cocur_slugify:
imports:
- {resource: ../src/CoreBundle/Resources/config/services.yml}
# - {resource: ../src/PageBundle/Resources/config/services.yml}

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\UserRelUser;
use Chamilo\CoreBundle\Entity\User as UserEntity;
use Chamilo\CoreBundle\Entity\UserRelUser;
$cidReset = true;

@ -3,9 +3,9 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\CourseCategory;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\CourseCategoryRepository;
use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CoreBundle\Entity\User;
$cidReset = true;

@ -3,7 +3,6 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Hook\HookAdminBlock;
use League\Flysystem\Filesystem;
/**
* Index page of the admin tools.

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\UserRelUser;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Entity\UserRelUser;
/**
* Script showing information about a user (name, e-mail, courses and sessions).

@ -1,8 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\UserRelUser;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Entity\UserRelUser;
$cidReset = true;

@ -298,14 +298,14 @@ function prepare_user_sql_query($getCount)
$keyword_admin = '';
if (isset($keywordListValues['keyword_status']) &&
$keywordListValues['keyword_status'] == PLATFORM_ADMIN
PLATFORM_ADMIN == $keywordListValues['keyword_status']
) {
$query_admin_table = " , $admin_table a ";
$keyword_admin = ' AND a.user_id = u.id ';
$keywordListValues['keyword_status'] = '';
}
if ($keywordListValues['keyword_status'] === '%') {
if ('%' === $keywordListValues['keyword_status']) {
$keywordListValues['keyword_status'] = '';
}
@ -356,7 +356,7 @@ function prepare_user_sql_query($getCount)
$preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users');
$extraConditions = '';
if (api_is_session_admin() && $preventSessionAdminsToManageAllUsers === 'true') {
if (api_is_session_admin() && 'true' === $preventSessionAdminsToManageAllUsers) {
$extraConditions .= ' AND u.creator_id = '.api_get_user_id();
}
@ -405,7 +405,7 @@ function prepare_user_sql_query($getCount)
if (empty($value)) {
continue;
}
if ($info['field_type'] == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $info['field_type']) {
$result = $extraField->getAllUserPerTag($info['id'], $value);
$result = empty($result) ? [] : array_column($result, 'user_id');
} else {
@ -424,7 +424,7 @@ function prepare_user_sql_query($getCount)
// If simple search then use "OR"
if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
$condition = ' OR ';
}
}
if (!empty($extraFieldHasData) && !empty($extraFieldResult)) {
$sql .= " $condition (u.id IN ('".implode("','", $extraFieldResult)."') $extraConditions ) ";

@ -1,9 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Hook\HookUpdateUser;
use Chamilo\CoreBundle\Entity\User;
use ChamiloSession as Session;
/**

@ -233,7 +233,7 @@ if ($allowExport) {
if (0 !== strcmp($backpack, $configBackpack)) {
$backpack = $configBackpack;
if (substr($backpack, -1) !== '/') {
if ('/' !== substr($backpack, -1)) {
$backpack .= '/';
}
}

@ -220,7 +220,7 @@ foreach ($userSkills as $index => $skillIssue) {
if (0 !== strcmp($backpack, $configBackpack)) {
$backpack = $configBackpack;
if (substr($backpack, -1) !== '/') {
if ('/' !== substr($backpack, -1)) {
$backpack .= '/';
}
}

@ -89,13 +89,13 @@ $tpl->assign('agenda_actions', $actions);
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
if (api_is_allowed_to_edit()) {
if ($action == 'change_visibility') {
$courseInfo = api_get_course_info();
$courseCondition = '';
// This happens when list agenda is not inside a course
if (($type == 'course' || $type == 'session' && !empty($courseInfo))) {
// For course and session event types
// Just needs course ID
if ('change_visibility' == $action) {
$courseInfo = api_get_course_info();
$courseCondition = '';
// This happens when list agenda is not inside a course
if (('course' == $type || 'session' == $type && !empty($courseInfo))) {
// For course and session event types
// Just needs course ID
$agenda->changeVisibility($_GET['id'], $_GET['visibility'], $courseInfo);
} else {
$courseCondition = '&'.api_get_cidreq();

@ -18,9 +18,6 @@ if (isset($_GET['cat_id']) &&
isset($_GET['sent_received'])
) {
/** step 1: constructing the sql statement.
Due to the nature off the classes of the dropbox the categories for sent files are stored in the table
dropbox_file while the categories for the received files are stored in dropbox_post.
It would have been more elegant if these could be stored in dropbox_person (which stores the link file-person)
Therefore we have to create to separate sql statements to find which files are in the category
(depending if we zip-download a sent category or a received category)*/
if ('sent' == $_GET['sent_received']) {

@ -7,7 +7,6 @@ use APY\DataGridBundle\Grid\Action\RowAction;
use APY\DataGridBundle\Grid\Row;
use APY\DataGridBundle\Grid\Source\Entity;
use Chamilo\CoreBundle\Entity\GradebookLink;
use Chamilo\CoreBundle\EntityLink;
use Chamilo\CoreBundle\Entity\TrackEHotspot;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
@ -4137,7 +4136,7 @@ class Exercise
}
$type = FillBlanks::getFillTheBlankAnswerType($correctAnswer);
if ($type == FillBlanks::FILL_THE_BLANK_MENU) {
if (FillBlanks::FILL_THE_BLANK_MENU == $type) {
$listMenu = FillBlanks::getFillTheBlankMenuAnswers($correctAnswer, false);
if (!empty($studentAnswer)) {
foreach ($listMenu as $key => $item) {

@ -73,7 +73,7 @@ function SendEx(num) {
</script>';
$header = '';
if ($objExercise->getFeedbackType() === EXERCISE_FEEDBACK_TYPE_POPUP) {
if (EXERCISE_FEEDBACK_TYPE_POPUP === $objExercise->getFeedbackType()) {
$header = '
<div class="modal-header">
<h4 class="modal-title" id="global-modal-title">'.get_lang('Incorrect').'</h4>
@ -272,10 +272,10 @@ if (!empty($result)) {
}
$header = '';
if ($objExercise->getFeedbackType() === EXERCISE_FEEDBACK_TYPE_DIRECT) {
if (EXERCISE_FEEDBACK_TYPE_DIRECT === $objExercise->getFeedbackType()) {
if (isset($result['correct_answer_id'])) {
foreach ($result['correct_answer_id'] as $answerId) {
/** @var Answer $answer */
/** @var Answer $answer */
$contents .= $objAnswerTmp->selectComment($answerId);
}
}
@ -289,16 +289,16 @@ if ($objExercise->getFeedbackType() === EXERCISE_FEEDBACK_TYPE_DIRECT) {
} else {
if ($partialCorrect) {
$message = get_lang('PartialCorrect');
}
}
}
$comments = '';
if ($answerType != HOT_SPOT_DELINEATION) {
if (HOT_SPOT_DELINEATION != $answerType) {
if (isset($result['correct_answer_id'])) {
$table = new HTML_Table(['class' => 'table data_table']);
$row = 0;
$table->setCellContents($row, 0, get_lang('YourAnswer'));
if ($answerType != DRAGGABLE) {
if (DRAGGABLE != $answerType) {
$table->setCellContents($row, 1, get_lang('Comment'));
}
@ -333,7 +333,7 @@ if ($objExercise->getFeedbackType() === EXERCISE_FEEDBACK_TYPE_DIRECT) {
</div>';
}
if ($answerType === HOT_SPOT_DELINEATION) {
if (HOT_SPOT_DELINEATION === $answerType) {
$contents = $manageAnswerHtmlContent;
}
$links = '';

@ -323,7 +323,7 @@ foreach ($sessionList as $item) {
$course_list = [];
// Course list, get course list of session, or for course where user is admin
if (!empty($session_id) && $session_id != '-1' && !empty($sessionList)) {
if (!empty($session_id) && '-1' != $session_id && !empty($sessionList)) {
$sessionInfo = [];
foreach ($sessionList as $session) {
if ($session['session_id'] == $session_id) {
@ -362,7 +362,7 @@ foreach ($course_list as $item) {
$course_select_list[$courseItemId] .= $courseInfo['title'];
}
if (empty($selected_course) || $selected_course == '-1') {
if (empty($selected_course) || '-1' == $selected_course) {
$course_info = api_get_course_info();
// no course selected, reset menu test / difficult<EFBFBD> / type de reponse
reset_menu_exo_lvl_type();
@ -569,7 +569,7 @@ function getExtraFieldConditions(array $formValues, $queryType = 'from')
continue;
}
if ($queryType === 'from') {
if ('from' === $queryType) {
$from .= ", extra_field_values efv_$variable, extra_field ef_$variable";
$where .= "AND (
qu.iid = efv_$variable.item_id
@ -578,7 +578,7 @@ function getExtraFieldConditions(array $formValues, $queryType = 'from')
AND ef_$variable.variable = '$variable'
AND efv_$variable.value = '$value'
)";
} elseif ($queryType === 'join') {
} elseif ('join' === $queryType) {
$from .= " INNER JOIN extra_field_values efv_$variable ON qu.iid = efv_$variable.item_id
INNER JOIN extra_field ef_$variable ON efv_$variable.field_id = ef_$variable.id";
$where .= "AND (
@ -690,7 +690,7 @@ function getQuestions(
{$efConditions['where']}
ORDER BY BINARY qu.question ASC
";
} elseif ($exerciseId == -1) {
} elseif (-1 == $exerciseId) {
$efConditions = getExtraFieldConditions($formValues, 'join');
// If we have selected the option 'Orphan questions' in the list-box 'Filter'
$level_where = '';
@ -850,7 +850,7 @@ function getQuestions(
$result = Database::query($sql);
$mainQuestionList = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($exerciseId == -1 && isQuestionInActiveQuiz($row['iid'])) {
if (-1 == $exerciseId && isQuestionInActiveQuiz($row['iid'])) {
continue;
}

@ -1,10 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use Symfony\Component\ErrorHandler\Debug;
use Chamilo\CoreBundle\Framework\Container;
use Patchwork\Utf8\Bootup;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
/**
* All legacy Chamilo scripts should include this important file.

@ -8,10 +8,10 @@ use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\ResourceRepository;
use Chamilo\CourseBundle\Entity\CChatConnected;
use Chamilo\CourseBundle\Entity\CChatConversation;
use Chamilo\CoreBundle\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Michelf\MarkdownExtra;

@ -1,11 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Ticket;
use Chamilo\CoreBundle\Entity\TicketMessageAttachment;
use Chamilo\CoreBundle\Entity\TicketPriority;
use Chamilo\CoreBundle\Entity\TicketProject;
use Chamilo\CoreBundle\Entity\TicketStatus;
use Chamilo\CoreBundle\Entity\Ticket;
/**
* Class TicketManager.

@ -5,9 +5,9 @@ use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session as SessionEntity;
use Chamilo\CoreBundle\Entity\SettingsCurrent;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\CoreBundle\Entity\User;
use ChamiloSession as Session;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Finder\Finder;
@ -6335,7 +6335,7 @@ function api_request_uri()
return $uri;
}
/** Gets the current access_url id of the Chamilo Platform
/** Gets the current access_url id of the Chamilo Platform.
* @author Julio Montoya <gugli100@gmail.com>
*
* @return int access_url_id of the current Chamilo Installation

@ -3,10 +3,10 @@
use Chamilo\CoreBundle\Entity\ResourceFile;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\CoreBundle\Entity\User;
use ChamiloSession as Session;
use Symfony\Component\HttpFoundation\File\UploadedFile;

@ -4255,8 +4255,8 @@ EOT;
!empty($exercise_stat_info['exe_user_id']) &&
!empty($studentInfo)
) {
// Shows exercise header
echo $objExercise->showExerciseResultHeader(
// Shows exercise header
echo $objExercise->showExerciseResultHeader(
$studentInfo,
$exercise_stat_info
);
@ -5256,7 +5256,7 @@ EOT;
$exercise = new Exercise($courseId);
$courseInfo = $courseId ? api_get_course_info_by_id($courseId) : [];
if ($exercise->read($exerciseId) === false) {
if (false === $exercise->read($exerciseId)) {
return null;
}

@ -630,25 +630,25 @@ class ExtraField extends Model
$result = Database::query($sql);
if (Database::num_rows($result)) {
$row = Database::fetch_array($result, 'ASSOC');
$row['display_text'] = $this->translateDisplayName(
$row['display_text'] = $this->translateDisplayName(
$row['variable'],
$row['display_text']
);
// All the options of the field
// All the options of the field
$sql = "SELECT * FROM $this->table_field_tag
WHERE field_id='".intval($row['id'])."'
ORDER BY id ASC";
$result = Database::query($sql);
$result = Database::query($sql);
while ($option = Database::fetch_array($result, 'ASSOC')) {
$row['options'][$option['id']] = $option;
}
$row['options'][$option['id']] = $option;
}
return $row;
return $row;
} else {
return false;
}
}
}
/**
* Translate the display text for a extra field.
@ -750,17 +750,17 @@ class ExtraField extends Model
$extraData = false;
if (!empty($itemId)) {
$extraData = $this->get_handler_extra_data($itemId);
if (!empty($showOnlyTheseFields)) {
$setData = [];
foreach ($showOnlyTheseFields as $variable) {
$extraName = 'extra_'.$variable;
if (in_array($extraName, array_keys($extraData))) {
$setData[$extraName] = $extraData[$extraName];
}
if (!empty($showOnlyTheseFields)) {
$setData = [];
foreach ($showOnlyTheseFields as $variable) {
$extraName = 'extra_'.$variable;
if (in_array($extraName, array_keys($extraData))) {
$setData[$extraName] = $extraData[$extraName];
}
$form->setDefaults($setData);
} else {
$form->setDefaults($extraData);
}
$form->setDefaults($setData);
} else {
$form->setDefaults($extraData);
}
}
@ -2480,7 +2480,7 @@ JAVASCRIPT;
// Parse params.
$fields = [];
foreach ($values as $key => $value) {
if (substr($key, 0, 6) !== 'extra_' && substr($key, 0, 7) !== '_extra_') {
if ('extra_' !== substr($key, 0, 6) && '_extra_' !== substr($key, 0, 7)) {
continue;
}
if (!empty($value)) {
@ -2512,7 +2512,7 @@ JAVASCRIPT;
$filter->rules[] = $rule;
$filter->groupOp = 'AND';
if ($extraFieldsType[$variableNoExtra] == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $extraFieldsType[$variableNoExtra]) {
$tagElement = $form->getElement($variable);
$tags = [];
foreach ($values[$variable] as $tag) {
@ -2575,82 +2575,82 @@ JAVASCRIPT;
is_array($filters->rules) &&
!empty($filters->rules)
) {
foreach ($filters->rules as $rule) {
if (empty($rule)) {
continue;
}
if (false === strpos($rule->field, '_second')) {
} else {
$my_field = str_replace('_second', '', $rule->field);
$double_select[$my_field] = $rule->data;
foreach ($filters->rules as $rule) {
if (empty($rule)) {
continue;
}
if (false === strpos($rule->field, '_second')) {
} else {
$my_field = str_replace('_second', '', $rule->field);
$double_select[$my_field] = $rule->data;
}
}
}
foreach ($filters->rules as $rule) {
if (empty($rule)) {
continue;
}
if (false === strpos($rule->field, $stringToSearch)) {
// normal fields
$field = $rule->field;
if (isset($rule->data) && is_string($rule->data) && -1 != $rule->data) {
$condition_array[] = $this->get_where_clause($field, $rule->op, $rule->data);
foreach ($filters->rules as $rule) {
if (empty($rule)) {
continue;
}
} else {
// Extra fields
if (false === strpos($rule->field, '_second')) {
//No _second
$original_field = str_replace($stringToSearch, '', $rule->field);
$field_option = $this->get_handler_field_info_by_field_variable($original_field);
if (self::FIELD_TYPE_DOUBLE_SELECT == $field_option['field_type']) {
if (isset($double_select[$rule->field])) {
$data = explode('#', $rule->data);
$rule->data = $data[1].'::'.$double_select[$rule->field];
} else {
// only was sent 1 select
if (is_string($rule->data)) {
if (false === strpos($rule->field, $stringToSearch)) {
// normal fields
$field = $rule->field;
if (isset($rule->data) && is_string($rule->data) && -1 != $rule->data) {
$condition_array[] = $this->get_where_clause($field, $rule->op, $rule->data);
}
} else {
// Extra fields
if (false === strpos($rule->field, '_second')) {
//No _second
$original_field = str_replace($stringToSearch, '', $rule->field);
$field_option = $this->get_handler_field_info_by_field_variable($original_field);
if (self::FIELD_TYPE_DOUBLE_SELECT == $field_option['field_type']) {
if (isset($double_select[$rule->field])) {
$data = explode('#', $rule->data);
$rule->data = $data[1];
$rule->data = $data[1].'::'.$double_select[$rule->field];
} else {
// only was sent 1 select
if (is_string($rule->data)) {
$data = explode('#', $rule->data);
$rule->data = $data[1];
}
}
}
if (!isset($rule->data)) {
$condition_array[] = ' ('
if (!isset($rule->data)) {
$condition_array[] = ' ('
.$this->get_where_clause($rule->field, $rule->op, $rule->data)
.') ';
$extra_fields[] = ['field' => $rule->field, 'id' => $field_option['id']];
}
} else {
if (isset($rule->data)) {
if (isset($rule->data) && is_int($rule->data) && -1 == $rule->data) {
continue;
$extra_fields[] = ['field' => $rule->field, 'id' => $field_option['id']];
}
/*var_dump($rule->data);
foreach ($rule->data as $option) {
}*/
$where = $this->get_where_clause($rule->field, $rule->op, $rule->data, 'OR');
$condition_array[] = " ( $where ) ";
} else {
if (isset($rule->data)) {
if (isset($rule->data) && is_int($rule->data) && -1 == $rule->data) {
continue;
}
/*var_dump($rule->data);
foreach ($rule->data as $option) {
}*/
$where = $this->get_where_clause($rule->field, $rule->op, $rule->data, 'OR');
$condition_array[] = " ( $where ) ";
$extra_fields[] = [
$extra_fields[] = [
'field' => $rule->field,
'id' => $field_option['id'],
'data' => $rule->data,
];
}
}
}
} else {
$my_field = str_replace('_second', '', $rule->field);
$original_field = str_replace($stringToSearch, '', $my_field);
$field_option = $this->get_handler_field_info_by_field_variable($original_field);
$extra_fields[] = [
} else {
$my_field = str_replace('_second', '', $rule->field);
$original_field = str_replace($stringToSearch, '', $my_field);
$field_option = $this->get_handler_field_info_by_field_variable($original_field);
$extra_fields[] = [
'field' => $rule->field,
'id' => $field_option['id'],
];
}
}
}
}
}
/*var_dump(
[
@ -2876,7 +2876,7 @@ JAVASCRIPT;
/**
* Get the extra fields and their formatted values.
*
* @param int|string $itemId The item ID (It could be a session_id, course_id or user_id)
* @param int|string $itemId The item ID (It could be a session_id, course_id or user_id)
* @param bool $filter
* @param array $onlyShow (list of extra fields variables to show)
*
@ -2895,7 +2895,7 @@ JAVASCRIPT;
continue;
}
if ($filter && $field['filter'] != 1) {
if ($filter && 1 != $field['filter']) {
continue;
}

@ -119,10 +119,9 @@ class ExtraFieldValue extends Model
// Parse params.
foreach ($extraFields as $fieldDetails) {
if ($forceSave === false) {
// if the field is not visible to the user in the end, we need to apply special rules
if (1 != $fieldDetails['visible_to_self']) {
if (false === $forceSave) {
// if the field is not visible to the user in the end, we need to apply special rules
if (1 != $fieldDetails['visible_to_self']) {
//only admins should be able to add those values
if (!api_is_platform_admin(true, true)) {
// although if not admin but sent through a CLI script, we should accept it as well
@ -757,8 +756,8 @@ class ExtraFieldValue extends Model
*
* @param string $variable Field (type of data) we want to check
* @param string $value Data we are looking for in the given field
* @param bool $transform Whether to transform the result to a human readable strings
* @param bool $last Whether to return the last element or simply the first one we get
* @param bool $transform Whether to transform the result to a human readable strings
* @param bool $last Whether to return the last element or simply the first one we get
* @param bool $useLike
*
* @return mixed Give the ID if found, or false on failure or not found
@ -798,7 +797,7 @@ class ExtraFieldValue extends Model
$sql .= ' DESC';
}
$result = Database::query($sql);
if ($result !== false && Database::num_rows($result)) {
if (false !== $result && Database::num_rows($result)) {
if ($all) {
$result = Database::store_result($result, 'ASSOC');
} else {

@ -2242,8 +2242,8 @@ class GroupManager
/**
* Get all groups where a specific user is subscribed.
*
* @param int $user_id
* @param int $courseId
* @param int $user_id
* @param int $courseId
* @param int|null $sessionId
*
* @return array

@ -139,8 +139,6 @@ class Image
/**
* Image wrapper class.
*
* @package chamilo.include.image
*/
abstract class ImageWrapper
{

@ -1956,7 +1956,7 @@ function &_api_get_day_month_names($language = null)
/**
/**
* The following table contains two types of conventions concerning person names:
* The following table contains two types of conventions concerning person names:.
*
* "format" - determines how a full person name to be formatted, i.e. in what order the title, the first_name and the last_name to be placed.
* You might need to correct the value for your language. The possible values are:
@ -1964,7 +1964,8 @@ function &_api_get_day_month_names($language = null)
* title last_name first_name - Eastern order;
* title last_name, first_name - Western libraries order.
* Placing the title (Dr, Mr, Miss, etc) depends on the tradition in you country.
* @link http://en.wikipedia.org/wiki/Personal_name#Naming_convention
*
* @see http://en.wikipedia.org/wiki/Personal_name#Naming_convention
*
* "sort_by" - determines you preferable way of sorting person names. The possible values are:
* first_name - sorting names with priority for the first name;
@ -1972,86 +1973,86 @@ function &_api_get_day_month_names($language = null)
*/
function getLegacyOrderConventions()
{
return array(
'afrikaans' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'albanian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'alemannic' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'amharic' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'armenian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'ar' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'asturian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'bosnian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'brazilian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'breton' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'bulgarian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'catalan' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'croatian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'czech' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'danish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'dari' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'dutch' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'english' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'esperanto' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'estonian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'basque' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'finnish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'french' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'frisian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'friulian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'galician' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'),
'georgian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'german' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'greek' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'hawaiian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'hebrew' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'hindi' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'hungarian' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'icelandic' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'indonesian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'irish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'italian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'japanese' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'korean' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'latin' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'latvian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'lithuanian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'macedonian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'malay' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'manx' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'marathi' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'middle_frisian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'mingo' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'nepali' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'norwegian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'occitan' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'pashto' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'persian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'polish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'portuguese' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'quechua_cusco' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'romanian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'rumantsch' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'russian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'sanskrit' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'serbian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'serbian_cyrillic' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'simpl_chinese' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'slovak' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'slovenian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'spanish' => array('format' => 'title last_name, first_name', 'sort_by' => 'last_name'), // Library order
'swahili' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'swedish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'tagalog' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'tamil' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'thai' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'trad_chinese' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'turkish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'ukrainian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'vietnamese' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name'), // Eastern order
'welsh' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'yiddish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'yoruba' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
);
return [
'afrikaans' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'albanian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'alemannic' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'amharic' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'armenian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'ar' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'asturian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'bosnian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'brazilian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'breton' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'bulgarian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'catalan' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'croatian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'czech' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'danish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'dari' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'dutch' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'english' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'esperanto' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'estonian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'basque' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'finnish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'french' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'frisian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'friulian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'galician' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'],
'georgian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'german' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'greek' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'hawaiian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'hebrew' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'hindi' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'hungarian' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'icelandic' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'indonesian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'irish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'italian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'japanese' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'korean' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'latin' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'latvian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'lithuanian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'macedonian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'malay' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'manx' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'marathi' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'middle_frisian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'mingo' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'nepali' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'norwegian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'occitan' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'pashto' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'persian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'polish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'portuguese' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'quechua_cusco' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'romanian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'rumantsch' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'russian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'sanskrit' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'serbian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'serbian_cyrillic' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'simpl_chinese' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'slovak' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'slovenian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'spanish' => ['format' => 'title last_name, first_name', 'sort_by' => 'last_name'], // Library order
'swahili' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'swedish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'tagalog' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'tamil' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'thai' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'trad_chinese' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'turkish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'ukrainian' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'vietnamese' => ['format' => 'title last_name first_name', 'sort_by' => 'last_name'], // Eastern order
'welsh' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'yiddish' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
'yoruba' => ['format' => 'title first_name last_name', 'sort_by' => 'first_name'],
];
}
function getIsoToLegacy()
@ -2140,7 +2141,7 @@ function _api_get_person_name_convention($iso, $type)
{
$conventions = getLegacyOrderConventions();
$languageName = null;
if (isset(getIsoToLegacy()[$iso])){
if (isset(getIsoToLegacy()[$iso])) {
$languageName = getIsoToLegacy()[$iso];
}

@ -218,7 +218,7 @@ class MessageManager
}
$userInfo = api_get_user_info($senderId);
if ($type == self::MESSAGE_TYPE_OUTBOX) {
if (self::MESSAGE_TYPE_OUTBOX == $type) {
$userInfo = api_get_user_info($receiverId);
}
$message[3] = '';
@ -2493,7 +2493,7 @@ class MessageManager
$result = Database::query($sql);
$messages = [];
if ($result !== false) {
if (false !== $result) {
while ($row = Database::fetch_assoc($result)) {
$pictureInfo = UserManager::get_user_picture_path_by_id($row['user_id'], 'web');
$row['pictureUri'] = $pictureInfo['dir'].$pictureInfo['file'];
@ -2537,7 +2537,7 @@ class MessageManager
$result = Database::query($sql);
$messages = [];
if ($result !== false) {
if (false !== $result) {
while ($row = Database::fetch_assoc($result)) {
$pictureInfo = UserManager::get_user_picture_path_by_id($row['user_id'], 'web');
$row['pictureUri'] = $pictureInfo['dir'].$pictureInfo['file'];
@ -2734,7 +2734,7 @@ class MessageManager
);
$layoutContent = '';
$emailbody = '';
if (api_get_configuration_value('mail_template_system') == true) {
if (true == api_get_configuration_value('mail_template_system')) {
$mailTemplateManager = new MailTemplateManager();
$templateText = $mailTemplateManager->getTemplateByType('new_user_mail_to_admin_approval.tpl');
if (empty($templateText)) {

@ -2811,35 +2811,35 @@ class MySpace
return $connections;
}
/**
* @param int $user_id
* @param array $course_info
* @param int $sessionId
* @param null $start_date
* @param null $end_date
*
* @return array
*/
/**
* @param int $user_id
* @param array $course_info
* @param int $sessionId
* @param null $start_date
* @param null $end_date
*
* @return array
*/
public static function getStats($user_id, $course_info, $sessionId, $start_date = null, $end_date = null)
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$result = [];
if (!empty($course_info)) {
$stringStartDate = '';
$stringEndDate = '';
if ($start_date != null && $end_date != null) {
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$result = [];
if (!empty($course_info)) {
$stringStartDate = '';
$stringEndDate = '';
if (null != $start_date && null != $end_date) {
$end_date = self::add_day_to($end_date);
$start_date = Database::escape_string($start_date);
$end_date = Database::escape_string($end_date);
$start_date = Database::escape_string($start_date);
$end_date = Database::escape_string($end_date);
$stringStartDate = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
$stringEndDate = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
}
$user_id = (int) $user_id;
$courseId = (int) $course_info['real_id'];
$sessionCondition = api_get_session_condition($sessionId);
$sql = "SELECT
$stringStartDate = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
$stringEndDate = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
}
$user_id = (int) $user_id;
$courseId = (int) $course_info['real_id'];
$sessionCondition = api_get_session_condition($sessionId);
$sql = "SELECT
SEC_TO_TIME(AVG(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
SEC_TO_TIME(SUM(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
count(user_id) as times
@ -2850,96 +2850,96 @@ class MySpace
$sessionCondition
ORDER BY login_course_date ASC";
$rs = Database::query($sql);
if ($row = Database::fetch_array($rs)) {
$foo_avg = $row['avrg'];
$foo_total = $row['total'];
$foo_times = $row['times'];
$result = [
$rs = Database::query($sql);
if ($row = Database::fetch_array($rs)) {
$foo_avg = $row['avrg'];
$foo_total = $row['total'];
$foo_times = $row['times'];
$result = [
'avg' => $foo_avg,
'total' => $foo_total,
'times' => $foo_times,
];
}
}
}
return $result;
}
return $result;
}
public static function add_day_to($end_date)
{
$foo_date = strtotime($end_date);
$foo_date = strtotime(' +1 day', $foo_date);
$foo_date = date('Y-m-d', $foo_date);
{
$foo_date = strtotime($end_date);
$foo_date = strtotime(' +1 day', $foo_date);
$foo_date = date('Y-m-d', $foo_date);
return $foo_date;
}
return $foo_date;
}
/**
* This function draw the graphic to be displayed on the user view as an image.
*
* @param array $sql_result
* @param string $start_date
* @param string $end_date
* @param string $type
*
* @author Jorge Frisancho Jibaja
*
* @version OCT-22- 2010
*
* @return string
*/
/**
* This function draw the graphic to be displayed on the user view as an image.
*
* @param array $sql_result
* @param string $start_date
* @param string $end_date
* @param string $type
*
* @author Jorge Frisancho Jibaja
*
* @version OCT-22- 2010
*
* @return string
*/
public static function grapher($sql_result, $start_date, $end_date, $type = '')
{
if (empty($start_date)) {
$start_date = '';
}
if (empty($end_date)) {
$end_date = '';
}
if ('' == $type) {
$type = 'day';
}
$main_year = $main_month_year = $main_day = [];
{
if (empty($start_date)) {
$start_date = '';
}
if (empty($end_date)) {
$end_date = '';
}
if ('' == $type) {
$type = 'day';
}
$main_year = $main_month_year = $main_day = [];
$period = new DatePeriod(
$period = new DatePeriod(
new DateTime($start_date),
new DateInterval('P1D'),
new DateTime($end_date)
);
foreach ($period as $date) {
$main_day[$date->format('d-m-Y')] = 0;
}
foreach ($period as $date) {
$main_day[$date->format('d-m-Y')] = 0;
}
$period = new DatePeriod(
$period = new DatePeriod(
new DateTime($start_date),
new DateInterval('P1M'),
new DateTime($end_date)
);
foreach ($period as $date) {
$main_month_year[$date->format('m-Y')] = 0;
}
foreach ($period as $date) {
$main_month_year[$date->format('m-Y')] = 0;
}
$i = 0;
if (is_array($sql_result) && count($sql_result) > 0) {
foreach ($sql_result as $key => $data) {
$login = api_strtotime($data['login']);
$logout = api_strtotime($data['logout']);
//creating the main array
if (isset($main_month_year[date('m-Y', $login)])) {
$i = 0;
if (is_array($sql_result) && count($sql_result) > 0) {
foreach ($sql_result as $key => $data) {
$login = api_strtotime($data['login']);
$logout = api_strtotime($data['logout']);
//creating the main array
if (isset($main_month_year[date('m-Y', $login)])) {
$main_month_year[date('m-Y', $login)] += (float) ($logout - $login) / 60;
}
if (isset($main_day[date('d-m-Y', $login)])) {
}
if (isset($main_day[date('d-m-Y', $login)])) {
$main_day[date('d-m-Y', $login)] += (float) ($logout - $login) / 60;
}
if ($i > 500) {
break;
}
$i++;
}
if ($i > 500) {
break;
}
$i++;
}
switch ($type) {
switch ($type) {
case 'day':
$main_date = $main_day;
break;
@ -2951,52 +2951,52 @@ class MySpace
break;
}
$labels = array_keys($main_date);
if (1 == count($main_date)) {
$labels = $labels[0];
$main_date = $main_date[$labels];
}
/* Create and populate the pData object */
$myData = new pData();
$myData->addPoints($main_date, 'Serie1');
if (1 != count($main_date)) {
$myData->addPoints($labels, 'Labels');
$myData->setSerieDescription('Labels', 'Months');
$myData->setAbscissa('Labels');
}
$myData->setSerieWeight('Serie1', 1);
$myData->setSerieDescription('Serie1', get_lang('My results'));
$myData->setAxisName(0, get_lang('Minutes'));
$myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(['CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)]);
$chartHash = $myCache->getHash($myData);
$labels = array_keys($main_date);
if (1 == count($main_date)) {
$labels = $labels[0];
$main_date = $main_date[$labels];
}
if ($myCache->isInCache($chartHash)) {
//if we already created the img
$imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
} else {
/* Define width, height and angle */
$mainWidth = 760;
$mainHeight = 230;
$angle = 50;
/* Create the pChart object */
$myPicture = new pImage($mainWidth, $mainHeight, $myData);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Draw the background */
$settings = ["R" => 255, "G" => 255, "B" => 255];
$myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $settings);
/* Add a border to the picture */
$myPicture->drawRectangle(
/* Create and populate the pData object */
$myData = new pData();
$myData->addPoints($main_date, 'Serie1');
if (1 != count($main_date)) {
$myData->addPoints($labels, 'Labels');
$myData->setSerieDescription('Labels', 'Months');
$myData->setAbscissa('Labels');
}
$myData->setSerieWeight('Serie1', 1);
$myData->setSerieDescription('Serie1', get_lang('My results'));
$myData->setAxisName(0, get_lang('Minutes'));
$myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(['CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)]);
$chartHash = $myCache->getHash($myData);
if ($myCache->isInCache($chartHash)) {
//if we already created the img
$imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
} else {
/* Define width, height and angle */
$mainWidth = 760;
$mainHeight = 230;
$angle = 50;
/* Create the pChart object */
$myPicture = new pImage($mainWidth, $mainHeight, $myData);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Draw the background */
$settings = ["R" => 255, "G" => 255, "B" => 255];
$myPicture->drawFilledRectangle(0, 0, $mainWidth, $mainHeight, $settings);
/* Add a border to the picture */
$myPicture->drawRectangle(
0,
0,
$mainWidth - 1,
@ -3004,14 +3004,14 @@ class MySpace
["R" => 0, "G" => 0, "B" => 0]
);
/* Set the default font */
$myPicture->setFontProperties(
/* Set the default font */
$myPicture->setFontProperties(
[
"FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
"FontSize" => 10, ]
);
/* Write the chart title */
$myPicture->drawText(
/* Write the chart title */
$myPicture->drawText(
$mainWidth / 2,
30,
get_lang('Time spent in the course'),
@ -3021,19 +3021,19 @@ class MySpace
]
);
/* Set the default font */
$myPicture->setFontProperties(
/* Set the default font */
$myPicture->setFontProperties(
[
"FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
"FontSize" => 8,
]
);
/* Define the chart area */
$myPicture->setGraphArea(50, 40, $mainWidth - 40, $mainHeight - 80);
/* Define the chart area */
$myPicture->setGraphArea(50, 40, $mainWidth - 40, $mainHeight - 80);
/* Draw the scale */
$scaleSettings = [
/* Draw the scale */
$scaleSettings = [
'XMargin' => 10,
'YMargin' => 10,
'Floating' => true,
@ -3045,13 +3045,13 @@ class MySpace
'LabelRotation' => $angle,
'Mode' => SCALE_MODE_ADDALL_START0,
];
$myPicture->drawScale($scaleSettings);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = true;
/* Turn on Antialiasing */
$myPicture->Antialias = true;
/* Enable shadow computing */
$myPicture->setShadow(
/* Enable shadow computing */
$myPicture->setShadow(
true,
[
"X" => 1,
@ -3063,15 +3063,15 @@ class MySpace
]
);
/* Draw the line chart */
$myPicture->setFontProperties(
/* Draw the line chart */
$myPicture->setFontProperties(
[
"FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
"FontSize" => 10,
]
);
$myPicture->drawSplineChart();
$myPicture->drawPlotChart(
$myPicture->drawSplineChart();
$myPicture->drawPlotChart(
[
"DisplayValues" => true,
"PlotBorder" => true,
@ -3081,17 +3081,17 @@ class MySpace
]
);
/* Do NOT Write the chart legend */
/* Do NOT Write the chart legend */
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
}
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
}
return '<img src="'.$imgPath.'">';
} else {
} else {
return api_convert_encoding(
'<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>',
'UTF-8'

@ -9,8 +9,8 @@ use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourse;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Entity\SessionRelUser;
use Chamilo\CoreBundle\Repository\SequenceRepository;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\SequenceRepository;
use ExtraField as ExtraFieldModel;
use Monolog\Logger;
@ -490,7 +490,7 @@ class SessionManager
/**
* Get session list for a session admin or platform admin.
*
* @param int $userId User Id for the session admin.
* @param int $userId User Id for the session admin.
* @param array $options Order and limit keys.
* @param bool $getCount Whether to get all the results or only the count.
* @param array $columns Columns from jqGrid.
@ -679,10 +679,10 @@ class SessionManager
/**
* Gets the admin session list callback of the session/session_list.php page.
*
* @param array $options order and limit keys
* @param bool $getCount Whether to get all the results or only the count
* @param array $columns
* @param array $extraFieldsToLoad
* @param array $options order and limit keys
* @param bool $getCount Whether to get all the results or only the count
* @param array $columns
* @param array $extraFieldsToLoad
* @param string $listType
*
* @return mixed Integer for number of rows, or array of results
@ -7642,7 +7642,7 @@ class SessionManager
$sessionFieldValueList = [];
foreach (array_keys($fields) as $fieldId) {
$sessionFieldValue = $extra->get_values_by_handler_and_field_id($sessionId, $fieldId);
if ($sessionFieldValue != false) {
if (false != $sessionFieldValue) {
$sessionFieldValueList[$fieldId] = $sessionFieldValue;
}
}

@ -3,10 +3,10 @@
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use Chamilo\CoreBundle\Entity\Skill as SkillEntity;
use Chamilo\CoreBundle\Entity\SkillRelItemRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUser as SkillRelUserEntity;
use Chamilo\CoreBundle\Entity\SkillRelCourse;
use Chamilo\CoreBundle\Entity\SkillRelItem;
use Chamilo\CoreBundle\Entity\SkillRelItemRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUser as SkillRelUserEntity;
use Chamilo\CoreBundle\Entity\User;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Vertex;

@ -3,8 +3,8 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Symfony\Component\HttpFoundation\Response;
/**

@ -5,8 +5,8 @@
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField;
use Chamilo\CoreBundle\Entity\Session as SessionEntity;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use ChamiloSession as Session;
use CpChart\Cache as pCache;
use CpChart\Data as pData;
@ -1042,7 +1042,7 @@ class Tracking
$list1 = learnpath::get_iv_interactions_array($row['iv_id'], $course_id);
foreach ($list1 as $id => $interaction) {
$oddclass = 'row_even';
if (($counter % 2) == 0) {
if (0 == ($counter % 2)) {
$oddclass = 'row_odd';
}
$timeRow = '<td class="lp_time">'.$interaction['time'].'</td>';
@ -1069,7 +1069,7 @@ class Tracking
$list2 = learnpath::get_iv_objectives_array($row['iv_id'], $course_id);
foreach ($list2 as $id => $interaction) {
$oddclass = 'row_even';
if (($counter % 2) == 0) {
if (0 == ($counter % 2)) {
$oddclass = 'row_odd';
}
$output .= '<tr class="'.$oddclass.'">
@ -1645,9 +1645,9 @@ class Tracking
* Calculates the time spent on the platform by a user.
*
* @param int|array $userId
* @param string $timeFilter type of time filter: 'last_week' or 'custom'
* @param string $start_date start date date('Y-m-d H:i:s')
* @param string $end_date end date date('Y-m-d H:i:s')
* @param string $timeFilter type of time filter: 'last_week' or 'custom'
* @param string $start_date start date date('Y-m-d H:i:s')
* @param string $end_date end date date('Y-m-d H:i:s')
* @param bool $returnAllRecords
*
* @return int
@ -6918,7 +6918,7 @@ class Tracking
}
$lpProgress = self::get_avg_student_progress($userId, $courseCode, [$lp_id], $sessionId);
$time = isset($lpTimeList[TOOL_LEARNPATH][$lp_id]) ? $lpTimeList[TOOL_LEARNPATH][$lp_id] : 0;
if ($lpProgress == 100) {
if (100 == $lpProgress) {
if (!empty($time)) {
$timeInMinutes = $time / 60;
$min = (int) learnpath::getAccumulateWorkTimePrerequisite($lp_id, $courseId);
@ -7682,14 +7682,14 @@ class TrackingCourseLog
if ($surveyList) {
$total_surveys = count($surveyList);
foreach ($surveyList as $survey) {
$user_list = SurveyManager::get_people_who_filled_survey(
$user_list = SurveyManager::get_people_who_filled_survey(
$survey['survey_id'],
false,
$courseId
);
foreach ($user_list as $user_id) {
isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
foreach ($user_list as $user_id) {
isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
}
}
}

@ -269,7 +269,7 @@ class UserGroup extends Model
return 0;
} else {
$typeCondition = '';
if ($type != -1) {
if (-1 != $type) {
$type = (int) $type;
$typeCondition = " AND group_type = $type ";
}
@ -2198,7 +2198,7 @@ class UserGroup extends Model
return $array;
}
/** Gets the inner join of users and group table
/** Gets the inner join of users and group table.
* @param int quantity of records
* @param bool show groups with image or not
*
@ -2262,7 +2262,7 @@ class UserGroup extends Model
return $array;
}
/** Gets the last groups created
/** Gets the last groups created.
* @param int $num quantity of records
* @param bool $withImage show groups with image or not
*

@ -5,10 +5,10 @@ use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUserComment;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Hook\HookCreateUser;
use Chamilo\CoreBundle\Hook\HookUpdateUser;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\UserRepository;
use ChamiloSession as Session;
@ -62,7 +62,6 @@ class UserManager
/**
* Create/update/delete methods are available in the UserManager
* (based in the Sonata\UserBundle\Entity\UserManager).
*
*/
public static function getManager()
{
@ -2656,7 +2655,7 @@ class UserManager
return $extra_data;
}
/** Get extra user data by field
/** Get extra user data by field.
* @param int user ID
* @param string the internal variable name of the field
*

@ -1,14 +1,14 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLpCategory;
use Chamilo\CourseBundle\Entity\CNotebook;
use Chamilo\CourseBundle\Repository\CNotebookRepository;
use Chamilo\CoreBundle\Entity\User;
/**
* Class RestApi.
@ -115,7 +115,7 @@ class Rest extends WebService
$this->course = $course;
}
/** Set the current session
/** Set the current session.
* @param int $id
*
* @throws Exception
@ -358,11 +358,11 @@ class Rest extends WebService
/** @var array $document */
foreach ($documents as $document) {
if ($document['visibility'] != '1') {
if ('1' != $document['visibility']) {
continue;
}
$icon = $document['filetype'] == 'file'
$icon = 'file' == $document['filetype']
? choose_image($document['path'])
: chooseFolderIcon($document['path']);
@ -568,7 +568,7 @@ class Rest extends WebService
$categoriesFullData = get_forum_categories('', $this->course->getId(), $sessionId);
$categories = [];
$includeGroupsForums = api_get_setting('display_groups_forum_in_general_tool') === 'true';
$includeGroupsForums = 'true' === api_get_setting('display_groups_forum_in_general_tool');
$forumsFullData = get_forums('', $this->course->getCode(), $includeGroupsForums, $sessionId);
$forums = [];
@ -776,7 +776,7 @@ class Rest extends WebService
$listData = [];
foreach ($flatLpList as $lpId => $lpDetails) {
if ($lpDetails['lp_visibility'] == 0) {
if (0 == $lpDetails['lp_visibility']) {
continue;
}
@ -892,8 +892,7 @@ class Rest extends WebService
}
/**
* @param array $postValues
* @param int $forumId
* @param int $forumId
*
* @return array
*/
@ -967,7 +966,6 @@ class Rest extends WebService
/**
* @param string $subject
* @param string $text
* @param array $receivers
*
* @return array
*/
@ -992,7 +990,7 @@ class Rest extends WebService
$repo = UserManager::getRepository();
$users = $repo->findUsersToSendMessage($this->user->getId(), $search);
$showEmail = api_get_setting('show_email_addresses') === 'true';
$showEmail = 'true' === api_get_setting('show_email_addresses');
$data = [];
/** @var User $user */
@ -1036,8 +1034,7 @@ class Rest extends WebService
}
/**
* @param array $values
* @param int $forumId
* @param int $forumId
*
* @return array
*/
@ -1056,8 +1053,6 @@ class Rest extends WebService
}
/**
* @param array $params
*
* @return array
*/
public function getUsersCampus(array $params)
@ -1082,8 +1077,6 @@ class Rest extends WebService
}
/**
* @param array $params
*
* @return array
*/
public function getCoursesCampus(array $params)
@ -1105,8 +1098,6 @@ class Rest extends WebService
}
/**
* @param array $params
*
* @return array
*/
public function addSession(array $params)
@ -1158,8 +1149,6 @@ class Rest extends WebService
}
/**
* @param array $courseParam
*
* @return array
*/
public function addCourse(array $courseParam)
@ -1269,7 +1258,7 @@ class Rest extends WebService
if ($userId) {
if (api_is_multiple_url_enabled()) {
if (api_get_current_access_url_id() != -1) {
if (-1 != api_get_current_access_url_id()) {
UrlManager::add_user_to_url(
$userId,
api_get_current_access_url_id()
@ -1364,9 +1353,9 @@ class Rest extends WebService
$active = isset($params['active']) ? intval($params['active']) : 0;
$num = UrlManager::url_exist($urlCampus);
if ($num == 0) {
if (0 == $num) {
// checking url
if (substr($urlCampus, strlen($urlCampus) - 1, strlen($urlCampus)) == '/') {
if ('/' == substr($urlCampus, strlen($urlCampus) - 1, strlen($urlCampus))) {
$idCampus = UrlManager::add($urlCampus, $description, $active, true);
} else {
//create
@ -1402,11 +1391,11 @@ class Rest extends WebService
if (!empty($url_id)) {
//we can't change the status of the url with id=1
if ($url_id == 1) {
if (1 == $url_id) {
$active = 1;
}
//checking url
if (substr($urlCampus, strlen($urlCampus) - 1, strlen($urlCampus)) == '/') {
if ('/' == substr($urlCampus, strlen($urlCampus) - 1, strlen($urlCampus))) {
UrlManager::update($url_id, $urlCampus, $description, $active);
} else {
UrlManager::update($url_id, $urlCampus.'/', $description, $active);
@ -1444,8 +1433,6 @@ class Rest extends WebService
}
/**
* @param array $params
*
* @throws Exception
*
* @return array
@ -1476,8 +1463,6 @@ class Rest extends WebService
}
/**
* @param array $params
*
* @return array
*/
public function addUsersSession(array $params)

@ -4,12 +4,12 @@
use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\BranchSync;
use Chamilo\CoreBundle\Entity\ExtraField;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\ToolChain;
use Chamilo\CoreBundle\Entity\Group;
use Chamilo\CoreBundle\Entity\TicketCategory as TicketCategory;
use Chamilo\CoreBundle\Entity\TicketPriority as TicketPriority;
use Chamilo\CoreBundle\Entity\TicketProject as TicketProject;
use Chamilo\CoreBundle\Entity\Group;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\ToolChain;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\Container as SymfonyContainer;

@ -3,6 +3,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
@ -18,7 +19,6 @@ use Chamilo\CourseBundle\Entity\CQuiz;
use Chamilo\CourseBundle\Entity\CShortcut;
use Chamilo\CourseBundle\Entity\CStudentPublication;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CoreBundle\Entity\User;
use ChamiloSession as Session;
use Gedmo\Sortable\Entity\Repository\SortableRepository;
use Symfony\Component\Filesystem\Filesystem;
@ -31,7 +31,6 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
* and SCORM learnpaths. It is used by the scorm class.
*
* @todo decouple class
* *
*
* @author Yannick Warnier <ywarnier@beeznest.org>
* @author Julio Montoya <gugli100@gmail.com> Several improvements and fixes

@ -4,8 +4,8 @@
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Repository\CourseRepository;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,10 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLpCategory;
use Chamilo\CourseBundle\Entity\CLpCategoryUser;
use Chamilo\CoreBundle\Entity\User;
require_once __DIR__.'/../inc/global.inc.php';

@ -249,7 +249,7 @@ $orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
original_cols = grid.jqGrid('getGridParam', 'colModel');
<?php if ($allowOrder) {
?>
?>
options = {
update: function (e, ui) {
var rowNum = jQuery("#sessions").getGridParam('rowNum');
@ -283,7 +283,7 @@ $orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
<?php
// Create the searching dialog.
if ($hideSearch !== true) {
if (true !== $hideSearch) {
echo 'grid.searchGrid(prmSearch);';
}
?>
@ -373,7 +373,7 @@ $tabs = [
];
$default = 2;
if ($list_type === 'complete') {
if ('complete' === $list_type) {
$default = 3;
}

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Hook\HookWSRegistration;
use Chamilo\CoreBundle\Entity\User;
require_once __DIR__.'/../inc/global.inc.php';
$debug = true;

@ -4,8 +4,8 @@
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CourseBundle\Entity\CLp;
/**
* Responses to AJAX calls.

@ -99,9 +99,7 @@ try {
/** @var \Category $gradebook */
$gradebook = $cats[0];
/** @var \ExerciseLink $exerciseLink */
/** commented until we get clear understanding of how to use the dates refs BT#12404
$exerciseLink = $gradebook->get_links()[0];
$exerciseId = $exerciseLink->get_ref_id();
/** commented until we get clear understanding of how to use the dates refs BT#12404.
$exerciseInfo = ExerciseLib::get_exercise_by_id($exerciseId, $course->getId());
*/
$dateStart = new DateTime($values['range_start'].' 00:00:00', new DateTimeZone('UTC'));
@ -125,24 +123,7 @@ try {
if (!$userFinishedCourse) {
continue;
}
/** commented until we get clear understanding of how to use the dates refs BT#12404
$exerciseResult = Event::get_best_exercise_results_by_user(
$exerciseId,
$course->getId(),
$session ? $session->getId() : 0,
$student->getId()
);
$exerciseResult = current($exerciseResult);
if (!$exerciseResult) {
continue;
}
$attemptDate = new DateTime($exerciseResult['exe_date'], new DateTimeZone('UTC'));
$dateIsRange = $attemptDate >= $dateStart && $attemptDate <= $dateEnd;
if (!$dateEnd) {
continue;
/** commented until we get clear understanding of how to use the dates refs BT#12404.
}
*/
$fieldStudent = $uFieldValue->get_values_by_handler_and_field_variable(

@ -50,6 +50,11 @@ class Group
$this->roles = $roles;
}
public function __toString()
{
return $this->getName() ?: '';
}
public function addRole($role)
{
if (!$this->hasRole($role)) {
@ -135,9 +140,4 @@ class Group
return $this;
}
public function __toString()
{
return $this->getName() ?: '';
}
}

@ -69,6 +69,14 @@ class ResourceFile
{
use TimestampableEntity;
/**
* @var string|null
*
* @ApiProperty(iri="http://schema.org/contentUrl")
* @Groups({"resource_file:read", "resource_node:read", "document:read", "media_object_read"})
*/
public $contentUrl;
/**
* @ORM\Id
* @ORM\Column(type="integer")
@ -139,14 +147,6 @@ class ResourceFile
*/
protected $crop;
/**
* @var string|null
*
* @ApiProperty(iri="http://schema.org/contentUrl")
* @Groups({"resource_file:read", "resource_node:read", "document:read", "media_object_read"})
*/
public $contentUrl;
/**
* @var ResourceNode
*

@ -40,9 +40,9 @@ use Symfony\Component\Validator\Constraints as Assert;
*/
class ResourceNode
{
public const PATH_SEPARATOR = '`';
use TimestampableEntity;
use TimestampableAgoTrait;
public const PATH_SEPARATOR = '`';
/**
* @Groups({"resource_node:read", "document:read"})

@ -931,7 +931,6 @@ class User implements UserInterface, EquatableInterface
/**
* Set lastname.
*
*
* @return User
*/
public function setLastname(string $lastname): self
@ -944,7 +943,6 @@ class User implements UserInterface, EquatableInterface
/**
* Set firstname.
*
*
* @return User
*/
public function setFirstname(string $firstname): self

Loading…
Cancel
Save