Minor - format code.

pull/2487/head
jmontoyaa 9 years ago
parent 4a8471b4a8
commit 00e4940863
  1. 14
      index.php
  2. 48
      main/inc/lib/course.lib.php
  3. 54
      main/inc/lib/display.lib.php

@ -38,7 +38,10 @@ if (!empty($_GET['logout'])) {
/**
* Registers in the track_e_default table (view in important activities in admin
* interface) a possible attempted break in, sending auth data through get.
* @todo This piece of code should probably move to local.inc.php where the actual login / logout procedure is handled. The real use of this code block should be seriously considered as well. This form should just use a security token and get done with it.
* @todo This piece of code should probably move to local.inc.php where the
* actual login / logout procedure is handled.
* The real use of this code block should be seriously considered as well.
* This form should just use a security token and get done with it.
*/
if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
$i = api_get_anonymous_id();
@ -68,12 +71,13 @@ if (!api_get_user_id() && CustomPages::enabled()) {
}
/**
* @todo This piece of code should probably move to local.inc.php where the actual login procedure is handled.
* @todo Check if this code is used. I think this code is never executed because after clicking the submit button
* the code does the stuff in local.inc.php and then redirects to index.php or user_portal.php depending
* @todo This piece of code should probably move to local.inc.php where the
* actual login procedure is handled.
* @todo Check if this code is used. I think this code is never executed because
* after clicking the submit button the code does the stuff
* in local.inc.php and then redirects to index.php or user_portal.php depending
* on api_get_setting('page_after_login').
*/
if (!empty($_POST['submitAuth'])) {
// The user has been already authenticated, we are now to find the last login of the user.
if (isset($_user['user_id'])) {

@ -4868,8 +4868,8 @@ class CourseManager
}
if ($access_link && in_array('enter',
$access_link) || $course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
if ($access_link && in_array('enter',$access_link) ||
$course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD
) {
$my_course['go_to_course_button'] = Display::url(
get_lang('GoToCourse').' '.
@ -4918,9 +4918,6 @@ class CourseManager
//Description
$my_course['description_button'] = '';
/* if ($course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || in_array($course_info['real_id'],
$my_course_code_list)
) { */
$my_course['description_button'] = Display::url(
Display::returnFontAwesomeIcon('info-circle'),
api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$course_info['code'],
@ -4931,8 +4928,6 @@ class CourseManager
'aria-label' => get_lang('Description')
]
);
//}
/* get_lang('Description') */
$my_course['teachers'] = self::getTeachersFromCourse($course_info['real_id'], true);
$point_info = self::get_course_ranking($course_info['real_id'], 0);
@ -5085,7 +5080,8 @@ class CourseManager
$visibilityCondition = self::getCourseVisibilitySQLCondition('c', true);
if (!empty($accessUrlId) && $accessUrlId == intval($accessUrlId)) {
$sql = "SELECT count(c.id) FROM $tableCourse c, $tableCourseRelAccessUrl u
$sql = "SELECT count(c.id)
FROM $tableCourse c, $tableCourseRelAccessUrl u
WHERE
c.id = u.c_id AND
u.access_url_id = $accessUrlId AND
@ -5163,8 +5159,11 @@ class CourseManager
$options[] = 'enter';
}
if ($course['visibility'] != COURSE_VISIBILITY_HIDDEN && empty($course['registration_code']) && $course['unsubscribe'] == UNSUBSCRIBE_ALLOWED && api_user_is_login($uid) && (in_array($course['real_id'],
$user_courses))
if ($course['visibility'] != COURSE_VISIBILITY_HIDDEN &&
empty($course['registration_code']) &&
$course['unsubscribe'] == UNSUBSCRIBE_ALLOWED &&
api_user_is_login($uid) &&
in_array($course['real_id'], $user_courses)
) {
$options[] = 'unsubscribe';
}
@ -5416,7 +5415,12 @@ class CourseManager
// Create
Database::insert(
$courseSettingTable,
['title' => $variable, 'value' => $value, 'c_id' => $courseId, 'variable' => $variable]
[
'title' => $variable,
'value' => $value,
'c_id' => $courseId,
'variable' => $variable,
]
);
}
return true;
@ -5444,9 +5448,10 @@ class CourseManager
* Get information from the track_e_course_access table
* @param int $sessionId
* @param int $userId
* @param int $limit
* @return array
*/
public static function getCourseAccessPerSessionAndUser($sessionId, $userId, $limit = null)
public static function getCourseAccessPerSessionAndUser($sessionId, $userId, $limit = 0)
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
@ -5882,13 +5887,15 @@ class CourseManager
" WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" : null;
$visibility = ($includeClosed ? '' : 'visibility NOT IN (0, 4) AND ');
$query = "SELECT id, code, title
FROM " . Database::get_main_table(TABLE_MAIN_COURSE)."
$sql = "SELECT id, code, title
FROM ".Database::get_main_table(TABLE_MAIN_COURSE)."
WHERE $visibility code NOT IN (
SELECT DISTINCT course_code FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE).$dateConditional.")
SELECT DISTINCT course_code
FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE).$dateConditional."
)
ORDER BY id";
$result = Database::query($query);
$result = Database::query($sql);
$courses = array();
while ($row = Database::fetch_array($result)) {
$courses[] = $row;
@ -5940,7 +5947,6 @@ class CourseManager
}
$result = Database::query($sql);
while ($row = Database::fetch_assoc($result)) {
$coursesList[] = $row;
}
@ -6246,8 +6252,11 @@ class CourseManager
* @param string $tableUserFieldValues The user extra field value table name
* @return int The number of users with this extra field with a specific value
*/
public static function getCountRegisteredUsersWithCourseExtraField($name, $tableExtraFields = '', $tableUserFieldValues = '')
{
public static function getCountRegisteredUsersWithCourseExtraField(
$name,
$tableExtraFields = '',
$tableUserFieldValues = ''
) {
if (empty($tableExtraFields)) {
$tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
}
@ -6256,7 +6265,6 @@ class CourseManager
}
$registered_users_with_extra_field = 0;
if (!empty($name) && $name != '-') {
$extraFieldType = EntityExtraField::COURSE_FIELD_TYPE;
$name = Database::escape_string($name);

@ -1273,9 +1273,7 @@ class Display
// Creating the jqgrid element.
$json .= '$("#'.$div_id.'").jqGrid({';
//$json .= $beforeSelectRow;
$json .= $json_encode;
$json .= '});';
// Grouping headers option
@ -1575,50 +1573,8 @@ class Display
}
$active = true;
} else {
/*$start = $stop = false;
$start_buffer = $stop_buffer = '';
if ($session_info['access_start_date'] === '0000-00-00 00:00:00' || empty($session_info['access_start_date'])) {
$session_info['access_start_date'] = '';
} else {
$start = true;
$start_buffer = $session_info['access_start_date'];
$session_info['access_start_date'] = $session_info['access_start_date'];
}
if ($session_info['access_end_date'] === '0000-00-00 00:00:00' || empty($session_info['access_end_date'])) {
$session_info['access_end_date'] = '';
} else {
$stop = true;
$stop_buffer = $session_info['access_end_date'];
$session_info['access_end_date'] = $session_info['access_end_date'];
}
if ($start && $stop) {
$session['dates'] = sprintf(
get_lang('FromDateXToDateY'),
api_format_date($start_buffer),
api_format_date($stop_buffer)
);
} else {
$start_buffer = $stop_buffer = null;
if (!empty($session_info['access_start_date'])) {
$start_buffer = sprintf(
get_lang('FromDateX'),
api_format_date(api_get_local_time($session_info['access_start_date']))
);
}
if (!empty($session_info['access_end_date'])) {
$stop_buffer = sprintf(
get_lang('UntilDateX'),
api_format_date(api_get_local_time($session_info['access_end_date']))
);
}*/
$dates = SessionManager::parseSessionDates($session_info, true);
//$session['dates'] = $start_buffer . ' ' . $stop_buffer.'- julio '.$dates['access'];
$session['dates'] = $dates['access'];
if (api_get_setting('show_session_coach') === 'true') {
$session['coach'] = api_get_person_name(
$session_info['firstname'],
@ -2124,6 +2080,7 @@ class Display
return $html;
}
/**
*
* @param int $itemId
@ -2149,7 +2106,7 @@ class Display
$fixedValue = null,
$linkAttributes = []
) {
$defaultClass = "before";
$defaultClass = 'before';
$class = $defaultClass;
foreach ($conditions as $condition) {
$array = isset($condition['items']) ? $condition['items'] : array();
@ -2178,13 +2135,13 @@ class Display
}
}
if ($isCurrent) {
$class = "before current";
$class = 'before current';
}
if ($isMedia && $isCurrent) {
$class = "before current";
$class = 'before current';
}
if (empty($link)) {
$link_to_show = "#";
$link_to_show = '#';
} else {
$link_to_show = $link.($nextValue + $localCounter);
}
@ -2392,7 +2349,6 @@ class Display
if (!$colsWidth) {
$width = 12 / $col;
array_walk($content, function() use ($width, &$colsWidth) {
$colsWidth[] = $width;
});

Loading…
Cancel
Save