Minor - Format code

pull/2487/head
jmontoyaa 9 years ago
parent 21afa46d59
commit 3f48324277
  1. 13
      main/admin/access_url_add_usergroup_to_url.php
  2. 34
      main/admin/access_url_add_users_to_url.php
  3. 22
      main/admin/access_url_check_user_session.php
  4. 3
      main/admin/access_url_edit.php
  5. 2
      main/admin/access_url_edit_course_category_to_url.php
  6. 1
      main/admin/access_url_edit_courses_to_url.php
  7. 2
      main/admin/access_url_edit_usergroup_to_url.php
  8. 2
      main/admin/access_url_edit_users_to_url.php
  9. 34
      main/admin/access_urls.php
  10. 5
      main/admin/add_courses_to_usergroup.php
  11. 4
      main/admin/add_sessions_to_promotion.php
  12. 26
      main/admin/add_sessions_to_usergroup.php
  13. 22
      main/admin/career_dashboard.php
  14. 4
      main/admin/cli.php
  15. 2
      main/admin/configure_inscription.php
  16. 2
      main/admin/course_edit.php
  17. 4
      main/admin/course_list.php
  18. 5
      main/admin/course_request_accepted.php
  19. 5
      main/admin/course_request_edit.php
  20. 7
      main/admin/course_request_rejected.php
  21. 1
      main/admin/course_request_review.php
  22. 6
      main/admin/course_user_import.php
  23. 3
      main/admin/dashboard_add_courses_to_user.php
  24. 6
      main/admin/dashboard_add_sessions_to_user.php
  25. 6
      main/admin/dashboard_add_users_to_user.php
  26. 6
      main/admin/event_type.php
  27. 2
      main/admin/export_certificates.php
  28. 1
      main/admin/extra_field_options.php
  29. 3
      main/admin/languages.php
  30. 7
      main/course_home/course_home.php
  31. 2
      main/inc/lib/AnnouncementManager.php
  32. 6
      main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
  33. 2
      main/inc/lib/add_courses_to_session_functions.lib.php
  34. 13
      main/inc/lib/add_many_session_to_category_functions.lib.php
  35. 4
      main/inc/lib/app_view.php
  36. 9
      user_portal.php

@ -1,12 +1,12 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script allows platform admins to add users to urls. * This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses; * It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on * you can select multiple users and courses and then click on
* @package chamilo.admin * @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
*/ */
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
@ -18,7 +18,6 @@ if (!api_get_multiple_access_url()) {
} }
$userGroup = new UserGroup(); $userGroup = new UserGroup();
$form_sent = 0; $form_sent = 0;
$firstLetterUserGroup = null; $firstLetterUserGroup = null;
$courses = array(); $courses = array();

@ -1,12 +1,12 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script allows platform admins to add users to urls. * This script allows platform admins to add users to urls.
* It displays a list of users and a list of courses; * It displays a list of users and a list of courses;
* you can select multiple users and courses and then click on * you can select multiple users and courses and then click on
* @package chamilo.admin * @package chamilo.admin
* @author Julio Montoya <gugli100@gmail.com> * @author Julio Montoya <gugli100@gmail.com>
*/ */
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
@ -20,13 +20,13 @@ if (!api_get_multiple_access_url()) {
$form_sent = 0; $form_sent = 0;
$first_letter_user = ''; $first_letter_user = '';
$first_letter_course = ''; $first_letter_course = '';
$courses = array (); $courses = array();
$url_list = array(); $url_list = array();
$users = array(); $users = array();
$tbl_access_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_access_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); $tbl_access_url = Database:: get_main_table(TABLE_MAIN_ACCESS_URL);
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_user = Database:: get_main_table(TABLE_MAIN_USER);
/* Header */ /* Header */
$tool_name = get_lang('AddUsersToURL'); $tool_name = get_lang('AddUsersToURL');
@ -37,8 +37,9 @@ Display :: display_header($tool_name);
echo '<div class="actions">'; echo '<div class="actions">';
echo Display::url( echo Display::url(
Display::return_icon('edit.png', get_lang('EditUsersToURL'),''), Display::return_icon('edit.png', get_lang('EditUsersToURL'), ''),
api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'); api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'
);
echo '</div>'; echo '</div>';
api_display_tool_title($tool_name); api_display_tool_title($tool_name);
@ -48,17 +49,18 @@ if ($_POST['form_sent']) {
$users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ; $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ;
$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
$first_letter_user = $_POST['first_letter_user']; $first_letter_user = $_POST['first_letter_user'];
foreach ($users as $key => $value) {
foreach($users as $key => $value) {
$users[$key] = intval($value); $users[$key] = intval($value);
} }
if ($form_sent == 1) { if ($form_sent == 1) {
if (count($users) == 0 || count($url_list) == 0) { if (count($users) == 0 || count($url_list) == 0) {
Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); Display:: display_error_message(
get_lang('AtLeastOneUserAndOneURL')
);
} else { } else {
UrlManager::add_users_to_urls($users,$url_list); UrlManager::add_users_to_urls($users, $url_list);
Display :: display_confirmation_message(get_lang('UsersBelongURL')); Display:: display_confirmation_message(get_lang('UsersBelongURL'));
} }
} }
} }

@ -1,10 +1,10 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* @author Bart Mollet, Julio Montoya lot of fixes * @author Bart Mollet, Julio Montoya lot of fixes
* @package chamilo.admin * @package chamilo.admin
*/ */
/* INIT SECTION */
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
@ -14,7 +14,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true); api_protect_admin_script(true);
$tool_name = get_lang('SessionOverview'); $tool_name = get_lang('SessionOverview');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList')); $interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
@ -32,7 +31,13 @@ switch ($action) {
$result = UrlManager::add_user_to_url($user_id, $url_id); $result = UrlManager::add_user_to_url($user_id, $url_id);
$user_info = api_get_user_info($user_id); $user_info = api_get_user_info($user_id);
if ($result) { if ($result) {
$message = Display::return_message(get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), 'confirm'); $message = Display::return_message(
get_lang('UserAdded').' '.api_get_person_name(
$user_info['firstname'],
$user_info['lastname']
),
'confirm'
);
} }
break; break;
} }
@ -44,9 +49,7 @@ if (!empty($message)) {
} }
$multiple_url_is_on = api_get_multiple_access_url(); $multiple_url_is_on = api_get_multiple_access_url();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
$session_list = SessionManager::get_sessions_list(); $session_list = SessionManager::get_sessions_list();
$html = ''; $html = '';
@ -57,11 +60,9 @@ if ($show_users_with_problems) {
$html .= '<a href="'.api_get_self().'?show_users_with_problems=1">'.get_lang('ShowUsersNotAddedInTheURL').'</a>'; $html .= '<a href="'.api_get_self().'?show_users_with_problems=1">'.get_lang('ShowUsersNotAddedInTheURL').'</a>';
} }
foreach ($session_list as $session_item) { foreach ($session_list as $session_item) {
$session_id = $session_item['id']; $session_id = $session_item['id'];
$html .= '<h3>'.$session_item['name'].'</h3>'; $html .= '<h3>'.$session_item['name'].'</h3>';
$access_where = "(access_url_id = $url_id OR access_url_id is null )"; $access_where = "(access_url_id = $url_id OR access_url_id is null )";
if ($show_users_with_problems) { if ($show_users_with_problems) {
$access_where = "(access_url_id is null)"; $access_where = "(access_url_id is null)";
@ -89,7 +90,6 @@ foreach ($session_list as $session_item) {
} }
$link_to_add_user_in_url = ''; $link_to_add_user_in_url = '';
if ($multiple_url_is_on) { if ($multiple_url_is_on) {
if ($user['access_url_id'] != $url_id) { if ($user['access_url_id'] != $url_id) {
$user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_MEDIUM); $user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_MEDIUM);

@ -51,7 +51,8 @@ if ($form->validate()) {
unlink($url_images_dir . $url_id . '_' . $image_field . '.png'); unlink($url_images_dir . $url_id . '_' . $image_field . '.png');
} }
move_uploaded_file( move_uploaded_file(
$_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png' $_FILES[$image_field]['tmp_name'],
$url_images_dir.$url_id.'_'.$image_field.'.png'
); );
} }
// else fail silently // else fail silently

@ -7,7 +7,6 @@
// resetting the course id // resetting the course id
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$xajax = new xajax(); $xajax = new xajax();
@ -97,7 +96,6 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
} }
Display::display_header($tool_name); Display::display_header($tool_name);
api_display_tool_title($tool_name); api_display_tool_title($tool_name);
$noUserGroupList = $userGroupList = array(); $noUserGroupList = $userGroupList = array();

@ -325,7 +325,6 @@ $url_list = UrlManager::get_url_data();
nosessionClasses = makepost(document.getElementById('origin_classes')); nosessionClasses = makepost(document.getElementById('origin_classes'));
sessionClasses = makepost(document.getElementById('destination_classes')); sessionClasses = makepost(document.getElementById('destination_classes'));
xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses); xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
xhr_object.onreadystatechange = function() { xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4) { if(xhr_object.readyState == 4) {
document.getElementById('content_source').innerHTML = result = xhr_object.responseText; document.getElementById('content_source').innerHTML = result = xhr_object.responseText;

@ -45,10 +45,8 @@ $htmlHeadXtra[] = '
function add_user_to_url(code, content) { function add_user_to_url(code, content) {
document.getElementById("course_to_add").value = ""; document.getElementById("course_to_add").value = "";
document.getElementById("ajax_list_courses").innerHTML = ""; document.getElementById("ajax_list_courses").innerHTML = "";
destination = document.getElementById("destination_users"); destination = document.getElementById("destination_users");
destination.options[destination.length] = new Option(content,code); destination.options[destination.length] = new Option(content,code);
destination.selectedIndex = -1; destination.selectedIndex = -1;
sortOptions(destination.options); sortOptions(destination.options);
} }

@ -48,10 +48,8 @@ $htmlHeadXtra[] = '<script>
function add_user_to_url(code, content) { function add_user_to_url(code, content) {
document.getElementById("user_to_add").value = ""; document.getElementById("user_to_add").value = "";
document.getElementById("ajax_list_users").innerHTML = ""; document.getElementById("ajax_list_users").innerHTML = "";
destination = document.getElementById("destination_users"); destination = document.getElementById("destination_users");
destination.options[destination.length] = new Option(content,code); destination.options[destination.length] = new Option(content,code);
destination.selectedIndex = -1; destination.selectedIndex = -1;
sortOptions(destination.options); sortOptions(destination.options);
} }

@ -79,16 +79,24 @@ foreach ($url_list as $my_url) {
$url_string .= $my_url['url'].' <br />'; $url_string .= $my_url['url'].' <br />';
} }
} }
if(!empty($url_string)) { if (!empty($url_string)) {
Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); Display:: display_warning_message(
get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,
false
);
} }
// checking the current installation // checking the current installation
if ($current_access_url_id==-1) { if ($current_access_url_id == -1) {
Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); Display::display_warning_message(
} elseif(api_is_platform_admin()) { get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)
$quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id); );
if ($quant==0) { } elseif (api_is_platform_admin()) {
$quant = UrlManager::relation_url_user_exist(
api_get_user_id(),
$current_access_url_id
);
if ($quant == 0) {
Display:: display_warning_message( Display:: display_warning_message(
'<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>', '<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>',
false false
@ -135,13 +143,13 @@ foreach ($sortable_data as $row) {
//Status //Status
$active = $row['active']; $active = $row['active'];
if ($active=='1') { if ($active == '1') {
$action='lock'; $action = 'lock';
$image='right'; $image = 'right';
} }
if ($active=='0') { if ($active == '0') {
$action='unlock'; $action = 'unlock';
$image='wrong'; $image = 'wrong';
} }
// you cannot lock the default // you cannot lock the default
if ($row['id']=='1') { if ($row['id']=='1') {

@ -32,7 +32,6 @@ if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
} }
$add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null; $add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
function add_user_to_session (code, content) { function add_user_to_session (code, content) {
@ -87,7 +86,6 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
} }
} }
// Filters // Filters
$filters = array( $filters = array(
array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')), array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')),
@ -201,11 +199,8 @@ echo '</div>';
echo '<div id="advanced_search_options" style="display:none">'; echo '<div id="advanced_search_options" style="display:none">';
$searchForm->display(); $searchForm->display();
echo '</div>'; echo '</div>';
?> ?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
<?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; <?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
echo Display::input('hidden', 'id', $id); echo Display::input('hidden', 'id', $id);
echo Display::input('hidden', 'form_sent', '1'); echo Display::input('hidden', 'form_sent', '1');

@ -67,7 +67,7 @@ function validate_filter() {
$form_sent = 0; $form_sent = 0;
$errorMsg = ''; $errorMsg = '';
$users =$sessions=array(); $users = $sessions = array();
$promotion = new Promotion(); $promotion = new Promotion();
$id = intval($_GET['id']); $id = intval($_GET['id']);
if (isset($_POST['form_sent']) && $_POST['form_sent']) { if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@ -86,7 +86,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$promotion_data = $promotion->get($id); $promotion_data = $promotion->get($id);
$session_list = SessionManager::get_sessions_list(array(), array('name')); $session_list = SessionManager::get_sessions_list(array(), array('name'));
$session_not_in_promotion = $session_in_promotion= array(); $session_not_in_promotion = $session_in_promotion = array();
if (!empty($session_list)) { if (!empty($session_list)) {
foreach ($session_list as $session) { foreach ($session_list as $session) {

@ -101,12 +101,10 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$data = $usergroup->get($id); $data = $usergroup->get($id);
$session_list_in = $usergroup->get_sessions_by_usergroup($id); $session_list_in = $usergroup->get_sessions_by_usergroup($id);
$session_list = SessionManager::get_sessions_list(array(), array('name')); $session_list = SessionManager::get_sessions_list(array(), array('name'));
$elements_not_in = $elements_in = array();
//api_display_tool_title($tool_name.' ('.$session_info['name'].')');
$elements_not_in = $elements_in= array();
if (!empty($session_list)) { if (!empty($session_list)) {
foreach($session_list as $session) { foreach ($session_list as $session) {
if (in_array($session['id'], $session_list_in)) { if (in_array($session['id'], $session_list_in)) {
$elements_in[$session['id']] = $session['name']; $elements_in[$session['id']] = $session['name'];
} else { } else {
@ -134,17 +132,19 @@ function search_usergroup_sessions($needle,$type) {
array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%")) array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
); );
} }
$i=0;
if ($type != 'single') { if ($type != 'single') {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">'; $return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
foreach ($session_list as $row) {
foreach ($session_list as $row ) {
if (!in_array($row['id'], array_keys($elements_in))) { if (!in_array($row['id'], array_keys($elements_in))) {
$return .= '<option value="'.$row['id'].'">'.$row['name'].'</option>'; $return .= '<option value="'.$row['id'].'">'.$row['name'].'</option>';
} }
} }
$return .= '</select>'; $return .= '</select>';
$xajax_response -> addAssign('ajax_list_multiple','innerHTML',api_utf8_encode($return)); $xajax_response->addAssign(
'ajax_list_multiple',
'innerHTML',
api_utf8_encode($return)
);
} }
} }
@ -176,10 +176,10 @@ echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
<?php <?php
echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
echo Display::input('hidden','id',$id); echo Display::input('hidden', 'id', $id);
echo Display::input('hidden','form_sent','1'); echo Display::input('hidden', 'form_sent', '1');
echo Display::input('hidden','add_type',null); echo Display::input('hidden', 'add_type', null);
if(!empty($errorMsg)) { if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg); //main API Display::display_normal_message($errorMsg); //main API
} }
?> ?>
@ -266,7 +266,7 @@ if(!empty($errorMsg)) {
</table> </table>
</form> </form>
<script type="text/javascript"> <script>
function moveItem(origin , destination) { function moveItem(origin , destination) {
for(var i = 0 ; i<origin.options.length ; i++) { for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) { if(origin.options[i].selected) {

@ -18,8 +18,14 @@ $this_section = SECTION_PLATFORM_ADMIN;
$htmlHeadXtra[] = api_get_jqgrid_js(); $htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs // setting breadcrumbs
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array(
$interbreadcrumb[]=array('url' => 'career_dashboard.php','name' => get_lang('CareersAndPromotions')); 'url' => 'index.php',
'name' => get_lang('PlatformAdmin')
);
$interbreadcrumb[] = array(
'url' => 'career_dashboard.php',
'name' => get_lang('CareersAndPromotions')
);
Display :: display_header(null); Display :: display_header(null);
@ -142,19 +148,19 @@ if (!empty($career_arrayer)) {
if (!empty($sessions)) { if (!empty($sessions)) {
foreach ($sessions as $session) { foreach ($sessions as $session) {
$course_list = $session['courses']; $course_list = $session['courses'];
$url = Display::url(
$url = Display::url($session['data']['name'], $session['data']['name'],
'../session/resume_session.php?id_session=' . $session['data']['id']); '../session/resume_session.php?id_session='.$session['data']['id']
);
echo '<tr>'; echo '<tr>';
//Session name // Session name
echo Display::tag('td', $url); echo Display::tag('td', $url);
echo '<td>'; echo '<td>';
//Courses // Courses
echo '<table>'; echo '<table>';
if (!empty($course_list)) { if (!empty($course_list)) {
foreach ($course_list as $course) { foreach ($course_list as $course) {
echo '<tr>'; echo '<tr>';
$url = Display::url( $url = Display::url(
$course['title'], $course['title'],
api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . $session['data']['id'] api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . $session['data']['id']

@ -6,9 +6,7 @@
* @author Arnaud Ligot, CBlue SPRL * @author Arnaud Ligot, CBlue SPRL
* @package chamilo.admin.cli * @package chamilo.admin.cli
*/ */
/**
* Init section
*/
// we are in the admin area so we do not need a course id // we are in the admin area so we do not need a course id
$cidReset = true; $cidReset = true;
// include global script // include global script

@ -46,7 +46,7 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm
$tool_name = get_lang('ConfigureInscription'); $tool_name = get_lang('ConfigureInscription');
if (!empty($action)) { if (!empty($action)) {
$interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription')); $interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription'));
switch($action) { switch ($action) {
case 'edit_top': case 'edit_top':
$tool_name = get_lang('EditTopRegister'); $tool_name = get_lang('EditTopRegister');
break; break;

@ -59,7 +59,7 @@ if (api_is_multiple_url_enabled()) {
ON (u.user_id=url_rel_user.user_id) ON (u.user_id=url_rel_user.user_id)
WHERE WHERE
url_rel_user.access_url_id=" . api_get_current_access_url_id() . " AND url_rel_user.access_url_id=" . api_get_current_access_url_id() . " AND
status=1" . $order_clause; status = 1" . $order_clause;
} else { } else {
$sql = "SELECT user_id, lastname, firstname $sql = "SELECT user_id, lastname, firstname
FROM $table_user WHERE status='1'" . $order_clause; FROM $table_user WHERE status='1'" . $order_clause;

@ -30,7 +30,7 @@ function get_number_of_courses()
ON (c.id = url_rel_course.c_id)"; ON (c.id = url_rel_course.c_id)";
} }
if (isset ($_GET['keyword'])) { if (isset($_GET['keyword'])) {
$keyword = Database::escape_string("%".$_GET['keyword']."%"); $keyword = Database::escape_string("%".$_GET['keyword']."%");
$sql .= " WHERE ( $sql .= " WHERE (
c.title LIKE '".$keyword."' OR c.title LIKE '".$keyword."' OR
@ -105,7 +105,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
ON (course.id = url_rel_course.c_id)"; ON (course.id = url_rel_course.c_id)";
} }
if (isset ($_GET['keyword'])) { if (isset($_GET['keyword'])) {
$keyword = Database::escape_string("%".trim($_GET['keyword'])."%"); $keyword = Database::escape_string("%".trim($_GET['keyword'])."%");
$sql .= " WHERE ( $sql .= " WHERE (
title LIKE '".$keyword."' OR title LIKE '".$keyword."' OR

@ -14,9 +14,7 @@
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(); api_protect_admin_script();
// A check whether the course validation feature is enabled. // A check whether the course validation feature is enabled.
@ -28,7 +26,6 @@ $message = isset($_GET['message']) ? trim(Security::remove_XSS(stripslashes(urld
$is_error_message = !empty($_GET['is_error_message']); $is_error_message = !empty($_GET['is_error_message']);
if ($course_validation_feature) { if ($course_validation_feature) {
/** /**
* Deletion of a course request. * Deletion of a course request.
*/ */
@ -50,7 +47,7 @@ if ($course_validation_feature) {
elseif (isset($_POST['action'])) { elseif (isset($_POST['action'])) {
switch ($_POST['action']) { switch ($_POST['action']) {
// Delete selected courses // Delete selected courses
case 'delete_course_requests' : case 'delete_course_requests':
$course_requests = $_POST['course_request']; $course_requests = $_POST['course_request'];
if (is_array($_POST['course_request']) && !empty($_POST['course_request'])) { if (is_array($_POST['course_request']) && !empty($_POST['course_request'])) {
$success = true; $success = true;

@ -22,7 +22,6 @@ $id = intval($_GET['id']);
$caller = intval($_GET['caller']); $caller = intval($_GET['caller']);
if ($course_validation_feature) { if ($course_validation_feature) {
// Retrieve request's data from the corresponding database record. // Retrieve request's data from the corresponding database record.
$course_request_info = CourseRequestManager::get_course_request_info($id); $course_request_info = CourseRequestManager::get_course_request_info($id);
if (!is_array($course_request_info)) { if (!is_array($course_request_info)) {
@ -30,7 +29,6 @@ if ($course_validation_feature) {
$message = get_lang('CourseRequestHasNotBeenFound'); $message = get_lang('CourseRequestHasNotBeenFound');
$is_error_message = true; $is_error_message = true;
} else { } else {
// Ensure the database prefix + database name do not get over 40 characters. // Ensure the database prefix + database name do not get over 40 characters.
$maxlength = 40; $maxlength = 40;
@ -225,7 +223,8 @@ if ($course_validation_feature) {
// Functions. // Functions.
// Converts the given numerical id to the name of the page that opened this editor. // Converts the given numerical id to the name of the page that opened this editor.
function get_caller_name($caller_id) { function get_caller_name($caller_id)
{
switch ($caller_id) { switch ($caller_id) {
case 1: case 1:
return 'course_request_accepted.php'; return 'course_request_accepted.php';

@ -30,7 +30,6 @@ $message = isset($_GET['message']) ? trim(Security::remove_XSS(stripslashes(urld
$is_error_message = !empty($_GET['is_error_message']); $is_error_message = !empty($_GET['is_error_message']);
if ($course_validation_feature) { if ($course_validation_feature) {
/** /**
* Acceptance and creation of the requested course. * Acceptance and creation of the requested course.
*/ */
@ -77,7 +76,7 @@ if ($course_validation_feature) {
*/ */
switch ($_POST['action']) { switch ($_POST['action']) {
// Delete selected courses // Delete selected courses
case 'delete_course_requests' : case 'delete_course_requests':
$course_requests = $_POST['course_request']; $course_requests = $_POST['course_request'];
if (is_array($_POST['course_request']) && !empty($_POST['course_request'])) { if (is_array($_POST['course_request']) && !empty($_POST['course_request'])) {
$success = true; $success = true;
@ -99,7 +98,8 @@ if ($course_validation_feature) {
/** /**
* Get the number of courses which will be displayed. * Get the number of courses which will be displayed.
*/ */
function get_number_of_requests() { function get_number_of_requests()
{
return CourseRequestManager::count_course_requests(COURSE_REQUEST_REJECTED); return CourseRequestManager::count_course_requests(COURSE_REQUEST_REJECTED);
} }
@ -165,7 +165,6 @@ function modify_filter($id) {
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList')); $interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
$tool_name = get_lang('RejectedCourseRequests'); $tool_name = get_lang('RejectedCourseRequests');
Display :: display_header($tool_name); Display :: display_header($tool_name);

@ -33,7 +33,6 @@ $is_error_message = isset($_GET['is_error_message']) ? !empty($_GET['is_error_me
$keyword = isset($_GET['keyword']) ? Database::escape_string(trim($_GET['keyword'])) : ''; $keyword = isset($_GET['keyword']) ? Database::escape_string(trim($_GET['keyword'])) : '';
if ($course_validation_feature) { if ($course_validation_feature) {
/** /**
* Course acceptance and creation. * Course acceptance and creation.
*/ */

@ -26,7 +26,7 @@ function validate_data($users_courses)
} }
// 2. Check whether coursecode exists. // 2. Check whether coursecode exists.
if (isset ($user_course['CourseCode']) && strlen($user_course['CourseCode']) != 0) { if (isset($user_course['CourseCode']) && strlen($user_course['CourseCode']) != 0) {
// 2.1 Check whethher code has been allready used by this CVS-file. // 2.1 Check whethher code has been allready used by this CVS-file.
if (!isset($coursecodes[$user_course['CourseCode']])) { if (!isset($coursecodes[$user_course['CourseCode']])) {
// 2.1.1 Check whether course with this code exists in the system. // 2.1.1 Check whether course with this code exists in the system.
@ -44,7 +44,7 @@ function validate_data($users_courses)
} }
// 3. Check whether username exists. // 3. Check whether username exists.
if (isset ($user_course['UserName']) && strlen($user_course['UserName']) != 0) { if (isset($user_course['UserName']) && strlen($user_course['UserName']) != 0) {
if (UserManager::is_username_available($user_course['UserName'])) { if (UserManager::is_username_available($user_course['UserName'])) {
$user_course['error'] = get_lang('UnknownUser'); $user_course['error'] = get_lang('UnknownUser');
$errors[] = $user_course; $errors[] = $user_course;
@ -52,7 +52,7 @@ function validate_data($users_courses)
} }
// 4. Check whether status is valid. // 4. Check whether status is valid.
if (isset ($user_course['Status']) && strlen($user_course['Status']) != 0) { if (isset($user_course['Status']) && strlen($user_course['Status']) != 0) {
if ($user_course['Status'] != COURSEMANAGER && $user_course['Status'] != STUDENT) { if ($user_course['Status'] != COURSEMANAGER && $user_course['Status'] != STUDENT) {
$user_course['error'] = get_lang('UnknownStatus'); $user_course['error'] = get_lang('UnknownStatus');
$errors[] = $user_course; $errors[] = $user_course;

@ -44,7 +44,7 @@ if (UserManager::is_admin($user_id)) {
} }
$add_type = 'multiple'; $add_type = 'multiple';
if(isset($_GET['add_type']) && $_GET['add_type']!='') { if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']); $add_type = Security::remove_XSS($_REQUEST['add_type']);
} }
@ -61,7 +61,6 @@ function search_courses($needle, $type)
if (!empty($needle) && !empty($type)) { if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas // xajax send utf8 datas... datas in db can be non-utf8 datas
$needle = Database::escape_string($needle); $needle = Database::escape_string($needle);
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id); $assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm); $assigned_courses_code = array_keys($assigned_courses_to_hrm);
foreach ($assigned_courses_code as &$value) { foreach ($assigned_courses_code as &$value) {

@ -88,7 +88,11 @@ function search_sessions($needle, $type)
$return .= '<option value="'.$session['id'].'" title="'.htmlspecialchars($session['name'],ENT_QUOTES).'">'.$session['name'].'</option>'; $return .= '<option value="'.$session['id'].'" title="'.htmlspecialchars($session['name'],ENT_QUOTES).'">'.$session['name'].'</option>';
} }
$return .= '</select>'; $return .= '</select>';
$xajax_response->addAssign('ajax_list_sessions_multiple','innerHTML',api_utf8_encode($return)); $xajax_response->addAssign(
'ajax_list_sessions_multiple',
'innerHTML',
api_utf8_encode($return)
);
} }
return $xajax_response; return $xajax_response;

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Interface for assigning users to Human Resources Manager * Interface for assigning users to Human Resources Manager
* @package chamilo.admin * @package chamilo.admin
*/ */
// resetting the course id // resetting the course id
$cidReset = true; $cidReset = true;

@ -4,9 +4,7 @@
* Definition of new system event types * Definition of new system event types
* @package chamilo.admin.events * @package chamilo.admin.events
*/ */
/**
* Init and access validation
*/
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
@ -49,9 +47,7 @@ if ($action == 'modEventType') {
} }
$ets = Event::get_all_event_types(); $ets = Event::get_all_event_types();
$languages = api_get_languages(); $languages = api_get_languages();
$ajaxPath = api_get_path(WEB_CODE_PATH) . 'inc/ajax/events.ajax.php'; $ajaxPath = api_get_path(WEB_CODE_PATH) . 'inc/ajax/events.ajax.php';
$action_array = array( $action_array = array(

@ -6,9 +6,7 @@
*/ */
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
Display::display_header(null); Display::display_header(null);
$form = new FormValidator('export_certificate'); $form = new FormValidator('export_certificate');

@ -9,7 +9,6 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null; $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
api_protect_admin_script(); api_protect_admin_script();

@ -13,9 +13,6 @@
* @since Dokeos 1.6 * @since Dokeos 1.6
* @package chamilo.admin * @package chamilo.admin
*/ */
/**
* INIT SECTION
*/
// we are in the admin area so we do not need a course id // we are in the admin area so we do not need a course id
$cidReset = true; $cidReset = true;

@ -162,7 +162,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
/* Is the user allowed here? */ /* Is the user allowed here? */
api_protect_course_script(true); api_protect_course_script(true);
/* STATISTICS */ /* STATISTICS */
if (!isset($coursesAlreadyVisited[$course_code])) { if (!isset($coursesAlreadyVisited[$course_code])) {
@ -199,11 +198,9 @@ if (!empty($auto_launch)) {
WHERE c_id = $course_id AND autolaunch = 1 $condition WHERE c_id = $course_id AND autolaunch = 1 $condition
LIMIT 1"; LIMIT 1";
$result = Database::query($sql); $result = Database::query($sql);
//If we found nothing in the session we just called the session_id = 0 autolaunch // If we found nothing in the session we just called the session_id = 0 autolaunch
if (Database::num_rows($result) == 0) { if (Database::num_rows($result) == 0) {
$condition = ''; $condition = '';
} else {
//great, there is an specific auto launch for this session we leave the $condition
} }
} }
@ -212,7 +209,7 @@ if (!empty($auto_launch)) {
LIMIT 1"; LIMIT 1";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
$lp_data = Database::fetch_array($result,'ASSOC'); $lp_data = Database::fetch_array($result, 'ASSOC');
if (!empty($lp_data['id'])) { if (!empty($lp_data['id'])) {
if (api_is_platform_admin() || api_is_allowed_to_edit()) { if (api_is_platform_admin() || api_is_allowed_to_edit()) {
$show_autolaunch_lp_warning = true; $show_autolaunch_lp_warning = true;

@ -300,6 +300,8 @@ class AnnouncementManager
/** /**
* Displays one specific announcement * Displays one specific announcement
* @param int $announcement_id, the id of the announcement you want to display * @param int $announcement_id, the id of the announcement you want to display
*
* @return string
*/ */
public static function display_announcement($announcement_id) public static function display_announcement($announcement_id)
{ {

@ -54,7 +54,11 @@ class Accessurleditcoursestourl
} }
} }
} }
$xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return)); $xajax_response->addAssign(
'ajax_list_courses',
'innerHTML',
api_utf8_encode($return)
);
return $xajax_response; return $xajax_response;
} }

@ -39,7 +39,6 @@ class AddCourseToSession
$course_codes .= '\''.$row[0].'\','; $course_codes .= '\''.$row[0].'\',';
} }
$course_codes = substr($course_codes, 0, (strlen($course_codes) - 1)); $course_codes = substr($course_codes, 0, (strlen($course_codes) - 1));
$cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; $cond_course_code = ' AND course.id NOT IN('.$course_codes.') ';
} }
} }
@ -70,7 +69,6 @@ class AddCourseToSession
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
if ($type == 'single') { if ($type == 'single') {
$sql = 'SELECT $sql = 'SELECT
course.id, course.id,

@ -27,24 +27,25 @@ class AddManySessionToCategoryFunctions
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$xajax_response = new xajaxResponse(); $xajax_response = new xajaxResponse();
$return = ''; $return = '';
if(!empty($needle) && !empty($type)) { if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas // xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding(); $charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8'); $needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle); $needle = Database::escape_string($needle);
$sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id';
$rs = Database::query($sql); $rs = Database::query($sql);
$course_list = array(); $course_list = array();
$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
while($course = Database :: fetch_array($rs)) { while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['id']; $course_list[] = $course['id'];
$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
} }
$return .= '</select>'; $return .= '</select>';
$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); $xajax_response->addAssign(
'ajax_list_courses_multiple',
'innerHTML',
api_utf8_encode($return)
);
} }
$_SESSION['course_list'] = $course_list; $_SESSION['course_list'] = $course_list;

@ -13,10 +13,10 @@ class View
/** /**
* Constructor, init tool path for rendering * Constructor, init tool path for rendering
* @param string tool name (optional) * @param string $toolname tool name (optional)
* @param string $template_path * @param string $template_path
*/ */
public function __construct($toolname = '', $template_path=null) public function __construct($toolname = '', $template_path = null)
{ {
if (!empty($toolname)) { if (!empty($toolname)) {
if (isset($template_path)) { if (isset($template_path)) {

@ -190,7 +190,9 @@ if (api_get_setting('go_to_course_after_login') == 'true') {
if (!isset($_SESSION['coursesAlreadyVisited']) && if (!isset($_SESSION['coursesAlreadyVisited']) &&
$count_of_sessions == 0 && $count_of_courses_no_sessions == 1 $count_of_sessions == 0 && $count_of_courses_no_sessions == 1
) { ) {
$courses = CourseManager::get_courses_list_by_user_id($userId); $courses = CourseManager::get_courses_list_by_user_id(
$userId
);
if (!empty($courses) && isset($courses[0]) && isset($courses[0]['code'])) { if (!empty($courses) && isset($courses[0]) && isset($courses[0]['code'])) {
$courseInfo = api_get_course_info_by_id($courses[0]['real_id']); $courseInfo = api_get_course_info_by_id($courses[0]['real_id']);
@ -205,7 +207,10 @@ if (api_get_setting('go_to_course_after_login') == 'true') {
// Show the chamilo mascot // Show the chamilo mascot
if (empty($courseAndSessions['html']) && !isset($_GET['history'])) { if (empty($courseAndSessions['html']) && !isset($_GET['history'])) {
$controller->tpl->assign('welcome_to_course_block', $controller->return_welcome_to_course_block()); $controller->tpl->assign(
'welcome_to_course_block',
$controller->return_welcome_to_course_block()
);
} }
$controller->tpl->assign('content', $courseAndSessions['html']); $controller->tpl->assign('content', $courseAndSessions['html']);

Loading…
Cancel
Save