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

1.10.x
Yannick Warnier 10 years ago
commit 986d696f5c
  1. 110
      main/document/document.php
  2. 32
      main/document/downloadfolder.inc.php
  3. 1
      main/exercice/exercise.php
  4. 2
      main/exercice/hotpotatoes.php
  5. 2
      main/inc/ajax/model.ajax.php
  6. 2
      main/inc/lib/add_course.lib.inc.php
  7. 33
      main/inc/lib/display.lib.php
  8. 2
      main/inc/lib/pear/HTML/QuickForm/select.php
  9. 1
      main/newscorm/aicc.class.php
  10. 41
      main/user/class.php
  11. 3
      main/work/downloadfolder.inc.php
  12. 1
      main/work/work.lib.php

@ -34,7 +34,6 @@ $current_course_tool = TOOL_DOCUMENT;
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$to_user_id = null; $to_user_id = null;
$parent_id = null; $parent_id = null;
$message = null;
$lib_path = api_get_path(LIBRARY_PATH); $lib_path = api_get_path(LIBRARY_PATH);
@ -50,16 +49,15 @@ if (
) { ) {
unlink($_SESSION['temp_realpath_image']); unlink($_SESSION['temp_realpath_image']);
} }
$_user = api_get_user_info();
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
$course_dir = $courseInfo['directory'] . '/document'; $course_dir = $courseInfo['directory'] . '/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path . $course_dir; $base_work_dir = $sys_course_path . $course_dir;
$http_www = api_get_path(WEB_COURSE_PATH) . $http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'] . '/document';
$courseInfo['directory'] . '/document';
$document_path = $base_work_dir; $document_path = $base_work_dir;
$usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true'; $usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true';
$courseInfo = api_get_course_info();
$course_dir = $courseInfo['directory'].'/document'; $course_dir = $courseInfo['directory'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir; $base_work_dir = $sys_course_path.$course_dir;
@ -68,7 +66,7 @@ $document_path = $base_work_dir;
$currentUrl = api_get_self().'?'.api_get_cidreq(); $currentUrl = api_get_self().'?'.api_get_cidreq();
//Removing sessions // Removing sessions
unset($_SESSION['draw_dir']); unset($_SESSION['draw_dir']);
unset($_SESSION['paint_dir']); unset($_SESSION['paint_dir']);
unset($_SESSION['temp_audio_nanogong']); unset($_SESSION['temp_audio_nanogong']);
@ -229,18 +227,20 @@ switch ($action) {
if ($deleteDocument) { if ($deleteDocument) {
$certificateId = isset($_GET['delete_certificate_id']) ? $_GET['delete_certificate_id'] : null; $certificateId = isset($_GET['delete_certificate_id']) ? $_GET['delete_certificate_id'] : null;
DocumentManager::remove_attach_certificate(api_get_course_id(), $certificateId); DocumentManager::remove_attach_certificate(
$message = Display::return_message( api_get_course_id(),
$certificateId
);
Display::addFlash(Display::return_message(
get_lang('DocDeleted') . ': ' . $documentInfo['title'], get_lang('DocDeleted') . ': ' . $documentInfo['title'],
'success' 'success'
); ));
} else { } else {
$message = Display::return_message(get_lang('DocDeleteError'), 'warning'); Display::addFlash(Display::return_message(get_lang('DocDeleteError'), 'warning'));
} }
} else { } else {
$message = Display::return_message(get_lang('FileNotFound'), 'warning'); Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
} }
Session::write('message', $message);
header("Location: $currentUrl"); header("Location: $currentUrl");
exit; exit;
} }
@ -390,27 +390,28 @@ switch ($action) {
get_lang('Yes'). get_lang('Yes').
'</a></p>'; '</a></p>';
if (!isset($_GET['copy'])) { if (!isset($_GET['copy'])) {
$message = Display::return_message($message, 'warning', false); Display::addFlash(Display::return_message($message, 'warning', false));
} }
if (Security::remove_XSS($_GET['copy']) == 'yes') { if (Security::remove_XSS($_GET['copy']) == 'yes') {
if (!copy($file, $copyfile)) { if (!copy($file, $copyfile)) {
$message = Display::return_message(get_lang('CopyFailed'), 'error'); Display::addFlash(Display::return_message(get_lang('CopyFailed'), 'error'));
} else { } else {
$message = Display::return_message( Display::addFlash(Display::return_message(
get_lang('OverwritenFile').' '.$file_link, get_lang('OverwritenFile').' '.$file_link,
'confirmation', 'confirmation',
false false
); ));
} }
} }
} else { } else {
if (!copy($file, $copyfile)) { if (!copy($file, $copyfile)) {
$message = Display::return_message(get_lang('CopyFailed'), 'error'); Display::addFlash(Display::return_message(get_lang('CopyFailed'), 'error'));
} else { } else {
$message = Display::return_message(get_lang('CopyMade').' '.$file_link, 'confirmation', false); Display::addFlash(
Display::return_message(get_lang('CopyMade').' '.$file_link, 'confirmation', false)
);
} }
} }
Session::write('message', $message);
} }
break; break;
case 'convertToPdf': case 'convertToPdf':
@ -432,10 +433,10 @@ switch ($action) {
'/document' . $document_info['path']; '/document' . $document_info['path'];
$fileInfo = pathinfo($file); $fileInfo = pathinfo($file);
if ($fileInfo['extension'] == $formatTarget) { if ($fileInfo['extension'] == $formatTarget) {
$message = Display::return_message( Display::addFlash(Display::return_message(
get_lang('ErrorSameFormat'), get_lang('ErrorSameFormat'),
'warning' 'warning'
); ));
} elseif ( } elseif (
!( !(
in_array( in_array(
@ -455,10 +456,10 @@ switch ($action) {
) )
) )
) { ) {
$message = Display::return_message( Display::addFlash(Display::return_message(
get_lang('FormatNotSupported'), get_lang('FormatNotSupported'),
'warning' 'warning'
); ));
} else { } else {
$convertedFile = $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $convertedFile = $fileInfo['dirname'] . DIRECTORY_SEPARATOR .
$fileInfo['filename'] . '_from_' . $fileInfo['extension'] . $fileInfo['filename'] . '_from_' . $fileInfo['extension'] .
@ -466,10 +467,10 @@ switch ($action) {
$convertedTitle = $document_info['title']; $convertedTitle = $document_info['title'];
$obj = new OpenofficePresentation(true); $obj = new OpenofficePresentation(true);
if (file_exists($convertedFile)) { if (file_exists($convertedFile)) {
$message = Display::return_message( Display::addFlash(Display::return_message(
get_lang('FileExists'), get_lang('FileExists'),
'error' 'error'
); ));
} else { } else {
$result = $obj->convertCopyDocument( $result = $obj->convertCopyDocument(
$file, $file,
@ -477,10 +478,10 @@ switch ($action) {
$convertedTitle $convertedTitle
); );
if (empty($result)) { if (empty($result)) {
$message = Display::return_message( Display::addFlash(Display::return_message(
get_lang('CopyFailed'), get_lang('CopyFailed'),
'error' 'error'
); ));
} else { } else {
$cidReq = Security::remove_XSS($_GET['cidReq']); $cidReq = Security::remove_XSS($_GET['cidReq']);
$id_session = api_get_session_id(); $id_session = api_get_session_id();
@ -492,11 +493,11 @@ switch ($action) {
'&id_session=' . $id_session . '&' . '&id_session=' . $id_session . '&' .
'gidReq=' . $gidReq . '&id=' . current($result) 'gidReq=' . $gidReq . '&id=' . current($result)
); );
$message = Display::return_message( Display::addFlash(Display::return_message(
get_lang('CopyMade') . ' ' . $file_link, get_lang('CopyMade') . ' ' . $file_link,
'confirmation', 'confirmation',
false false
); ));
} }
} }
} }
@ -1059,7 +1060,7 @@ if ($is_allowed_to_edit ||
null, null,
$sessionId $sessionId
); );
$message = Display::return_message(get_lang('DirMv'), 'confirmation'); Display::addFlash(Display::return_message(get_lang('DirMv'), 'confirmation'));
} elseif (is_file($real_path_target)) { } elseif (is_file($real_path_target)) {
api_item_property_update( api_item_property_update(
$courseInfo, $courseInfo,
@ -1073,7 +1074,7 @@ if ($is_allowed_to_edit ||
null, null,
$sessionId $sessionId
); );
$message = Display::return_message(get_lang('DocMv'), 'confirmation'); Display::addFlash(Display::return_message(get_lang('DocMv'), 'confirmation'));
} }
// Set the current path // Set the current path
@ -1086,14 +1087,14 @@ if ($is_allowed_to_edit ||
} elseif (is_file($real_path_target)) { } elseif (is_file($real_path_target)) {
$message = Display::return_message(get_lang('FileExists'), 'v'); $message = Display::return_message(get_lang('FileExists'), 'v');
} }
Display::addFlash($message);
} else { } else {
$message = Display::return_message(get_lang('Impossible'), 'error'); Display::addFlash(Display::return_message(get_lang('Impossible'), 'error'));
} }
} }
} else { } else {
$message = Display::return_message(get_lang('Impossible'), 'error'); Display::addFlash(Display::return_message(get_lang('Impossible'), 'error'));
} }
Session::write('message', $message);
} }
} }
@ -1210,8 +1211,7 @@ if ($is_allowed_to_edit ||
} }
} }
} // endforeach } // endforeach
Display::addFlash($messages);
Session::write('message', $messages);
} }
} }
@ -1284,7 +1284,7 @@ if ($is_allowed_to_edit ||
} }
} }
Session::write('message', $message); Display::addFlash($message);
} }
// Show them the form for the directory name // Show them the form for the directory name
@ -1372,9 +1372,7 @@ if ($is_allowed_to_edit ||
} elseif (isset($_GET['add_as_template']) && isset($_POST['create_template'])) { } elseif (isset($_GET['add_as_template']) && isset($_POST['create_template'])) {
$document_id_for_template = intval($_GET['add_as_template']); $document_id_for_template = intval($_GET['add_as_template']);
$title = Security::remove_XSS($_POST['template_title']); $title = Security::remove_XSS($_POST['template_title']);
//$description = Security::remove_XSS($_POST['template_description']);
$user_id = api_get_user_id(); $user_id = api_get_user_id();
// Create the template_thumbnails folder in the upload folder (if needed) // Create the template_thumbnails folder in the upload folder (if needed)
@ -1425,8 +1423,9 @@ if ($is_allowed_to_edit ||
$user_id, $user_id,
$new_file_name $new_file_name
); );
$message = Display::return_message(get_lang('DocumentSetAsTemplate'), 'confirmation'); Display::addFlash(
Session::write('message', $message); Display::return_message(get_lang('DocumentSetAsTemplate'), 'confirmation')
);
} }
if (isset($_GET['remove_as_template'])) { if (isset($_GET['remove_as_template'])) {
@ -1437,8 +1436,10 @@ if ($is_allowed_to_edit ||
$course_code, $course_code,
$user_id $user_id
); );
$message = Display::return_message(get_lang('DocumentUnsetAsTemplate'), 'confirmation');
Session::write('message', $message); Display::addFlash(
Display::return_message(get_lang('DocumentUnsetAsTemplate'), 'confirmation')
);
} }
} }
@ -1454,7 +1455,9 @@ if (isset($_GET['curdirpath']) &&
$document_id = Security::remove_XSS($_GET['set_certificate']); // document id $document_id = Security::remove_XSS($_GET['set_certificate']); // document id
DocumentManager::attach_gradebook_certificate($course_id, $document_id); DocumentManager::attach_gradebook_certificate($course_id, $document_id);
$message = Display::return_message(get_lang('IsDefaultCertificate'), 'normal'); $message = Display::return_message(get_lang('IsDefaultCertificate'), 'normal');
Session::write('message', $message); Display::addFlash(
$message
);
} }
} }
/* GET ALL DOCUMENT DATA FOR CURDIRPATH */ /* GET ALL DOCUMENT DATA FOR CURDIRPATH */
@ -1502,17 +1505,16 @@ if ($groupId != 0) {
if (!isset($folders) || $folders === false) { if (!isset($folders) || $folders === false) {
$folders = array(); $folders = array();
} }
$btngroup= array('class' => 'btn btn-default'); $btngroup = array('class' => 'btn btn-default');
/* GO TO PARENT DIRECTORY */ /* GO TO PARENT DIRECTORY */
$actionsLeft = '';
if ($curdirpath != '/' && $curdirpath != $group_properties['directory'] && !$is_certificate_mode) { if ($curdirpath != '/' && $curdirpath != $group_properties['directory'] && !$is_certificate_mode) {
$actionsLeft = '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'">'; $actionsLeft = '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'">';
$actionsLeft .= Display::return_icon('folder_up.png', get_lang('Up'), '', ICON_SIZE_MEDIUM); $actionsLeft .= Display::return_icon('folder_up.png', get_lang('Up'), '', ICON_SIZE_MEDIUM);
$actionsLeft .= '</a>'; $actionsLeft .= '</a>';
} }
if ($is_certificate_mode && $curdirpath != '/certificates') { if ($is_certificate_mode && $curdirpath != '/certificates') {
@ -1530,9 +1532,7 @@ if ($is_allowed_to_edit ||
) { ) {
// TODO:check enable more options for shared folders // TODO:check enable more options for shared folders
/* CREATE NEW DOCUMENT OR NEW DIRECTORY / GO TO UPLOAD / DOWNLOAD ZIPPED FOLDER */ /* CREATE NEW DOCUMENT OR NEW DIRECTORY / GO TO UPLOAD / DOWNLOAD ZIPPED FOLDER */
// Create new document // Create new document
if (!$is_certificate_mode) { if (!$is_certificate_mode) {
$actionsLeft .= Display::url( $actionsLeft .= Display::url(
Display::return_icon('new_document.png', get_lang('CreateDoc'), '', ICON_SIZE_MEDIUM), Display::return_icon('new_document.png', get_lang('CreateDoc'), '', ICON_SIZE_MEDIUM),
@ -1647,11 +1647,10 @@ if (api_is_allowed_to_edit(null, true)) {
Display::return_icon('percentage.png', get_lang('DocumentQuota'), '', ICON_SIZE_MEDIUM), Display::return_icon('percentage.png', get_lang('DocumentQuota'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH).'document/document_quota.php?'.api_get_cidreq() api_get_path(WEB_CODE_PATH).'document/document_quota.php?'.api_get_cidreq()
); );
} }
$actionsRight = '';
if (!$is_certificate_mode) { if (!$is_certificate_mode) {
/* BUILD SEARCH FORM */ /* BUILD SEARCH FORM */
$form = new FormValidator( $form = new FormValidator(
'search_document', 'search_document',
'get', 'get',
@ -1741,7 +1740,7 @@ if (isset($documentAndFolders) && is_array($documentAndFolders)) {
$count++; $count++;
} }
// Validacion when belongs to a session // Validation when belongs to a session
$session_img = api_get_session_image($document_data['session_id'], $_user['status']); $session_img = api_get_session_image($document_data['session_id'], $_user['status']);
// Document title with link // Document title with link
@ -1843,8 +1842,6 @@ if (!is_null($documentAndFolders)) {
} }
} }
if (!empty($moveTo)) { if (!empty($moveTo)) {
$document_id = DocumentManager::get_document_id($courseInfo, $moveTo); $document_id = DocumentManager::get_document_id($courseInfo, $moveTo);
} }
@ -1966,7 +1963,10 @@ if (!empty($groupId)) {
} else { } else {
Display::display_introduction_section(TOOL_DOCUMENT); Display::display_introduction_section(TOOL_DOCUMENT);
} }
$toolbar = Display::toolbarAction('toolbar-document',array(0 => $actionsLeft, 1 => $actionsRight)); $toolbar = Display::toolbarAction(
'toolbar-document',
array(0 => $actionsLeft, 1 => $actionsRight)
);
echo $toolbar; echo $toolbar;
echo $templateForm; echo $templateForm;

@ -58,9 +58,6 @@ if (($path == '/shared_folder' ||
exit; exit;
} }
// Zip library for creation of the zip file.
require api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php';
// Creating a ZIP file. // Creating a ZIP file.
$tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
@ -94,10 +91,16 @@ function fixDocumentNameCallback($p_event, &$p_header)
); );
// Changes file.phps to file.php // Changes file.phps to file.php
$basename = basename($documentNameFixed); $basename = basename($documentNameFixed);
$basenamePHPFixed = str_replace('.phps', '.php', $basename); $basenamePHPFixed = str_replace('.phps', '.php', $basename);
$documentNameFixed = str_replace($basename, $basenamePHPFixed, $basenamePHPFixed); $documentNameFixed = str_replace(
$basename,
$basenamePHPFixed,
$documentNameFixed
);
$documentNameFixed = str_replace($remove_dir, '', $documentNameFixed);
$p_header['stored_filename'] = $documentNameFixed; $p_header['stored_filename'] = $documentNameFixed;
return 1; return 1;
@ -161,7 +164,8 @@ if (api_is_allowed_to_edit()) {
} }
} }
} }
//error_log($sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path']);
//error_log($sysCoursePath.$courseInfo['path'].'/document'.$remove_dir);
$zip->add( $zip->add(
$sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path'], $sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path'],
PCLZIP_OPT_REMOVE_PATH, PCLZIP_OPT_REMOVE_PATH,
@ -230,12 +234,12 @@ if (api_is_allowed_to_edit()) {
docs.id = props.ref AND docs.id = props.ref AND
docs.c_id = props.c_id docs.c_id = props.c_id
WHERE WHERE
docs.c_id = $courseId AND docs.c_id = $courseId AND
props.tool = '".TOOL_DOCUMENT."' AND props.tool = '".TOOL_DOCUMENT."' AND
docs.path LIKE '".$querypath."/%' AND docs.path LIKE '".$querypath."/%' AND
props.visibility <> '1' AND props.visibility <> '1' AND
(props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND
docs.filetype = 'folder'"; docs.filetype = 'folder'";
$query2 = Database::query($sql); $query2 = Database::query($sql);
// If we get invisible folders, we have to filter out these results from all visible files we found // If we get invisible folders, we have to filter out these results from all visible files we found
@ -255,9 +259,9 @@ if (api_is_allowed_to_edit()) {
docs.c_id = $courseId AND docs.c_id = $courseId AND
props.tool ='".TOOL_DOCUMENT."' AND props.tool ='".TOOL_DOCUMENT."' AND
docs.path LIKE '".$invisible_folders['path']."/%' AND docs.path LIKE '".$invisible_folders['path']."/%' AND
docs.filetype ='file' AND docs.filetype = 'file' AND
(props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND
props.visibility ='1'"; props.visibility ='1'";
$query3 = Database::query($sql); $query3 = Database::query($sql);
// Add tem to an array // Add tem to an array
while ($files_in_invisible_folder = Database::fetch_assoc($query3)) { while ($files_in_invisible_folder = Database::fetch_assoc($query3)) {
@ -294,7 +298,9 @@ if (api_is_allowed_to_edit()) {
} }
// Launch event // Launch event
Event::event_download(($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip (folder)'); Event::event_download(
($path == '/') ? 'documents.zip (folder)' : basename($path).'.zip (folder)'
);
// Start download of created file // Start download of created file
$name = ($path == '/') ? 'documents.zip' : $documentInfo['title'].'.zip'; $name = ($path == '/') ? 'documents.zip' : $documentInfo['title'].'.zip';

@ -118,7 +118,6 @@ $nameTools = get_lang('Exercises');
$errorXmlExport = null; $errorXmlExport = null;
if ($is_allowedToEdit && !empty($choice) && $choice == 'exportqti2') { if ($is_allowedToEdit && !empty($choice) && $choice == 'exportqti2') {
require_once api_get_path(SYS_CODE_PATH).'exercice/export/qti2/qti2_export.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/export/qti2/qti2_export.php';
require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php';
$export = export_exercise_to_qti($exerciseId, true); $export = export_exercise_to_qti($exerciseId, true);
$archive_path = api_get_path(SYS_ARCHIVE_PATH); $archive_path = api_get_path(SYS_ARCHIVE_PATH);

@ -8,8 +8,6 @@
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php';
require_once 'hotpotatoes.lib.php'; require_once 'hotpotatoes.lib.php';
// Section (for the tabs). // Section (for the tabs).

@ -1509,7 +1509,7 @@ switch ($action) {
$class = 'btn btn-danger'; $class = 'btn btn-danger';
$text = get_lang('Remove'); $text = get_lang('Remove');
} else { } else {
$url = 'class.php?action=add_class_to_course&id='.$group['id'].'&'.api_get_cidreq(); $url = 'class.php?action=add_class_to_course&id='.$group['id'].'&'.api_get_cidreq().'&type=not_registered';
$class = 'btn btn-primary'; $class = 'btn btn-primary';
//$icon = Display::return_icon('add.png', get_lang('Add')); //$icon = Display::return_icon('add.png', get_lang('Add'));
$text = get_lang('Add'); $text = get_lang('Add');

@ -1444,8 +1444,6 @@ class AddCourse
*/ */
public static function readPropertiesInArchive($archive, $is_compressed = true) public static function readPropertiesInArchive($archive, $is_compressed = true)
{ {
include api_get_path(LIBRARY_PATH) . 'pclzip/pclzip.lib.php';
debug::printVar(dirname($archive), 'Zip : ');
$uid = api_get_user_id(); $uid = api_get_user_id();
/* /*
string tempnam (string dir, string prefix) string tempnam (string dir, string prefix)

@ -1893,9 +1893,9 @@ class Display
foreach ($items as $item) { foreach ($items as $item) {
$html .= '<div class="accordion-my-group">'; $html .= '<div class="accordion-my-group">';
$html .= '<div class="accordion-heading"> $html .= '<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#'.$id.'" href="#collapse'.$count.'"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#'.$id.'" href="#collapse'.$count.'">
'.$item['title'].' '.$item['title'].'
</a> </a>
</div>'; </div>';
$html .= '<div id="collapse'.$count.'" class="accordion-body">'; $html .= '<div id="collapse'.$count.'" class="accordion-body">';
@ -1906,6 +1906,7 @@ class Display
} }
$html .= '</div>'; $html .= '</div>';
} }
return $html; return $html;
} }
@ -1915,8 +1916,10 @@ class Display
public static function group_button($title, $elements) public static function group_button($title, $elements)
{ {
$html = '<div class="btn-group"> $html = '<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">'.$title.' <span class="caret"></span></button> <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu">'; '.$title.'
<span class="caret"></span></button>
<ul class="dropdown-menu">';
foreach ($elements as $item) { foreach ($elements as $item) {
$html .= Display::tag('li', Display::url($item['title'], $item['href'])); $html .= Display::tag('li', Display::url($item['title'], $item['href']));
} }
@ -1957,6 +1960,7 @@ class Display
<param name="flashvars" value="controls=true&file='.$params['url'].'" /> <param name="flashvars" value="controls=true&file='.$params['url'].'" />
</object>'; </object>';
$html .= '</audio>'; $html .= '</audio>';
return $html; return $html;
break; break;
} }
@ -1991,6 +1995,7 @@ class Display
$messageToString .= $message; $messageToString .= $message;
} }
} }
return $messageToString; return $messageToString;
} }
@ -2032,10 +2037,7 @@ class Display
$objSSO = null; $objSSO = null;
if (!empty($subSSOClass)) { if (!empty($subSSOClass)) {
require_once api_get_path( require_once api_get_path(SYS_CODE_PATH)."auth/sso/sso.$subSSOClass.class.php";
SYS_CODE_PATH
)."auth/sso/sso.$subSSOClass.class.php";
$subSSOClass = 'sso'.$subSSOClass; $subSSOClass = 'sso'.$subSSOClass;
$objSSO = new $subSSOClass(); $objSSO = new $subSSOClass();
} else { } else {
@ -2090,20 +2092,26 @@ class Display
* @param string $text The button content * @param string $text The button content
* @param string $url The url to button * @param string $url The url to button
* @param string $icon The Awesome Font class for icon * @param string $icon The Awesome Font class for icon
* @param string $type Ooptional. The button Bootstrap class. Default 'default' class * @param string $type Optional. The button Bootstrap class. Default 'default' class
* @param array $attributes The additional attributes * @param array $attributes The additional attributes
* @return string The button HTML * @return string The button HTML
*/ */
public static function toolbarButton($text, $url, $icon = 'check', $type = 'default', array $attributes = []) public static function toolbarButton($text, $url, $icon = 'check', $type = 'default', array $attributes = [])
{ {
$buttonClass = "btn btn-$type"; $buttonClass = "btn btn-$type";
$icon = self::tag('i', null, ['class' => "fa fa-$icon"]); $icon = self::tag('i', null, ['class' => "fa fa-$icon"]);
$attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass; $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass;
return self::url("$icon $text", $url, $attributes); return self::url("$icon $text", $url, $attributes);
} }
/**
* @param int $id
* @param array $content
* @param int $col
* @param bool|true $right
* @return string
*/
public static function toolbarAction($id, $content = array(), $col = 2, $right = true) public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
{ {
$columns = 12/$col; $columns = 12/$col;
@ -2131,6 +2139,7 @@ class Display
} }
$html .= '</div>'; $html .= '</div>';
$html .= '</div>'; $html .= '</div>';
return $html; return $html;
} }
} }

@ -550,7 +550,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
$this->setName($myName); $this->setName($myName);
} }
$strHtml .= $tabs . '<select class="selectpicker show-tick form-control"' . $attrString . ">\n"; $strHtml .= $tabs . '<select data-live-search="true" class="selectpicker show-tick form-control"' . $attrString . ">\n";
$strValues = is_array($this->_values)? array_map('strval', $this->_values): array(); $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();

@ -668,7 +668,6 @@ class aicc extends learnpath
//error_log('New LP - in export_zip()', 0); //error_log('New LP - in export_zip()', 0);
// Zip everything that is in the corresponding scorm dir. // Zip everything that is in the corresponding scorm dir.
// Write the zip file somewhere (might be too big to return). // Write the zip file somewhere (might be too big to return).
require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php';
require_once 'learnpath_functions.inc.php'; require_once 'learnpath_functions.inc.php';
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);

@ -37,16 +37,16 @@ $(document).ready( function() {
}); });
</script>'; </script>';
Display :: display_header($tool_name, "User"); $actions = '';
$usergroup = new UserGroup(); $usergroup = new UserGroup();
if (api_is_allowed_to_edit()) { if (api_is_allowed_to_edit()) {
echo '<div class="actions">'; $actions .= '<div class="actions">';
if ($type == 'registered') { if ($type == 'registered') {
echo '<a href="class.php?'.api_get_cidreq().'&type=not_registered">'. $actions .= '<a href="class.php?'.api_get_cidreq().'&type=not_registered">'.
Display::return_icon('add.png', get_lang("AddClassesToACourse"), array(), ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('add.png', get_lang("AddClassesToACourse"), array(), ICON_SIZE_MEDIUM).'</a>';
} else { } else {
echo '<a href="class.php?'.api_get_cidreq().'&type=registered">'. $actions .= '<a href="class.php?'.api_get_cidreq().'&type=registered">'.
Display::return_icon('empty_evaluation.png', get_lang("Classes"), array(), ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang("Classes"), array(), ICON_SIZE_MEDIUM).'</a>';
$form = new FormValidator('groups', 'post', api_get_self(), '', '', FormValidator::LAYOUT_INLINE); $form = new FormValidator('groups', 'post', api_get_self(), '', '', FormValidator::LAYOUT_INLINE);
$options = [ $options = [
@ -56,13 +56,11 @@ if (api_is_allowed_to_edit()) {
]; ];
$form->addSelect('group_filter', get_lang('Groups'), $options, ['id' => 'group_filter']); $form->addSelect('group_filter', get_lang('Groups'), $options, ['id' => 'group_filter']);
$form->setDefaults(['group_filter' => $groupFilter]); $form->setDefaults(['group_filter' => $groupFilter]);
$form->display(); $actions .= $form->returnForm();
} }
echo '</div>'; $actions .= '</div>';
} }
echo UserManager::getUserSubscriptionTab(4);
if (api_is_allowed_to_edit()) { if (api_is_allowed_to_edit()) {
$action = isset($_GET['action']) ? $_GET['action'] : null; $action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) { switch ($action) {
@ -74,6 +72,7 @@ if (api_is_allowed_to_edit()) {
array(api_get_course_int_id()), array(api_get_course_int_id()),
false false
); );
Display::addFlash(Display::return_message(get_lang('Added')));
} }
break; break;
case 'remove_class_from_course': case 'remove_class_from_course':
@ -83,6 +82,7 @@ if (api_is_allowed_to_edit()) {
$id, $id,
array(api_get_course_int_id()) array(api_get_course_int_id())
); );
Display::addFlash(Display::return_message(get_lang('Deleted')));
} }
break; break;
} }
@ -101,8 +101,8 @@ $columns = array(
get_lang('Actions'), get_lang('Actions'),
); );
//Column config // Column config
$column_model = array( $columnModel = array(
array('name'=>'name', array('name'=>'name',
'index' => 'name', 'index' => 'name',
'width' => '35', 'width' => '35',
@ -135,26 +135,25 @@ $column_model = array(
), ),
); );
// Autowidth // Autowidth
$extra_params['autowidth'] = 'true'; $extraParams['autowidth'] = 'true';
// height auto // height auto
$extra_params['height'] = 'auto'; $extraParams['height'] = 'auto';
// With this function we can add actions to the jgrid Display :: display_header($tool_name, "User");
$action_links = 'function action_formatter (cellvalue, options, rowObject) {
return \''
.' <a href="class.php?action=add_class&id=\'+options.rowId+\'"><img src="../img/icons/22/user_to_class.png" title="'.get_lang('SubscribeUsersToClass').'"></a>'
.' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'"><img title="'.get_lang('Delete').'" src="../img/delete.png"></a>\';
}';
?> ?>
<script> <script>
$(function() { $(function() {
<?php <?php
// grid definition see the $usergroup>display() function // grid definition see the $usergroup>display() function
echo Display::grid_js('usergroups', $url, $columns, $column_model, $extra_params, array(), $action_links, true); echo Display::grid_js('usergroups', $url, $columns, $columnModel, $extraParams, array(), '', true);
?> ?>
}); });
</script> </script>
<?php <?php
echo $actions;
echo UserManager::getUserSubscriptionTab(4);
$usergroup->display_teacher_view(); $usergroup->display_teacher_view();
Display :: display_footer(); Display :: display_footer();

@ -35,9 +35,6 @@ if (empty($_course) || empty($_course['path'])) {
$sys_course_path = api_get_path(SYS_COURSE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH);
//zip library for creation of the zipfile
require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php';
// Creating a ZIP file // Creating a ZIP file
$temp_zip_file = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; $temp_zip_file = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";

@ -4895,7 +4895,6 @@ function downloadAllFilesPerUser($userId, $courseInfo)
return false; return false;
} }
require_once api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php';
$tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip"; $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
$coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/'; $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/';

Loading…
Cancel
Save