1.10.x
Yannick Warnier 10 years ago
commit 2d5aae849f
  1. 11
      main/admin/resume_session.php
  2. 23
      main/admin/session_add.php
  3. 37
      main/admin/session_edit.php
  4. 7
      main/auth/courses_controller.php
  5. 15
      main/inc/ajax/session.ajax.php
  6. 2
      main/inc/lib/auth.lib.php
  7. 2
      main/inc/lib/course.lib.php
  8. 5
      main/inc/lib/display.lib.php
  9. 79
      main/inc/lib/sessionmanager.lib.php
  10. 3
      main/inc/lib/userportal.lib.php
  11. 5
      main/install/db_main.sql
  12. 5
      main/install/migrate-db-1.9.0-1.10.0-pre.sql
  13. 12
      main/session/index.php
  14. 17
      main/template/default/auth/sessions_catalog.tpl
  15. 2
      vendor/autoload.php
  16. 10
      vendor/composer/autoload_real.php

@ -51,7 +51,8 @@ $sql = 'SELECT
nb_days_access_before_beginning,
nb_days_access_after_end,
session_category_id,
visibility
visibility,
show_description, description
FROM '.$tbl_session.'
LEFT JOIN '.$tbl_user.'
ON id_coach = user_id
@ -244,6 +245,14 @@ if (SessionManager::durationPerUserIsEnabled()) {
}
?>
<tr>
<td><?php echo get_lang('Description'); ?></td>
<td><?php echo $session['description'] ?></td>
</tr>
<tr>
<td><?php echo get_lang('ShowDescription'); ?></td>
<td><?php echo $session['show_description'] == 1 ? get_lang('Yes') : get_lang('No') ?></td>
</tr>
</table>
<br />

@ -112,6 +112,8 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$end_limit = $_POST['end_limit'];
$start_limit = $_POST['start_limit'];
$duration = isset($_POST['duration']) ? $_POST['duration'] : null;
$description = isset($_POST['description']) ? $_POST['description'] : null;
$showDescription = isset($_POST['show_description']) ? 1 : 0;
if (empty($end_limit) && empty($start_limit)) {
$nolimit = 1;
@ -134,8 +136,11 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$id_session_category,
$id_visibility,
$start_limit,
false,
$end_limit,
$duration
$duration,
$description,
$showDescription
);
if ($return == strval(intval($return))) {
@ -227,6 +232,22 @@ $Categories = SessionManager::get_all_session_category();
?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="description"><?php echo get_lang('Description') ?></label>
<div class="controls">
<?php $fckEditor = new FCKeditor('description'); ?>
<?php $fckEditor->ToolbarSet = 'TrainingDescription'; ?>
<?php echo $fckEditor->CreateHtml(); ?>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input id="show_description" type="checkbox" name="show_description" />
<?php echo get_lang('ShowDescription') ?>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">
<?php echo get_lang('SessionCategory') ?>

@ -161,6 +161,23 @@ if (!empty($return)) {
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="description"><?php echo get_lang('Description') ?></label>
<div class="controls">
<?php $fckEditor = new FCKeditor('description'); ?>
<?php $fckEditor->ToolbarSet = 'TrainingDescription'; ?>
<?php $fckEditor->Value = $infos['description'] ; ?>
<?php echo $fckEditor->CreateHtml(); ?>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input id="show_description" type="checkbox" name="show_description" <?php echo $showDescriptionChecked ?> />
<?php echo get_lang('ShowDescription') ?>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">
<?php echo get_lang('SessionCategory') ?>
@ -367,26 +384,6 @@ if (!empty($return)) {
</div>
</div>
<?php if (array_key_exists('show_description', $infos)) { ?>
<div class="control-group">
<div class="controls">
<?php echo get_lang('Description') ?> <br />
<textarea name="description"><?php echo $infos['description']; ?></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<label>
<input id="show_description" type="checkbox" name="show_description" <?php echo $showDescriptionChecked ?> />
<?php echo get_lang('ShowDescription') ?>
</label>
</div>
</div>
<?php } ?>
<?php
if (SessionManager::durationPerUserIsEnabled()) {
if (empty($infos['duration'])) {

@ -547,7 +547,7 @@ class CoursesController
$courseUrl = getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe');
foreach ($sessions as $session) {
$sessionsBlocks[] = array(
$sessionsBlock = array(
'id' => $session['id'],
'name' => $session['name'],
'nbr_courses' => $session['nbr_courses'],
@ -556,8 +556,11 @@ class CoursesController
'is_subscribed' => $session['is_subscribed'],
'icon' => $this->getSessionIcon($session['name']),
'date' => SessionManager::getSessionFormattedDate($session),
'subscribe_button' => $this->getRegisterInSessionButton($session['name'])
'subscribe_button' => $this->getRegisterInSessionButton($session['name']),
'showDescription' => $session['show_description']
);
$sessionsBlocks[] = $sessionsBlock;
}
$tpl = new Template();

@ -3,7 +3,6 @@
/**
* Responses to AJAX calls
*/
$language_file[] = 'admin';
require_once '../global.inc.php';
@ -107,6 +106,20 @@ switch ($action) {
}
}
break;
case 'get_description':
$sessionId = intval($_GET['session']);
$sessionInfo = api_get_session_info($sessionId);
?>
<h2><?php echo $sessionInfo['name'] ?></h2><br>
<div class="home-course-intro">
<div class="page-course">
<div class="page-course-intro">
<p><?php echo $sessionInfo['show_description'] == 1 ? $sessionInfo['description'] : get_lang('None') ?></p>
</div>
</div>
</div>
<?php
default:
echo '';
}

@ -607,7 +607,7 @@ class Auth
$userId = api_get_user_id();
$limitFilter = getLimitFilterFromArray($limit);
$sql = "SELECT s.id, s.name, s.nbr_courses, s.nbr_users, s.date_start, s.date_end, u.lastname, u.firstname, u.username "
$sql = "SELECT s.id, s.name, s.nbr_courses, s.nbr_users, s.date_start, s.date_end, u.lastname, u.firstname, u.username, description, show_description "
. "FROM $sessionTable AS s "
. "INNER JOIN $userTable AS u "
. "ON s.id_coach = u.user_id "

@ -3561,7 +3561,7 @@ class CourseManager
$html .= '<div class="span6 '.$param_class.'">';
$html .='<h3>'.$params['title'].$notifications.'</h3> ';
if (isset($params['description'])) {
if (isset($params['show_description'], $params['description']) && $params['show_description'] == 1) {
$html .= '<p>'.$params['description'].'</p>';
}
if (!empty($params['subtitle'])) {

@ -1562,11 +1562,8 @@ class Display
$session['active'] = $active;
$session['session_category_id'] = $session_info['session_category_id'];
if (array_key_exists('show_description', $session_info)) {
if (!empty($session_info['show_description'])) {
$session['description'] = $session_info['description'];
}
}
$session['show_description'] = $session_info['show_description'];
$output = $session;
}

@ -63,6 +63,9 @@ class SessionManager
* @param string Start limit = true if the start date has to be considered
* @param string End limit = true if the end date has to be considered
* @param string $fix_name
* @param string $duration
* @param string $description Optional. The session description
* @param int $showDescription Optional. Whether show the session description
* @todo use an array to replace all this parameters or use the model.lib.php ...
* @return mixed Session ID on success, error message otherwise
* */
@ -84,7 +87,8 @@ class SessionManager
$end_limit = true,
$fix_name = false,
$duration = null,
$showDescription = null
$description = null,
$showDescription = 0
) {
global $_configuration;
@ -181,10 +185,20 @@ class SessionManager
}
if ($ready_to_create) {
$sql = "INSERT INTO $tbl_session(name,date_start,date_end,id_coach,session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id,visibility)
VALUES('" . $name . "','$date_start','$date_end','$id_coach'," . api_get_user_id() . "," . $nb_days_acess_before . ", " . $nb_days_acess_after . ", " . $id_session_category . ", " . $id_visibility . ")";
Database::query($sql);
$session_id = Database::insert_id();
$values = array(
'name' => $name,
'date_start' => $date_start,
'date_end' => $date_end,
'id_coach' => $id_coach,
'session_admin_id' => api_get_user_id(),
'nb_days_access_before_beginning' => $nb_days_acess_before,
'nb_days_access_after_end' => $nb_days_acess_after,
'session_category_id' => $id_session_category,
'visibility' => $id_visibility,
'description' => Database::escape_string($description),
'show_description' => intval($showDescription)
);
$session_id = Database::insert($tbl_session, $values);
if (self::durationPerUserIsEnabled()) {
$duration = intval($duration);
@ -204,14 +218,6 @@ class SessionManager
Database::query($sql);
}
if (!is_null($showDescription)) {
$showDescription = intval($showDescription);
$sql = "UPDATE $tbl_session
SET show_description = '$showDescription'
WHERE id = $session_id";
Database::query($sql);
}
if (!empty($session_id)) {
/*
Sends a message to the user_id = 1
@ -1361,7 +1367,7 @@ class SessionManager
$start_limit = true,
$end_limit = true,
$description = null,
$showDescription = null,
$showDescription = 0,
$duration = null
) {
$name = trim(stripslashes($name));
@ -1430,22 +1436,9 @@ class SessionManager
$msg = get_lang('SessionNameAlreadyExists');
return $msg;
} else {
$values = array();
$sessionInfo = SessionManager::fetch($id);
$descriptionCondition = null;
if (array_key_exists('description', $sessionInfo)) {
$descriptionCondition = ' description = "' . Database::escape_string($description) . '" ,';
}
$showDescriptionCondition = null;
if (array_key_exists('show_description', $sessionInfo)) {
$showDescriptionCondition = ' show_description = "' . Database::escape_string($showDescription) . '" ,';
}
$durationCondition = null;
if (self::durationPerUserIsEnabled()) {
if (empty($duration)) {
$duration = null;
} else {
@ -1454,24 +1447,24 @@ class SessionManager
$duration = intval($duration);
}
$durationCondition = ' duration = "' . $duration . '" ,';
$values['duration'] = $duration;
}
$sql = "UPDATE $tbl_session SET
name='" . Database::escape_string($name) . "',
date_start='" . $date_start . "',
date_end='" . $date_end . "',
id_coach='" . $id_coach . "',
nb_days_access_before_beginning = " . $nb_days_acess_before . ",
nb_days_access_after_end = " . $nb_days_acess_after . ",
session_category_id = " . $id_session_category . " ,
$descriptionCondition
$showDescriptionCondition
$durationCondition
visibility= " . $id_visibility . "
WHERE id='$id'";
$values['name'] = Database::escape_string($name);
$values['date_start'] = $date_start;
$values['date_end'] = $date_end;
$values['id_coach'] = $id_coach;
$values['nb_days_access_before_beginning'] = $nb_days_acess_before;
$values['nb_days_access_after_end'] = $nb_days_acess_after;
$values['session_category_id'] = $id_session_category;
$values['description'] = Database::escape_string($description);
$values['show_description'] = intval($showDescription);
$values['visibility'] = $id_visibility;
Database::update($tbl_session, $values, array(
'id = ?' => $id
));
Database::query($sql);
return $id;
}
}

@ -1146,7 +1146,8 @@ class IndexManager
// $params['extra'] .= $html_courses_session;
}
$params['description'] = isset($session_box['description']) ? $session_box['description'] : null;
$params['description'] = $session_box['description'];
$params['show_description'] = $session_box['show_description'];
$parentInfo = CourseManager::course_item_html($params, true);

@ -469,6 +469,8 @@ CREATE TABLE IF NOT EXISTS session (
visibility int NOT NULL default 1,
session_category_id int NOT NULL,
promotion_id INT NOT NULL,
description TEXT DEFAULT NULL,
show_description TINYINT UNSIGNED DEFAULT 0,
PRIMARY KEY (id),
INDEX (session_admin_id),
UNIQUE KEY name (name)
@ -877,7 +879,7 @@ VALUES
('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1),
('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1),
('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.2','DatabaseVersion','', NULL, NULL, 0);
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.3','DatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -3057,3 +3059,4 @@ CREATE TABLE IF NOT EXISTS hook_call(
PRIMARY KEY PK_hook_management_hook_call(id)
);
INSERT INTO session_field (field_type, field_variable, field_display_text, field_default_value) values (2, 'description','Description', NULL);

@ -21,8 +21,11 @@ CREATE TABLE IF NOT EXISTS hook_observer( id int UNSIGNED NOT NULL AUTO_INCREMEN
CREATE TABLE IF NOT EXISTS hook_event( id int UNSIGNED NOT NULL AUTO_INCREMENT, class_name varchar(255) UNIQUE, description varchar(255), PRIMARY KEY PK_hook_management_hook_event(id));
CREATE TABLE IF NOT EXISTS hook_call( id int UNSIGNED NOT NULL AUTO_INCREMENT, hook_event_id int UNSIGNED NOT NULL, hook_observer_id int UNSIGNED NOT NULL, type tinyint NOT NULL, hook_order int UNSIGNED NOT NULL, enabled tinyint NOT NULL, PRIMARY KEY PK_hook_management_hook_call(id));
ALTER TABLE session ADD COLUMN description TEXT DEFAULT NULL;
ALTER TABLE session ADD COLUMN show_description TINYINT UNSIGNED DEFAULT 0 AFTER description;
-- Do not move this query
UPDATE settings_current SET selected_value = '1.10.0.2' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.3' WHERE variable = 'chamilo_database_version';
-- xxCOURSExx

@ -354,6 +354,18 @@ if (!empty($start) && !empty($end)) {
echo Display::tag('h1', $session_info['name']);
echo $dates.'<br />';
if ($session_info['show_description'] == 1) {
?>
<div class="home-course-intro">
<div class="page-course">
<div class="page-course-intro">
<p><?php echo $session_info['description']; ?></p>
</div>
</div>
</div>
<?php
}
// All Learnpaths grid settings (First tab, first subtab)
$columns_courses = array(

@ -28,7 +28,7 @@
var coursesUL = '';
$.each(response, function(index, course) {
coursesUL += '<li><img src="{{ _p.web }}/main/img/check.png"/> <strong>' + course.name + '</strong>';
coursesUL += '<li><img src="{{ _p.web }}main/img/check.png"/> <strong>' + course.name + '</strong>';
if (course.coachName != '') {
coursesUL += ' (' + course.coachName + ')';
@ -96,7 +96,8 @@
<input type="date" name="date" id="date" class="span2 search-session" value="{{ searchDate }}" readonly>
<button class="btn" type="submit">{{ 'Search' | get_lang }}</button>
</div>
</form></li>
</form>
</li>
</ul>
</div>
{% endif %}
@ -114,7 +115,9 @@
</div>
<div class="span10 border-info">
<h3>{{ session.name }}</h3>
<div class="tutor"><img src="{{ _p.web }}/main/img/teachers.gif" width="16px"> {{ 'GeneralCoach' | get_lang }} {{ session.coach_name }}</div>
<div class="tutor">
<img src="{{ 'teacher.png' | icon(22) }}" width="16"> {{ 'GeneralCoach' | get_lang }} {{ session.coach_name }}
</div>
</div>
</div>
<div class="row-fluid">
@ -133,6 +136,11 @@
</div>
</div>
<div class="span3">
{% if session.showDescription %}
<div class="buttom-subscribed">
<a class="ajax btn btn-large btn-info" href="{{ _p.web_ajax }}session.ajax.php?a=get_description&session={{ session.id }}">{{ 'Description' | get_lang }}</a>
</div>
{% endif %}
<div class="buttom-subscribed">
{% if session.is_subscribed %}
@ -141,11 +149,10 @@
{{ session.subscribe_button }}
{% endif %}
</div>
<div class="time"><img src="{{ _p.web }}/main/img/agenda.gif"> {{ session.date }}</div>
<div class="time"><img src="{{ 'agenda.png' | icon(22) }}"> {{ session.date }}</div>
</div>
</div>
</div>
{% endfor %}
{{ cataloguePagination }}
</div>

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit8dc63da0bae852e2c5fe3026e05ecb41::getLoader();
return ComposerAutoloaderInit8ad7b35a03268b25720788d50c4e5355::getLoader();

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit8dc63da0bae852e2c5fe3026e05ecb41
class ComposerAutoloaderInit8ad7b35a03268b25720788d50c4e5355
{
private static $loader;
@ -19,9 +19,9 @@ class ComposerAutoloaderInit8dc63da0bae852e2c5fe3026e05ecb41
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit8dc63da0bae852e2c5fe3026e05ecb41', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit8ad7b35a03268b25720788d50c4e5355', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit8dc63da0bae852e2c5fe3026e05ecb41', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit8ad7b35a03268b25720788d50c4e5355', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@ -42,14 +42,14 @@ class ComposerAutoloaderInit8dc63da0bae852e2c5fe3026e05ecb41
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequire8dc63da0bae852e2c5fe3026e05ecb41($file);
composerRequire8ad7b35a03268b25720788d50c4e5355($file);
}
return $loader;
}
}
function composerRequire8dc63da0bae852e2c5fe3026e05ecb41($file)
function composerRequire8ad7b35a03268b25720788d50c4e5355($file)
{
require $file;
}

Loading…
Cancel
Save