Minor - Adding comments, removing white spaces, fixing PHP warnings.

1.9.x
Julio Montoya 11 years ago
parent 531e7e2c34
commit ba3000da55
  1. 1
      main/admin/access_url_add_courses_to_url.php
  2. 86
      main/admin/add_many_session_to_category.php
  3. 8
      main/admin/add_sessions_to_usergroup.php
  4. 2
      main/admin/archive_cleanup.php
  5. 6
      main/admin/course_list.php
  6. 1
      main/admin/dashboard_add_courses_to_user.php
  7. 2
      main/admin/group_list.php
  8. 11
      main/admin/inactive_user_list.php
  9. 29
      main/admin/languages.php
  10. 66
      main/admin/promotions.php
  11. 4
      main/admin/session_category_add.php
  12. 5
      main/admin/session_category_edit.php
  13. 25
      main/admin/session_category_list.php
  14. 4
      main/admin/session_user_import.php
  15. 13
      main/admin/settings.lib.php
  16. 4
      main/admin/settings.php
  17. 2
      main/admin/sub_language.class.php
  18. 2
      main/admin/system_announcements.php
  19. 8
      main/admin/user_add.php
  20. 46
      main/admin/user_edit.php
  21. 2
      main/admin/user_export.php
  22. 5
      main/admin/user_information.php
  23. 6
      main/admin/user_move_stats.php
  24. 6
      main/admin/usergroups.php
  25. 1
      main/coursecopy/classes/CourseBuilder.class.php
  26. 8
      main/coursecopy/classes/Event.class.php
  27. 20
      main/coursecopy/classes/Resource.class.php
  28. 2
      main/coursecopy/copy_course.php
  29. 4
      main/coursecopy/create_backup.php
  30. 19
      main/create_course/add_course.php
  31. 2
      main/cron/img/list_used_img.php
  32. 114
      main/document/create_audio.php
  33. 6
      main/document/document.inc.php
  34. 2
      main/newscorm/lp_view.php

@ -17,6 +17,7 @@ require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
$this_section=SECTION_PLATFORM_ADMIN;
api_protect_global_admin_script();
if (!api_get_multiple_access_url()) {
header('Location: index.php');
exit;

@ -86,54 +86,52 @@ function remove_item(origin)
}
</script>';
$formSent=0;
$errorMsg = $firstLetterCourse = $firstLetterSession='';
$CourseList=$SessionList=array();
$courses=$sessions=array();
$Categoryid = intval($_POST['CategorySessionId']);
if ($_POST['formSent']) {
$formSent=$_POST['formSent'];
$SessionCategoryList = $_POST['SessionCategoryList'];
if($Categoryid != 0 && count($SessionCategoryList)>0 ){
$session_id = join(',', $SessionCategoryList);
$sql = "UPDATE $tbl_session SET session_category_id = $Categoryid WHERE id in ($session_id) ";
Database::query($sql);
//header('Location: session_list.php?id_category='.$Categoryid);
header('Location: add_many_session_to_category.php?id_category='.$Categoryid.'&msg=ok');
exit;
} else {
header('Location: add_many_session_to_category.php?msg=error');
exit;
}
$formSent = 0;
$errorMsg = $firstLetterCourse = $firstLetterSession = '';
$CourseList = $SessionList = array();
$courses = $sessions = array();
$Categoryid = isset($_POST['CategorySessionId']) ? intval($_POST['CategorySessionId']) : null;
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent = $_POST['formSent'];
$SessionCategoryList = $_POST['SessionCategoryList'];
if ($Categoryid != 0 && count($SessionCategoryList) > 0) {
$session_id = join(',', $SessionCategoryList);
$sql = "UPDATE $tbl_session SET session_category_id = $Categoryid WHERE id in ($session_id) ";
Database::query($sql);
header('Location: add_many_session_to_category.php?id_category=' . $Categoryid . '&msg=ok');
exit;
} else {
header('Location: add_many_session_to_category.php?msg=error');
exit;
}
}
if (isset($_GET['id_category'])) {
$Categoryid = intval($_GET['id_category']);
$Categoryid = intval($_GET['id_category']);
}
if(isset($_GET['msg']) && $_GET['msg']=='error'){
$errorMsg = get_lang('MsgErrorSessionCategory');
if (isset($_GET['msg']) && $_GET['msg'] == 'error') {
$errorMsg = get_lang('MsgErrorSessionCategory');
}
if(isset($_GET['msg']) && $_GET['msg']=='ok'){
$OkMsg = get_lang('SessionCategoryUpdate');
if (isset($_GET['msg']) && $_GET['msg'] == 'ok') {
$OkMsg = get_lang('SessionCategoryUpdate');
}
$page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null;
// display the dokeos header
Display::display_header($tool_name);
$where ='';
$where = '';
$rows_category_session = array();
if((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category']) ) {
$where = 'WHERE session_category_id !='.$Categoryid;
$sql = 'SELECT id, name FROM '.$tbl_session .' WHERE session_category_id ='.$Categoryid.' ORDER BY name';
$result=Database::query($sql);
$rows_category_session = Database::store_result($result);
if ((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category'])) {
$where = 'WHERE session_category_id !=' . $Categoryid;
$sql = 'SELECT id, name FROM ' . $tbl_session . ' WHERE session_category_id =' . $Categoryid . ' ORDER BY name';
$result = Database::query($sql);
$rows_category_session = Database::store_result($result);
}
$rows_session_category = SessionManager::get_all_session_category();
@ -153,13 +151,17 @@ if (api_get_multiple_access_url()) {
$result=Database::query($sql);
$rows_session = Database::store_result($result);
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo Security::remove_XSS($_GET['page']); if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<?php echo '<legend>'.$tool_name.'</legend>'; ?>
<input type="hidden" name="formSent" value="1" />
<?php
if(!empty($errorMsg)) {
Display::display_error_message($errorMsg); //main API
}
<form name="formulaire" method="post"
action="<?php echo api_get_self(); ?>?page=<?php echo $page;
if (!empty($_GET['add'])) {
echo '&add=true';
} ?>" style="margin:0px;">
<?php echo '<legend>' . $tool_name . '</legend>'; ?>
<input type="hidden" name="formSent" value="1"/>
<?php
if (!empty($errorMsg)) {
Display::display_error_message($errorMsg); //main API
}
if(!empty($OkMsg)) {
Display::display_confirmation_message($OkMsg); //main API

@ -149,7 +149,7 @@ function search_sessions($needle,$type) {
} else {
$session_list = SessionManager::get_sessions_list(array('s.name LIKE' => "$needle%"));
}
$i=0;
$i=0;
if ($type=='single') {
/*
while ($user = Database :: fetch_array($rs)) {
@ -164,9 +164,9 @@ function search_sessions($needle,$type) {
$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));*/
} else {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row ) {
if (!in_array($row['id'], array_keys($elements_in))) {
foreach ($session_list as $row ) {
if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="'.$row['id'].'">'.$row['name'].'</option>';
}
}

@ -63,4 +63,4 @@ if (!empty($message)) {
echo $message;
}
$form->display();
Display::display_footer();
Display::display_footer();

@ -222,7 +222,7 @@ if (isset ($_POST['action'])) {
$course_codes = $_POST['course'];
if (count($course_codes) > 0) {
foreach ($course_codes as $course_code) {
CourseManager :: delete_course($course_code);
CourseManager::delete_course($course_code);
$obj_cat = new Category();
$obj_cat->update_category_delete($course_code);
}
@ -298,8 +298,8 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
break;
}
}
if (isset ($_GET['delete_course'])) {
CourseManager :: delete_course($_GET['delete_course']);
if (isset($_GET['delete_course'])) {
CourseManager::delete_course($_GET['delete_course']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_GET['delete_course']);

@ -17,7 +17,6 @@ require_once '../inc/lib/xajax/xajax.inc.php';
global $_configuration;
// create an ajax object
$xajax = new xajax();
$xajax->registerFunction('search_courses');

@ -397,4 +397,4 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
$table->set_form_actions(array('delete' => get_lang('DeleteFromPlatform')));
$table->display();
}
Display :: display_footer();
Display :: display_footer();

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */
/**
@author Andre Boivin base code
@author Julio Montoya fixing lot of little details
@author Julio Montoya fixing lot of little details
@todo this script is not ready for a production use that's why I'm commenting the function delete_inactive_student
* @package chamilo.admin
* script pour effacer les user inactif depuis x temps
*/
@ -34,12 +34,11 @@ Display :: display_header($tool_name, "");
//On sélectionne les user élèves
$sql = "SELECT user_id FROM ".$table_user." user WHERE user.status= '5' ORDER by lastname " ;
$result = Database::query($sql);
while($row = Database::fetch_array($result)) {
while($row = Database::fetch_array($result)) {
$user_id = $row['user_id'];
// pour chaque élève, on trouve la dernière connexion
//$last_connection_date = UserManager:: delete_inactive_student($user_id, 2, true);
}
/* FOOTER */
Display :: display_footer();

@ -28,6 +28,7 @@ require_once 'sub_language.class.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$action = isset($_GET['action']) ? $_GET['action'] : null;
//Ajax request
if (isset($_POST['sent_http_request'])) {
@ -50,7 +51,6 @@ if (isset($_POST['sent_http_request'])) {
exit;
}
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
@ -124,13 +124,6 @@ $htmlHeadXtra[] = '<script>
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
/*
==============================================================================
STORING THE CHANGES
==============================================================================
*/
$action = isset($_GET['action']) ? $_GET['action'] : null;
// we change the availability
if ($action == 'makeunavailable') {
if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
@ -186,11 +179,6 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
}
}
/*
==============================================================================
MAIN CODE
==============================================================================
*/
// setting the name of the tool
$tool_name = get_lang('PlatformLanguages');
@ -221,12 +209,6 @@ $sql_select_lang = "SELECT * FROM $tbl_settings_current WHERE category='Languag
$result_select_lang = Database::query($sql_select_lang);
$row_lang = Database::fetch_array($result_select_lang);
/*
--------------------------------------
DISPLAY THE TABLE
--------------------------------------
*/
// the table data
$language_data = array();
while ($row = Database::fetch_array($result_select)) {
@ -278,6 +260,9 @@ while ($row = Database::fetch_array($result_select)) {
$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('2rightarrow.gif', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>";
$allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>";
}
} else {
$allow_use_sub_language = '';
$allow_add_term_sub_language = '';
}
if ($row['english_name'] == $row_lang['selected_value']) {
@ -306,10 +291,4 @@ $table->set_form_actions($form_actions);
echo '<div id="id_content_message">&nbsp;</div>';
$table->display();
/*
==============================================================================
FOOTER
==============================================================================
*/
Display :: display_footer();
?>

@ -25,13 +25,13 @@ $interbreadcrumb[] = array('url' => 'career_dashboard.php','name' => get_lang('C
$action = isset($_GET['action']) ? $_GET['action'] : null;
$check = Security::check_token('request');
$token = Security::get_token();
$token = Security::get_token();
if ($action == 'add') {
$interbreadcrumb[]=array('url' => 'promotions.php','name' => get_lang('Promotions'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
} elseif ($action == 'edit') {
$interbreadcrumb[]=array('url' => 'promotions.php','name' => get_lang('Promotions'));
$interbreadcrumb[]=array('url' => 'promotions.php','name' => get_lang('Promotions'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit'));
} else {
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Promotions'));
@ -43,7 +43,7 @@ Display::display_header($tool_name);
// Tool name
if (isset($_GET['action']) && $_GET['action'] == 'add') {
$tool = 'Add';
$interbreadcrumb[] = array ('url' => api_get_self(), 'name' => get_lang('Promotion'));
$interbreadcrumb[] = array ('url' => api_get_self(), 'name' => get_lang('Promotion'));
}
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
$tool = 'Modify';
@ -54,31 +54,31 @@ $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_promotions';
//The order is important you need to check the model.ajax.php the $column variable
$columns = array(get_lang('Name'),get_lang('Career'),get_lang('Description'),get_lang('Actions'));
$column_model = array(
array('name'=>'name', 'index'=>'name', 'width'=>'180', 'align'=>'left'),
array('name'=>'career', 'index'=>'career', 'width'=>'100', 'align'=>'left'),
array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left','sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false'),
);
array('name'=>'name', 'index'=>'name', 'width'=>'180', 'align'=>'left'),
array('name'=>'career', 'index'=>'career', 'width'=>'100', 'align'=>'left'),
array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left','sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false'),
);
$extra_params['autowidth'] = 'true'; //use the width of the parent
//$extra_params['editurl'] = $url; //use the width of the parent
$extra_params['height'] = 'auto'; //use the width of the parent
//With this function we can add actions to the jgrid
$action_links = 'function action_formatter (cellvalue, options, rowObject) {
return \'<a href="add_sessions_to_promotion.php?id=\'+options.rowId+\'">'.Display::return_icon('session_to_promotion.png',get_lang('SubscribeSessionsToPromotions'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a> \';
}';
return \'<a href="add_sessions_to_promotion.php?id=\'+options.rowId+\'">'.Display::return_icon('session_to_promotion.png',get_lang('SubscribeSessionsToPromotions'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a> \';
}';
?>
<script>
$(function() {
<?php
echo Display::grid_js('promotions', $url,$columns,$column_model,$extra_params,array(), $action_links, true);
$(function() {
<?php
echo Display::grid_js('promotions', $url,$columns,$column_model,$extra_params,array(), $action_links, true);
?>
});
</script>
</script>
<?php
$promotion = new Promotion();
@ -99,22 +99,22 @@ switch ($action) {
}
$url = api_get_self().'?action='.Security::remove_XSS($_GET['action']);
$form = $promotion->return_form($url, 'add');
$form = $promotion->return_form($url, 'add');
// The validation or display
if ($form->validate()) {
if ($form->validate()) {
if ($check) {
$values = $form->exportValues();
$res = $promotion->save($values);
$values = $form->exportValues();
$res = $promotion->save($values);
if ($res) {
Display::display_confirmation_message(get_lang('ItemAdded'));
}
}
}
$promotion->display();
} else {
echo '<div class="actions">';
echo '<div class="actions">';
echo Display::url(Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM), api_get_self());
echo '</div>';
echo '</div>';
$form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token));
$form->display();
@ -122,13 +122,13 @@ switch ($action) {
break;
case 'edit':
//Editing
$url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
$url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
$form = $promotion->return_form($url, 'edit');
// The validation or display
if ($form->validate()) {
if ($form->validate()) {
if ($check) {
$values = $form->exportValues();
$values = $form->exportValues();
$res = $promotion->update($values);
$promotion->update_all_sessions_status_by_promotion_id($values['id'], $values['status']);
if ($res) {
@ -137,15 +137,15 @@ switch ($action) {
}
$promotion->display();
} else {
echo '<div class="actions">';
echo '<div class="actions">';
echo Display::url(Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM), api_get_self());
echo '</div>';
echo '</div>';
$form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token));
$form->display();
}
break;
case 'delete':
case 'delete':
if ($check) {
// Action handling: deleting an obj
$res = $promotion->delete($_GET['id']);
@ -153,17 +153,17 @@ switch ($action) {
Display::display_confirmation_message(get_lang('ItemDeleted'));
}
}
$promotion->display();
$promotion->display();
break;
case 'copy':
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
if ($check) {
$res = $promotion->copy($_GET['id'], null, true);
$res = $promotion->copy($_GET['id'], null, true);
if ($res) {
Display::display_confirmation_message(get_lang('ItemCopied').' - '.get_lang('ExerciseAndLPsAreInvisibleInTheNewCourse'));
}
}
}
$promotion->display();
break;

@ -31,7 +31,7 @@ $interbreadcrumb[]=array('url' => "session_category_list.php","name" => get_lang
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
if ($_POST['formSent']) {
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent=1;
$name= $_POST['name'];
$year_start= $_POST['year_start'];
@ -233,4 +233,4 @@ function setDisable(select) {
</script>
<?php
Display::display_footer();
?>

@ -220,11 +220,9 @@ for($i=$thisYear-5;$i <= ($thisYear+5);$i++)
</td>
</tr>
</table>
</form>
<script type="text/javascript">
<script>
<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?>
function setDisable(select){
document.form.day_start.disabled = (select.checked) ? true : false;
@ -237,4 +235,3 @@ function setDisable(select){
</script>
<?php
Display::display_footer();
?>

@ -17,16 +17,14 @@ api_protect_admin_script(true);
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
$htmlHeadXtra[] =
'<script>
function selectAll(idCheck,numRows,action) {
for(i=0;i<numRows;i++) {
idcheck = document.getElementById(idCheck+"_"+i);
if (action == "true"){
idcheck.checked = true;
} else {
idcheck.checked = false;
}
$htmlHeadXtra[] = '<script>
function selectAll(idCheck,numRows,action) {
for(i=0;i<numRows;i++) {
idcheck = document.getElementById(idCheck+"_"+i);
if (action == "true"){
idcheck.checked = true;
} else {
idcheck.checked = false;
}
}
</script>';
@ -75,9 +73,6 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
} else {
$where .= (empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%".Database::escape_string(trim($_REQUEST['keyword']))."%'");
}
if (empty($where)) {
$where = " WHERE access_url_id = ".api_get_current_access_url_id()." ";
} else {
@ -206,9 +201,7 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
?>
</table>
<br />
<div align="left">
<?php
if ($num > $limit) {
if ($page) {
@ -221,9 +214,7 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
echo get_lang('Previous');
}
?>
|
<?php
if ($nbr_results > $limit) {
?>

@ -28,7 +28,7 @@ $tool_name = get_lang('ImportUsers');
$session_id = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
if (empty($session_id)) {
api_not_allowed(true);
api_not_allowed(true);
}
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
@ -43,7 +43,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$send_mail = $_POST['sendMail'] ? 1 : 0;
// CSV
$users = Import::csv_to_array($_FILES['import_file']['tmp_name']);
$users = Import::csv_to_array($_FILES['import_file']['tmp_name']);
$user_list = array();
foreach ($users as $user_data) {
$username = $user_data['username'];

@ -238,6 +238,8 @@ function handle_stylesheets()
}
}
// Stylesheet upload.
if (isset($_POST['stylesheet_upload'])) {
if ($form->validate()) {
$values = $form->exportValues();
@ -717,6 +719,7 @@ function handle_search()
* Wrapper for the templates
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
* @author Julio Montoya.
* @version August 2008
* @since Dokeos 1.8.6
*/
@ -747,7 +750,6 @@ function handle_templates() {
$category = $_GET['category'];
event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
}
display_templates();
}
}
@ -969,7 +971,7 @@ function add_edit_template() {
if ($_GET['action'] == 'add') {
$content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>';
$sql = "INSERT INTO $table_system_template (title, content, image) VALUES ('".Database::escape_string($values['title'])."','".$content_template."','".Database::escape_string($new_file_name)."')";
$result = Database::query($sql);
Database::query($sql);
// Display a feedback message.
Display::display_confirmation_message(get_lang('TemplateAdded'));
@ -981,7 +983,7 @@ function add_edit_template() {
$sql .= ", image = '".Database::escape_string($new_file_name)."'";
}
$sql .= " WHERE id='".Database::escape_string($_GET['id'])."'";
$result = Database::query($sql);
Database::query($sql);
// Display a feedback message.
Display::display_confirmation_message(get_lang('TemplateEdited'));
@ -1030,7 +1032,7 @@ function delete_template($id) {
/**
* Returns the list of timezone identifiers used to populate the select
*
* This function is called through a call_user_func() in the generate_settings_form function.
* @return array List of timezone identifiers
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
@ -1042,7 +1044,7 @@ function select_timezone_value() {
/**
* Returns an array containing the list of options used to populate the gradebook_number_decimals variable
*
* This function is called through a call_user_func() in the generate_settings_form function.
* @return array List of gradebook_number_decimals options
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
@ -1106,7 +1108,6 @@ function generate_settings_form($settings, $settings_by_access_list) {
}
$default_values = array();
$url_info = api_get_access_url($url_id);
$i = 0;

@ -159,12 +159,12 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
$changeable = 1;
}
$params = array('variable = ?' => array($key));
$params = array('variable = ?' => array($key));
$data = api_get_settings_params($params);
if (!empty($data)) {
foreach ($data as $item) {
$params = array('id' =>$item['id'], 'access_url_changeable' => $changeable);
$params = array('id' => $item['id'], 'access_url_changeable' => $changeable);
api_set_setting_simple($params);
}
}

@ -4,7 +4,7 @@
/**
* SubLanguageManager class definition file
* @package chamilo.admin.sublanguage
* @package chamilo.admin.sublanguage
* @todo clean this lib and move to main/inc/lib
*/
class SubLanguageManager {

@ -65,7 +65,7 @@ $show_announcement_list = true;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
// Form was posted?
if (isset ($_POST['action'])) {
if (isset($_POST['action'])) {
$action_todo = true;
}

@ -163,9 +163,9 @@ if (api_get_setting('login_is_email') != 'true') {
$group = array();
$auth_sources = 0; //make available wider as we need it in case of form reset (see below)
$nb_ext_auth_source_added = 0;
if (count($extAuthSource) > 0) {
if (isset($extAuthSource) && count($extAuthSource) > 0) {
$auth_sources = array();
foreach($extAuthSource as $key => $info) {
foreach ($extAuthSource as $key => $info) {
// @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
@ -291,9 +291,9 @@ if( $form->validate()) {
$picture = $_FILES['picture'];
$platform_admin = intval($user['admin']['platform_admin']);
$send_mail = intval($user['mail']['send_mail']);
$hr_dept_id = intval($user['hr_dept_id']);
$hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0;
if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
if (isset($extAuthSource) && count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
$auth_source = $user['password']['auth_source'];
$password = 'PLACEHOLDER';
} else {

@ -89,8 +89,8 @@ $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
$sql = "SELECT u.*, a.user_id AS is_admin FROM $table_user u LEFT JOIN $table_admin a ON a.user_id = u.user_id WHERE u.user_id = '".$user_id."'";
$res = Database::query($sql);
if (Database::num_rows($res) != 1) {
header('Location: user_list.php');
exit;
header('Location: user_list.php');
exit;
}
$user_data = Database::fetch_array($res, 'ASSOC');
@ -180,25 +180,25 @@ if (api_get_setting('login_is_email') != 'true') {
// Password
$form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
$nb_ext_auth_source_added = 0;
if (isset($extAuthSource) && count($extAuthSource) > 0) {
$auth_sources = array();
foreach ($extAuthSource as $key => $info) {
// @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
// same action for file user_add.php
if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
$auth_sources[$key] = $key;
$nb_ext_auth_source_added++;
}
}
if ($nb_ext_auth_source_added > 0) {
// @todo check the radio button for external authentification and select the external authentification in the menu
$group[] =$form->createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication').' ', 3);
$group[] =$form->createElement('select', 'auth_source', null, $auth_sources);
$group[] =$form->createElement('static', '', '', '<br />');
$form->addGroup($group, 'password', null, '', false);
}
if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0) {
$auth_sources = array();
foreach ($extAuthSource as $key => $info) {
// @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
// Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
// extAuthSource always on for CAS even if not activated
// same action for file user_add.php
if (($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true') || ($key != CAS_AUTH_SOURCE)) {
$auth_sources[$key] = $key;
$nb_ext_auth_source_added++;
}
}
if ($nb_ext_auth_source_added > 0) {
// @todo check the radio button for external authentification and select the external authentification in the menu
$group[] = $form->createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication').' ', 3);
$group[] = $form->createElement('select', 'auth_source', null, $auth_sources);
$group[] = $form->createElement('static', '', '', '<br />');
$form->addGroup($group, 'password', null, '', false);
}
}
$form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1);
$group = array();
@ -252,8 +252,8 @@ $form->addElement('select_language', 'language', get_lang('Language'));
// Send email
$group = array();
$group[] =$form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
$group[] =$form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
$group[] = $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
$group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
$form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), '&nbsp;', false);
// Registration User and Date

@ -94,7 +94,7 @@ if ($form->validate()) {
$sql .= " FROM $user_table u ORDER BY lastname,firstname";
}
$filename = 'export_users_'.date('Y-m-d_H-i-s');
}
}
$data = array();
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false);
if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') {

@ -23,10 +23,6 @@ if (!isset($_GET['user_id'])) {
}
$user = api_get_user_info($_GET['user_id']);
$tool_name = $user['complete_name'].(empty($user['official_code'])?'':' ('.$user['official_code'].')');
/**
* Display
*/
Display::display_header($tool_name);
$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@ -121,7 +117,6 @@ if (count($sessions) > 0) {
$header[] = array (get_lang('Status'), true);
$header[] = array ('', false);
foreach ($sessions as $session_item) {
$data = array ();

@ -188,8 +188,7 @@ if (isset($_REQUEST['load_ajax'])) {
}
}
}
}
}
//2.track_e_attempt, track_e_attempt_recording, track_e_downloads
//Nothing to do because there are not relationship with a session
@ -235,8 +234,7 @@ if (isset($_REQUEST['load_ajax'])) {
}
}
//5. lp_item_view
//5. lp_item_view
//CHECK ORIGIN
$sql = "SELECT * FROM $TBL_LP_VIEW WHERE user_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id ";

@ -173,10 +173,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'add') {
$form->setConstants(array('sec_token' => $token));
$form->display();
}
}
// Action handling: deleting a note
elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && is_numeric($_GET['id'])) {
} elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && is_numeric($_GET['id'])) {
$res = $usergroup->delete(Security::remove_XSS($_GET['id']));
if ($res) {
Display::display_confirmation_message(get_lang('Deleted'));
@ -185,5 +182,4 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && is_numeric($_GE
} else {
$usergroup->display();
}
Display :: display_footer();

@ -82,7 +82,6 @@ class CourseBuilder
$this->course->path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/';
$this->course->backup_path = api_get_path(SYS_COURSE_PATH).$_course['path'];
$this->course->encoding = api_get_system_encoding(); //current platform encoding
$this->course->db_name = $_course['dbName'];
$this->course->info = $_course;
}

@ -62,19 +62,19 @@ class Event extends Resource
*/
function Event($id, $title, $content, $start_date, $end_date, $attachment_path = null, $attachment_filename= null, $attachment_size= null, $attachment_comment= null, $all_day = 0) {
parent::Resource($id,RESOURCE_EVENT);
$this->title = $title;
$this->content = $content;
$this->start_date = $start_date;
$this->end_date = $end_date;
$this->all_day = $all_day;
$this->attachment_path = $attachment_path;
$this->attachment_filename = $attachment_filename;
$this->attachment_size = $attachment_size;
$this->attachment_comment = $attachment_comment;
$this->attachment_comment = $attachment_comment;
}
/**
* Show this Event
*/

@ -31,7 +31,7 @@ define('RESOURCE_WORK', 'work');
* Representation of a resource in a Chamilo-course.
* This is a base class of which real resource-classes (for Links,
* Documents,...) should be derived.
* @author Bart Mollet <bart.mollet@hogent.be>s
* @author Bart Mollet <bart.mollet@hogent.be>s
* @package chamilo.backup
* @todo Use the gloabaly defined constants voor tools and remove the RESOURCE_*
* constants
@ -113,7 +113,8 @@ class Resource
* Returns the id of this resource.
* @return int The id of this resource in the source course.
*/
function get_id() {
function get_id()
{
return $this->source_id;
}
@ -121,7 +122,8 @@ class Resource
* Resturns the type of this resource
* @return constant The type.
*/
function get_type() {
function get_type()
{
return $this->type;
}
@ -133,7 +135,8 @@ class Resource
* @todo once the RESOURCE_* constants are replaced by the globally
* defined TOOL_* constants, this function will be replaced by get_type()
*/
function get_tool($for_item_property_table = true) {
function get_tool($for_item_property_table = true)
{
switch ($this->get_type()) {
case RESOURCE_DOCUMENT:
return TOOL_DOCUMENT;
@ -195,7 +198,8 @@ class Resource
* Set the destination id
* @param int $id The id of this resource in the destination course.
*/
function set_new_id($id) {
function set_new_id($id)
{
$this->destination_id = $id;
}
@ -203,14 +207,16 @@ class Resource
* Check if this resource is allready restored in the destination course.
* @return bool true if allready restored (i.e. destination_id is set).
*/
function is_restored() {
function is_restored()
{
return $this->destination_id > -1;
}
/**
* Show this resource
*/
function show() {
function show()
{
//echo 'RESOURCE: '.$this->get_id().' '.$type[$this->get_type()].' ';
}
}

@ -47,7 +47,7 @@ echo Display::page_header(get_lang('CopyCourse'));
// If a CourseSelectForm is posted or we should copy all resources, then copy them
if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy')) {
if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') {
$course = CourseSelectForm::get_posted_course('copy_course');
$course = CourseSelectForm :: get_posted_course('copy_course');
} else {
$cb = new CourseBuilder();
$course = $cb->build();

@ -14,7 +14,7 @@ $language_file = array('exercice', 'admin', 'coursebackup');
// Including the global initialization file
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
@ -22,7 +22,7 @@ api_check_archive_dir();
// Check access rights (only teachers are allowed here)
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
api_not_allowed(true);
}
// Remove memory and time limits as much as possible as this might be a long process...

@ -152,12 +152,10 @@ if ($course_validation_feature) {
$form->addElement('checkbox', 'legal', null, get_lang('IAcceptTermsAndConditions'), 1);
$form->addRule('legal', get_lang('YouHaveToAcceptTermsAndConditions'), 'required');
// Link to terms and conditions.
$link_terms_and_conditions = '<script type="text/JavaScript">
<!--
$link_terms_and_conditions = '<script>
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script><a href="#" onclick="javascript: MM_openBrWindow(\''.$terms_and_conditions_url.'\',\'Conditions\',\'scrollbars=yes, width=800\')">';
$link_terms_and_conditions .= get_lang('ReadTermsAndConditions').'</a>';
$form->addElement('label', null, $link_terms_and_conditions);
@ -188,15 +186,15 @@ $form->setDefaults($values);
if ($form->validate()) {
$course_values = $form->exportValues();
$wanted_code = $course_values['wanted_code'];
$category_code = $course_values['category_code'];
$title = $course_values['title'];
$course_language = $course_values['course_language'];
$exemplary_content = !empty($course_values['exemplary_content']);
$wanted_code = $course_values['wanted_code'];
$category_code = $course_values['category_code'];
$title = $course_values['title'];
$course_language = $course_values['course_language'];
$exemplary_content = !empty($course_values['exemplary_content']);
if ($course_validation_feature) {
$description = $course_values['description'];
$objetives = $course_values['objetives'];
$description = $course_values['description'];
$objetives = $course_values['objetives'];
$target_audience = $course_values['target_audience'];
}
@ -266,7 +264,6 @@ if ($form->validate()) {
// Display the form.
$content = $form->return_form();
}
} else {
if (!$course_validation_feature) {
$message = Display :: return_message(get_lang('Explanation'));

@ -93,7 +93,7 @@ function get_all_php_files($base_path) {
if (in_array($ext,array('.php','html','.htm','.css'))) {
$files[] = $base_path.$item;
}
}
}
}
$list = null;
return $files;

@ -112,7 +112,7 @@ if (isset ($group)) {
// Copied from document.php
$dir_array = explode('/', $dir);
$array_len = count($dir_array);
$dir_acum = '';
for ($i = 0; $i < $array_len; $i++) {
$url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];
@ -151,11 +151,11 @@ $(document).ready(function(){
'displayFormat' : '#input/#max'
};
$('#textarea_google').textareaCount(options, function(data){
$('#textareaCallBack').html(data);
});
$('#textareaCallBack').html(data);
});
});
</script>
</script>
<style>
.overview {
background: #FFEC9D;
@ -173,7 +173,7 @@ $(document).ready(function(){
.warningTextareaInfo {
color: #FF0000;
font-weight:bold;
text-align: right;
text-align: right;
}
#showData {
@ -186,10 +186,9 @@ $(document).ready(function(){
</style>
<div id="textareaCallBack"></div>
<?php
if(Security::remove_XSS($_POST['text2voice_mode'])=='google'){
if (Security::remove_XSS($_POST['text2voice_mode'])=='google') {
downloadMP3_google($filepath, $dir);
}
elseif(Security::remove_XSS($_POST['text2voice_mode'])=='pediaphon'){
} elseif (Security::remove_XSS($_POST['text2voice_mode']) == 'pediaphon') {
downloadMP3_pediaphon($filepath, $dir);
}
@ -308,16 +307,13 @@ $(document).ready(function(){
echo '<label>'.get_lang('Language').': ';
$tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql_select = "SELECT * FROM $tbl_admin_languages";
$result_select = Database::query($sql_select);
$result_select = Database::query($sql_select);
echo '<select name="lang" id="select">';
while ($row = Database::fetch_array($result_select)) {
if (in_array($row['isocode'], array('ca', 'en', 'es', 'hi', 'it', 'pt'))){
if (in_array($row['isocode'], array('ca', 'en', 'es', 'hi', 'it', 'pt'))) {
if (api_get_setting('platformLanguage')==$row['english_name']){
echo '<option value="'.$row['isocode'].'" selected="selected">'.$row['original_name'].' ('.$row['english_name'].')</option>';
}
else{
} else {
echo '<option value="'.$row['isocode'].'">'.$row['original_name'].' ('.$row['english_name'].')</option>';
}
}
@ -335,8 +331,8 @@ $(document).ready(function(){
echo '<br/>';
echo '<label>';
echo '<textarea name="text" id="textarea" cols="70" rows="10"></textarea>';
echo '</label>';
echo '<br/><br/>';
echo '</label>';
echo '<br/><br/>';
echo '<button class="save" type="submit" name="SendText2Audio">'.get_lang('BuildMP3').'</button>';
echo '<br/>';
echo '</form>';
@ -356,7 +352,8 @@ Display :: display_footer();
* @author Juan Carlos Raña Trabado <herodoto@telefonica.net>
* @version january 2011, chamilo 1.8.8
*/
function downloadMP3_google($filepath, $dir) {
function downloadMP3_google($filepath, $dir)
{
$location='create_audio.php?'.api_get_cidreq().'&id='.Security::remove_XSS($_POST['document_id']).'&dt2a=google';
//security
@ -468,9 +465,6 @@ function downloadMP3_pediaphon($filepath, $dir){
}
$documentPath = $filepath.'/'.$audio_filename;
//prev for a fine unicode, borrowed from main api TODO:clean
// Safe replacements for some non-letter characters (whitout blank spaces)
@ -486,49 +480,47 @@ function downloadMP3_pediaphon($filepath, $dir){
// Replacing remaining dangerous non-letter characters.
$clean_text = str_replace($search, $replace, $filename);
//adding the file
//adding the file
if ($clean_lang=='de'){
$url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi';
$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/';
}
else{
$url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi';//en, es, fr
$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/';
}
if ($clean_lang=='de') {
$url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi';
$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/';
} else {
$url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi';//en, es, fr
$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/';
}
$data="stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak";
$opts = array('http' =>
array(
'method' => 'POST',
'header' =>"Content-Type: application/x-www-form-urlencoded\r\n",
"Content-Length: " . strlen($data) . "\r\n",
'content' => $data
)
);
$context = stream_context_create($opts);
// Download the whole HTML page
$previous_returntext2voice = file_get_contents($url_pediaphon,false,$context);
//extract the audio file path
$search_source=preg_match($find_t2v, $previous_returntext2voice, $hits);
$souce_end=substr($hits[0], 0,-1);
//download file
$returntext2voice = file_get_contents($souce_end);
//save file
$f = @file_put_contents($documentPath, $returntext2voice);
if ($f === false && !empty($php_errormsg)) {
error_log($php_errormsg);
}
//add document to database
$current_session_id = api_get_session_id();
$groupId = $_SESSION['_gid'];
$file_size = filesize($documentPath);
$relativeUrlPath=$dir;
$doc_id = add_document($_course, $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
Display::display_confirmation_message(get_lang('DocumentCreated'));
$data="stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak";
$opts = array('http' =>
array(
'method' => 'POST',
'header' =>"Content-Type: application/x-www-form-urlencoded\r\n",
"Content-Length: " . strlen($data) . "\r\n",
'content' => $data
)
);
$context = stream_context_create($opts);
// Download the whole HTML page
$previous_returntext2voice = file_get_contents($url_pediaphon,false,$context);
//extract the audio file path
$search_source=preg_match($find_t2v, $previous_returntext2voice, $hits);
$souce_end=substr($hits[0], 0,-1);
//download file
$returntext2voice = file_get_contents($souce_end);
//save file
$f = @file_put_contents($documentPath, $returntext2voice);
if ($f === false && !empty($php_errormsg)) {
error_log($php_errormsg);
}
//add document to database
$current_session_id = api_get_session_id();
$groupId = $_SESSION['_gid'];
$file_size = filesize($documentPath);
$relativeUrlPath=$dir;
$doc_id = add_document($_course, $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
Display::display_confirmation_message(get_lang('DocumentCreated'));
//return to location
echo '<script>window.location.href="'.$location.'"</script>';
}

@ -1,5 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
/**
* EXTRA FUNCTIONS FOR DOCUMENTS TOOL
@ -180,9 +179,6 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
$tooltip_title = $title;
//Cut long titles
//$title = cut($title, 120);
$tooltip_title_alt = $tooltip_title;
if ($path == '/shared_folder') {
$tooltip_title_alt = get_lang('UserFolders');
@ -297,6 +293,7 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
(preg_match('/wav$/i', urldecode($url)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) ||
preg_match('/ogg$/i', urldecode($url))) {
$sound_preview = DocumentManager::generate_media_preview($counter);
return $sound_preview;
} elseif (
//Show preview
@ -326,6 +323,7 @@ function create_document_link($document_data, $show_as_icon = false, $counter =
(preg_match('/wav$/i', urldecode($url)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) ||
preg_match('/ogg$/i', urldecode($url))) {
$sound_preview = DocumentManager::generate_media_preview($counter);
return $sound_preview;
} elseif (
//Show preview

@ -41,7 +41,9 @@ api_protect_course_script();
$lp_id = intval($_GET['lp_id']);
// Check if the learning path is visible for student - (LP requisites)
if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
api_not_allowed(true);
}

Loading…
Cancel
Save