Session: remove unnecessary references to session_list_order config

pull/3991/head
Angel Fernando Quiroz Campos 3 years ago
parent 385dd1afca
commit 36091f0703
  1. 23
      public/main/inc/ajax/session.ajax.php
  2. 8
      public/main/inc/lib/sessionmanager.lib.php
  3. 10
      public/main/inc/lib/usermanager.lib.php
  4. 5
      public/main/install/configuration.dist.php
  5. 1
      public/main/mySpace/session.php
  6. 5
      public/main/session/session_list.php
  7. 5
      public/main/session/session_list_custom.php

@ -28,19 +28,16 @@ switch ($action) {
break;
case 'order':
api_protect_admin_script();
$allowOrder = api_get_configuration_value('session_list_order');
if ($allowOrder) {
$order = isset($_GET['order']) ? $_GET['order'] : [];
$order = json_decode($order);
if (!empty($order)) {
$table = Database::get_main_table(TABLE_MAIN_SESSION);
foreach ($order as $data) {
if (isset($data->order) && isset($data->id)) {
$orderId = (int) $data->order;
$sessionId = (int) $data->id;
$sql = "UPDATE $table SET position = $orderId WHERE id = $sessionId ";
Database::query($sql);
}
$order = isset($_GET['order']) ? $_GET['order'] : [];
$order = json_decode($order);
if (!empty($order)) {
$table = Database::get_main_table(TABLE_MAIN_SESSION);
foreach ($order as $data) {
if (isset($data->order) && isset($data->id)) {
$orderId = (int) $data->order;
$sessionId = (int) $data->id;
$sql = "UPDATE $table SET position = $orderId WHERE id = $sessionId ";
Database::query($sql);
}
}
}

@ -515,7 +515,7 @@ class SessionManager
$where .= $conditions['where'];
$sqlInjectWhere = $conditions['inject_where'];
$injectExtraFields = $conditions['inject_extra_fields'];
$order = $conditions['order'];
$order = empty($conditions['order']) ? ' ORDER BY position ASC' : $conditions['order'];
$limit = $conditions['limit'];
$isMakingOrder = false;
@ -639,12 +639,6 @@ class SessionManager
$query .= ' GROUP by s.id';
}
$allowOrder = api_get_configuration_value('session_list_order');
if ($allowOrder) {
$order = ' ORDER BY position ASC';
}
$query .= $order;
$query .= $limit;
$result = Database::query($query);

@ -2498,12 +2498,6 @@ class UserManager
return [];
}
$allowOrder = api_get_configuration_value('session_list_order');
$position = '';
if ($allowOrder) {
$position = ', s.position AS position ';
}
// Get the list of sessions per user
$now = new DateTime('now', new DateTimeZone('UTC'));
@ -2526,7 +2520,7 @@ class UserManager
s.coachAccessStartDate AS coach_access_start_date,
s.coachAccessEndDate AS coach_access_end_date,
CASE WHEN s.accessEndDate IS NULL THEN 1 ELSE 0 END HIDDEN _isFieldNull
$position
, s.position AS position
";
}
@ -2554,7 +2548,7 @@ class UserManager
}
// Order by position
if ($allowOrder) {
if (api_get_configuration_value('session_list_order')) {
$order = 'ORDER BY s.position';
}

@ -640,10 +640,7 @@ $_configuration['gradebook_badge_sidebar'] = [
// Add user extra fields in report: main/mySpace/exercise_category_report.php
//$_configuration['exercise_category_report_user_extra_fields'] = ['fields' => ['skype', 'rssfeeds']];
// Order sessions
// Requires DB change: ALTER TABLE session ADD COLUMN position INT DEFAULT 0;
// Requires edit Entity Session: src/Chamilo/CoreBundle/Entity/Session.php uncomment "position" variable.
// Requires uncomment the position get and set
// Order sessions by position in user session list (UserManager::get_sessions_by_category)
//$_configuration['session_list_order'] = false;
// Show skills as a hierarchical table

@ -461,7 +461,6 @@ $extraParams = [
];*/
$urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
$allowOrder = api_get_configuration_value('session_list_order');
$orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
?>

@ -161,7 +161,6 @@ $action_links = 'function action_formatter(cellvalue, options, rowObject) {
}';
$urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
$allowOrder = api_get_configuration_value('session_list_order');
$orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
?>
@ -280,8 +279,6 @@ $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');
@ -302,8 +299,6 @@ $orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
// Sortable rows
grid.jqGrid('sortableRows', options);
<?php
} ?>
grid.jqGrid('navGrid','#sessions_pager',
{edit:false,add:false,del:false},

@ -131,7 +131,6 @@ $action_links = 'function action_formatter(cellvalue, options, rowObject) {
}';
$urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
$allowOrder = api_get_configuration_value('session_list_order');
$orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
?>
@ -250,8 +249,6 @@ $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');
@ -272,8 +269,6 @@ $orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order';
// Sortable rows
grid.jqGrid('sortableRows', options);
<?php
} ?>
grid.jqGrid('navGrid','#sessions_pager',
{edit:false,add:false,del:false},

Loading…
Cancel
Save