Minor - Format code, fix PHP warnings

ofaj
jmontoyaa 9 years ago
parent 2077b079c9
commit fd941099c5
  1. 1
      main/link/link.php
  2. 26
      main/messages/new_message.php
  3. 10
      main/mySpace/admin_view.php
  4. 3
      main/mySpace/user_edit.php
  5. 22
      main/mySpace/user_import.php
  6. 22
      main/mySpace/users.php
  7. 3
      main/ticket/tickets.php

@ -118,7 +118,6 @@ switch ($action) {
case 'editlink':
$form = Link::getLinkForm($id, 'editlink');
if ($form->validate()) {
Link::editLink($id, $form->getSubmitValues());
header('Location: '.$linkListUrl);
exit;

@ -12,12 +12,12 @@
* - reply on message (when pressing reply when viewing a message)
* - send to specific user (when pressing send message in the who is online list)
*/
$cidReset = true;
$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_message_tool') !='true') {
if (api_get_setting('allow_message_tool') !== 'true') {
api_not_allowed();
}
@ -66,7 +66,8 @@ $nameTools = get_lang('ComposeMessage');
/**
* Shows the compose area + a list of users to select from.
*/
function show_compose_to_any($user_id) {
function show_compose_to_any($user_id)
{
$default['user_list'] = 0;
$online_user_list = null;
$html = manage_form($default, $online_user_list);
@ -77,8 +78,9 @@ function show_compose_to_any($user_id) {
function show_compose_reply_to_message($message_id, $receiver_id)
{
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT user_sender_id FROM $table_message
WHERE user_receiver_id=".intval($receiver_id)." AND id='".intval($message_id)."';";
$query = "SELECT user_sender_id
FROM $table_message
WHERE user_receiver_id = ".intval($receiver_id)." AND id='".intval($message_id)."';";
$result = Database::query($query);
$row = Database::fetch_array($result,'ASSOC');
if (!isset($row['user_sender_id'])) {
@ -100,6 +102,7 @@ function show_compose_to_user ($receiver_id)
$default['title'] = api_xml_http_response_encode(get_lang('EnterTitle'));
$default['users'] = array($receiver_id);
$html .= manage_form($default);
return $html;
}
@ -173,7 +176,7 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null)
$message_reply_info = MessageManager::get_message_by_id($_GET['re_id']);
$default['title'] = get_lang('MailSubjectReplyShort')." ".$message_reply_info['title'];
$form->addElement('hidden', 're_id', intval($_GET['re_id']));
$form->addElement('hidden','save_form', 'save_form');
$form->addElement('hidden', 'save_form', 'save_form');
// Adding reply mail
$user_reply_info = api_get_user_info($message_reply_info['user_sender_id']);
@ -206,7 +209,10 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null)
'
);
$form->addLabel('', '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
$form->addLabel(
'',
'<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')'
);
}
$form->addButtonSend(get_lang('SendMessage'), 'compose');
@ -270,13 +276,13 @@ if ($socialToolIsActive) {
$this_section = SECTION_SOCIAL;
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_PATH).'main/social/home.php',
'name' => get_lang('SocialNetwork'),
'name' => get_lang('SocialNetwork')
);
} else {
$this_section = SECTION_MYPROFILE;
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_PATH).'main/auth/profile.php',
'name' => get_lang('Profile'),
'name' => get_lang('Profile')
);
}
@ -385,8 +391,6 @@ if (api_get_setting('allow_social_tool') === 'true') {
$tpl->display($social_layout);
} else {
$content = $social_right_content;
//$tpl->assign('actions', $actions);
//$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}

@ -5,8 +5,8 @@ $cidReset = true;
require_once '../inc/global.inc.php';
$exportCSV = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$display = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
$exportCSV = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$display = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
$htmlHeadXtra[] = api_get_jqgrid_js();
// the section (for the tabs)
@ -15,9 +15,9 @@ $this_section = SECTION_TRACKING;
$csv_content = array();
$nameTools = get_lang('MySpace');
$is_platform_admin = api_is_platform_admin();
$is_drh = api_is_drh();
$is_session_admin = api_is_session_admin();
$is_platform_admin = api_is_platform_admin();
$is_drh = api_is_drh();
$is_session_admin = api_is_session_admin();
if ($exportCSV) {
if ($display == 'user') {

@ -5,9 +5,6 @@
$cidReset = true;
require_once '../inc/global.inc.php';
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath.'fileManage.lib.php';
require_once $libpath.'fileUpload.lib.php';
// user permissions
api_block_anonymous_users();

@ -27,7 +27,7 @@ if (isset($_GET['id_session']) && $_GET['id_session'] != '') {
$purification_option_for_usernames = false;
// Checking whether the current coach is the admin coach.
if (api_get_setting('add_users_by_coach') == 'true') {
if (api_get_setting('add_users_by_coach') === 'true') {
if (!api_is_platform_admin()) {
if (isset($_REQUEST['id_session'])) {
$id_session = intval($_REQUEST['id_session']);
@ -42,7 +42,7 @@ if (api_get_setting('add_users_by_coach') == 'true') {
}
}
} else {
api_not_allowed(true);
api_not_allowed(true);
}
set_time_limit(0);
@ -77,10 +77,12 @@ if ($_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
}
} else {
header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoSessionId')));
exit;
}
}
} else {
header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoUsersRead')));
exit;
}
}
@ -91,14 +93,14 @@ if ($_FILES['import_file']['size'] == 0 && $_POST) {
}
if (count($errors) != 0) {
$error_message = '<ul>';
foreach ($errors as $index => $error_user) {
$error_message .= '<li><strong>'.$error_user['error'].'</strong>: ';
$error_message .= api_get_person_name($error_user['FirstName'], $error_user['LastName']);
$error_message .= '</li>';
}
$error_message .= '</ul>';
Display :: display_error_message($error_message, false);
$error_message = '<ul>';
foreach ($errors as $index => $error_user) {
$error_message .= '<li><strong>'.$error_user['error'].'</strong>: ';
$error_message .= api_get_person_name($error_user['FirstName'], $error_user['LastName']);
$error_message .= '</li>';
}
$error_message .= '</ul>';
Display :: display_error_message($error_message, false);
}
$form = new FormValidator('user_import');

@ -105,7 +105,7 @@ function get_users($from, $limit, $column, $direction)
COURSEMANAGER,
$keyword
);
}
}
$all_datas = array();
@ -123,8 +123,8 @@ function get_users($from, $limit, $column, $direction)
$courseId = $courseInfo['real_id'];
if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
$avg_time_spent += Tracking :: get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
$my_average = Tracking :: get_avg_student_score($student_id, $course_code);
$avg_time_spent += Tracking :: get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
$my_average = Tracking :: get_avg_student_score($student_id, $course_code);
if (is_numeric($my_average)) {
$avg_student_score += $my_average;
}
@ -169,6 +169,7 @@ function get_users($from, $limit, $column, $direction)
$row[] = $detailsLink;
$all_datas[] = $row;
}
return $all_datas;
}
@ -257,11 +258,16 @@ if ($export_csv) {
$form = new FormValidator('search_user', 'get', api_get_path(WEB_CODE_PATH).'mySpace/users.php');
$form->addElement('select', 'status', get_lang('Status'), array(
'' => '',
STUDENT => get_lang('Student'),
COURSEMANAGER => get_lang('Teacher'),
DRH => get_lang('DRH'))
$form->addElement(
'select',
'status',
get_lang('Status'),
array(
'' => '',
STUDENT => get_lang('Student'),
COURSEMANAGER => get_lang('Teacher'),
DRH => get_lang('DRH')
)
);
$form = Tracking::setUserSearchForm($form);
$form->setDefaults($params);

@ -110,8 +110,7 @@ switch ($action) {
utf8_decode(strip_tags($ticket[4])),
utf8_decode(strip_tags($ticket[5])),
utf8_decode(strip_tags($ticket[6])),
utf8_decode(strip_tags($ticket[7])),
utf8_decode(strip_tags(str_replace('&nbsp;', ' ', $ticket[9])))
utf8_decode(strip_tags($ticket[7]))
);
$data[] = $ticket_rem;
}

Loading…
Cancel
Save