Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 09c8e4d94f
commit 4612d643b4
  1. 31
      main/inc/lib/login.lib.php
  2. 3
      main/inc/lib/model.lib.php
  3. 9
      main/inc/lib/notebook.lib.php
  4. 10
      main/inc/lib/promotion.lib.php
  5. 24
      main/inc/lib/statistics.lib.php
  6. 2
      main/inc/lib/sub_language.class.php
  7. 29
      main/inc/lib/system_announcements.lib.php
  8. 10
      main/inc/lib/table_sort.class.php
  9. 14
      main/inc/lib/tracking.lib.php

@ -18,7 +18,7 @@ class Login
* @param array $user array with keys: email, password, uid, loginName
* @param boolean $reset
* @param boolean $by_username
* @return unknown
* @return string
*/
public static function get_user_account_list($user, $reset = false, $by_username = false)
{
@ -73,6 +73,7 @@ class Login
* This function sends the actual password to the user
*
* @param int $user
* @return string
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/
public static function send_password_to_user($user, $by_username = false)
@ -107,7 +108,6 @@ class Login
$email_admin = api_get_setting('emailAdministrator');
if (api_mail_html('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) {
return get_lang('YourPasswordHasBeenReset');
} else {
$admin_email = Display:: encrypted_mailto_link(
@ -128,8 +128,9 @@ class Login
/**
* Handle encrypted password, send an email to a user with his password
*
* @param int user id
* @param bool $by_username
* @param int user id
* @param bool $by_username
* @return string
*
* @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
*/
@ -252,7 +253,6 @@ class Login
$user = Database::fetch_array($result);
if ($user['auth_source'] == 'extldap') {
return get_lang('CouldNotResetPassword');
}
} else {
@ -534,7 +534,6 @@ class Login
if ($reset) {
if (isset($user_id) && $user_id && isset($_cid) && $_cid) {
//Check if user is subscribed in a course
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT * FROM $course_user_table
@ -570,7 +569,6 @@ class Login
//We are in a session course? Check session permissions
if (!empty($session_id)) {
//I'm not the teacher of the course
if ($is_courseAdmin == false) {
// this user has no status related to this course
@ -673,7 +671,7 @@ class Login
case COURSE_VISIBILITY_OPEN_WORLD: //3
$is_allowed_in_course = true;
break;
case COURSE_VISIBILITY_OPEN_PLATFORM : //2
case COURSE_VISIBILITY_OPEN_PLATFORM: //2
if (isset($user_id) && !api_is_anonymous($user_id)) {
$is_allowed_in_course = true;
}
@ -760,7 +758,8 @@ class Login
} else {
Session::erase('_gid');
}
} elseif (isset($_SESSION['_gid']) or isset($_gid)) { // Keys missing => not anymore in the group - course relation
} elseif (isset($_SESSION['_gid']) || isset($_gid)) {
// Keys missing => not anymore in the group - course relation
Session::erase('_gid');
}
} elseif (isset($_SESSION['_gid'])) { // continue with the previous values
@ -812,15 +811,15 @@ class Login
$email = false;
}
if ($email) {
$condition = "LOWER(email) = '".Database::escape_string($username)."' ";
} else {
if ($email) {
$condition = "LOWER(email) = '".Database::escape_string($username)."' ";
} else {
$condition = "LOWER(username) = '".Database::escape_string($username)."'";
}
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$query = "SELECT
user_id AS uid,
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$query = "SELECT
user_id AS uid,
lastname AS lastName,
firstname AS firstName,
username AS loginName,
@ -834,7 +833,7 @@ class Login
auth_source
FROM $tbl_user
WHERE ( $condition AND active = 1) ";
$result = Database::query($query);
$result = Database::query($query);
$num_rows = Database::num_rows($result);
if ($result && $num_rows > 0) {
return Database::fetch_assoc($result);

@ -77,7 +77,7 @@ class Model
{
$clean_params = array();
if (!empty($params)) {
foreach ($params as $key=>$value) {
foreach ($params as $key => $value) {
if (in_array($key, $this->columns)) {
$clean_params[$key] = $value;
}
@ -142,6 +142,7 @@ class Model
/**
* Get the count of elements
* @return int
*/
public function get_count()
{

@ -2,10 +2,10 @@
/* For licensing terms, see /license.txt */
/**
* This class provides methods for the notebook management.
* Include/require it in your code to use its features.
* @author Carlos Vargas <litox84@gmail.com>, move code of main/notebook up here
* @package chamilo.library
* This class provides methods for the notebook management.
* Include/require it in your code to use its features.
* @author Carlos Vargas <litox84@gmail.com>, move code of main/notebook up here
* @package chamilo.library
*/
class NotebookManager
{
@ -130,6 +130,7 @@ class NotebookManager
*
* @author Christian Fasanando <christian.fasanando@dokeos.com>
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium
* @return bool
* @version januari 2009, dokeos 1.8.6
*/
public static function update_note($values)

@ -160,8 +160,14 @@ class Promotion extends Model
{
// Action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="career_dashboard.php">'.Display::return_icon('back.png',
get_lang('Back'), '', '32').'</a>';
echo '<a href="career_dashboard.php">'.
Display::return_icon(
'back.png',
get_lang('Back'),
'',
'32'
)
.'</a>';
echo '<a href="'.api_get_self().'?action=add">'.
Display::return_icon(
'new_promotion.png',

@ -100,8 +100,12 @@ class Statistics
* @param bool $onlyActive Count only active users (false to only return currently active users)
* @return int Number of users counted
*/
public static function countUsers($status = null, $categoryCode = null, $countInvisibleCourses = true, $onlyActive = false)
{
public static function countUsers(
$status = null,
$categoryCode = null,
$countInvisibleCourses = true,
$onlyActive = false
) {
// Database table definitions
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
@ -223,8 +227,12 @@ class Statistics
* @param string $direction
* @return array
*/
public static function getActivitiesData($from, $numberOfItems, $column, $direction)
{
public static function getActivitiesData(
$from,
$numberOfItems,
$column,
$direction
) {
$track_e_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@ -396,8 +404,12 @@ class Statistics
* @param bool $showTotal
* @param bool $isFileSize
*/
public static function printStats($title, $stats, $showTotal = true, $isFileSize = false)
{
public static function printStats(
$title,
$stats,
$showTotal = true,
$isFileSize = false
) {
$total = 0;
$data = self::rescale($stats);
echo '<table class="data_table" cellspacing="0" cellpadding="3">

@ -392,7 +392,7 @@ class SubLanguageManager
*/
public static function set_platform_language($language_id)
{
if (empty($language_id) or (intval($language_id) != $language_id)) {
if (empty($language_id) || (intval($language_id) != $language_id)) {
return false;
}
$language_id = intval($language_id);

@ -67,7 +67,10 @@ class SystemAnnouncementManager
$groups = array();
foreach ($temp_user_groups as $user_group) {
$groups = array_merge($groups, array($user_group['id']));
$groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
$groups = array_merge(
$groups,
$userGroup->get_parent_groups($user_group['id'])
);
}
$groups_string = '('.implode($groups, ',').')';
@ -379,8 +382,16 @@ class SystemAnnouncementManager
//Fixing urls that are sent by email
//$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
//$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
$content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
$content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
$content = str_replace(
'src=\"'.api_get_path(REL_HOME_PATH),
'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH),
$content
);
$content = str_replace(
'file='.api_get_path(REL_HOME_PATH),
'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH),
$content
);
$lang = is_null($lang) ? '' : $lang;
$current_access_url_id = 1;
@ -568,8 +579,16 @@ class SystemAnnouncementManager
//Fixing urls that are sent by email
//$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
//$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
$content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
$content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
$content = str_replace(
'src=\"'.api_get_path(REL_HOME_PATH),
'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH),
$content
);
$content = str_replace(
'file='.api_get_path(REL_HOME_PATH),
'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH),
$content
);
if ($sendEmailTest) {
self::send_system_announcement_by_email(

@ -11,7 +11,7 @@ define('SORT_DATE', 3);
define('SORT_IMAGE', 4);
/**
* @package chamilo.library
* Class TableSort
*/
class TableSort
{
@ -25,8 +25,12 @@ class TableSort
* @return array The sorted dataset
* @author bart.mollet@hogent.be
*/
public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
{
public static function sort_table(
$data,
$column = 0,
$direction = SORT_ASC,
$type = SORT_REGULAR
) {
if (!is_array($data) || empty($data)) {
return array();
}

@ -3972,8 +3972,11 @@ class Tracking
* @param int Session id (optional)
* @return int Chat last connections by course in x days
*/
public static function chat_connections_during_last_x_days_by_course($course_code, $last_days, $session_id = 0)
{
public static function chat_connections_during_last_x_days_by_course(
$course_code,
$last_days,
$session_id = 0
) {
$course_info = api_get_course_info($course_code);
if (empty($course_info)) {
return null;
@ -4009,8 +4012,11 @@ class Tracking
* @param int Session id (optional)
* @return string datetime formatted without day (e.g: February 23, 2010 10:20:50 )
*/
public static function chat_last_connection($student_id, $courseId, $session_id = 0)
{
public static function chat_last_connection(
$student_id,
$courseId,
$session_id = 0
) {
$student_id = intval($student_id);
$courseId = intval($courseId);
$session_id = intval($session_id);

Loading…
Cancel
Save