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

1.10.x
Yannick Warnier 10 years ago
commit 5654d2711e
  1. 42
      app/Resources/public/css/base.css
  2. 50
      main/admin/configure_homepage.php
  3. 7
      main/auth/courses.php
  4. 183
      main/coursecopy/classes/CourseRestorer.class.php
  5. 29
      main/document/slideshow.php
  6. 3
      main/exercice/exercise_result.php
  7. 17
      main/exercice/exercise_submit.php
  8. 26
      main/inc/lib/api.lib.php
  9. 10
      main/inc/lib/auth.lib.php
  10. 4
      main/inc/lib/course_category.lib.php
  11. 27
      main/inc/lib/display.lib.php
  12. 14
      main/inc/lib/document.lib.php
  13. 15
      main/inc/lib/usergroup.lib.php
  14. 19
      main/mySpace/myStudents.php

@ -62,6 +62,37 @@ a.thumbnail:hover{
margin-left: 20px;
text-align: left;
}
.gallery .img-gallery{
height: 100%;
width: 100%;
position: absolute;
left: 0;
top: 0;
border-radius: 5px;
}
.gallery .photo{
display: block;
padding-bottom: 100%;
overflow: hidden;
}
.gallery .frame{
background-color: #eeeeee;
display: block;
width: 100%;
}
.gallery .canvas-one{
margin-bottom: 30px;
}
.gallery .canvas-two{
margin-right: 30px;
flex-shrink: 1;
-webkit-flex-shrink: 1;
-ms-flex-negative:1 ;
display: block;
position: relative;
width: 100%;
}
/*------------------------*/
.cursor-pointer {
cursor: pointer;
@ -1864,13 +1895,20 @@ div.admin_section h4 {
box-shadow: 0px 1px 1px rgba(0,0,0,0.05);
margin-bottom: 35px;
}
.question_row_score{
margin-bottom: 20px;
display: block;
}
.question_item {
height:50px;
padding:5px;
margin:10px 0px 10px 0px;
}
.question-return{
padding: 10px;
text-align: center;
margin-bottom: 20px;
}
.option_item {
width:150px;
padding:3px;

@ -74,7 +74,7 @@ $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
$tool_name = get_lang('ConfigureHomePage');
$_languages = api_get_languages();
$selfUrl = api_get_self();
$interbreadcrumb[] = array(
'url' => 'index.php',
'name' => get_lang('PlatformAdmin')
@ -464,7 +464,7 @@ if (!empty($action)) {
}
}
$class_add_in_tab = 'class="show_menu"';
if (!$add_in_tab) {
$class_add_in_tab = 'class="hide_menu"';
}
@ -472,7 +472,7 @@ if (!empty($action)) {
// If the requested action is to create a link, make some room
// for the new link in the home_menu array at the requested place
// and insert the new link there
$icon = '<em class="fa fa-external-link"></em>';
if ($action == 'insert_link' || $action == 'insert_tabs') {
for ($i = sizeof($home_menu); $i; $i--) {
if ($i > $insert_where) {
@ -481,10 +481,10 @@ if (!empty($action)) {
break;
}
}
$home_menu[$insert_where + 1] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'.$icon.' '.$link_name.'</a></li>';
$home_menu[$insert_where + 1] = '<li><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'">'. $link_name .'</a></li>';
} else {
// If the request is about a link edition, change the link
$home_menu[$link_index]='<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank?'_blank':'_self').'">'.$icon.' '.$link_name.'</a></li>';
$home_menu[$link_index]='<li><a href="'.$link_url.'" target="'.($target_blank?'_blank':'_self').'">'. $link_name .'</a></li>';
}
// Re-build the file from the home_menu array
$home_menu = implode("\n", $home_menu);
@ -546,7 +546,7 @@ if (!empty($action)) {
} //end of switch($action)
if (empty($errorMsg)) {
header('Location: '.api_get_self().'?language='.$languageGet);
header('Location: '.$selfUrl.'?language='.$languageGet);
exit();
}
} else {
@ -588,7 +588,7 @@ if (!empty($action)) {
fclose($fpo);
}
}
header('Location: '.api_get_self());
header('Location: '.$selfUrl);
exit();
break;
case 'edit_top':
@ -792,7 +792,7 @@ switch ($action) {
case 'edit_notice':
// Display for edit_notice case
?>
<form action="<?php echo api_get_self(); ?>?action=<?php echo $action; ?>" method="post" class="form-horizontal">
<form action="<?php echo $selfUrl; ?>?action=<?php echo $action; ?>" method="post" class="form-horizontal">
<legend><?php echo $tool_name; ?></legend>
<input type="hidden" name="formSent" value="1"/>
<?php
@ -847,7 +847,7 @@ switch ($action) {
Display::display_normal_message($errorMsg);
}
$default = array();
$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
$form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', array('style' => 'margin: 0px;'));
$renderer =& $form->defaultRenderer();
$form->addElement('header', '', $tool_name);
@ -942,7 +942,7 @@ switch ($action) {
$form = new FormValidator(
'configure_homepage_'.$action,
'post',
api_get_self().'?action='.$action,
$selfUrl.'?action='.$action,
'',
array('style' => 'margin: 0px;')
);
@ -1037,7 +1037,7 @@ switch ($action) {
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#notice-block" href="#notice-list" aria-expanded="true" aria-controls="notice-list">
<?php echo get_lang('Notice'); ?>
<a class="pull-right" href="<?php echo api_get_self(); ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
<a class="pull-right" href="<?php echo $selfUrl; ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
</a>
</h4>
</div>
@ -1073,8 +1073,7 @@ switch ($action) {
</div>
<div id="links-list" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); ?>
<?php echo get_lang('InsertLink'); ?>
<a href="<?php echo $selfUrl; ?>?action=insert_link"><?php echo Display::return_icon('add.png', get_lang('InsertLink')).'&nbsp;'. get_lang('InsertLink'); ?>
</a>
<ul class="menulist">
<?php
@ -1096,9 +1095,9 @@ switch ($action) {
foreach ($home_menu as $enreg) {
$enreg = trim($enreg);
if (!empty($enreg)) {
$edit_link = '<a href="'.api_get_self().'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
$delete_link = '<a href="'.api_get_self().'?action=delete_link&amp;link_index='.$i.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
echo str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', '<br />'.$edit_link.' '.$delete_link.'</li>'), $enreg);
$edit_link = '<a href="'.$selfUrl.'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.png', get_lang('Edit')).'</a>';
$delete_link = '<a href="'.$selfUrl.'?action=delete_link&amp;link_index='.$i.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>';
echo str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'), $enreg);
$i++;
}
}
@ -1112,9 +1111,8 @@ switch ($action) {
</div>
<div class="col-md-9">
<div class="actions">
<a href="<?php echo api_get_self(); ?>?action=edit_top&language=<?php echo $languageGet; ?>">
<?php echo Display::return_icon('edit.png', get_lang('EditHomePage'),null,ICON_SIZE_SMALL); ?>
<?php echo get_lang('EditHomePage'); ?>
<a href="<?php echo $selfUrl; ?>?action=edit_top&language=<?php echo $languageGet; ?>">
<?php echo Display::return_icon('edit.png', get_lang('EditHomePage'),null,ICON_SIZE_SMALL).'&nbsp;'. get_lang('EditHomePage'); ?>
</a>
</div>
<section id="homepage-home">
@ -1140,14 +1138,14 @@ switch ($action) {
if ($access_url_id == 1) {
echo '<div class="actions">';
echo '<a href="course_category.php">'.Display::return_icon('edit.png', get_lang('Edit')).get_lang('EditCategories').'</a>';
echo '<a href="course_category.php">'.Display::return_icon('edit.png', get_lang('Edit')).'&nbsp;'.get_lang('EditCategories').'</a>';
echo '</div>';
}
echo '<ul class="list-group">';
if ($access_url_id == 1) {
if (sizeof($Categories)) {
foreach ($Categories as $enreg) {
echo '<li class="list-group-item">'.Display::return_icon('folder_document.gif', $enreg['name']).'&nbsp;'.$enreg['name'].'</li>';
echo '<li class="list-group-item">'.Display::return_icon('folder.png', $enreg['name']).'&nbsp;'.$enreg['name'].'</li>';
}
unset($Categories);
} else {
@ -1195,10 +1193,10 @@ switch ($action) {
foreach ($home_menu as $enreg) {
$enreg = trim($enreg);
if (!empty($enreg)) {
$edit_link = ' <a href="'.api_get_self().'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.gif', get_lang('Edit')).'</span></a>';
$delete_link = ' <a href="'.api_get_self().'?action=delete_tabs&amp;link_index='.$tab_counter.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.gif', get_lang('Delete')).'</span></a>';
$edit_link = ' <a href="'.$selfUrl.'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.png', get_lang('Edit')).'</span></a>';
$delete_link = ' <a href="'.$selfUrl.'?action=delete_tabs&amp;link_index='.$tab_counter.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.png', get_lang('Delete')).'</span></a>';
$tab_string = str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'),
array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename(api_get_self()).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
$enreg);
$tab_string = str_replace(array('<li>', '</li>','class="hide_menu"', 'hide_menu'), '', $tab_string);
$link_list .= Display::tag('li', $tab_string, array('class' => 'list-group-item'));
@ -1207,8 +1205,8 @@ switch ($action) {
}
?>
<div class="actions">
<a href="<?php echo api_get_self(); ?>?action=insert_tabs">
<?php Display::display_icon('addd.gif', get_lang('InsertLink')); echo get_lang('InsertLink'); ?>
<a href="<?php echo $selfUrl; ?>?action=insert_tabs">
<?php echo Display::return_icon('add.png', get_lang('InsertLink')) .'&nbsp;'. get_lang('InsertLink'); ?>
</a>
</div>
<?php

@ -173,11 +173,10 @@ if (isset($_POST['unsubscribe'])) {
switch ($action) {
case 'subscribe_user_with_password':
$courses_controller->subscribe_user(
$_POST['subscribe_user_with_password'],
$_POST['search_term'],
$_POST['category_code']
isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '',
isset($_POST['search_term']) ? $_POST['search_term'] : '',
isset($_POST['category_code']) ? $_POST['category_code'] : ''
);
exit;
break;
case 'createcoursecategory':
$courses_controller->categories_list($action);

@ -82,9 +82,10 @@ class CourseRestorer
public $add_text_in_items = false;
public $destination_course_id;
/**
* Create a new CourseRestorer
*/
/**
* CourseRestorer constructor.
* @param array $course
*/
public function __construct($course)
{
$this->course = $course;
@ -97,17 +98,17 @@ class CourseRestorer
$this->file_option = FILE_RENAME;
$this->set_tools_invisible_by_default = false;
$this->skip_content = array();
}
}
/**
* Set the file-option
* @param int $option (optional) What to do with files with same name
/**
* Set the file-option
* @param int $option (optional) What to do with files with same name
* FILE_SKIP, FILE_RENAME or FILE_OVERWRITE
*/
*/
public function set_file_option($option = FILE_OVERWRITE)
{
$this->file_option = $option;
}
$this->file_option = $option;
}
/**
* @param string $status
@ -228,6 +229,8 @@ class CourseRestorer
$params['tool'] = self::DBUTF8(
$property['tool']
);
$property['insert_user_id'] = $this->checkUserId($property['insert_user_id']);
$params['insert_user_id'] = self::DBUTF8(
$property['insert_user_id']
);
@ -253,6 +256,9 @@ class CourseRestorer
$params['end_visible'] = self::DBUTF8(
$property['end_visible']
);
$property['to_user_id'] = $this->checkUserId($property['to_user_id'], true);
$params['to_user_id'] = self::DBUTF8(
$property['to_user_id']
);
@ -317,9 +323,9 @@ class CourseRestorer
$my_session_id = $session_id;
}
if ($document->file_type == FOLDER) {
$visibility = $document->item_properties[0]['visibility'];
$new = substr($document->path, 8);
if ($document->file_type == FOLDER) {
$visibility = $document->item_properties[0]['visibility'];
$new = substr($document->path, 8);
$folderList = explode('/', $new);
$tempFolder = '';
@ -411,14 +417,22 @@ class CourseRestorer
false
);
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'FolderCreated',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
@ -461,14 +475,22 @@ class CourseRestorer
}
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $document_id;
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
@ -498,14 +520,23 @@ class CourseRestorer
);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$obj->id,
'default',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
@ -547,7 +578,7 @@ class CourseRestorer
}
break;
case FILE_SKIP :
case FILE_SKIP:
$sql = "SELECT id FROM $table
WHERE
c_id = ".$this->destination_course_id." AND
@ -556,7 +587,7 @@ class CourseRestorer
$obj = Database::fetch_object($res);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;
break;
case FILE_RENAME :
case FILE_RENAME:
$i = 1;
$ext = explode('.', basename($document->path));
if (count($ext) > 1) {
@ -618,7 +649,6 @@ class CourseRestorer
$dest_document_path = $new_base_path.'/'.$document_path[2]; // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png"
$basedir_dest_path = dirname($dest_document_path); // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1"
$base_path_document = $course_path.$document_path[0]; // e.g: "/var/www/wiener/courses/CURSO4/document"
$path_title = '/'.$new_base_foldername.'/'.$document_path[2];
copy_folder_course_session(
@ -671,25 +701,31 @@ class CourseRestorer
}
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $document_id;
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
);
} else {
if (file_exists($path.$document->path)) {
copy($path.$document->path, $path.$new_file_name);
}
//Replace old course code with the new destination code see BT#1985
if (file_exists($path.$new_file_name)) {
$file_info = pathinfo($path.$new_file_name);
@ -726,14 +762,23 @@ class CourseRestorer
Database::query($sql);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $document_id;
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
@ -781,14 +826,23 @@ class CourseRestorer
}
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $document_id;
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
@ -845,21 +899,31 @@ class CourseRestorer
}
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $document_id;
$itemProperty = isset($document->item_properties[0]) ? $document->item_properties[0] : '';
$insertUserId = isset($itemProperty['insert_user_id']) ? $itemProperty['insert_user_id'] : api_get_user_id();
$toGroupId = isset($itemProperty['to_group_id']) ? $itemProperty['to_group_id'] : 0;
$toUserId = isset($itemProperty['to_user_id']) ? $itemProperty['to_user_id'] : null;
$insertUserId = $this->checkUserId($insertUserId);
$toUserId = $this->checkUserId($toUserId, true);
api_item_property_update(
$course_info,
TOOL_DOCUMENT,
$document_id,
'DocumentAdded',
$document->item_properties[0]['insert_user_id'],
$document->item_properties[0]['to_group_id'],
$document->item_properties[0]['to_user_id'],
$insertUserId,
$toGroupId,
$toUserId,
null,
null,
$my_session_id
);
} else {
//echo 'not Copying';
if (is_file($this->course->backup_path.'/'.$document->path) && is_readable($this->course->backup_path.'/'.$document->path)) {
if (is_file($this->course->backup_path.'/'.$document->path) &&
is_readable($this->course->backup_path.'/'.$document->path)
) {
error_log('Course copy generated an ignoreable error while trying to copy '.$this->course->backup_path.'/'.$document->path.': file not found');
}
if (!is_dir(dirname($path.$document->path))) {
@ -1456,9 +1520,15 @@ class CourseRestorer
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_COURSEDESCRIPTION] as $id => $cd) {
$courseDescription = (array) $cd;
$content = isset($courseDescription['content']) ? $courseDescription['content'] : '';
$descriptionType = isset($courseDescription['description_type']) ? $courseDescription['description_type'] : '';
$title = isset($courseDescription['title']) ? $courseDescription['title'] : '';
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$description_content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$cd->content,
$content,
$this->course->code,
$this->course->destination_path,
$this->course->backup_path,
@ -1471,8 +1541,8 @@ class CourseRestorer
$params['session_id'] = $session_id;
}
$params['c_id'] = $this->destination_course_id;
$params['description_type'] = self::DBUTF8($cd->description_type);
$params['title'] = self::DBUTF8($cd->title);
$params['description_type'] = self::DBUTF8($descriptionType);
$params['title'] = self::DBUTF8($title);
$params['content'] = self::DBUTF8($description_content);
$id = Database::insert($table, $params);
@ -3220,4 +3290,27 @@ class CourseRestorer
return $array;
}
}
/**
* Check if user exist otherwise use current user
* @param int $userId
* @param bool $returnNull
*
* @return int
*/
private function checkUserId($userId, $returnNull = false) {
if (!empty($userId)) {
$userInfo = api_get_user_info($userId);
if (empty($userInfo)) {
return api_get_user_id();
}
}
if ($returnNull) {
return null;
}
return $userId;
}
}

@ -169,8 +169,8 @@ if ($slide_id == 'all') {
// Config for make thumbnails
$allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
$max_thumbnail_width = 100;
$max_thumbnail_height = 100;
$max_thumbnail_width = 200;
$max_thumbnail_height = 200;
$png_compression = 0;//0(none)-9
$jpg_quality = 75;//from 0 to 100 (default is 75). More quality less compression
@ -291,7 +291,7 @@ if ($slide_id == 'all') {
$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
} else {
//if images aren't support by gd (not gif, jpg, jpeg, png)
if ($imagetype=="bmp") {
@ -326,23 +326,30 @@ if ($slide_id == 'all') {
$count_image = count($image_tag);
$number_iteration = ceil($count_image/$number_image);
$p = 0;
echo '<ul class="thumbnails">';
$html = '';
$html .= '<div class="gallery">';
for ($k = 0; $k < $number_iteration; $k++) {
for ($i = 0; $i < $number_image; $i++) {
if (isset($image_tag[$p])) {
echo '<li class="col-md-4">
<div class="thumbnail">';
echo '<a href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'.$image_tag[$p].'</a>';
echo '</div>';
echo '</li>';
$html .= '<div class="col-md-3">';
$html .= '<div class="canvas-one">';
$html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
$html .= '<div class="frame">';
$html .= '<div class="photo">';
$html .= $image_tag[$p];
$html .= '</div>';
$html .= '</div>';
$html .= '</a>';
$html .= '</div>';
$html .= '</div>';
}
$p++;
}
}
echo '</ul>';
$html .= '</div>';
}//end slide==all
echo $html;
/* ONE AT A TIME VIEW */
$course_id = api_get_course_int_id();

@ -168,12 +168,13 @@ ExerciseLib::exercise_time_control_delete(
ExerciseLib::delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
echo '<hr>';
echo '<div class="question-return">';
echo Display::url(
get_lang('ReturnToCourseHomepage'),
api_get_course_url(),
array('class' => 'btn btn-primary')
);
echo '</div>';
if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise');

@ -1097,6 +1097,11 @@ if (!empty($error)) {
// Showing the question
if (!empty($objExercise->description)){
echo Display::panel($objExercise->description, get_lang('ExerciseDescriptionLabel'));
}
echo '<div id="question_div_'.$questionId.'" class="main-question '.$remind_highlight.'" >';
// Shows the question and its answers
@ -1158,18 +1163,6 @@ if (!empty($error)) {
}
echo '</form>';
if (!empty($objExercise->description)){
echo Display::panelCollapse(
get_lang('ExerciseDescriptionLabel'),
$objExercise->description,
'exercise-description',
[],
'description',
'exercise-collapse',
false,
true
);
}
}
if ($origin != 'learnpath') {

@ -8,6 +8,8 @@
* @package chamilo.library
*/
use ChamiloSession as Session;
/**
* Constants declaration
*/
@ -18,8 +20,6 @@ define('REQUIRED_MIN_MEMORY_LIMIT', '128');
define('REQUIRED_MIN_UPLOAD_MAX_FILESIZE', '10');
define('REQUIRED_MIN_POST_MAX_SIZE', '10');
use ChamiloSession as Session;
// USER STATUS CONSTANTS
/** global status of a user: student */
define('STUDENT', 5);
@ -1629,7 +1629,7 @@ function api_get_course_int_id($code = null)
return false;
}
}
return isset($_SESSION['_real_cid']) ? intval($_SESSION['_real_cid']) : 0;
return Session::read('_real_cid', 0);
}
/**
@ -1856,17 +1856,14 @@ function api_format_course_array($course_data)
$_course['language'] = $course_data['course_language'];
$_course['extLink']['url'] = $course_data['department_url'];
$_course['extLink']['name'] = $course_data['department_name'];
$_course['categoryCode'] = $course_data['faCode'];
$_course['categoryName'] = $course_data['faName'];
$_course['visibility'] = $course_data['visibility'];
$_course['subscribe_allowed'] = $course_data['subscribe'];
$_course['subscribe'] = $course_data['subscribe'];
$_course['unsubscribe'] = $course_data['unsubscribe'];
$_course['course_language'] = $course_data['course_language'];
$_course['activate_legal'] = isset($course_data['activate_legal']) ? $course_data['activate_legal'] : false;;
$_course['activate_legal'] = isset($course_data['activate_legal']) ? $course_data['activate_legal'] : false;
$_course['legal'] = $course_data['legal'];
$_course['show_score'] = $course_data['show_score']; //used in the work tool
$_course['department_name'] = $course_data['department_name'];
@ -1884,14 +1881,14 @@ function api_format_course_array($course_data)
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 {
$url_image = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true);
$url_image = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true, false);
}
$_course['course_image'] = $url_image;
if (file_exists(api_get_path(SYS_COURSE_PATH).$course_data['directory'].'/course-pic.png')) {
$url_image = api_get_path(WEB_COURSE_PATH).$course_data['directory'].'/course-pic.png';
} else {
$url_image = Display::return_icon('session_default.png',null,null,null,null,true);
$url_image = Display::return_icon('session_default.png', null, null, null, null, true, false);
}
$_course['course_image_large'] = $url_image;
@ -4370,11 +4367,13 @@ function api_get_language_info($language_id) {
* The returned name depends on the platform, course or user -wide settings.
* @return string The visual theme's name, it is the name of a folder inside .../chamilo/main/css/
*/
function api_get_visual_theme() {
function api_get_visual_theme()
{
static $visual_theme;
if (!isset($visual_theme)) {
$platform_theme = api_get_setting('stylesheets');
// Platform's theme.
$visual_theme = $platform_theme;
@ -4391,14 +4390,15 @@ function api_get_visual_theme() {
}
$course_id = api_get_course_id();
if (!empty($course_id) && $course_id != -1) {
if (api_get_setting('allow_course_theme') == 'true') {
$course_theme = api_get_course_setting('course_theme');
if (!empty($course_theme) && $course_theme != -1) {
if (!empty($course_theme)) {
$visual_theme = $course_theme;
// Course's theme.
$visual_theme = $course_theme;
}
}
@ -4408,8 +4408,8 @@ function api_get_visual_theme() {
// These variables come from the file lp_controller.php.
if (!$lp_theme_config) {
if (!empty($lp_theme_css)) {
$visual_theme = $lp_theme_css;
// LP's theme.
$visual_theme = $lp_theme_css;
}
}
}
@ -4463,7 +4463,6 @@ function api_get_themes() {
return array($list_dir, $list_name);
}
/**
* Find the largest sort value in a given user_course_category
* This function is used when we are moving a course to a different category
@ -4475,7 +4474,6 @@ function api_get_themes() {
function api_max_sort_value($user_course_category, $user_id)
{
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT max(sort) as max_sort FROM $tbl_course_user
WHERE
user_id='".intval($user_id)."' AND

@ -605,7 +605,13 @@ class Auth
$user_id = api_get_user_id();
$all_course_information = CourseManager::get_course_information($course_code);
if ($all_course_information['registration_code'] == '' || $_POST['course_registration_code'] == $all_course_information['registration_code']) {
if (
$all_course_information['registration_code'] == '' ||
(
isset($_POST['course_registration_code']) &&
$_POST['course_registration_code'] == $all_course_information['registration_code']
)
) {
if (api_is_platform_admin()) {
$status_user_in_new_course = COURSEMANAGER;
} else {
@ -636,7 +642,7 @@ class Auth
$form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
$form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
$form->addElement('text', 'course_registration_code');
$form->addButton(get_lang('SubmitRegistrationCode'));
$form->addButton('submit', get_lang('SubmitRegistrationCode'));
$content = $form->returnForm();
return array('message' => $message, 'content' => $content);

@ -1041,6 +1041,10 @@ function getCourseCategoryUrl(
$action = isset($action) ? Security::remove_XSS($action) : $requestAction;
$searchTerm = isset($_REQUEST['search_term']) ? Security::remove_XSS($_REQUEST['search_term']) : null;
if ($action === 'subscribe_user_with_password') {
$action = 'subscribe';
}
$categoryCodeRequest = isset($_REQUEST['category_code']) ? Security::remove_XSS($_REQUEST['category_code']) : null;
$categoryCode = isset($categoryCode) ? Security::remove_XSS($categoryCode) : $categoryCodeRequest;

@ -712,7 +712,8 @@ class Display
$additional_attributes = array(),
$size = ICON_SIZE_SMALL,
$show_text = true,
$return_only_path = false
$return_only_path = false,
$loadThemeIcon = true
) {
$code_path = api_get_path(SYS_CODE_PATH);
$w_code_path = api_get_path(WEB_CODE_PATH);
@ -720,7 +721,6 @@ class Display
$alternateWebCssPath = api_get_path(WEB_CSS_PATH);
$image = trim($image);
$theme = 'themes/' . api_get_visual_theme() . '/icons/';
$size_extra = '';
if (isset($size)) {
@ -730,15 +730,20 @@ class Display
$size = ICON_SIZE_SMALL;
}
//Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
$icon = $alternateWebCssPath.$theme.$size_extra.$image;
} elseif (is_file($code_path.'img/icons/'.$size_extra.$image)) {
//Checking the main/img/icons/XXX/ folder
$icon = $w_code_path.'img/icons/'.$size_extra.$image;
} else {
//Checking the img/ folder
$icon = $w_code_path . 'img/' . $image;
// Checking the img/ folder
$icon = $w_code_path.'img/'.$image;
$theme = 'themes/chamilo/icons/';
if ($loadThemeIcon) {
$theme = 'themes/' . api_get_visual_theme() . '/icons/';
// Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
$icon = $alternateWebCssPath.$theme.$size_extra.$image;
} elseif (is_file($code_path.'img/icons/'.$size_extra.$image)) {
//Checking the main/img/icons/XXX/ folder
$icon = $w_code_path.'img/icons/'.$size_extra.$image;
}
}
// Special code to enable SVG - refs #7359 - Needs more work

@ -6226,8 +6226,9 @@ class DocumentManager
$documentTable = Database::get_course_table(TABLE_DOCUMENT);
$conditionSession = api_get_session_condition($sessionId, true, false, 'd.session_id');
$courseId = $courseInfo['real_id'];
//get invisible folders
// get invisible folders
$sql = "SELECT DISTINCT d.id, path
FROM $itemPropertyTable i
INNER JOIN $documentTable d
@ -6236,8 +6237,8 @@ class DocumentManager
d.id = i.ref AND
i.tool = '" . TOOL_DOCUMENT . "'
$conditionSession AND
i.c_id = {$courseInfo['real_id']} AND
d.c_id = {$courseInfo['real_id']} ";
i.c_id = $courseId AND
d.c_id = $courseId ";
$result = Database::query($sql);
$documents = Database::store_result($result, 'ASSOC');
@ -6258,5 +6259,12 @@ class DocumentManager
}
}
$sql = "DELETE FROM $documentTable
WHERE c_id = $courseId AND session_id = $sessionId";
Database::query($sql);
$sql = "DELETE FROM $itemPropertyTable
WHERE c_id = $courseId AND session_id = $sessionId AND tool = '".TOOL_DOCUMENT."'";
Database::query($sql);
}
}

@ -513,11 +513,12 @@ class UserGroup extends Model
}
/**
* @param int $userId
*
* @return array
* Get the group list for a user
* @param int $userId The user ID
* @param int $filterByType Optional. The type of group
* @return type
*/
public function getUserGroupListByUser($userId)
public function getUserGroupListByUser($userId, $filterByType = null)
{
if ($this->useMultipleUrl) {
$urlId = api_get_current_access_url_id();
@ -536,6 +537,10 @@ class UserGroup extends Model
$where = array('where' => array('user_id = ?' => $userId));
}
if ($filterByType !== null) {
$where['where'][' AND g.group_type = ?'] = intval($filterByType);
}
$results = Database::select(
'g.*',
$from,
@ -958,7 +963,7 @@ class UserGroup extends Model
$this->add_user_to_group(
api_get_user_id(),
$id,
$params['relation_type']
$params['group_type']
);
}
$picture = isset($_FILES['picture']) ? $_FILES['picture'] : null;

@ -470,6 +470,9 @@ if (!empty($student_id)) {
echo Display::page_subheader($table_title);
$userPicture = UserManager::getUserPicture($user_info['user_id']);
$userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getUserGroupListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS);
?>
<img src="<?php echo $userPicture ?>">
<div class="row">
@ -581,6 +584,22 @@ if (!empty($student_id)) {
} ?>
</tbody>
</table>
<?php if (!empty($userGroups)) { ?>
<table class="table table-striped table-hover">
<thead>
<tr>
<th><?php echo get_lang('Classes') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($userGroups as $class) { ?>
<tr>
<td><?php echo $class['name'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
</div>
<?php

Loading…
Cancel
Save