Minor - format code

pull/2585/head
Julio 7 years ago
parent f76775a95d
commit 43c501aa6a
  1. 7
      main/admin/user_list.php
  2. 51
      main/inc/lib/CourseChatUtils.php
  3. 6
      main/inc/lib/sessionmanager.lib.php
  4. 2
      main/inc/lib/template.lib.php
  5. 21
      main/inc/lib/usermanager.lib.php
  6. 2
      plugin/olpc_peru_filter/lib/olpc_peru_filter_plugin.class.php

@ -439,7 +439,9 @@ function get_number_of_users()
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
*
* @return array Users list
*
* @see SortableTable#get_table_data($from)
*/
function get_user_data($from, $number_of_items, $column, $direction)
@ -529,8 +531,9 @@ function user_filter($name, $params, $row)
* @param string URL params to add to table links
* @param array Row of elements to alter
*
* @return string Some HTML-code with modify-buttons
* @throws Exception
*
* @return string Some HTML-code with modify-buttons
*/
function modify_filter($user_id, $url_params, $row)
{
@ -811,7 +814,9 @@ function active_filter($active, $params, $row)
/**
* Instead of displaying the integer of the status, we give a translation for the status.
*
* @param int $status
*
* @return string translation
*
* @version march 2008

@ -704,37 +704,14 @@ class CourseChatUtils
return (int) $number;
}
/**
* Format the user data to return it in the user list
*
* @param User $user
* @param int $status
*
* @return array
*/
private function formatUser(User $user, $status)
{
return [
'id' => $user->getId(),
'firstname' => $user->getFirstname(),
'lastname' => $user->getLastname(),
'status' => $status,
'image_url' => UserManager::getUserPicture($user->getId(), USER_IMAGE_SIZE_MEDIUM),
'profile_url' => api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user->getId(),
'complete_name' => $user->getCompleteName(),
'username' => $user->getUsername(),
'email' => $user->getEmail(),
'isConnected' => $this->userIsConnected($user->getId()),
];
}
/**
* Get the users online data.
*
* @return array
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws \Doctrine\ORM\TransactionRequiredException
*
* @return array
*/
public function listUsersOnline()
{
@ -763,6 +740,30 @@ class CourseChatUtils
return $usersInfo;
}
/**
* Format the user data to return it in the user list.
*
* @param User $user
* @param int $status
*
* @return array
*/
private function formatUser(User $user, $status)
{
return [
'id' => $user->getId(),
'firstname' => $user->getFirstname(),
'lastname' => $user->getLastname(),
'status' => $status,
'image_url' => UserManager::getUserPicture($user->getId(), USER_IMAGE_SIZE_MEDIUM),
'profile_url' => api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user->getId(),
'complete_name' => $user->getCompleteName(),
'username' => $user->getUsername(),
'email' => $user->getEmail(),
'isConnected' => $this->userIsConnected($user->getId()),
];
}
/**
* Get the users subscriptions (SessionRelCourseRelUser array or CourseRelUser array) for chat.
*

@ -2486,8 +2486,10 @@ class SessionManager
* @param bool $removeExistingCoursesWithUsers Whether to unsubscribe
* existing courses and users (true, default) or not (false)
* @param bool $copyEvaluation from base course to session course
* @return bool False on failure, true otherwise
*
* @throws Exception
*
* @return bool False on failure, true otherwise
* */
public static function add_courses_to_session(
$sessionId,
@ -2511,7 +2513,6 @@ class SessionManager
}
$sessionVisibility = $session->getVisibility();
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
@ -2743,6 +2744,7 @@ class SessionManager
SET nbr_courses = $nbr_courses
WHERE id = $sessionId";
Database::query($sql);
return true;
}

@ -760,7 +760,7 @@ class Template
'bootstrap-select/dist/js/bootstrap-select.min.js',
$selectLink,
'select2/dist/js/select2.min.js',
"select2/dist/js/i18n/$isoCode.js",
"select2/dist/js/i18n/$isoCode.js"
];
$features = api_get_configuration_value('video_features');

@ -58,6 +58,7 @@ class UserManager
{
/** @var UserRepository $userRepository */
$userRepository = Database::getManager()->getRepository('ChamiloUserBundle:User');
return $userRepository;
}
@ -677,10 +678,11 @@ class UserManager
*
* @param int The ID of th user to be deleted
*
* @throws Exception
*
* @return bool true if user is successfully deleted, false otherwise
* @assert (null) === false
* @assert ('abc') === false
* @throws Exception
*/
public static function delete_user($user_id)
{
@ -967,6 +969,7 @@ class UserManager
$r = Database::query($sql);
if ($r !== false) {
Event::addEvent(LOG_USER_DISABLE, LOG_USER_ID, $ids);
return true;
}
@ -1002,6 +1005,7 @@ class UserManager
$r = Database::query($sql);
if ($r !== false) {
Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids);
return true;
}
@ -1034,6 +1038,7 @@ class UserManager
if (Database::query($sql) !== false) {
return true;
}
return false;
}
@ -4098,8 +4103,10 @@ class UserManager
$sql = "INSERT INTO $table_user_tag_values SET user_id = $user_id, tag_id = $last_insert_id";
Database::query($sql);
}
return true;
}
return false;
}
@ -4354,6 +4361,7 @@ class UserManager
return $whereFilter;
}
return '';
}
@ -4362,8 +4370,9 @@ class UserManager
*
* @param string $query the value of the search box
*
* @return string HTML form
* @throws Exception
*
* @return string HTML form
*/
public static function get_search_form($query, $defaultParams = [])
{
@ -5098,6 +5107,7 @@ class UserManager
return $row['uid'];
}
return false;
}
@ -5276,7 +5286,8 @@ class UserManager
}
/**
* Returns an array of the different types of user extra fields [id => title translation]
* Returns an array of the different types of user extra fields [id => title translation].
*
* @return array
*/
public static function get_user_field_types()
@ -5417,6 +5428,7 @@ class UserManager
}
}
}
return $inserted;
}
@ -5774,6 +5786,7 @@ SQL;
return Display::tabsOnlyLink($headers, $optionSelected);
}
return '';
}
@ -5933,6 +5946,7 @@ SQL;
* Send user confirmation mail.
*
* @param User $user
*
* @throws Exception
*/
public static function sendUserConfirmationMail(User $user)
@ -5990,6 +6004,7 @@ SQL;
*
* @param int $user_id
* @param int $active Enable or disable
*
* @return bool True on success, false on failure
* @assert (-1,0) === false
* @assert (1,1) === true

@ -8,7 +8,7 @@
*/
/**
* Class OLPC_Peru_FilterPlugin
* Class OLPC_Peru_FilterPlugin.
*/
class OLPC_Peru_FilterPlugin extends Plugin
{

Loading…
Cancel
Save