|
@@ -579,12 +579,18 @@ class CourseHome
|
|
|
}
|
|
|
|
|
|
$allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session');
|
|
|
- $toolWithSessionValue = [];
|
|
|
- foreach ($tools as $row) {
|
|
|
- if (!empty($row['session_id'])) {
|
|
|
- $toolWithSessionValue[$row['name']] = $row;
|
|
|
+ // If exists same tool (by name) from session in base course then avoid it. Allow them pass in other cases
|
|
|
+ $tools = array_filter($tools, function (array $toolToFilter) use ($sessionId, $tools) {
|
|
|
+ if (!empty($toolToFilter['session_id'])) {
|
|
|
+ foreach ($tools as $originalTool) {
|
|
|
+ if ($toolToFilter['name'] == $originalTool['name'] && empty($originalTool['session_id'])) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ });
|
|
|
|
|
|
foreach ($tools as $temp_row) {
|
|
|
$add = false;
|
|
@@ -596,12 +602,6 @@ class CourseHome
|
|
|
$add = true;
|
|
|
}
|
|
|
|
|
|
- if (isset($toolWithSessionValue[$temp_row['name']])) {
|
|
|
- if (!empty($temp_row['session_id'])) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if ($allowEditionInSession && !empty($sessionId)) {
|
|
|
// Checking if exist row in session
|
|
|
$criteria = [
|