Internal: Database: Fix internal methods calls with name vs title (6) - refs #3581 #4706

pull/5095/head
Yannick Warnier 2 years ago
commit 2752a9b427
  1. 14
      public/main/admin/ldap_synchro.php
  2. 8
      public/main/admin/special_exports.php
  3. 6
      public/main/attendance/index.php
  4. 8
      public/main/course_copy/copy_course_session.php
  5. 4
      public/main/course_copy/copy_course_session_selected.php
  6. 2
      public/main/glossary/glossary_ajax_request.php
  7. 32
      public/main/glossary/index.php
  8. 12
      public/main/inc/ajax/model.ajax.php
  9. 6
      public/main/inc/ajax/sequence.ajax.php
  10. 14
      public/main/inc/lib/access_url_edit_sessions_to_url_functions.lib.php
  11. 4
      public/main/inc/lib/api.lib.php
  12. 32
      public/main/inc/lib/attendance.lib.php
  13. 2
      public/main/inc/lib/banner.lib.php
  14. 2
      public/main/inc/lib/course.lib.php
  15. 18
      public/main/inc/lib/glossary.lib.php
  16. 3
      public/main/inc/lib/groupmanager.lib.php
  17. 57
      public/main/inc/lib/sessionmanager.lib.php
  18. 6
      public/main/inc/lib/urlmanager.lib.php
  19. 13
      public/main/inc/lib/usergroup.lib.php
  20. 18
      public/main/session/add_many_session_to_category.php
  21. 10
      public/main/session/session_category_edit.php
  22. 16
      public/main/session/session_category_list.php
  23. 24
      public/main/session/session_export.php
  24. 10
      public/main/session/session_import.php
  25. 12
      public/main/webservices/registration.soap.php

@ -16,7 +16,7 @@ require_once('../auth/ldap/authldap.php');
$annee_base = date('Y');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
//api_protect_admin_script(); // on vire la secu... qui n'a pas lieu d'etre ici (script de synchro)
api_protect_admin_script(); // make sure you don't need to protect this script against external access before removing
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('Administration'));
@ -35,7 +35,7 @@ $tbl_session_rel_etape = "session_rel_etape";
$message = "";
$result = Database::query("SELECT id, name FROM $tbl_session");
$result = Database::query("SELECT id, title FROM $tbl_session");
$Sessions = Database::store_result($result);
$result = Database::query($sql);
@ -43,12 +43,12 @@ $users = Database::store_result($result);
foreach ($Sessions as $session) {
$id_session = $session['id'];
$name_session = $session['name'];
$name_session = $session['title'];
$UserList = array();
$UserUpdate = array();
$UserAdd = array();
// Parse des code etape de la session
// Parsing of code_etape in sessions
/*
$sql = "SELECT id_session, code_etape, etape_description, code_ufr, annee
FROM $tbl_session_rel_etape
@ -58,7 +58,7 @@ foreach ($Sessions as $session) {
*/
$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAP Connection Error'));
ldap_set_version($ds);
// Import des utilisateurs des etapes dans la session
// Import of users of "etape" in the session
if ($ds)
{
$r = false;
@ -150,8 +150,8 @@ foreach ($Sessions as $session) {
print "> $name_session: ".count($UserAdd).get_lang('Added').' '.get_lang('and').' '.count($UserUpdate).' '.get_lang('Modified')."\n";
}
// Une fois les utilisateurs importer dans la base des utilisateurs, on peux les affecter la session
$result = Database::query("SELECT c_id FROM $tbl_session_rel_course WHERE session_id='$id_session'");
// Once users have been imported, they can be added to the session
$result = Database::query("SELECT c_id FROM $tbl_session_rel_course WHERE session_id = $id_session");
$CourseList = array();
while ($row = Database::fetch_array($result)) {
$CourseList[] = $row['c_id'];

@ -41,11 +41,11 @@ if ((isset($_POST['action']) && 'course_select_form' == $_POST['action']) ||
if (isset($_POST['action']) && 'course_select_form' == $_POST['action']) {
$FileZip = create_zip();
$to_group_id = 0;
$sql_session = "SELECT id, name FROM $tbl_session ";
$sql_session = "SELECT id, title FROM $tbl_session ";
$query_session = Database::query($sql_session);
$ListSession = [];
while ($rows_session = Database::fetch_assoc($query_session)) {
$ListSession[$rows_session['id']] = $rows_session['name'];
$ListSession[$rows_session['id']] = $rows_session['title'];
}
$groupCondition = " props.to_group_id = $to_group_id";
@ -258,7 +258,7 @@ function fullexportspecial()
}
//Add tem to the zip file session course
$sql = "SELECT s.id, name, c_id
$sql = "SELECT s.id, title, c_id
FROM $tbl_session_course sc
INNER JOIN $tbl_session s
ON sc.session_id = s.id
@ -282,7 +282,7 @@ function fullexportspecial()
$zip_folder->add(
$FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'],
PCLZIP_OPT_ADD_PATH,
$_course['directory']."/".$rows_session['name'],
$_course['directory']."/".$rows_session['title'],
PCLZIP_OPT_REMOVE_PATH,
$FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE']
);

@ -221,7 +221,7 @@ switch ($action) {
}
if (0 === $attendance->getNumberOfAttendances()) {
$attendance->set_name(get_lang('Attendances'));
$attendance->set_title(get_lang('Attendances'));
$attendance->set_description(get_lang('Attendances'));
$attendance->attendance_add();
}
@ -272,7 +272,7 @@ switch ($action) {
$attendance->setAttendanceForm($form);
if ($form->validate()) {
$attendance->set_name($_POST['title']);
$attendance->set_title($_POST['title']);
$attendance->set_description($_POST['description']);
$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
$attendance->set_attendance_weight($_POST['attendance_weight']);
@ -311,7 +311,7 @@ switch ($action) {
$attendance->setAttendanceForm($form, $attendanceEntity);
if (!empty($_POST['title'])) {
$attendance->set_name($_POST['title']);
$attendance->set_title($_POST['title']);
$attendance->set_description($_POST['description']);
if (isset($_POST['attendance_qualify_title'])) {
$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);

@ -74,7 +74,7 @@ function make_select_session_list($name, $sessions, $attr = [])
}
$output .= '<option value="'.$session['id'].'">'.
$session['name'].' '.$categoryName.
$session['title'].' '.$categoryName.
'</option>';
}
}
@ -89,7 +89,7 @@ function make_select_session_list($name, $sessions, $attr = [])
function display_form()
{
$html = '';
$sessions = SessionManager::get_sessions_list([], ['name', 'ASC']);
$sessions = SessionManager::get_sessions_list([], ['title', 'ASC']);
// Link back to the documents overview
$actionsLeft = '<a href="../admin/index.php">'.
@ -178,7 +178,7 @@ function search_courses($id_session, $type)
// Build select for destination sessions where is not included current session from select origin
if (!empty($id_session)) {
$sessions = SessionManager::get_sessions_list([], ['name', 'ASC']);
$sessions = SessionManager::get_sessions_list([], ['title', 'ASC']);
$select_destination .= '<select name="sessions_list_destination" class="form-control" onchange = "javascript: xajax_search_courses(this.value,\'destination\');">';
$select_destination .= '<option value = "0">-- '.get_lang('Select a session').' --</option>';
foreach ($sessions as $session) {
@ -188,7 +188,7 @@ function search_courses($id_session, $type)
if (!empty($session['category_name'])) {
$session['category_name'] = ' ('.$session['category_name'].') ';
}
$select_destination .= '<option value="'.$session['id'].'">'.$session['name'].' '.$session['category_name'].'</option>';
$select_destination .= '<option value="'.$session['id'].'">'.$session['title'].' '.$session['category_name'].'</option>';
}
$select_destination .= '</select>';
$xajax_response->addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination));

@ -88,7 +88,7 @@ function make_select_session_list($name, $sessions, $attr = [])
$category_name = ' ('.$session['category_name'].')';
}
$output .= '<option value="'.$session['id'].'">'.$session['name'].' '.$category_name.'</option>';
$output .= '<option value="'.$session['id'].'">'.$session['title'].' '.$category_name.'</option>';
}
}
$output .= '</select>';
@ -164,7 +164,7 @@ function displayForm()
continue;
}
$html .= '<option value="'.$session['id'].'">'.$session['name'].'</option>';
$html .= '<option value="'.$session['id'].'">'.$session['title'].'</option>';
}
}

@ -31,7 +31,7 @@ if (!empty($glossaryId)) {
$glossary_all_data = [];
if (count($glossary_data) > 0) {
foreach ($glossary_data as $glossary_index => $glossary_value) {
$glossary_all_data[] = $glossary_value['id'].'__|__|'.$glossary_value['name'];
$glossary_all_data[] = $glossary_value['id'].'__|__|'.$glossary_value['title'];
}
$description = implode('[|.|_|.|-|.|]', $glossary_all_data);
}

@ -90,14 +90,14 @@ switch ($action) {
$form->addElement('header', get_lang('Add new glossary term'));
if ('true' === api_get_setting('editor.save_titles_as_html')) {
$form->addHtmlEditor(
'name',
'title',
get_lang('Term'),
false,
false,
['ToolbarSet' => 'TitleAsHtml']
);
} else {
$form->addElement('text', 'name', get_lang('Term'), ['id' => 'glossary_title']);
$form->addElement('text', 'title', get_lang('Term'), ['id' => 'glossary_title']);
}
$form->addHtmlEditor(
@ -109,7 +109,7 @@ switch ($action) {
);
$form->addButtonCreate(get_lang('Save term'), 'SubmitGlossary');
// setting the rules
$form->addRule('name', get_lang('Required field'), 'required');
$form->addRule('title', get_lang('Required field'), 'required');
// The validation or display
if ($form->validate()) {
$check = Security::check_token('post');
@ -155,14 +155,14 @@ switch ($action) {
$form->addElement('hidden', 'glossary_id');
if ('true' === api_get_setting('editor.save_titles_as_html')) {
$form->addHtmlEditor(
'name',
'title',
get_lang('Term'),
false,
false,
['ToolbarSet' => 'TitleAsHtml']
);
} else {
$form->addElement('text', 'name', get_lang('Term'), ['id' => 'glossary_title']);
$form->addElement('text', 'title', get_lang('Term'), ['id' => 'glossary_title']);
}
$form->addElement(
@ -200,13 +200,13 @@ switch ($action) {
$form->addButtonUpdate(get_lang('Update term'), 'SubmitGlossary');
$default = [
'glossary_id' => $glossaryData->getIid(),
'name' => $glossaryData->getTitle(),
'title' => $glossaryData->getTitle(),
'description' => $glossaryData->getDescription(),
];
$form->setDefaults($default);
// setting the rules
$form->addRule('name', get_lang('Required field'), 'required');
$form->addRule('title', get_lang('Required field'), 'required');
// The validation or display
if ($form->validate()) {
@ -309,7 +309,7 @@ switch ($action) {
Display::return_message(get_lang('Cannot delete glossary').':'.$term['id'], 'error')
);
} else {
$termsDeleted[] = $term['name'];
$termsDeleted[] = $term['title'];
}
}
}
@ -341,7 +341,7 @@ switch ($action) {
continue;
}
$items = [
'name' => $item['term'],
'title' => $item['term'],
'description' => $item['definition'],
];
$termsToAdd[] = $items;
@ -356,7 +356,7 @@ switch ($action) {
exit;
}
$repeatItems = array_count_values(array_column($termsToAdd, 'name'));
$repeatItems = array_count_values(array_column($termsToAdd, 'title'));
foreach ($repeatItems as $item => $count) {
if ($count > 1) {
$doubles[] = $item;
@ -369,26 +369,26 @@ switch ($action) {
$item = $termsPerKey[$itemTerm];
if ($updateTerms) {
$glossaryInfo = GlossaryManager::get_glossary_term_by_glossary_name($item['name']);
$glossaryInfo = GlossaryManager::get_glossary_term_by_glossary_name($item['title']);
if (!empty($glossaryInfo)) {
$glossaryInfo['description'] = $item['description'];
GlossaryManager::update_glossary($glossaryInfo, false);
$updatedList[] = $item['name'];
$updatedList[] = $item['title'];
} else {
$result = GlossaryManager::save_glossary($item, false);
if ($result) {
$addedList[] = $item['name'];
$addedList[] = $item['title'];
} else {
$badList[] = $item['name'];
$badList[] = $item['title'];
}
}
} else {
$result = GlossaryManager::save_glossary($item, false);
if ($result) {
$addedList[] = $item['name'];
$addedList[] = $item['title'];
} else {
$badList[] = $item['name'];
$badList[] = $item['title'];
}
}
}

@ -1817,7 +1817,7 @@ switch ($action) {
if (api_is_drh()) {
$orderByName = Database::escape_string($sidx);
$orderByName = in_array($orderByName, ['name', 'access_start_date']) ? $orderByName : 'name';
$orderByName = in_array($orderByName, ['title', 'access_start_date']) ? $orderByName : 'title';
$orderBy = " ORDER BY $orderByName $sord";
$sessions = SessionManager::get_sessions_followed_by_drh(
api_get_user_id(),
@ -1833,7 +1833,7 @@ switch ($action) {
);
} elseif (api_is_session_admin()) {
$orderByName = Database::escape_string($sidx);
$orderByName = in_array($orderByName, ['name', 'access_start_date']) ? $orderByName : 'name';
$orderByName = in_array($orderByName, ['title', 'access_start_date']) ? $orderByName : 'title';
$orderBy = " ORDER BY $orderByName $sord";
$sessions = SessionManager::getSessionsFollowedByUser(
api_get_user_id(),
@ -1866,7 +1866,13 @@ switch ($action) {
$result = [];
if (!empty($sessions)) {
$pdfIcon = Display::getMdiIcon(ActionIcon::EXPORT_PDF, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('CertificateOfAchievement'));
$pdfIcon = Display::getMdiIcon(
ActionIcon::EXPORT_PDF,
'ch-tool-icon',
null,
ICON_SIZE_SMALL,
get_lang('CertificateOfAchievement')
);
foreach ($sessions as $session) {
$sessionEntity = api_get_session_entity($session['id']);
if (api_drh_can_access_all_session_content()) {

@ -82,13 +82,13 @@ switch ($action) {
case SequenceResource::SESSION_TYPE:
$resourceData = api_get_session_info($id);
if ($resourceData) {
$resourceName = $resourceData['name'];
$resourceName = $resourceData['title'];
}
break;
case SequenceResource::COURSE_TYPE:
$resourceData = api_get_course_info_by_id($id);
if ($resourceData) {
$resourceName = $resourceData['name'];
$resourceName = $resourceData['title'];
}
break;
}
@ -409,7 +409,7 @@ switch ($action) {
switch ($type) {
case SequenceResource::SESSION_TYPE:
$resourceData = api_get_session_info($id);
$resourceName = $resourceData['name'];
$resourceName = $resourceData['title'];
$template = 'session_requirements.tpl';
break;
case SequenceResource::COURSE_TYPE:

@ -19,7 +19,7 @@ require_once 'xajax/xajax.inc.php';
class Accessurleditsessionstourl
{
/**
* Search sessions by name, based on a search string.
* Search sessions by title, based on a search string.
*
* @param string Search string
* @param int Deprecated param
@ -34,21 +34,21 @@ class Accessurleditsessionstourl
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
// xajax send utf8 data. Data in db can be non-utf8
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
// search sessiones where username or firstname or lastname begins likes $needle
$sql = 'SELECT id, name FROM '.$tbl_session.' u
WHERE (name LIKE "'.$needle.'%")
ORDER BY name, id
// search sessions where username or firstname or lastname begins likes $needle
$sql = 'SELECT id, title FROM '.$tbl_session.' u
WHERE (title LIKE "'.$needle.'%")
ORDER BY title, id
LIMIT 11';
$rs = Database::query($sql);
$i = 0;
while ($session = Database::fetch_array($rs)) {
$i++;
if ($i <= 10) {
$return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />';
$return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['title']).' ('.addslashes($session['id']).')'.'\')">'.$session['title'].' </a><br />';
} else {
$return .= '...<br />';
}

@ -2163,7 +2163,7 @@ function api_format_course_array(Course $course = null)
// Added
$courseData['code'] = $courseData['sysCode'] = $course->getCode();
$courseData['name'] = $courseData['title'] = $course->getTitle();
$courseData['name'] = $courseData['title'] = $course->getTitle(); // 'name' only used for backwards compatibility - should be removed in the long run
$courseData['official_code'] = $courseData['visual_code'] = $course->getVisualCode();
$courseData['creation_date'] = $course->getCreationDate()->format('Y-m-d H:i:s');
$courseData['titular'] = $course->getTutorName();
@ -2377,7 +2377,7 @@ function api_get_session_name($session_id = 0)
}
}
$t = Database::get_main_table(TABLE_MAIN_SESSION);
$s = "SELECT name FROM $t WHERE id = ".(int) $session_id;
$s = "SELECT title FROM $t WHERE id = ".(int) $session_id;
$r = Database::query($s);
$c = Database::num_rows($r);
if ($c > 0) {

@ -23,13 +23,13 @@ class Attendance
private $session_id;
private $course_id;
private $date_time;
private $name;
private $title;
private $description;
private $attendance_qualify_title;
private $attendance_weight;
/**
* Get attendance list only the id, name and attendance_qualify_max fields.
* Get attendance list only the id, title and attendance_qualify_max fields.
*
* @return CAttendance[]
*/
@ -52,7 +52,7 @@ class Attendance
$condition_session = api_get_session_condition($session_id);
// Get attendance data
$sql = "SELECT iid, name, attendance_qualify_max
$sql = "SELECT iid, title, attendance_qualify_max
FROM $table
WHERE active = 1 $condition_session ";
$result = Database::query($sql);
@ -181,7 +181,7 @@ class Attendance
foreach ($attendances as $attendance) {
$row = [];
$id = $attendance->getIid();
$name = $attendance->getTitle();
$title = $attendance->getTitle();
$active = $attendance->getActive();
$session_star = '';
/*if ($session_id == $attendance[6]) {
@ -194,13 +194,13 @@ class Attendance
) || api_is_drh();
if ($isDrhOfCourse || api_is_allowed_to_edit(null, true)) {
// Link to edit
$row[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$id.$student_param.'">'.$name.'</a>'.$session_star;
$row[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$id.$student_param.'">'.$title.'</a>'.$session_star;
} else {
// Link to view
$row[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list_no_edit&attendance_id='.$id.$student_param.'">'.$name.'</a>'.$session_star;
$row[1] = '<a href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list_no_edit&attendance_id='.$id.$student_param.'">'.$title.'</a>'.$session_star;
}
} else {
$row[1] = '<a class="muted" href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$id.$student_param.'">'.$name.'</a>'.$session_star;
$row[1] = '<a class="muted" href="index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$id.$student_param.'">'.$title.'</a>'.$session_star;
}
if (1 == $active) {
@ -347,7 +347,7 @@ class Attendance
$course = api_get_course_entity();
$attendance = new CAttendance();
$attendance
->setTitle($this->name)
->setTitle($this->title)
->setDescription($this->description)
->setAttendanceQualifyTitle($titleGradebook)
->setAttendanceWeight($weightCalification)
@ -411,7 +411,7 @@ class Attendance
if ($attendance) {
$attendanceId = $attendance->getIid();
$attendance
->setTitle($this->name)
->setTitle($this->title)
->setDescription($this->description)
->setAttendanceQualifyTitle($title_gradebook)
->setAttendanceWeight($weight_calification)
@ -421,7 +421,7 @@ class Attendance
$repo->update($attendance);
/*$params = [
'name' => $this->name,
'title' => $this->title,
'description' => $this->description,
'attendance_qualify_title' => $title_gradebook,
'attendance_weight' => $weight_calification,
@ -1920,9 +1920,9 @@ class Attendance
$this->date_time = $datetime;
}
public function set_name($name)
public function set_title($title)
{
$this->name = $name;
$this->title = $title;
}
public function set_description($description)
@ -1956,9 +1956,9 @@ class Attendance
return $this->date_time;
}
public function get_name()
public function get_title()
{
return $this->name;
return $this->title;
}
public function get_description()
@ -2554,7 +2554,7 @@ class Attendance
$groupList = GroupManager::get_group_list(null, null, 1);
$groupIdList = ['--'];
foreach ($groupList as $group) {
$groupIdList[$group['iid']] = $group['name'];
$groupIdList[$group['iid']] = $group['title'];
}
if (!empty($groupList)) {
@ -3044,7 +3044,7 @@ class Attendance
'course_code' => $courseInfo['code'],
'add_signatures' => ['Drh', 'Teacher', 'Date'],
'pdf_teachers' => $teacherName,
'pdf_course_category' => $courseCategory ? $courseCategory['name'] : '',
'pdf_course_category' => $courseCategory ? $courseCategory['title'] : '',
'format' => 'A4-L',
'orientation' => 'L',
];

@ -377,7 +377,7 @@ function return_breadcrumb($interbreadcrumb, $language_file, $nameTools)
'ch-tool-icon',
null,
ICON_SIZE_TINY,
$courseInfo['name'].$sessionName
$courseInfo['title'].$sessionName
)
.' '.$course_title.$sessionName;

@ -1341,7 +1341,7 @@ class CourseManager
course.*,
course.id AS c_id
'.$injectExtraFields.'
session.name as session_name
session.title as session_name
';
if ($return_count) {
$sql = ' SELECT COUNT(user.id) as count';

@ -44,7 +44,7 @@ class GlossaryManager
foreach ($glossaries as $item) {
$glossaryData[] = [
'id' => $item->getIid(),
'name' => $item->getTitle(),
'title' => $item->getTitle(),
'description' => $item->getDescription(),
];
}
@ -57,7 +57,7 @@ class GlossaryManager
$sql_filter = api_get_session_condition($session_id);
$course_id = api_get_course_int_id();
$sql = "SELECT glossary_id as id, name, description
$sql = "SELECT glossary_id as id, title, description
FROM $table
WHERE c_id = $course_id $sql_filter";
$rs = Database::query($sql);
@ -165,7 +165,7 @@ class GlossaryManager
*/
public static function save_glossary($values, $showMessage = true)
{
if (!is_array($values) || !isset($values['name'])) {
if (!is_array($values) || !isset($values['title'])) {
return false;
}
@ -173,7 +173,7 @@ class GlossaryManager
$max_glossary_item = self::get_max_glossary_item();
// check if the glossary term already exists
if (self::glossary_exists($values['name'])) {
if (self::glossary_exists($values['title'])) {
// display the feedback message
if ($showMessage) {
Display::addFlash(
@ -192,7 +192,7 @@ class GlossaryManager
$sessionId = api_get_session_id();
$glossary
->setTitle($values['name'])
->setTitle($values['title'])
->setDescription($values['description'])
->setDisplayOrder($max_glossary_item + 1)
;
@ -232,7 +232,7 @@ class GlossaryManager
*/
// check if the glossary term already exists
if (self::glossary_exists($values['name'], $values['glossary_id'])) {
if (self::glossary_exists($values['title'], $values['glossary_id'])) {
// display the feedback message
if ($showMessage) {
Display::addFlash(
@ -251,14 +251,14 @@ class GlossaryManager
$glossary = $repo->find($values['glossary_id']);
if (null !== $glossary) {
$glossary
->setTitle($values['name'])
->setTitle($values['title'])
->setDescription($values['description']);
$repo->update($glossary);
}
/*
$sql = "UPDATE $table SET
name = '".Database::escape_string($values['name'])."',
name = '".Database::escape_string($values['title'])."',
description = '".Database::escape_string($values['description'])."'
WHERE
c_id = $course_id AND
@ -303,7 +303,7 @@ class GlossaryManager
$findArray = [
'cId' => api_get_course_int_id(),
'sessionId' => api_get_session_id(),
'name'=>$term,
'title' => $term,
];
$glossary = $repo->findBy($findArray);
*/

@ -527,7 +527,8 @@ class GroupManager
if ($db_object) {
$result['id'] = $db_object->iid;
$result['iid'] = $db_object->iid;
$result['name'] = $db_object->title;
$result['name'] = $db_object->title; // for temporary compatibility with title - should be removed in the long run
$result['title'] = $db_object->title;
$result['status'] = $db_object->status;
$result['description'] = $db_object->description;
$result['maximum_number_of_students'] = $db_object->max_student;

@ -67,7 +67,8 @@ class SessionManager
$result = [
'id' => $session->getId(),
'session_category_id' => $session->getCategory() ? $session->getCategory()->getId() : null,
'name' => $session->getTitle(),
'name' => $session->getTitle(), // only provided for backwards compatibility - should be removed in the long run
'title' => $session->getTitle(),
'description' => $session->getDescription(),
'show_description' => $session->getShowDescription(),
'duration' => $session->getDuration(),
@ -188,7 +189,7 @@ class SessionManager
$endDate = Database::escape_string($endDate);
if (empty($name)) {
$msg = get_lang('A name is required for the session');
$msg = get_lang('A title is required for the session');
return $msg;
} elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i') &&
@ -214,14 +215,14 @@ class SessionManager
if ($name) {
$ready_to_create = true;
} else {
$msg = get_lang('Session name already exists');
$msg = get_lang('Session title already exists');
return $msg;
}
} else {
$rs = Database::query("SELECT 1 FROM $tbl_session WHERE title='".$name."'");
if (Database::num_rows($rs)) {
$msg = get_lang('Session name already exists');
$msg = get_lang('Session title already exists');
return $msg;
}
@ -375,7 +376,7 @@ class SessionManager
if (!empty($where_condition)) {
$where_condition = str_replace("( session_active = ':' )", '1=1', $where_condition);
$where_condition = str_replace('category_name', 'sc.name', $where_condition);
$where_condition = str_replace('category_name', 'sc.title', $where_condition);
$where_condition = str_replace(
["AND session_active = '1' )", " AND ( session_active = '1' )"],
[') GROUP BY s.title HAVING session_active = 1 ', " GROUP BY s.title HAVING session_active = 1 "],
@ -536,17 +537,17 @@ class SessionManager
}
$isFilteringSessionCategory = false !== strpos($where, 'category_name');
$isFilteringSessionCategoryWithName = false !== strpos($where, 'sc.name');
$isFilteringSessionCategoryWithName = false !== strpos($where, 'sc.title');
if ($isMakingOrder || $isFilteringSessionCategory || $isFilteringSessionCategoryWithName) {
$sqlInjectJoins .= " LEFT JOIN $sessionCategoryTable sc ON s.session_category_id = sc.id ";
if ($isFilteringSessionCategory) {
$where = str_replace('category_name', 'sc.name', $where);
$where = str_replace('category_name', 'sc.title', $where);
}
if ($isMakingOrder) {
$order = str_replace('category_name', 'sc.name', $order);
$order = str_replace('category_name', 'sc.title', $order);
}
}
@ -689,7 +690,7 @@ class SessionManager
$orderedCategories = [];
if (!empty($categories)) {
foreach ($categories as $category) {
$orderedCategories[$category['id']] = $category['name'];
$orderedCategories[$category['id']] = $category['title'];
}
}
$result = Database::query($query);
@ -742,7 +743,7 @@ class SessionManager
if ($extraFieldsToLoad) {
$url = api_get_path(WEB_CODE_PATH).'session/about.php?session_id='.$session['id'];
}
$session['name'] = Display::url($session['name'], $url);
$session['title'] = Display::url($session['name'], $url);
if (isset($session['session_active']) && $session['session_active'] == 1) {
$session['session_active'] = $activeIcon;
@ -885,7 +886,7 @@ class SessionManager
$orderedCategories = [];
if (!empty($categories)) {
foreach ($categories as $category) {
$orderedCategories[$category['id']] = $category['name'];
$orderedCategories[$category['id']] = $category['title'];
}
}
@ -901,7 +902,7 @@ class SessionManager
$url = api_get_path(WEB_PATH).'sessions/'.$session['id'].'/about/';
}
$session['name'] = Display::url($session['title'], $url);
$session['title'] = Display::url($session['title'], $url);
if (!empty($extraFieldsToLoad)) {
foreach ($extraFieldsToLoad as $field) {
@ -1107,7 +1108,7 @@ class SessionManager
*
* @todo fix the query
*
* @return array table with user name, lp name, progress
* @return array table with username, lp name, progress
*/
public static function get_survey_overview(
$sessionId,
@ -1216,7 +1217,7 @@ class SessionManager
* @param int $courseId
* @param array options order and limit keys
*
* @return array table with user name, lp name, progress
* @return array table with username, lp name, progress
*/
public static function get_session_progress(
$sessionId,
@ -1672,7 +1673,7 @@ class SessionManager
foreach ($data as $key => $info) {
$sql = "SELECT
name
title
FROM $sessionTable
WHERE
id = {$info['session_id']}";
@ -3442,7 +3443,7 @@ class SessionManager
{
$table = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$id = (int) $id;
$sql = "SELECT id, name, date_start, date_end
$sql = "SELECT id, title, date_start, date_end
FROM $table
WHERE id= $id";
$result = Database::query($sql);
@ -3475,7 +3476,7 @@ class SessionManager
s.id,
s.title,
s.session_category_id,
c.name as category_name,
c.title as category_name,
s.description,
s.nbr_users as users,
(SELECT COUNT(*) FROM $tbl_lp WHERE session_id = s.id) as lessons ";
@ -4890,7 +4891,7 @@ class SessionManager
return [];
}
$sql = "SELECT name, s.id
$sql = "SELECT title, s.id
FROM $table_session_course sc
INNER JOIN $table_session s
ON (sc.session_id = s.id)
@ -5162,7 +5163,7 @@ class SessionManager
$suffix = ' - '.$i;
}
$sql = 'SELECT id FROM '.$tbl_session.'
WHERE title="'.Database::escape_string($session_name).$suffix.'"';
WHERE title = "'.Database::escape_string($session_name).$suffix.'"';
$rs = Database::query($sql);
if (Database::result($rs, 0, 0)) {
$i++;
@ -7381,7 +7382,7 @@ class SessionManager
}
// Get the session list from session category and target
$sessionList = Database::select(
'id, name, access_start_date, access_end_date',
'id, title, access_start_date, access_end_date',
$sTable,
[
'where' => [
@ -7470,7 +7471,7 @@ class SessionManager
$sessionCategoryTable,
[
'where' => [
'name = ?' => $categoryName,
'title = ?' => $categoryName,
],
]
);
@ -7685,7 +7686,7 @@ class SessionManager
if (is_array($extraFieldsToInclude) && count($extraFieldsToInclude) > 0) {
$resultData = Database::select('*', $sTable, [
'where' => [
"name LIKE %?% " => $term,
"title LIKE %?% " => $term,
" OR description LIKE %?% " => $term,
" OR id IN (
SELECT item_id
@ -7698,7 +7699,7 @@ class SessionManager
} else {
$resultData = Database::select('*', $sTable, [
'where' => [
"name LIKE %?% " => $term,
"title LIKE %?% " => $term,
"OR description LIKE %?% " => $term,
],
]);
@ -7924,12 +7925,12 @@ class SessionManager
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$form->addText(
'name',
'title',
get_lang('Session name'),
true,
['maxlength' => 150, 'aria-label' => get_lang('Session name')]
);
$form->addRule('name', get_lang('Session name already exists'), 'callback', 'check_session_name');
$form->addRule('title', get_lang('Session name already exists'), 'callback', 'check_session_name');
if (!api_is_platform_admin() && api_is_teacher()) {
$form->addSelectFromCollection(
@ -9130,7 +9131,7 @@ class SessionManager
$sessions = Database::store_result($result, 'ASSOC');
foreach ($sessions as $session) {
$session_id = $session['id'];
$session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
$session['title'] = Display::url($session['title'], "resume_session.php?id_session=".$session['id']);
$session['coach_name'] = Display::url($session['coach_name'], "user_information.php?user_id=".$session['user_id']);
if (1 == $session['session_active']) {
$session['session_active'] = $acceptIcon;
@ -9451,14 +9452,14 @@ class SessionManager
if ($listCatInfo) {
$listCat[$catId] = [];
$listCat[$catId]['catSessionId'] = $catId;
$listCat[$catId]['catSessionName'] = $listCatInfo['name'];
$listCat[$catId]['catSessionName'] = $listCatInfo['title'];
$listCat[$catId]['sessionList'] = [];
}
}
$listSessionInfo = self::fetch($sessionId);
$listSessionIdName = [
'sessionId' => $sessionId,
'sessionName' => $listSessionInfo['name'],
'sessionName' => $listSessionInfo['title'],
];
$listCat[$catId]['sessionList'][] = $listSessionIdName;
}

@ -354,12 +354,12 @@ class UrlManager
$where = " WHERE $table_url_rel_usergroup.access_url_id = ".$urlId;
}
$sql = "SELECT u.id, u.name, access_url_id
$sql = "SELECT u.id, u.title, access_url_id
FROM $table_user_group u
INNER JOIN $table_url_rel_usergroup
ON $table_url_rel_usergroup.usergroup_id = u.id
$where
ORDER BY name";
ORDER BY u.title";
$result = Database::query($sql);
$courses = Database::store_result($result);
@ -393,7 +393,7 @@ class UrlManager
INNER JOIN $table_url_rel
ON $table_url_rel.course_category_id = u.id
$where
ORDER BY name";
ORDER BY u.title";
$result = Database::query($sql);
$courses = Database::store_result($result, 'ASSOC');

@ -1301,21 +1301,22 @@ class UserGroupModel extends Model
}
/**
* @param string $name
* @param string $title
*
* @return bool
* @throws Exception
*/
public function usergroup_exists($name)
public function usergroup_exists(string $title): bool
{
$name = Database::escape_string($name);
$title = Database::escape_string($title);
if ($this->getUseMultipleUrl()) {
$urlId = api_get_current_access_url_id();
$sql = "SELECT * FROM $this->table u
INNER JOIN {$this->access_url_rel_usergroup} a
ON (a.usergroup_id = u.id)
WHERE name = '".$name."' AND access_url_id = $urlId";
WHERE title = '".$title."' AND access_url_id = $urlId";
} else {
$sql = "SELECT * FROM $this->table WHERE name = '".$name."'";
$sql = "SELECT * FROM $this->table WHERE title = '".$title."'";
}
$res = Database::query($sql);
@ -1368,7 +1369,7 @@ class UserGroupModel extends Model
}
$result = Database::store_result(
Database::query("SELECT u.* FROM $sqlFrom WHERE $sqlWhere ORDER BY name $sord LIMIT $start, $limit")
Database::query("SELECT u.* FROM $sqlFrom WHERE $sqlWhere ORDER BY title $sord LIMIT $start, $limit")
);
$new_result = [];

@ -121,7 +121,7 @@ $where = '';
$rows_category_session = [];
if ((isset($_POST['CategorySessionId']) && 0 == $_POST['formSent']) || isset($_GET['id_category'])) {
$where = 'WHERE session_category_id != '.$categoryId.' OR session_category_id IS NULL';
$sql = 'SELECT id, name FROM '.$tbl_session.' WHERE session_category_id ='.$categoryId.' ORDER BY name';
$sql = 'SELECT id, title FROM '.$tbl_session.' WHERE session_category_id = '.$categoryId.' ORDER BY title';
$result = Database::query($sql);
$rows_category_session = Database::store_result($result);
}
@ -136,9 +136,9 @@ if (empty($rows_session_category)) {
if (api_get_multiple_access_url()) {
$table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
$sql = "SELECT s.id, s.name FROM $tbl_session s INNER JOIN $table_access_url_rel_session u ON s.id = u.session_id $where AND u.access_url_id = $access_url_id ORDER BY name";
$sql = "SELECT s.id, s.title FROM $tbl_session s INNER JOIN $table_access_url_rel_session u ON s.id = u.session_id $where AND u.access_url_id = $access_url_id ORDER BY title";
} else {
$sql = "SELECT id, name FROM $tbl_session $where ORDER BY name";
$sql = "SELECT id, title FROM $tbl_session $where ORDER BY title";
}
$result = Database::query($sql);
$rows_session = Database::store_result($result);
@ -188,9 +188,9 @@ if (!empty($OkMsg)) {
if (!empty($rows_session_category)) {
foreach ($rows_session_category as $category) {
if ($category['id'] == $categoryId) {
echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>';
echo '<option value="'.$category['id'].'" selected>'.$category['title'].'</option>';
} else {
echo '<option value="'.$category['id'].'">'.$category['name'].'</option>';
echo '<option value="'.$category['id'].'">'.$category['title'].'</option>';
}
}
}
@ -217,10 +217,10 @@ if (!empty($OkMsg)) {
<?php
foreach ($rows_session as $enreg) {
?>
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"';
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'], ENT_QUOTES).'"';
if (in_array($enreg['id'], $CourseList)) {
echo 'selected="selected"';
} ?>><?php echo $enreg['name']; ?></option>
} ?>><?php echo $enreg['title']; ?></option>
<?php
} ?>
</select></div>
@ -243,10 +243,10 @@ if (!empty($OkMsg)) {
<?php
foreach ($rows_category_session as $enreg) {
?>
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"';
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'], ENT_QUOTES).'"';
if (in_array($enreg['id'], $CourseList)) {
echo 'selected="selected"';
} ?>><?php echo $enreg['name']; ?></option>
} ?>><?php echo $enreg['title']; ?></option>
<?php
} ?>
</select></td>

@ -27,7 +27,7 @@ $interbreadcrumb[] = [
"name" => get_lang('Sessions categories list'),
];
$sql = "SELECT * FROM $tbl_session_category WHERE id='".$id."' ORDER BY name";
$sql = "SELECT * FROM $tbl_session_category WHERE id='".$id."' ORDER BY title";
$result = Database::query($sql);
if (!$infos = Database::fetch_array($result)) {
header('Location: session_list.php');
@ -50,7 +50,7 @@ if (!api_is_platform_admin() && !SessionManager::sessionHasSessionAdmin($id, $us
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent = 1;
$name = $_POST['name'];
$title = $_POST['name'];
$year_start = $_POST['year_start'];
$month_start = $_POST['month_start'];
$day_start = $_POST['day_start'];
@ -59,7 +59,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$day_end = $_POST['day_end'];
$return = SessionManager::edit_category_session(
$id,
$name,
$title,
$year_start,
$month_start,
$day_start,
@ -93,9 +93,9 @@ if (!empty($return)) {
<label class="col-sm-3 control-label"><?php echo get_lang('Name'); ?></label>
<div class="col-sm-6">
<input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if ($formSent) {
echo api_htmlentities($name, ENT_QUOTES);
echo api_htmlentities($title, ENT_QUOTES);
} else {
echo api_htmlentities($infos['name'], ENT_QUOTES);
echo api_htmlentities($infos['title'], ENT_QUOTES);
} ?>">
</div>
<div class="col-sm-3"></div>

@ -25,9 +25,9 @@ $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$page = isset($_GET['page']) ? (int) $_GET['page'] : null;
$action = isset($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : null;
$sort = isset($_GET['sort']) && in_array($_GET['sort'], ['name', 'nbr_session', 'date_start', 'date_end'])
$sort = isset($_GET['sort']) && in_array($_GET['sort'], ['title', 'nbr_session', 'date_start', 'date_end'])
? Security::remove_XSS($_GET['sort'])
: 'name';
: 'title';
$idChecked = isset($_REQUEST['idChecked']) ? Security::remove_XSS($_REQUEST['idChecked']) : null;
$order = isset($_REQUEST['order']) ? Security::remove_XSS($_REQUEST['order']) : 'ASC';
$keyword = isset($_REQUEST['keyword']) ? Security::remove_XSS($_REQUEST['keyword']) : null;
@ -63,9 +63,9 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
//if user is crfp admin only list its sessions
$where = null;
if (!api_is_platform_admin()) {
$where .= empty($keyword) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($keyword))."%'";
$where .= empty($keyword) ? "" : " WHERE title LIKE '%".Database::escape_string(trim($keyword))."%'";
} else {
$where .= empty($keyword) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($keyword))."%'";
$where .= empty($keyword) ? "" : " WHERE title LIKE '%".Database::escape_string(trim($keyword))."%'";
}
if (empty($where)) {
$where = " WHERE access_url_id = ".api_get_current_access_url_id()." ";
@ -109,7 +109,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
$actionsRight = '<form method="POST" action="session_category_list.php" class="form--inline">
<div class="form-group">
<input class="form-control" type="text" name="keyword" aria-label="'.get_lang('Search').'"/>
<button class="btn btn--plain" type="submit" name="name"
<button class="btn btn--plain" type="submit" name="title"
value="'.get_lang('Search').'">
<em class="fa fa-search"></em>'.get_lang('Search').'</button>
</div>
@ -159,7 +159,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
<table class="data_table" width="100%">
<tr>
<th>&nbsp;</th>
<th><a href="<?php echo api_get_self(); ?>?sort=name&order=<?php echo ('name' == $sort) ? $order
<th><a href="<?php echo api_get_self(); ?>?sort=title&order=<?php echo ('title' == $sort) ? $order
: 'ASC'; ?>"><?php echo get_lang('Category name'); ?></a></th>
<th><a href="<?php echo api_get_self(); ?>?sort=nbr_session&order=<?php echo ('nbr_session'
== $sort) ? $order : 'ASC'; ?>"><?php echo get_lang('Number sessions'); ?></a></th>
@ -190,7 +190,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
<tr class="<?php echo $i ? 'row_odd' : 'row_even'; ?>">
<td><input type="checkbox" id="idChecked_<?php echo $x; ?>" name="idChecked[]"
value="<?php echo $enreg['id']; ?>"></td>
<td><?php echo api_htmlentities($enreg['name'], ENT_QUOTES); ?></td>
<td><?php echo api_htmlentities($enreg['title'], ENT_QUOTES); ?></td>
<td><?php echo "<a href=\"session_list.php?id_category=".$enreg['id']."\">".$nb_courses
." Session(s) </a>"; ?></td>
<td><?php echo api_format_date($enreg['date_start'], DATE_FORMAT_SHORT); ?></td>
@ -274,7 +274,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
</select>
</div>
<div class="col-sm-2">
<button class="btn btn--success" type="submit" name="name" value="<?php echo get_lang('Validate'); ?>">
<button class="btn btn--success" type="submit" name="title" value="<?php echo get_lang('Validate'); ?>">
<?php echo get_lang('Validate'); ?>
</button>
</div>

@ -41,7 +41,7 @@ if (isset($_POST['formSent'])) {
if (empty($session_id)) {
$sql = "SELECT
s.id,
s.name,
s.title,
u.username,
s.access_start_date,
s.access_end_date,
@ -58,7 +58,7 @@ if (isset($_POST['formSent'])) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if (-1 != $access_url_id) {
$sql = "SELECT s.id, s.name,u.username,s.access_start_date,s.access_end_date,s.visibility,s.session_category_id
$sql = "SELECT s.id, s.title, u.username,s.access_start_date,s.access_end_date,s.visibility,s.session_category_id
FROM $tblSession s
INNER JOIN $tbl_session_rel_access_url as session_rel_url
ON (s.id= session_rel_url.session_id)
@ -72,7 +72,7 @@ if (isset($_POST['formSent'])) {
$result = Database::query($sql);
} else {
$sql = "SELECT s.id,s.name,u.username,s.access_start_date,s.access_end_date,s.visibility,s.session_category_id
$sql = "SELECT s.id, s.title,u.username,s.access_start_date,s.access_end_date,s.visibility,s.session_category_id
FROM $tblSession s
INNER JOIN $tblSessionRelUser sru
ON (s.id = sru.session_id AND sru.relation_type = ".Session::GENERAL_COACH.")
@ -119,7 +119,7 @@ if (isset($_POST['formSent'])) {
}
while ($row = Database::fetch_array($result)) {
$row['name'] = str_replace(';', ',', $row['name']);
$row['title'] = str_replace(';', ',', $row['title']);
$row['username'] = str_replace(';', ',', $row['username']);
$row['access_start_date'] = str_replace(';', ',', $row['access_start_date']);
$row['access_end_date'] = str_replace(';', ',', $row['access_end_date']);
@ -231,7 +231,7 @@ if (isset($_POST['formSent'])) {
if (in_array($file_type, ['csv', 'xls'])) {
$sessionListToExport[] = [
$row['name'],
$row['title'],
$row['username'],
$row['access_start_date'],
$row['access_end_date'],
@ -242,7 +242,7 @@ if (isset($_POST['formSent'])) {
];
} else {
$add = "\t<Session>\n"
."\t\t<SessionName>$row[name]</SessionName>\n"
."\t\t<SessionName>$row[title]</SessionName>\n"
."\t\t<Coach>$row[username]</Coach>\n"
."\t\t<DateStart>$row[access_start_date]</DateStart>\n"
."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n"
@ -278,21 +278,21 @@ if (isset($_POST['formSent'])) {
Display::display_header($tool_name);
//select of sessions
$sql = "SELECT id, name FROM $tblSession ORDER BY name";
$sql = "SELECT id, title FROM $tblSession ORDER BY title";
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if (-1 != $access_url_id) {
$sql = "SELECT s.id, name FROM $tblSession s
$sql = "SELECT s.id, title FROM $tblSession s
INNER JOIN $tbl_session_rel_access_url as session_rel_url
ON (s.id = session_rel_url.session_id)
WHERE access_url_id = $access_url_id
ORDER BY name";
ORDER BY title";
}
}
$result = Database::query($sql);
$Sessions = Database::store_result($result);
$sessions = Database::store_result($result);
$actions = '<a href="../session/session_list.php">'.
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Session list')).'</a>';
@ -310,8 +310,8 @@ $form->addElement('radio', 'file_type', null, 'XML', 'xml', null, ['id' => 'file
$options = [];
$options['0'] = get_lang('All the sessions');
foreach ($Sessions as $enreg) {
$options[$enreg['id']] = $enreg['name'];
foreach ($sessions as $enreg) {
$options[$enreg['id']] = $enreg['title'];
}
$form->addSelect('session_id', get_lang('Choose the session to export'), $options);

@ -264,7 +264,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$suffix = ' - '.$i;
}
$sql = 'SELECT id FROM '.$tblSession.'
WHERE name="'.Database::escape_string($sessionName.$suffix).'"';
WHERE title = "'.Database::escape_string($sessionName.$suffix).'"';
$rs = Database::query($sql);
if (Database::result($rs, 0, 0)) {
$i++;
@ -276,7 +276,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
// Creating the session.
$sqlSession = "INSERT IGNORE INTO $tblSession SET
name = '".Database::escape_string($sessionName)."',
title = '".Database::escape_string($sessionName)."',
access_start_date = '$dStart',
access_end_date = '$dateEnd',
visibility = '$visibilityAfterExpirationPerSession',
@ -315,7 +315,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
if (false === $mySessionResult) {
// Creating the session.
$sqlSession = "INSERT IGNORE INTO $tblSession SET
name = '".Database::escape_string($sessionName)."',
title = '".Database::escape_string($sessionName)."',
access_start_date = '$dStart',
access_end_date = '$dateEnd',
visibility = '$visibilityAfterExpirationPerSession',
@ -355,9 +355,9 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
access_end_date = '$dateEnd',
visibility = '$visibilityAfterExpirationPerSession',
session_category_id = '$sessionCategoryId'
WHERE name = '$sessionName'";
WHERE title = '$sessionName'";
$rsSession = Database::query($sqlSession);
$sessionId = Database::query("SELECT id FROM $tblSession WHERE name='$sessionName'");
$sessionId = Database::query("SELECT id FROM $tblSession WHERE title='$sessionName'");
[$sessionId] = Database::fetch_array($sessionId);
Database::query("DELETE FROM $tblSessionUser WHERE session_id ='$sessionId'");
Database::query("DELETE FROM $tblSessionCourse WHERE session_id='$sessionId'");

@ -4005,7 +4005,7 @@ function WSCreateSession($params)
$orig_session_id_value = [];
foreach ($sessions_params as $session_param) {
$name = trim($session_param['name']);
$name = trim($session_param['title']);
$year_start = intval($session_param['year_start']);
$month_start = intval($session_param['month_start']);
$day_start = intval($session_param['day_start']);
@ -4074,7 +4074,7 @@ function WSCreateSession($params)
}
continue;
} else {
$rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".addslashes($name)."'");
$rs = Database::query("SELECT 1 FROM $tbl_session WHERE title = '".addslashes($name)."'");
if (Database::num_rows($rs)) {
if ($debug) {
error_log("Session with name '$name' already exists");
@ -6242,8 +6242,8 @@ function WSListCourses($params)
} else {
$category = CourseManager::get_course_category($course['category_code']);
if ($category) {
$category_names[$course['category_code']] = $category['name'];
$course_tmp['category_name'] = $category['name'];
$category_names[$course['category_code']] = $category['title'];
$course_tmp['category_name'] = $category['title'];
}
}
@ -6432,7 +6432,7 @@ function WSListSessions($params)
foreach ($sessions_list as $session) {
$return_list[] = [
'id' => $session['id'],
'title' => $session['name'],
'title' => $session['title'],
// something like http://my.chamilo.net/main/session/index.php?session_id=5
'url' => api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session['id'],
'date_start' => $session['access_start_date'],
@ -6826,7 +6826,7 @@ function WSCreateGroup($params)
}
$userGroup = new UserGroupModel();
$params = [
'name' => $params['name'],
'title' => $params['name'],
];
return $userGroup->save($params);

Loading…
Cancel
Save