Minor - Format code

pull/2487/head
jmontoyaa 9 years ago
parent 21afa46d59
commit 3f48324277
  1. 1
      main/admin/access_url_add_usergroup_to_url.php
  2. 8
      main/admin/access_url_add_users_to_url.php
  3. 16
      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. 14
      main/admin/access_urls.php
  10. 5
      main/admin/add_courses_to_usergroup.php
  11. 12
      main/admin/add_sessions_to_usergroup.php
  12. 18
      main/admin/career_dashboard.php
  13. 4
      main/admin/cli.php
  14. 3
      main/admin/course_request_accepted.php
  15. 5
      main/admin/course_request_edit.php
  16. 5
      main/admin/course_request_rejected.php
  17. 1
      main/admin/course_request_review.php
  18. 1
      main/admin/dashboard_add_courses_to_user.php
  19. 6
      main/admin/dashboard_add_sessions_to_user.php
  20. 6
      main/admin/event_type.php
  21. 2
      main/admin/export_certificates.php
  22. 1
      main/admin/extra_field_options.php
  23. 3
      main/admin/languages.php
  24. 3
      main/course_home/course_home.php
  25. 2
      main/inc/lib/AnnouncementManager.php
  26. 6
      main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
  27. 2
      main/inc/lib/add_courses_to_session_functions.lib.php
  28. 9
      main/inc/lib/add_many_session_to_category_functions.lib.php
  29. 2
      main/inc/lib/app_view.php
  30. 9
      user_portal.php

@ -18,7 +18,6 @@ if (!api_get_multiple_access_url()) {
}
$userGroup = new UserGroup();
$form_sent = 0;
$firstLetterUserGroup = null;
$courses = array();

@ -38,7 +38,8 @@ Display :: display_header($tool_name);
echo '<div class="actions">';
echo Display::url(
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>';
api_display_tool_title($tool_name);
@ -48,14 +49,15 @@ if ($_POST['form_sent']) {
$users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ;
$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
$first_letter_user = $_POST['first_letter_user'];
foreach ($users as $key => $value) {
$users[$key] = intval($value);
}
if ($form_sent == 1) {
if (count($users) == 0 || count($url_list) == 0) {
Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL'));
Display:: display_error_message(
get_lang('AtLeastOneUserAndOneURL')
);
} else {
UrlManager::add_users_to_urls($users, $url_list);
Display:: display_confirmation_message(get_lang('UsersBelongURL'));

@ -4,7 +4,7 @@
* @author Bart Mollet, Julio Montoya lot of fixes
* @package chamilo.admin
*/
/* INIT SECTION */
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -14,7 +14,6 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
$tool_name = get_lang('SessionOverview');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$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);
$user_info = api_get_user_info($user_id);
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;
}
@ -44,9 +49,7 @@ if (!empty($message)) {
}
$multiple_url_is_on = api_get_multiple_access_url();
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
$session_list = SessionManager::get_sessions_list();
$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>';
}
foreach ($session_list as $session_item) {
$session_id = $session_item['id'];
$html .= '<h3>'.$session_item['name'].'</h3>';
$access_where = "(access_url_id = $url_id OR access_url_id is null )";
if ($show_users_with_problems) {
$access_where = "(access_url_id is null)";
@ -89,7 +90,6 @@ foreach ($session_list as $session_item) {
}
$link_to_add_user_in_url = '';
if ($multiple_url_is_on) {
if ($user['access_url_id'] != $url_id) {
$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');
}
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

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

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

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

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

@ -80,14 +80,22 @@ foreach ($url_list as $my_url) {
}
}
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
if ($current_access_url_id == -1) {
Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH));
Display::display_warning_message(
get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)
);
} elseif (api_is_platform_admin()) {
$quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id);
$quant = UrlManager::relation_url_user_exist(
api_get_user_id(),
$current_access_url_id
);
if ($quant == 0) {
Display:: display_warning_message(
'<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>',

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

@ -101,8 +101,6 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$data = $usergroup->get($id);
$session_list_in = $usergroup->get_sessions_by_usergroup($id);
$session_list = SessionManager::get_sessions_list(array(), array('name'));
//api_display_tool_title($tool_name.' ('.$session_info['name'].')');
$elements_not_in = $elements_in = array();
if (!empty($session_list)) {
@ -134,17 +132,19 @@ function search_usergroup_sessions($needle,$type) {
array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
);
}
$i=0;
if ($type != 'single') {
$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))) {
$return .= '<option value="'.$row['id'].'">'.$row['name'].'</option>';
}
}
$return .= '</select>';
$xajax_response -> addAssign('ajax_list_multiple','innerHTML',api_utf8_encode($return));
$xajax_response->addAssign(
'ajax_list_multiple',
'innerHTML',
api_utf8_encode($return)
);
}
}
@ -266,7 +266,7 @@ if(!empty($errorMsg)) {
</table>
</form>
<script type="text/javascript">
<script>
function moveItem(origin , destination) {
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {

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

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

@ -14,9 +14,7 @@
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
// 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']);
if ($course_validation_feature) {
/**
* Deletion of a course request.
*/

@ -22,7 +22,6 @@ $id = intval($_GET['id']);
$caller = intval($_GET['caller']);
if ($course_validation_feature) {
// Retrieve request's data from the corresponding database record.
$course_request_info = CourseRequestManager::get_course_request_info($id);
if (!is_array($course_request_info)) {
@ -30,7 +29,6 @@ if ($course_validation_feature) {
$message = get_lang('CourseRequestHasNotBeenFound');
$is_error_message = true;
} else {
// Ensure the database prefix + database name do not get over 40 characters.
$maxlength = 40;
@ -225,7 +223,8 @@ if ($course_validation_feature) {
// Functions.
// 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) {
case 1:
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']);
if ($course_validation_feature) {
/**
* Acceptance and creation of the requested course.
*/
@ -99,7 +98,8 @@ if ($course_validation_feature) {
/**
* 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);
}
@ -165,7 +165,6 @@ function modify_filter($id) {
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
$tool_name = get_lang('RejectedCourseRequests');
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'])) : '';
if ($course_validation_feature) {
/**
* Course acceptance and creation.
*/

@ -61,7 +61,6 @@ function search_courses($needle, $type)
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$needle = Database::escape_string($needle);
$assigned_courses_to_hrm = CourseManager::get_courses_followed_by_drh($user_id);
$assigned_courses_code = array_keys($assigned_courses_to_hrm);
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 .= '</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;

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

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

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

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

@ -162,7 +162,6 @@ if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
/* Is the user allowed here? */
api_protect_course_script(true);
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$course_code])) {
@ -202,8 +201,6 @@ if (!empty($auto_launch)) {
// If we found nothing in the session we just called the session_id = 0 autolaunch
if (Database::num_rows($result) == 0) {
$condition = '';
} else {
//great, there is an specific auto launch for this session we leave the $condition
}
}

@ -300,6 +300,8 @@ class AnnouncementManager
/**
* Displays one specific announcement
* @param int $announcement_id, the id of the announcement you want to display
*
* @return string
*/
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;
}

@ -39,7 +39,6 @@ class AddCourseToSession
$course_codes .= '\''.$row[0].'\',';
}
$course_codes = substr($course_codes, 0, (strlen($course_codes) - 1));
$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);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if ($type == 'single') {
$sql = 'SELECT
course.id,

@ -32,19 +32,20 @@ class AddManySessionToCategoryFunctions
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
$sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id';
$rs = Database::query($sql);
$course_list = array();
$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
while ($course = Database :: fetch_array($rs)) {
$course_list[] = $course['id'];
$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
}
$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;

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

@ -190,7 +190,9 @@ if (api_get_setting('go_to_course_after_login') == 'true') {
if (!isset($_SESSION['coursesAlreadyVisited']) &&
$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'])) {
$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
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']);

Loading…
Cancel
Save