Merge branch '1.10.x' of https://github.com/chamilo/chamilo-lms into 1.10.x

1.10.x
Angel Fernando Quiroz Campos 9 years ago
commit 84ee742b46
  1. 3
      app/Resources/public/css/base.css
  2. 7
      main/admin/settings.lib.php
  3. 6
      main/auth/profile.php
  4. 7
      main/document/document.php
  5. 10
      main/forum/forumfunction.inc.php
  6. 2
      main/inc/lib/agenda.lib.php
  7. 2
      main/inc/lib/api.lib.php
  8. 1
      main/inc/lib/course.lib.php
  9. 6
      main/inc/lib/course_category.lib.php
  10. 2
      main/inc/lib/course_home.lib.php
  11. 2
      main/inc/lib/sessionmanager.lib.php
  12. 1
      main/install/install.lib.php
  13. 1
      main/lang/english/trad4all.inc.php
  14. 1
      main/lang/french/trad4all.inc.php
  15. 1
      main/lang/spanish/trad4all.inc.php
  16. 16
      main/newscorm/learnpath.class.php
  17. 6
      main/social/my_skills_report.php
  18. 15
      main/user/user.php
  19. 103
      main/webservices/registration.soap.php
  20. 168
      main/webservices/soap_session.php
  21. 91
      main/webservices/webservice_session.php

@ -5206,6 +5206,9 @@ div#chat-remote-video video {
.ui-jqgrid .ui-jqgrid-htable th div{
height: 25px;
}
.ui-jqgrid .ui-jqgrid-htable th {
height: 35px;
}
.ui-jqgrid .ui-state-highlight, .ui-jqgrid .ui-widget-content .ui-state-highlight,.ui-jqgrid .ui-widget-header .ui-state-highlight{
background: #F7F7F7;
}

@ -1033,12 +1033,7 @@ function add_edit_template() {
$max_width_for_picture = 100;
if ($picture_info['width'] > $max_width_for_picture) {
$thumbwidth = $max_width_for_picture;
if (empty($thumbwidth) || $thumbwidth == 0) {
$thumbwidth = $max_width_for_picture;
}
$new_height = round(($thumbwidth / $picture_info['width']) * $picture_info['height']);
$temp->resize($thumbwidth, $new_height, 0);
$temp->resize($max_width_for_picture);
}
$temp->send_image($upload_dir.$new_file_name);
}

@ -500,8 +500,10 @@ if ($form->validate()) {
$validPassword = false;
$passwordWasChecked = false;
if ($user &&
!empty($user_data['password0']) &&
!empty($user_data['password1'])
(!empty($user_data['password0']) &&
!empty($user_data['password1'])) ||
(!empty($user_data['password0']) &&
api_get_setting('profile', 'email') == 'true')
) {
$passwordWasChecked = true;
$validPassword = UserManager::isPasswordValid(

@ -1417,12 +1417,7 @@ if ($is_allowed_to_edit ||
$max_width_for_picture = 100;
if ($picture_info['width'] > $max_width_for_picture) {
$thumbwidth = $max_width_for_picture;
if (empty($thumbwidth) || $thumbwidth == 0) {
$thumbwidth = $max_width_for_picture;
}
$new_height = round(($thumbwidth / $picture_info['width']) * $picture_info['height']);
$temp->resize($thumbwidth, $new_height, 0);
$temp->resize($max_width_for_picture);
}
$temp->send_image($upload_dir.$new_file_name);
}

@ -1464,6 +1464,8 @@ function get_forums(
} else {
$session_id = $sessionId;
}
$sessionIdLink = ($session_id === 0) ? '' : 'AND threads.session_id = item_properties.session_id';
$condition_session = api_get_session_condition(
$session_id,
@ -1503,8 +1505,8 @@ function get_forums(
INNER JOIN ".$table_item_property." item_properties
ON (
threads.thread_id=item_properties.ref AND
threads.c_id = item_properties.c_id AND
threads.session_id = item_properties.session_id
threads.c_id = item_properties.c_id
$sessionIdLink
)
WHERE
item_properties.visibility=1 AND
@ -1552,8 +1554,8 @@ function get_forums(
INNER JOIN ".$table_item_property." item_properties
ON (
threads.thread_id=item_properties.ref AND
threads.c_id = item_properties.c_id AND
threads.session_id = item_properties.session_id
threads.c_id = item_properties.c_id
$sessionIdLink
)
WHERE
item_properties.visibility<>2 AND

@ -1602,7 +1602,7 @@ class Agenda
$user_to_array = $items['users'];
$event = array();
$event['id'] = 'course_'.$row['id'];
$event['unique_id'] = 'course_'.$row['id'].intval($row['session_id']);
$event['unique_id'] = $row['iid'];
// To avoid doubles
if (in_array($event['unique_id'], $eventsAdded)) {

@ -1902,7 +1902,7 @@ function api_format_course_array($course_data)
if (array_key_exists('add_teachers_to_sessions_courses', $course_data)) {
$_course['add_teachers_to_sessions_courses'] = $course_data['add_teachers_to_sessions_courses'];
}
if (file_exists(api_get_path(SYS_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png')) {
$url_image = api_get_path(WEB_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png';
} else {

@ -3274,7 +3274,6 @@ class CourseManager
$html .= $params['icon'];
$html .= '</div>';
}
$html .= '</div>';
$notifications = isset($params['notifications']) ? $params['notifications'] : '';
$param_class = isset($params['class']) ? $params['class'] : '';

@ -134,7 +134,7 @@ function addNode($code, $name, $canHaveCourses, $parent_id)
$params = [
'name' => $name,
'code' => $code,
'parent_id' => empty($parent_id) ? '' : $parent_id,
'parent_id' => empty($parent_id) ? null : $parent_id,
'tree_pos' => $tree_pos,
'children_count' => 0,
'auth_course_child' => $canHaveCourses,
@ -595,7 +595,7 @@ function countCoursesInCategory($category_code="", $searchTerm = '')
$without_special_courses = '';
if (!empty($specialCourseList)) {
$without_special_courses = ' AND course.code NOT IN (' . implode(',', $specialCourseList) . ')';
$without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
}
$visibilityCondition = null;
@ -668,7 +668,7 @@ function browseCoursesInCategory($category_code, $random_value = null, $limit =
$without_special_courses = '';
if (!empty($specialCourseList)) {
$without_special_courses = ' AND course.code NOT IN (' . implode(',', $specialCourseList) . ')';
$without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
}
$visibilityCondition = null;
$hidePrivate = api_get_setting('course_catalog_hide_private');

@ -786,7 +786,7 @@ class CourseHome
$tool['link'] = $web_code_path.$tool['link'];
}
if ($tool['visibility'] == '0' && $toolAdmin != '1' && !isset($tool['original_link'])) {
if ($tool['visibility'] == '0' && $toolAdmin != '1') {
$class = 'invisible';
$info = pathinfo($tool['image']);
$basename = basename($tool['image'], '.'.$info['extension']); // $file is set to "index"

@ -1831,7 +1831,7 @@ class SessionManager
return false;
}
$courseId = $courseInfo['real_id'];
is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo;
$statusCondition = null;
if (isset($status) && !is_null($status)) {

@ -1391,7 +1391,6 @@ function display_database_settings_form(
//Database Name fix replace weird chars
if ($installType != INSTALL_TYPE_UPDATE) {
$dbNameForm = str_replace(array('-','*', '$', ' ', '.'), '', $dbNameForm);
$dbNameForm = api_replace_dangerous_char($dbNameForm);
}
displayDatabaseParameter(

@ -7579,4 +7579,5 @@ $AverageRatingX = "Average rating %s";
$AverageRating = "Average rating";
$GradebookTeacherResultsNotShown = "Teachers results are not shown nor taken into account in the gradebook.";
$SocialWallWriteNewPostToFriend = "Write something on your friend's wall";
$EmptyTemplate = "Blank template";
?>

@ -7566,4 +7566,5 @@ $AverageRatingX = "Score moyen: %s";
$AverageRating = "Score moyen";
$GradebookTeacherResultsNotShown = "Les résultats des enseignants ne sont pas affichés ni pris en compte dans l'outil d'évaluations.";
$SocialWallWriteNewPostToFriend = "Écris quelque chose d'intéressant sur le mur de ton ami...";
$EmptyTemplate = "Modèle blanc";
?>

@ -7604,4 +7604,5 @@ $AverageRatingX = "Promedio de la valoración %s";
$AverageRating = "Promedio de la valoración";
$GradebookTeacherResultsNotShown = "Los resultados de los profesores no se muestran ni están tomados en cuenta en los cálculos de la herramienta de evaluaciones.";
$SocialWallWriteNewPostToFriend = "Escribe algo interesante en el muro de tu amigo...";
$EmptyTemplate = "Plantilla vacía";
?>

@ -9753,19 +9753,7 @@ EOD;
// Resize the image.
$temp = new Image($image_array['tmp_name']);
$picture_infos = $temp->get_image_info();
if ($picture_infos['width'] > 104) {
$thumbwidth = 104;
} else {
$thumbwidth = $picture_infos['width'];
}
if ($picture_infos['height'] > 96) {
$new_height = 96;
} else {
$new_height = $picture_infos['height'];
}
$temp->resize($thumbwidth, $new_height, 0);
$temp->resize(104);
$result = $temp->send_image($new_path);
// Storing the image filename.
@ -9774,7 +9762,7 @@ EOD;
$this->set_preview_image($new_file_name);
//Resize to 64px to use on course homepage
$temp->resize(64, 64, 0);
$temp->resize(64);
$temp->send_image($updir.'/'.$filename.'.64.'.$file_extension);
return true;
}

@ -55,7 +55,7 @@ if ($isStudent) {
if (!file_exists($thumbSysPath)) {
$courseImageThumb = new Image($imageSysPath);
$courseImageThumb->resize(32, 32, 0);
$courseImageThumb->resize(32);
$courseImageThumb->send_image($thumbSysPath);
}
$tableRow['courseImage'] = $thumbWebPath;
@ -100,7 +100,7 @@ if ($isStudent) {
if (!file_exists($thumbSysPath)) {
$courseImageThumb = new Image($imageSysPath);
$courseImageThumb->resize(32, 32, 0);
$courseImageThumb->resize(32);
$courseImageThumb->send_image($thumbSysPath);
}
$tableRow['courseImage'] = $thumbWebPath;
@ -167,7 +167,7 @@ if ($isStudent) {
if (!file_exists($thumbSysPath)) {
$courseImageThumb = new Image($imageSysPath);
$courseImageThumb->resize(32, 32, 0);
$courseImageThumb->resize(32);
$courseImageThumb->send_image($thumbSysPath);
}

@ -259,11 +259,8 @@ if (api_is_allowed_to_edit(null, true)) {
$data[] = $user;
if ($_GET['format'] == 'pdf') {
$user_info = api_get_user_info($user['user_id']);
$user_image = Display::img(
$user_info['avatar_no_query'],
null,
array('width' => $user_image_pdf_size.'px')
);
$user_image = '<img src="'.$user_info['avatar'].'" width ="'.$user_image_pdf_size.'px" />';
if ($is_western_name_order) {
$user_pdf = array(
$counter,
@ -349,11 +346,8 @@ if (api_is_allowed_to_edit(null, true)) {
}
if ($_GET['format'] == 'pdf') {
$user_info = api_get_user_info($user['user_id']);
$user_image = Display::img(
$user_info['avatar_no_query'],
null,
array('width' => $user_image_pdf_size.'px')
);
$user_image = '<img src="'.$user_info['avatar'].'" width ="'.$user_image_pdf_size.'px" />';
if ($is_western_name_order) {
$user_pdf = array(
@ -412,6 +406,7 @@ if (api_is_allowed_to_edit(null, true)) {
'pdf_title' => $pdfTitle,
'header_attributes' => $header_attributes
);
Export::export_table_pdf($a_users, $params);
exit;
}

@ -969,6 +969,109 @@ function WSCreateUsersPasswordCrypted($params)
return $output;
}
// Subscribe / Unsubscribe Teacher to Session Course
//
// Prepare Input params for Subscribe Teacher to SC
$server->wsdl->addComplexType(
'SubscribeTeacherToSessionCourse',
'complexType',
'struct',
'all',
'',
array(
'userId' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id
'sessionId' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID
'courseId' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
)
);
$server->register(
'WSSubscribeTeacherToSessionCourse',
array('SubscribeTeacherToSessionCourse' => 'tns:SubscribeTeacherToSessionCourse'),
array('return' => 'xsd:string'),
'urn:WSRegistration',
'urn:WSRegistration#WSSubscribeTeacherToSessionCourse',
'rpc',
'encoded',
'This webservice subscribe a teacher to a session course'
);
// Prepare Input params for Unsubscribe Teacher from SC
$server->wsdl->addComplexType(
'UnsubscribeTeacherFromSessionCourse',
'complexType',
'struct',
'all',
'',
array(
'userId' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id
'sessionId' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID
'courseId' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
)
);
$server->register(
'WSUnsubscribeTeacherFromSessionCourse',
array('UnsubscribeTeacherFromSessionCourse' => 'tns:UnsubscribeTeacherFromSessionCourse'),
array('return' => 'xsd:string'),
'urn:WSRegistration',
'urn:WSRegistration#WSUnsubscribeTeacherFromSessionCourse',
'rpc',
'encoded',
'This webservice unsubscribe a teacher from a session course'
);
/**
* Subscribe teacher to a session course
*
* @param array $params - WSFunction parameters (include VerifyKey)
* @return bool|null|soap_fault A simple boolean (true if teacher successful subscribed, false otherwise)
*/
function WSSubscribeTeacherToSessionCourse($params)
{
global $debug;
if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
if ($debug) error_log('Params '. print_r($params, 1));
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$userId = $params['userId']; // Chamilo user Id
$sessionId = $params['sessionId']; // Current Session course ID
$courseId = $params['courseId']; // Course Real Id
return (SessionManager::set_coach_to_course_session($userId, $sessionId, $courseId));
}
/**
* Subscribe teacher to a session course
*
* @param array $params - WSFunction parameters (include VerifyKey)
* @return bool|null|soap_fault A simple boolean (true if teacher successful unsubscribed, false otherwise)
*/
function WSUnsubscribeTeacherFromSessionCourse($params)
{
global $debug;
if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
if ($debug) error_log('Params '. print_r($params, 1));
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$userId = $params['userId']; // Chamilo user Id
$sessionId = $params['sessionId']; // Current Session course ID
$courseId = $params['courseId']; // Course Real Id
return (SessionManager::removeUsersFromCourseSession($userId, $sessionId, $courseId));
}
/* Register WSCreateUserPasswordCrypted function */
// Register the data structures used by the service

@ -11,93 +11,119 @@ require_once(dirname(__FILE__).'/soap.php');
$s = WSSoapServer::singleton();
$s->register(
'WSSession.CreateSession',
array(
'secret_key' => 'xsd:string',
'name' => 'xsd:string',
'start_date' => 'xsd:string',
'end_date' => 'xsd:string',
'nb_days_access_before' => 'xsd:int',
'nb_days_access_after' => 'xsd:int',
'nolimit' => 'xsd:int',
'visibility' => 'xsd:int',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string',
'extras' => 'tns:extra_field'
),
array('return' => 'xsd:int')
'WSSession.CreateSession',
array(
'secret_key' => 'xsd:string',
'name' => 'xsd:string',
'start_date' => 'xsd:string',
'end_date' => 'xsd:string',
'nb_days_access_before' => 'xsd:int',
'nb_days_access_after' => 'xsd:int',
'nolimit' => 'xsd:int',
'visibility' => 'xsd:int',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string',
'extras' => 'tns:extra_field'
),
array('return' => 'xsd:int')
);
$s->register(
'WSSession.DeleteSession',
array(
'secret_key' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
'WSSession.DeleteSession',
array(
'secret_key' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
);
$s->register(
'WSSession.EditSession',
array(
'secret_key' => 'xsd:string',
'name' => 'xsd:string',
'start_date' => 'xsd:string',
'end_date' => 'xsd:string',
'nb_days_access_before' => 'xsd:int',
'nb_days_access_after' => 'xsd:int',
'nolimit' => 'xsd:int',
'visibility' => 'xsd:int',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string',
'extras' => 'tns:extra_field'
)
'WSSession.EditSession',
array(
'secret_key' => 'xsd:string',
'name' => 'xsd:string',
'start_date' => 'xsd:string',
'end_date' => 'xsd:string',
'nb_days_access_before' => 'xsd:int',
'nb_days_access_after' => 'xsd:int',
'nolimit' => 'xsd:int',
'visibility' => 'xsd:int',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string',
'extras' => 'tns:extra_field'
)
);
$s->register(
'WSSession.SubscribeUserToSession',
array(
'secret_key' => 'xsd:string',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
'WSSession.SubscribeUserToSession',
array(
'secret_key' => 'xsd:string',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
);
$s->register(
'WSSession.UnsubscribeUserFromSession',
array(
'secret_key' => 'xsd:string',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
'WSSession.UnsubscribeUserFromSession',
array(
'secret_key' => 'xsd:string',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
);
$s->register(
'WSSession.SubscribeCourseToSession',
array(
'secret_key' => 'xsd:string',
'course_id_field_name' => 'xsd:string',
'course_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
'WSSession.SubscribeTeacherToSessionCourse',
array(
'secret_key' => 'xsd:string',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string',
'course_id_field_name' => 'xsd:string',
'course_id_value' => 'xsd:string'
)
);
$s->register(
'WSSession.UnsubscribeCourseFromSession',
array(
'secret_key' => 'xsd:string',
'course_id_field_name' => 'xsd:string',
'course_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
'WSSession.UnsubscribeTeacherFromSessionCourse',
array(
'secret_key' => 'xsd:string',
'user_id_field_name' => 'xsd:string',
'user_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string',
'course_id_field_name' => 'xsd:string',
'course_id_value' => 'xsd:string'
)
);
$s->register(
'WSSession.SubscribeCourseToSession',
array(
'secret_key' => 'xsd:string',
'course_id_field_name' => 'xsd:string',
'course_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
);
$s->register(
'WSSession.UnsubscribeCourseFromSession',
array(
'secret_key' => 'xsd:string',
'course_id_field_name' => 'xsd:string',
'course_id_value' => 'xsd:string',
'session_id_field_name' => 'xsd:string',
'session_id_value' => 'xsd:string'
)
);

@ -355,8 +355,97 @@ class WSSession extends WS
}
}
}
/**
* Change Teacher subscription (helper method)
*
* @param string User id field name
* @param string User id value
* @param string Session id field name
* @param string Session id value
* @param string Course id field name
* @param string Course id value
* @param int State (1 to subscribe, 0 to unsubscribe)
* @return mixed True on success, WSError otherwise
*/
protected function changeTeacherSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $course_id_field_name, $course_id_value, $state)
{
$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
if ($session_id instanceof WSError) {
return $session_id;
} else {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if ($user_id instanceof WSError) {
return $user_id;
} else {
$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
if ($course_id instanceof WSError) {
return $course_id;
} else {
if ($state == 1) {
SessionManager::set_coach_to_course_session($user_id, $session_id, $course_id);
} else {
$user_id = array (0 => $user_id);
$result = SessionManager::removeUsersFromCourseSession($user_id, $session_id, $course_id);
if (!$result) {
return new WSError(303, 'There was an error unsubscribing this Teacher from the session');
}
}
return true;
}
}
}
}
/**
/**
* Subscribe teacher to a session course
*
* @param string API secret key
* @param string User id field name
* @param string User id value
* @param string Session id field name
* @param string Session id value
* @param string Course id field name
* @param string Course id value
*/
public function SubscribeTeacherToSessionCourse($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $course_id_field_name, $course_id_value)
{
$verifKey = $this->verifyKey($secret_key);
if ($verifKey instanceof WSError) {
$this->handleError($verifKey);
} else {
$result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $course_id_field_name, $course_id_value, 1);
if ($result instanceof WSError) {
$this->handleError($result);
}
}
}
/**
* Subscribe teacher to a session course
*
* @param string API secret key
* @param string User id field name
* @param string User id value
* @param string Session id field name
* @param string Session id value
* @param string Course id field name
* @param string Course id value
*/
public function UnsubscribeTeacherFromSessionCourse($secret_key, $user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $course_id_field_name, $course_id_value)
{
$verifKey = $this->verifyKey($secret_key);
if ($verifKey instanceof WSError) {
$this->handleError($verifKey);
} else {
$result = $this->changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $course_id_field_name, $course_id_value, 0);
if ($result instanceof WSError) {
$this->handleError($result);
}
}
}
/**
* Change course subscription
*
* @param string Course id field name

Loading…
Cancel
Save